|
|
|
import 'dart:convert';
|
|
|
|
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_keyboard_visibility/flutter_keyboard_visibility.dart';
|
|
|
|
import 'package:flutter_native_image/flutter_native_image.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:image_picker/image_picker.dart';
|
|
...
|
...
|
@@ -25,6 +27,8 @@ import 'package:one_key/widgets/v_empty_view.dart'; |
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import '../../../models/cookbook_practice_model.dart';
|
|
|
|
import '../../../models/menu_unit_model.dart';
|
|
|
|
import '../../../utils/screen_util.dart';
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -55,6 +59,14 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { |
|
|
|
List<String> specStrList = [];
|
|
|
|
String specStr = '请选择';
|
|
|
|
String mid = '';
|
|
|
|
List<MenuUnitModel> data; //价格
|
|
|
|
String showPrice;
|
|
|
|
String selectPracticeShow;
|
|
|
|
String selectPracticeIds;
|
|
|
|
List<CookbookPracticeSunModel> selectPractice;
|
|
|
|
TextEditingController introduceC = TextEditingController(); //简介
|
|
|
|
TextEditingController tasteC = TextEditingController(); //味型
|
|
|
|
TextEditingController cooksC = TextEditingController(); //烹调
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
...
|
...
|
@@ -120,18 +132,19 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { |
|
|
|
Utils.showToast('请输入菜品名称');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (_priceController.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请输入菜品价格');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (categoryStr == "请选择") {
|
|
|
|
Utils.showToast('请选择菜品分类');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (specStr == "请选择") {
|
|
|
|
Utils.showToast('请选择计价方式');
|
|
|
|
if (showPrice == null || showPrice == '') {
|
|
|
|
Utils.showToast('请选择菜品价格');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// if (specStr == "请选择") {
|
|
|
|
// Utils.showToast('请选择计价方式');
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
String cid = '';
|
|
|
|
// String unit = '';
|
|
|
|
menuManageProvider.categorySunModel.forEach((element) {
|
|
...
|
...
|
@@ -147,11 +160,13 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { |
|
|
|
Map<String, String> params = {
|
|
|
|
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
|
|
|
|
'cid': cid,
|
|
|
|
'unit': specStr,
|
|
|
|
// 'unit': specStr,
|
|
|
|
'name': _nameController.text,
|
|
|
|
'status': swichState ? '1' : '0',
|
|
|
|
'price': _priceController.text
|
|
|
|
// 'price': _priceController.text
|
|
|
|
'dishSkuList': json.encode(data)
|
|
|
|
};
|
|
|
|
|
|
|
|
if (mid != '') {
|
|
|
|
params['id'] = mid;
|
|
|
|
}
|
|
...
|
...
|
@@ -159,7 +174,27 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { |
|
|
|
uploadImageProvider.dish.qiniuUrl != '') {
|
|
|
|
params['image'] = uploadImageProvider.dish.qiniuUrl;
|
|
|
|
}
|
|
|
|
if (selectPracticeShow != null && selectPracticeShow != '') {
|
|
|
|
List temp = [];
|
|
|
|
selectPractice.forEach((element) {
|
|
|
|
temp.add(element.toJson2());
|
|
|
|
});
|
|
|
|
params['practiceList'] = json.encode(temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (introduceC.text.trim().length > 0) {
|
|
|
|
params['desc'] = introduceC.text;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tasteC.text.trim().length > 0) {
|
|
|
|
params['taste'] = tasteC.text;
|
|
|
|
}
|
|
|
|
if (cooksC.text.trim().length > 0) {
|
|
|
|
params['cooks'] = cooksC.text;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool sucess = false;
|
|
|
|
print(params);
|
|
|
|
if (mid != '') {
|
|
|
|
sucess = await menuManageProvider.setCookbookById(context, params,
|
|
|
|
showLoading: showLoading);
|
|
...
|
...
|
@@ -323,18 +358,21 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { |
|
|
|
),
|
|
|
|
)
|
|
|
|
: SizedBox(),
|
|
|
|
Spacer(),
|
|
|
|
Text(hintText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: hintText == '请选择' ||
|
|
|
|
hintText == '点击配置菜品价格' ||
|
|
|
|
hintText == '点击配置菜品做法' ||
|
|
|
|
hintText == '点击配置烹调方法'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
)),
|
|
|
|
// Spacer(),
|
|
|
|
HEmptyView(100),
|
|
|
|
Expanded(
|
|
|
|
child: Text(hintText,
|
|
|
|
textAlign: TextAlign.right,
|
|
|
|
style: TextStyle(
|
|
|
|
color: hintText == '请选择' ||
|
|
|
|
hintText == '点击配置菜品价格' ||
|
|
|
|
hintText == '点击配置菜品做法' ||
|
|
|
|
hintText == '点击配置烹调方法'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
))),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('arr_right_gray'),
|
|
...
|
...
|
@@ -445,277 +483,342 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> { |
|
|
|
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);
|
|
|
|
return KeyboardDismissOnTap(
|
|
|
|
child: 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);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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,
|
|
|
|
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),
|
|
|
|
)
|
|
|
|
: Container(
|
|
|
|
),
|
|
|
|
(uploadImageProvider.dish.file != null) &&
|
|
|
|
uploadImageProvider.dish.process !=
|
|
|
|
1 &&
|
|
|
|
uploadImageProvider.dish.process !=
|
|
|
|
0.01
|
|
|
|
? 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(
|
|
|
|
'+菜谱效果图',
|
|
|
|
child: Center(
|
|
|
|
child: Text('上传中...',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(30),
|
|
|
|
color:
|
|
|
|
MyColours.color_999999),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
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: Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
child: Text(
|
|
|
|
swichState ? '上架菜品,在所有点餐设备上显示' : '商品已下架',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_666666,
|
|
|
|
fontSize: ScreenUtil().setSp(24)),
|
|
|
|
),
|
|
|
|
: Container(),
|
|
|
|
])),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
swichState = !swichState;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
Image.asset(
|
|
|
|
swichState
|
|
|
|
? Utils.getImgPath('swich_on')
|
|
|
|
: Utils.getImgPath('swich_off'),
|
|
|
|
width: w(44),
|
|
|
|
height: w(24),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _textfield('名称', '点击输入菜品名称', _nameController,
|
|
|
|
_nameFocusNode, '',
|
|
|
|
inputType: TextInputType.text)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
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: w(44),
|
|
|
|
height: w(24),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
child: _select('分类', categoryStr, () {
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _textfield('名称', '点击输入菜品名称',
|
|
|
|
_nameController, _nameFocusNode, '',
|
|
|
|
inputType: TextInputType.text)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
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) {});
|
|
|
|
})),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _select(
|
|
|
|
'价格',
|
|
|
|
showPrice == null || showPrice == ''
|
|
|
|
? '点击配置菜品价格'
|
|
|
|
: showPrice, () async {
|
|
|
|
Map object =
|
|
|
|
await NavigatorUtil.goMenuSetPricePage(
|
|
|
|
context, {'object': data});
|
|
|
|
if (object != null) {
|
|
|
|
//选择了
|
|
|
|
data = object['data'];
|
|
|
|
print(data);
|
|
|
|
|
|
|
|
outerloop:
|
|
|
|
for (int i = 0; i < data.length; i++) {
|
|
|
|
MenuUnitModel menumodel = data[i];
|
|
|
|
if (menumodel.select) {
|
|
|
|
showPrice = menumodel.priceC.text;
|
|
|
|
break outerloop;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
})),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _select(
|
|
|
|
'做法',
|
|
|
|
selectPracticeShow == null ||
|
|
|
|
selectPracticeShow == ''
|
|
|
|
? '点击配置菜品做法'
|
|
|
|
: selectPracticeShow, () async {
|
|
|
|
Map object =
|
|
|
|
await NavigatorUtil.goMenuDishMethodPage(
|
|
|
|
context, selectPracticeIds);
|
|
|
|
if (object != null) {
|
|
|
|
selectPractice = object['select_practice'];
|
|
|
|
selectPracticeShow = '';
|
|
|
|
selectPracticeIds = '';
|
|
|
|
selectPractice.forEach((element) {
|
|
|
|
if (element.select) {
|
|
|
|
selectPracticeShow +=
|
|
|
|
'${element.name}、';
|
|
|
|
selectPracticeIds += '${element.id},';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (selectPracticeShow.endsWith('、')) {
|
|
|
|
selectPracticeShow =
|
|
|
|
selectPracticeShow.substring(
|
|
|
|
0, selectPracticeShow.length - 1);
|
|
|
|
}
|
|
|
|
if (selectPracticeIds.endsWith(',')) {
|
|
|
|
selectPracticeIds =
|
|
|
|
selectPracticeIds.substring(
|
|
|
|
0, selectPracticeIds.length - 1);
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}, needStar: false)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _textfield(
|
|
|
|
'味型', '如咸鲜、香辣等,向客户介绍菜品味型', tasteC, null, '',
|
|
|
|
fontsize: 12,
|
|
|
|
needStar: false,
|
|
|
|
inputType: TextInputType.text)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _textfield('烹调',
|
|
|
|
'如炙烤、熬煮、爆炒等,向客户介绍菜品烹调方法', cooksC, null, '',
|
|
|
|
fontsize: 12,
|
|
|
|
needStar: false,
|
|
|
|
inputType: TextInputType.text)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
_explain('菜品简介', '请输入菜品简介', introduceC, null)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.fromLTRB(
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
0,
|
|
|
|
ScreenUtil().setWidth(40),
|
|
|
|
ScreenUtil().setWidth(40)),
|
|
|
|
child: RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
DialogUtil.showSelectCusmanDialog(
|
|
|
|
context, categoryStrList, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
categoryStr = categoryStrList[value.first];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, selecteds: [
|
|
|
|
categoryStrList.indexOf(categoryStr)
|
|
|
|
]).then((value) {});
|
|
|
|
})),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _select('价格', '点击配置菜品价格', () async {
|
|
|
|
Map object =
|
|
|
|
await NavigatorUtil.goMenuSetPricePage(
|
|
|
|
context);
|
|
|
|
if (object != null) {
|
|
|
|
//选择了
|
|
|
|
}
|
|
|
|
})),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _select('做法', '点击配置菜品做法', () async {
|
|
|
|
await NavigatorUtil.goMenuDishMethodPage(context);
|
|
|
|
}, needStar: false)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _textfield(
|
|
|
|
'味型', '如咸鲜、香辣等,向客户介绍菜品味型', null, null, '',
|
|
|
|
fontsize: 12,
|
|
|
|
needStar: false,
|
|
|
|
inputType: TextInputType.text)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
child: _textfield(
|
|
|
|
'烹调', '如炙烤、熬煮、爆炒等,向客户介绍菜品烹调方法', null, null, '',
|
|
|
|
fontsize: 12, needStar: false)),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
child: MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
w(0.5),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
)),
|
|
|
|
_explain('菜品简介', '请输入菜品简介', null, null)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
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),
|
|
|
|
))
|
|
|
|
]))));
|
|
|
|
_addCookbook();
|
|
|
|
},
|
|
|
|
text: '保存',
|
|
|
|
fontSize: 34,
|
|
|
|
isBold: false,
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
width: double.infinity,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
))
|
|
|
|
])))));
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|