|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
|
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_native_image/flutter_native_image.dart';
|
|
|
|
import 'package:flutter_screenutil/screenutil.dart';
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
|
|
import 'package:one_key/models/upload_img_model.dart';
|
|
|
|
import 'package:one_key/provider/menu_provider.dart';
|
|
|
|
import 'package:one_key/provider/upload_img_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/upload_image_util.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.dart';
|
|
|
|
import 'package:one_key/widgets/round_button.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* 添加菜品页面
|
|
|
|
*/
|
|
|
|
class MenuAddDishesPage extends StatefulWidget {
|
|
|
|
MenuAddDishesPage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_MenuAddDishesPageState createState() => _MenuAddDishesPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
|
|
|
|
bool swichState = true;
|
|
|
|
TextEditingController _nameController = TextEditingController();
|
|
|
|
TextEditingController _priceController = TextEditingController();
|
|
|
|
|
|
|
|
FocusNode _nameFocusNode = FocusNode();
|
|
|
|
FocusNode _priceFocusNode = FocusNode();
|
|
|
|
final picker = ImagePicker();
|
|
|
|
UploadImageProvider uploadImageProvider;
|
|
|
|
MenuManageProvider menuManageProvider;
|
|
|
|
List<String> categoryStrList = [];
|
|
|
|
String categoryStr = '请选择';
|
|
|
|
List<String> specStrList = [];
|
|
|
|
String specStr = '请选择';
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
uploadImageProvider.dish.process = 0.01;
|
|
|
|
uploadImageProvider.dish.qiniuUrl = '';
|
|
|
|
uploadImageProvider.notifyListeners();
|
|
|
|
|
|
|
|
_getQiniuInfo();
|
|
|
|
_getCookbookBySellerId(showLoading: false);
|
|
|
|
_getSpecBySellerid();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
///计价方式
|
|
|
|
_getSpecBySellerid({bool showLoading = false}) async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
|
|
|
|
};
|
|
|
|
await menuManageProvider.getSpecBySellerid(context, params,
|
|
|
|
showLoading: showLoading);
|
|
|
|
if (menuManageProvider.specSunModel.length > 0) {
|
|
|
|
specStrList = [];
|
|
|
|
menuManageProvider.specSunModel.forEach((element) {
|
|
|
|
specStrList.add(element.name);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///添加菜品
|
|
|
|
_addCookbook({bool showLoading = true}) async {
|
|
|
|
if (_nameController.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请输入菜品名称');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (_priceController.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请输入菜品价格');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (categoryStr == "请选择") {
|
|
|
|
Utils.showToast('请选择菜品分类');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (specStr == "请选择") {
|
|
|
|
Utils.showToast('请选择计价方式');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
String cid = '';
|
|
|
|
// String unit = '';
|
|
|
|
menuManageProvider.categorySunModel.forEach((element) {
|
|
|
|
if (element.className == categoryStr) {
|
|
|
|
cid = element.id;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// menuManageProvider.specSunModel.forEach((element) {
|
|
|
|
// if (element.name == specStr) {
|
|
|
|
// unit = element.id;
|
|
|
|
// }
|
|
|
|
// });
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
|
|
|
|
'cid': cid,
|
|
|
|
'unit': specStr,
|
|
|
|
'name': _nameController.text,
|
|
|
|
'status': swichState ? '1' : '0',
|
|
|
|
'price': _priceController.text
|
|
|
|
};
|
|
|
|
if (uploadImageProvider.dish.qiniuUrl != null &&
|
|
|
|
uploadImageProvider.dish.qiniuUrl != '') {
|
|
|
|
params['image'] = uploadImageProvider.dish.qiniuUrl;
|
|
|
|
}
|
|
|
|
bool sucess = await menuManageProvider.addCookbook(context, params,
|
|
|
|
showLoading: showLoading);
|
|
|
|
if (sucess) {
|
|
|
|
EventBus().emit('menu_manage_page');
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取分类数据
|
|
|
|
_getCookbookBySellerId({bool showLoading = true}) async {
|
|
|
|
Map<String, String> params = {
|
|
|
|
"SellerId": Provider.of<UserModel>(context, listen: false).user.sellerid,
|
|
|
|
};
|
|
|
|
await menuManageProvider.getCookbookClassBySellerId(context, params,
|
|
|
|
showLoading: showLoading);
|
|
|
|
if (menuManageProvider.categorySunModel.length > 0) {
|
|
|
|
categoryStrList = [];
|
|
|
|
menuManageProvider.categorySunModel.forEach((element) {
|
|
|
|
if (element.className != '10道必点菜') {
|
|
|
|
categoryStrList.add(element.className);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取七牛云token
|
|
|
|
///
|
|
|
|
_getQiniuInfo() async {
|
|
|
|
await uploadImageProvider.getQiniuInfo(context, {});
|
|
|
|
}
|
|
|
|
|
|
|
|
///输入框
|
|
|
|
Widget _textfield(
|
|
|
|
String title,
|
|
|
|
String hintText,
|
|
|
|
TextEditingController editingController,
|
|
|
|
FocusNode focusNode,
|
|
|
|
String subTitle,
|
|
|
|
{bool needStar = true,
|
|
|
|
TextInputType inputType = TextInputType.number}) {
|
|
|
|
return Container(
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
needStar
|
|
|
|
? Container(
|
|
|
|
child: Text(
|
|
|
|
'*',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
// Spacer(),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
// height: ScreenUtil().setHeight(120),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(20),
|
|
|
|
right: ScreenUtil().setWidth(10),
|
|
|
|
top: ScreenUtil().setWidth(8)),
|
|
|
|
child: TextField(
|
|
|
|
controller: editingController,
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
// textAlignVertical: TextAlignVertical.bottom,
|
|
|
|
maxLines: 1,
|
|
|
|
inputFormatters: [],
|
|
|
|
|
|
|
|
// //光标颜色
|
|
|
|
// cursorColor:
|
|
|
|
// widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
),
|
|
|
|
focusNode: focusNode,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
hintText: hintText,
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
),
|
|
|
|
enabledBorder: new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
focusedBorder: new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
),
|
|
|
|
onChanged: (value) {},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
keyboardType: inputType,
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
subTitle,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///选择
|
|
|
|
Widget _select(String title, String hintText, VoidCallback callback,
|
|
|
|
{bool needStar = true}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: callback,
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(40)),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
needStar
|
|
|
|
? Container(
|
|
|
|
child: Text(
|
|
|
|
'*',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
Spacer(),
|
|
|
|
Text(hintText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: hintText == '请选择'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_333333,
|
|
|
|
fontWeight:
|
|
|
|
hintText == '请选择' ? FontWeight.normal : FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('arr_right_gray'),
|
|
|
|
width: ScreenUtil().setWidth(12),
|
|
|
|
height: ScreenUtil().setWidth(22),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 当前的任务状态
|
|
|
|
///#相机拍照,单图选择
|
|
|
|
_getFromPictureOrCamera(imageSource) async {
|
|
|
|
final pickedFile = await picker.getImage(source: imageSource);
|
|
|
|
File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
pickedFile.path,
|
|
|
|
quality: 50,
|
|
|
|
percentage: 50);
|
|
|
|
setState(() {
|
|
|
|
if (pickedFile != null) {
|
|
|
|
UploadImgModel imgModel = UploadImgModel();
|
|
|
|
imgModel.file = compressedFile;
|
|
|
|
imgModel.process = 0.01;
|
|
|
|
uploadImageProvider.dish = imgModel;
|
|
|
|
} else {
|
|
|
|
print('No image selected.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (pickedFile != null) {
|
|
|
|
uploadImageProvider.dish.process = 0.01;
|
|
|
|
uploadImageProvider.dish.qiniuUrl = null;
|
|
|
|
|
|
|
|
UploadImageUtil().startUploadOnly(
|
|
|
|
context, File(pickedFile.path), 3, true, uploadImageProvider);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
uploadImageProvider =
|
|
|
|
Provider.of<UploadImageProvider>(context, listen: true);
|
|
|
|
menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true);
|
|
|
|
return Material(
|
|
|
|
child: InkWell(
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
child: Scaffold(
|
|
|
|
appBar: SystemAppBar('添加菜品', onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
}),
|
|
|
|
body: Column(children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
DialogUtil.openImageModalBottomSheet(context,
|
|
|
|
lCallback: () {
|
|
|
|
Utils.getPickPermission(context, () {
|
|
|
|
_getFromPictureOrCamera(ImageSource.camera);
|
|
|
|
Navigator.pop(context);
|
|
|
|
}, Permission.camera);
|
|
|
|
}, rCallback: () {
|
|
|
|
Utils.getPickPermission(context, () {
|
|
|
|
_getFromPictureOrCamera(ImageSource.gallery);
|
|
|
|
// _getFromPictureOrCamera(ImageSource.gallery);
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
Platform.isAndroid
|
|
|
|
? Permission.storage
|
|
|
|
: Permission.photos);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Stack(children: [
|
|
|
|
uploadImageProvider.dish.file == null
|
|
|
|
? uploadImageProvider.dish.qiniuUrl != null &&
|
|
|
|
uploadImageProvider.dish.qiniuUrl !=
|
|
|
|
''
|
|
|
|
? CachedNetworkImage(
|
|
|
|
imageUrl:
|
|
|
|
uploadImageProvider.dish.qiniuUrl,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: double.infinity,
|
|
|
|
height: ScreenUtil().setWidth(400),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: ScreenUtil().setWidth(400),
|
|
|
|
color:
|
|
|
|
Color.fromRGBO(235, 234, 239, 1),
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.all(
|
|
|
|
ScreenUtil().setWidth(34)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
border: Border.all(
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(2),
|
|
|
|
color: MyColours
|
|
|
|
.color_c1c1c1,
|
|
|
|
)),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'take-picture'),
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(80)),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Text(
|
|
|
|
'+菜谱效果图',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(30),
|
|
|
|
color:
|
|
|
|
MyColours.color_999999),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Image.file(
|
|
|
|
uploadImageProvider.dish.file,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: double.infinity,
|
|
|
|
height: ScreenUtil().setWidth(400),
|
|
|
|
),
|
|
|
|
(uploadImageProvider.dish.file != null) &&
|
|
|
|
uploadImageProvider.dish.process != 1 &&
|
|
|
|
uploadImageProvider.dish.process != 0.01
|
|
|
|
? Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: ScreenUtil().setWidth(400),
|
|
|
|
child: Center(
|
|
|
|
child: Text('上传中...',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
])),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
swichState = !swichState;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(40),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment:
|
|
|
|
CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
// Container(
|
|
|
|
// child: Text(
|
|
|
|
// swichState ? '启用' : '停用',
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_333333,
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// fontSize: ScreenUtil().setSp(34)),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// VEmptyView(40),
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
swichState
|
|
|
|
? '商品已上架,在所有点餐设备上显示'
|
|
|
|
: '商品已下架',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_666666,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Image.asset(
|
|
|
|
swichState
|
|
|
|
? Utils.getImgPath('swich_on')
|
|
|
|
: Utils.getImgPath('swich_off'),
|
|
|
|
width: ScreenUtil().setWidth(122),
|
|
|
|
height: ScreenUtil().setWidth(82),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
color: Color.fromRGBO(235, 234, 239, 1),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_efefef,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(40),
|
|
|
|
right: ScreenUtil().setWidth(40)),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
),
|
|
|
|
child: _textfield('菜品名称', '请输入菜品名称',
|
|
|
|
_nameController, _nameFocusNode, '',
|
|
|
|
inputType: TextInputType.text)),
|
|
|
|
VEmptyView(10),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_efefef,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(40),
|
|
|
|
right: ScreenUtil().setWidth(40)),
|
|
|
|
),
|
|
|
|
VEmptyView(10),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
),
|
|
|
|
child: _textfield('菜品价格', '请输入菜品价格',
|
|
|
|
_priceController, _priceFocusNode, '元')),
|
|
|
|
VEmptyView(10),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_efefef,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(40),
|
|
|
|
right: ScreenUtil().setWidth(40)),
|
|
|
|
),
|
|
|
|
VEmptyView(10),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
),
|
|
|
|
child: _select('菜品分类', categoryStr, () {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
DialogUtil.showSelectCusmanDialog(
|
|
|
|
context, categoryStrList, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
categoryStr = categoryStrList[value.first];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, selecteds: [
|
|
|
|
categoryStrList.indexOf(categoryStr)
|
|
|
|
]).then((value) {});
|
|
|
|
})),
|
|
|
|
VEmptyView(10),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_efefef,
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(40),
|
|
|
|
right: ScreenUtil().setWidth(40))),
|
|
|
|
VEmptyView(10),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
),
|
|
|
|
child: _select('计价方式', specStr, () {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
DialogUtil.showSelectCusmanDialog(
|
|
|
|
context, specStrList, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
specStr = specStrList[value.first];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, selecteds: [specStrList.indexOf(specStr)])
|
|
|
|
.then((value) {});
|
|
|
|
})),
|
|
|
|
VEmptyView(10),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
|
|
|
|
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
|
|
|
|
child: RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
_addCookbook();
|
|
|
|
},
|
|
|
|
text: '保存',
|
|
|
|
fontSize: 34,
|
|
|
|
isBold: false,
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
width: double.infinity,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
))
|
|
|
|
]))));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|