Commit a13b8e25f042ad1d375efa14e560c15ec237752a

Authored by wdn127929
1 parent 71a7a8ce

员工管理

... ... @@ -4,6 +4,12 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
// {
// "name": "Flutter",
// "type": "dart",
// "request": "launch",
// "program": "lib/main.dart"
// },
{
"name": "oneKey_wdn",
"request": "launch",
... ...
... ... @@ -482,7 +482,7 @@
CURRENT_PROJECT_VERSION = 296;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
FLUTTER_BUILD_MODE = debug;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
... ... @@ -627,7 +627,7 @@
CURRENT_PROJECT_VERSION = 296;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
FLUTTER_BUILD_MODE = debug;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
... ...
... ... @@ -86,6 +86,9 @@ class PersonnelManageSunModel extends Object {
@JsonKey(name: 'user_name')
String userName;
@JsonKey(name: 'nick_name')
String nickName;
@JsonKey(name: 'is_first')
String isFirst;
... ... @@ -111,6 +114,7 @@ class PersonnelManageSunModel extends Object {
this.id,
this.openid,
this.userName,
this.nickName,
this.isFirst,
this.roleId,
this.phone,
... ...
... ... @@ -11,7 +11,8 @@ PersonnelManageModel _$PersonnelManageModelFromJson(Map<String, dynamic> json) {
json['ret'] as int,
json['data'] == null
? null
: PersonnelManageModelData.fromJson(json['data'] as Map<String, dynamic>),
: PersonnelManageModelData.fromJson(
json['data'] as Map<String, dynamic>),
json['msg'] as String,
);
}
... ... @@ -24,7 +25,8 @@ Map<String, dynamic> _$PersonnelManageModelToJson(
'msg': instance.msg,
};
PersonnelManageModelData _$PersonnelManageModelDataFromJson(Map<String, dynamic> json) {
PersonnelManageModelData _$PersonnelManageModelDataFromJson(
Map<String, dynamic> json) {
return PersonnelManageModelData(
json['admin'] == null
? null
... ... @@ -44,7 +46,9 @@ PersonnelManageModelData _$PersonnelManageModelDataFromJson(Map<String, dynamic>
);
}
Map<String, dynamic> _$PersonnelManageModelDataToJson(PersonnelManageModelData instance) => <String, dynamic>{
Map<String, dynamic> _$PersonnelManageModelDataToJson(
PersonnelManageModelData instance) =>
<String, dynamic>{
'admin': instance.admin,
'shopowner': instance.shopowner,
'cashier': instance.cashier,
... ... @@ -74,6 +78,7 @@ PersonnelManageSunModel _$PersonnelManageSunModelFromJson(
json['id'] as String,
json['openid'] as String,
json['user_name'] as String,
json['nick_name'] as String,
json['is_first'] as String,
json['role_id'] as String,
json['phone'] as String,
... ... @@ -90,6 +95,7 @@ Map<String, dynamic> _$PersonnelManageSunModelToJson(
'id': instance.id,
'openid': instance.openid,
'user_name': instance.userName,
'nick_name':instance.nickName,
'is_first': instance.isFirst,
'role_id': instance.roleId,
'phone': instance.phone,
... ...
... ... @@ -154,5 +154,15 @@ class HttpUrl {
"?service=App.Cookbook.GetCookbookById"; // 获取单个菜品信息
static const String get_auth_user_lists =
"?service=App.Seller.GetAuthUserLists"; // 店员列表
static const String add_seller_clerk =
"?service=App.Seller.AddsellerClerk"; // 添加店员
static const String set_user_is_call =
"?service=App.Seller.SetUserIsCall"; // 运营设置商家接单人
static const String delete_auth_user =
"?service=App.Seller.DeleteAuthUser"; // 删除店员
static const String edit_auth_user =
"?service=App.Seller.EditAuthUser"; // 编辑店员
static const String bind_phone_seller_user =
"?service=App.Seller.BindPhoneSellerUser"; // 账号表-员工绑定手机号
}
... ...
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/get_seller_info_model.dart';
import 'package:one_key/models/personnel_manage_model.dart';
import 'package:one_key/provider/personnel_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
... ... @@ -22,20 +26,197 @@ class PersonnelDetailPage extends StatefulWidget {
}
class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
String roleNameLogin;
String accountLogin;
bool canEdit = false;
List<String> btnList = [];
UserModel userModel;
PersonnelProvider personnelProvider;
String nickName;
String phone;
String dcAdduserCode;
@override
void initState() {
super.initState();
nickName = widget.model.nickName != null && widget.model.nickName != 'null'
? widget.model.nickName
: '暂未设置名称';
phone = widget.model.phone != null && widget.model.userName != 'null'
? widget.model.phone
: '添加手机号';
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
if (widget.model.openid == null || widget.model.openid == 'null') {
_getStoreBaseinfo();
}
setState(() {
roleNameLogin = userModel.user.role_name;
accountLogin = userModel.user.account;
if (roleNameLogin == '管理员') {
canEdit = true;
} else if (roleNameLogin == '店长') {
if (widget.position == '管理员') {
canEdit = false;
} else if (widget.position == '店长') {
if (accountLogin == widget.model.account) {
print('11111');
//店长自己
canEdit = true;
} else {
print('333333');
canEdit = false;
}
} else {
canEdit = true;
}
} else {
if (accountLogin == widget.model.account) {
//自己
canEdit = true;
} else {
canEdit = false;
}
}
if (canEdit) {
btnList = [
'移除店员',
];
if (widget.model.openid == null || widget.model.openid == 'null') {
btnList.add('绑定微信');
}
btnList.add('查看密码');
if (widget.model.isOnCall == '0') {
btnList.add('设为接单人');
}
} else {
btnList = [];
}
});
});
}
///获取店铺信息
_getStoreBaseinfo() async {
GetSellerInfoSunModel itemModel =
await personnelProvider.getSellerById(context);
if (itemModel != null) {
dcAdduserCode = itemModel.data.dcAdduserCode;
}
}
///设置接单人
_setUserIsCall({bool showLoading = true}) async {
Map<String, String> params = {
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid,
'uid': widget.model.id
};
bool success = await personnelProvider.setUserIsCall(context, params,
showLoading: showLoading);
if (success) {
Utils.showToast('设置成功');
EventBus().emit('personnel_manage_page');
//刷新页面
setState(() {
btnList.remove('设为接单人');
});
}
}
///删除店员
_delSellerClerk({bool showLoading = true}) async {
Map<String, String> params = {'seller_user_id': widget.model.id};
bool success = await personnelProvider.delSellerClerk(context, params,
showLoading: showLoading);
if (success) {
EventBus().emit('personnel_manage_page');
Navigator.pop(context);
}
}
///编辑店员
_editAuthUser(String name, {bool showLoading = true}) async {
Map<String, String> params = {'id': widget.model.id, 'user_name': name};
bool success = await personnelProvider.editAuthUser(context, params,
showLoading: showLoading);
if (success) {
EventBus().emit('personnel_manage_page');
setState(() {
nickName = name;
});
}
}
/// 账号表-员工绑定手机号
_bindPhoneSellerUser(String name, {bool showLoading = true}) async {
Map<String, String> params = {'kid': widget.model.id, 'phone': name};
bool success = await personnelProvider.bindPhoneSellerUser(context, params,
showLoading: showLoading);
if (success) {
EventBus().emit('personnel_manage_page');
setState(() {
phone = name;
});
}
}
List<Widget> _listWidget(List<String> titleList) {
List<Widget> list = [];
titleList.forEach((element) {
list.add(
RoundButton(
text: element,
fontSize: 30,
isBold: false,
height: ScreenUtil().setWidth(80),
// width: double.infinity,
width: (ScreenUtil.screenWidthDp - ScreenUtil().setWidth(140)) / 2,
radius: ScreenUtil().setWidth(10),
onPressed: () {
if (element == '设为接单人') {
DialogUtil.cupertinoAlertDialog(context,
content: '请确认该用户关注了周到安排公众号并填写了手机号,否则无法接单', rCallback: () {
_setUserIsCall();
});
} else if (element == '移除店员') {
DialogUtil.cupertinoAlertDialog(context,
title: '提示',
content: '移除店员后,店员将无法接收门店收款通知,店员收款码也将无法收款',
rTitle: '移除', rCallback: () {
_delSellerClerk();
});
} else if (element == '绑定微信') {
DialogUtil.openAlertDialogImage(
context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
} else if (element == '查看密码') {}
},
),
);
});
return list;
}
@override
Widget build(BuildContext context) {
userModel = Provider.of<UserModel>(context, listen: false);
personnelProvider = Provider.of<PersonnelProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('店员详情'),
appBar: SystemAppBar(
'店员详情',
onTap: () {
Navigator.pop(context);
},
),
body: SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.all(ScreenUtil().setWidth(40)),
// decoration: BoxDecoration(
// border: Border.all(color: Color.fromRGBO(235, 234, 239, 1)),
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10)),
// ),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
... ... @@ -54,37 +235,75 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
width: ScreenUtil().setWidth(38 * 2),
height: ScreenUtil().setWidth(38 * 2),
),
VEmptyView(30),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
widget.model.userName != null &&
widget.model.userName != 'null'
? widget.model.userName
: '暂未设置名称',
style: TextStyle(
fontSize: ScreenUtil().setWidth(34),
color: MyColours.color_333333),
),
HEmptyView(20),
Image.asset(
Utils.getImgPath('yd_bianji'),
width: ScreenUtil().setWidth(20),
),
],
),
VEmptyView(30),
Text(
widget.model.phone != null &&
widget.model.userName != 'null'
? widget.model.phone
: '',
style: TextStyle(
fontSize: ScreenUtil().setWidth(28),
color: MyColours.color_199095),
),
VEmptyView(30),
VEmptyView(40),
InkWell(
onTap: () {
if (canEdit) {
DialogUtil.textfeildAlertDialog(context,
title: '修改店员名称',
text: nickName != '暂未设置名称' ? nickName : '',
hintText: '输入店员名称',
toast: '请输入店员名称', rCallback: (name) {
_editAuthUser(name);
});
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
nickName,
style: TextStyle(
fontSize: ScreenUtil().setWidth(36),
color: MyColours.color_333333),
),
canEdit
? Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(20)),
child: Image.asset(
Utils.getImgPath('yd_bianji'),
width: ScreenUtil().setWidth(20),
),
)
: SizedBox(),
],
)),
VEmptyView(40),
canEdit
? InkWell(
onTap: () {
DialogUtil.textfeildAlertDialog(context,
title: '修改手机号',
text: phone != '添加手机号' ? phone : '',
hintText: '输入手机号',
keyboardType: TextInputType.number,
toast: '请输入手机号', rCallback: (phone) {
_bindPhoneSellerUser(phone);
});
},
child: Padding(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(40)),
child: Text(
phone,
style: TextStyle(
fontSize: ScreenUtil().setWidth(28),
color: MyColours.color_199095),
)))
: widget.model.phone != null &&
widget.model.phone != 'null'
? Padding(
padding: EdgeInsets.only(
bottom: ScreenUtil().setWidth(40)),
child: Text(
widget.model.phone,
style: TextStyle(
fontSize: ScreenUtil().setWidth(28),
color: MyColours.color_333333),
))
: SizedBox(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
... ... @@ -111,66 +330,10 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
// color: Color.fromRGBO(235, 234, 239, 1),
// ),
VEmptyView(60),
Padding(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(20)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
RoundButton(
text: '移除店员',
fontSize: 30,
isBold: false,
height: ScreenUtil().setWidth(80),
// width: double.infinity,
width: (ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(140)) /
2,
radius: ScreenUtil().setWidth(10),
),
RoundButton(
text: '查看初始密码',
fontSize: 30,
isBold: false,
height: ScreenUtil().setWidth(80),
// width: double.infinity,
width: (ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(140)) /
2,
radius: ScreenUtil().setWidth(10),
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(60)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
RoundButton(
text: '设为接单人',
fontSize: 30,
isBold: false,
height: ScreenUtil().setWidth(80),
// width: double.infinity,
width: (ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(140)) /
2,
radius: ScreenUtil().setWidth(10),
),
RoundButton(
text: '绑定微信',
fontSize: 30,
isBold: false,
height: ScreenUtil().setWidth(80),
// width: double.infinity,
width: (ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(140)) /
2,
radius: ScreenUtil().setWidth(10),
),
],
),
Wrap(
spacing: ScreenUtil().setWidth(20), //主轴上子控件的间距
runSpacing: ScreenUtil().setWidth(20), //交叉轴上子控件之间的间距
children: _listWidget(btnList), //要显示的子控件集合
),
],
),
... ...
... ... @@ -33,6 +33,17 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_getAuthUserLists(showLoading: false);
});
EventBus().on('personnel_manage_page', (arg) {
_getAuthUserLists(showLoading: false);
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
EventBus().off('personnel_manage_page');
}
//获取员工信息列表
... ... @@ -45,6 +56,21 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> {
showLoading: showLoading);
}
///添加店员
_addSellerClerk(String roleId, {bool showLoading = true}) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
'role_id': roleId
};
bool success = await personnelProvider.addSellerClerk(context, params,
showLoading: showLoading);
if (success) {
//刷新页面
_getAuthUserLists(showLoading: false);
}
}
@override
Widget build(BuildContext context) {
personnelProvider = Provider.of<PersonnelProvider>(context, listen: true);
... ... @@ -69,17 +95,23 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> {
itemBuilder: (BuildContext context, int index) {
String title = titleList[index];
List<PersonnelManageSunModel> data = [];
String roleId = '';
if (personnelProvider.dataMap != null) {
if (title == '管理员') {
data = personnelProvider.dataMap.admin.listdata;
roleId = personnelProvider.dataMap.admin.roleId;
} else if (title == '店长') {
data = personnelProvider.dataMap.shopowner.listdata;
roleId = personnelProvider.dataMap.shopowner.roleId;
} else if (title == '客户经理') {
data = personnelProvider.dataMap.manager.listdata;
roleId = personnelProvider.dataMap.manager.roleId;
} else if (title == '收银员') {
data = personnelProvider.dataMap.cashier.listdata;
roleId = personnelProvider.dataMap.cashier.roleId;
} else if (title == '服务员') {
data = personnelProvider.dataMap.waiter.listdata;
roleId = personnelProvider.dataMap.waiter.roleId;
}
}
... ... @@ -100,15 +132,32 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> {
fontSize: ScreenUtil().setWidth(28),
color: MyColours.color_333333),
),
InkWell(
onTap: () {},
child: Text(
'添加',
style: TextStyle(
fontSize: ScreenUtil().setWidth(30),
color: MyColours.color_199095),
),
)
title == '管理员'
? SizedBox()
: Provider.of<UserModel>(context,
listen: false)
.user
.role_name ==
'管理员' ||
(Provider.of<UserModel>(context,
listen: false)
.user
.role_name ==
'店长' &&
title != '店长')
? InkWell(
onTap: () {
_addSellerClerk(roleId);
},
child: Text(
'添加',
style: TextStyle(
fontSize:
ScreenUtil().setWidth(30),
color: MyColours.color_199095),
),
)
: SizedBox()
],
)),
MyDivider(
... ... @@ -167,9 +216,9 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> {
HEmptyView(40),
Expanded(
child: Text(
model.userName != null &&
model.userName != 'null'
? model.userName
model.nickName != null &&
model.nickName != 'null'
? model.nickName
: '暂未设置名称',
style: TextStyle(
fontSize:
... ... @@ -200,10 +249,7 @@ class _PersonnelManagePageState extends State<PersonnelManagePage> {
color: MyColours.color_f3f3f3,
)
]),
Provider.of<UserModel>(context, listen: false)
.user
.account ==
model.account
model.isOnCall == '1'
? Positioned(
child: Container(
width: ScreenUtil().setWidth(50),
... ...
... ... @@ -160,7 +160,10 @@ class _MenuCategoryPageState extends State<MenuCategoryPage> {
onTapRight: () {
//
DialogUtil.textfeildAlertDialog(context,
title: '添加分类', content: '输入分类名称', rCallback: (name) {
title: '添加分类',
hintText: '输入分类名称',
lenghtLimit: true,
toast: '请输入分类名称', rCallback: (name) {
_addCookbookClass(name, showLoading: true);
});
},
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/get_seller_info_model.dart';
import 'package:one_key/models/personnel_manage_model.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
/**
* 员工管理
... ... @@ -37,4 +40,128 @@ class PersonnelProvider extends ChangeNotifier {
}
notifyListeners();
}
/// 添加店员
Future<bool> addSellerClerk(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.add_seller_clerk,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.data != '') {
return true;
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
/// 删除店员
Future<bool> delSellerClerk(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.delete_auth_user,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.data.length == 1 && baseResp.data[0] == 1) {
return true;
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
/// 编辑店员
Future<bool> editAuthUser(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.edit_auth_user,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.data.length == 1 && baseResp.data[0] == 1) {
return true;
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
/// 账号表-员工绑定手机号
Future<bool> bindPhoneSellerUser(
BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.bind_phone_seller_user,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.data == 1) {
return true;
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
///根据商家ID获取商家信息
Future<GetSellerInfoSunModel> getSellerById(BuildContext context) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"sellerid": userModel.user.sellerid,
};
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.get, HttpUrl.get_seller_info,
data: params)
.catchError((error) {
print(error.toString());
});
GetSellerInfoSunModel itemModel;
if (baseResp == null) return itemModel;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return itemModel;
}
if (baseResp.responseData['data'] != null) {
itemModel = GetSellerInfoModel.fromJson(baseResp.responseData).data;
} else {
Utils.showToast(baseResp.msg ?? "");
}
return itemModel;
}
}
/// 设置商家接单人
Future<bool> setUserIsCall(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_user_is_call,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.data == 1) {
return true;
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
... ...
import 'dart:convert';
import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
... ... @@ -1987,7 +1988,7 @@ class DialogUtil {
}
static Future cupertinoAlertDialog(BuildContext context,
{String title = "标题",
{String title = "",
String content = "内容",
String lTitle = "取消",
String rTitle = "确定",
... ... @@ -2038,12 +2039,18 @@ class DialogUtil {
//输入弹框
static Future textfeildAlertDialog(BuildContext context,
{String title = "标题",
String content = "内容",
String text = "内容",
String hintText = "内容",
String lTitle = "取消",
String rTitle = "确定",
String toast = '请输入',
VoidCallback lCallback,
bool lenghtLimit = false,
TextInputType keyboardType = TextInputType.text,
CustomCallBack rCallback}) {
String name = '';
String name = text;
TextEditingController controller = TextEditingController();
controller.text = text;
showCupertinoDialog(
context: context,
builder: (context) {
... ... @@ -2058,41 +2065,45 @@ class DialogUtil {
content: Material(
color: Colors.transparent,
child: TextField(
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
inputFormatters: [
LengthLimitingTextInputFormatter(10),
],
textAlignVertical: TextAlignVertical.bottom,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
decoration: InputDecoration(
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: content,
hintStyle: TextStyle(
color: MyColours.color_999999,
controller: controller,
maxLines: 1,
autofocus: true,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
inputFormatters: lenghtLimit
? [
LengthLimitingTextInputFormatter(10),
]
: [],
textAlignVertical: TextAlignVertical.bottom,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
decoration: InputDecoration(
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
),
onChanged: (value) {
name = value;
},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text,
)),
onChanged: (value) {
name = value;
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: keyboardType)),
actions: [
CupertinoDialogAction(
child: Text(lTitle,
... ... @@ -2111,7 +2122,7 @@ class DialogUtil {
color: MyColours.color_199095)),
onPressed: () {
if (name == '' || name.trim().length == 0) {
Utils.showToast('请输入分类名称');
Utils.showToast(toast);
return;
}
Navigator.of(context).pop();
... ... @@ -2123,4 +2134,49 @@ class DialogUtil {
},
);
}
static Future openAlertDialogImage(
BuildContext context, String title, String image, double height,
{GestureTapCallback onTap, double fontSize = 30}) async {
final action = await showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Center(
child: Container(
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(72)),
height: ScreenUtil().setWidth(height),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(30)))), //设置圆角
child: Column(
children: [
VEmptyView(60),
Container(
height: ScreenUtil().setWidth(48),
alignment: Alignment.center,
child: Text(title,
style: TextStyle(
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_353535)),
),
VEmptyView(40),
MyDivider(
ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_efefef),
VEmptyView(70),
CachedNetworkImage(
imageUrl: image, width: ScreenUtil().setWidth(320))
],
),
),
),
);
},
);
}
}
... ...