Commit 5d1285189a74095a81670f5a41abcaeca8c3e97d

Authored by wdn127929
1 parent 12386ccc

菜单UI

import 'package:flutter/material.dart';
import 'package:one_key/utils/utils.dart';
///菜单
... ... @@ -14,6 +15,8 @@ class MenuModel {
int allSum; //总共选中菜数量
bool isChange = false; //是否发生数量变化
List<dynamic> cookbooklistShow;
MenuModel(
{this.id,
this.sellerid,
... ... @@ -111,6 +114,9 @@ class MenuSunModel {
TextEditingController amountC = TextEditingController();
int moreSum = 0; //排菜编辑页展示选中总数
String nameType = '3'; //1左侧,2右侧,3顶部分开
String imageType = '1'; //1大图,2小图
MenuSunModel(
{this.id,
this.sellerid,
... ... @@ -141,7 +147,9 @@ class MenuSunModel {
this.practice,
this.amount = 0,
this.cookList,
this.amountC});
this.amountC,
this.nameType,
this.imageType});
MenuSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
... ... @@ -178,6 +186,10 @@ class MenuSunModel {
cookList.add(new MenuModel.fromJson2(v));
});
}
// imageType = Utils.randomGet(1, 3) ?? '1';
// nameType = Utils.randomGet(1, 4) ?? '3';
imageType = name == '小炒肉' || name == '水煮肉片' || name == '西湖牛肉羹'? '2' : '1';
nameType = '1';
}
MenuSunModel.fromJson3(Map<String, dynamic> json) {
... ...
... ... @@ -12,6 +12,7 @@ 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/route/navigator_util.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';
... ... @@ -24,6 +25,8 @@ import 'package:one_key/widgets/v_empty_view.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import '../../../utils/screen_util.dart';
/**
*
* 添加菜品页面
... ... @@ -202,7 +205,8 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
FocusNode focusNode,
String subTitle,
{bool needStar = true,
TextInputType inputType = TextInputType.number}) {
TextInputType inputType = TextInputType.number,
double fontsize = 16}) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
... ... @@ -211,19 +215,18 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(20),
HEmptyView(10),
needStar
? Container(
padding: EdgeInsets.only(top: w(5)),
child: Text(
'*',
style: TextStyle(
color: MyColours.color_199095,
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
),
),
)
... ... @@ -233,9 +236,9 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
child: Container(
// height: ScreenUtil().setHeight(120),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(10),
top: ScreenUtil().setWidth(8)),
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(10),
),
child: TextField(
controller: editingController,
textAlign: TextAlign.right,
... ... @@ -248,7 +251,8 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_515151,
fontSize: w(fontsize),
),
focusNode: focusNode,
decoration: InputDecoration(
... ... @@ -256,7 +260,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
fontSize: w(fontsize),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
... ... @@ -294,7 +298,7 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
return InkWell(
onTap: callback,
child: Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(40)),
// padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(40)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
... ... @@ -303,19 +307,18 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(20),
HEmptyView(10),
needStar
? Container(
padding: EdgeInsets.only(top: w(5)),
child: Text(
'*',
style: TextStyle(
color: MyColours.color_199095,
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
),
),
)
... ... @@ -323,11 +326,13 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '请选择'
color: hintText == '请选择' ||
hintText == '点击配置菜品价格' ||
hintText == '点击配置菜品做法' ||
hintText == '点击配置烹调方法'
? MyColours.color_999999
: MyColours.color_333333,
fontWeight:
hintText == '请选择' ? FontWeight.normal : FontWeight.bold,
: MyColours.color_515151,
fontWeight: FontWeight.normal,
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(20),
... ... @@ -373,6 +378,68 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
}
}
///券说明
Widget _explain(String title, String hintText,
TextEditingController controller, FocusNode node) {
return Container(
// height: ScreenUtil().setWidth(380),
// padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: w(16), top: w(14), bottom: w(10)),
// height: w(48),
child: Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
)),
// Padding(
// padding: EdgeInsets.only(left: w(16)),
// child: MyDivider(
// double.infinity,
// w(0.5),
// color: MyColours.color_E7E7E7,
// )),
Padding(
padding: EdgeInsets.only(left: w(20), bottom: w(20)),
child: TextField(
controller: controller,
focusNode: node,
// keyboardType: TextInputType.number, //键盘类型,数字键盘
maxLines: 3,
maxLength: 500,
// maxLengthEnforced: true,
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_515151), //输入文本的样式
decoration: InputDecoration(
contentPadding: EdgeInsets.all(ScreenUtil().setWidth(30)),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24),
),
border: OutlineInputBorder(borderSide: BorderSide.none),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
)),
],
),
);
}
@override
Widget build(BuildContext context) {
uploadImageProvider =
... ... @@ -487,99 +554,61 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
swichState = !swichState;
});
},
child: Padding(
child: Container(
height: w(48),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(40),
horizontal: ScreenUtil().setWidth(32),
),
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)),
),
),
],
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),
width: w(44),
height: w(24),
)
],
)),
),
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.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(40),
horizontal: ScreenUtil().setWidth(32),
),
child: _textfield('菜品名称', '请输入菜品名称',
_nameController, _nameFocusNode, '',
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),
padding: EdgeInsets.only(left: w(16)),
child: MyDivider(
double.infinity,
w(0.5),
color: MyColours.color_E7E7E7,
)),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
height: w(48),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
horizontal: ScreenUtil().setWidth(32),
),
child: _select('菜品分类', categoryStr, () {
child: _select('分类', categoryStr, () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
DialogUtil.showSelectCusmanDialog(
... ... @@ -593,32 +622,81 @@ class _MenuAddDishesPageState extends State<MenuAddDishesPage> {
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.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(40),
horizontal: ScreenUtil().setWidth(32),
),
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) {});
child: _select('价格', '点击配置菜品价格', () async {
Map object =
await NavigatorUtil.goMenuSetPricePage(
context);
if (object != null) {
//选择了
}
})),
VEmptyView(10),
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)
],
),
)),
... ...
// 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/flutter_screenutil.dart';
// import 'package:image_picker/image_picker.dart';
// import 'package:one_key/models/cookbook_model.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 {
// final bool isNew;
// final String idstr;
// MenuAddDishesPage({Key key, this.isNew, this.idstr}) : 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 = '请选择';
// String mid = '';
// @override
// void initState() {
// super.initState();
// WidgetsBinding.instance.addPostFrameCallback((_) {
// uploadImageProvider.dish.process = 0.01;
// uploadImageProvider.dish.qiniuUrl = '';
// uploadImageProvider.notifyListeners();
// _getQiniuInfo();
// _getCookbookBySellerId(showLoading: false);
// _getSpecBySellerid();
// if (!widget.isNew) {
// _getCookbookById();
// }
// });
// }
// ///获取单个菜品信息
// _getCookbookById({bool showLoading = false}) async {
// Map<String, String> params = {
// "id": widget.idstr,
// };
// await menuManageProvider.getCookbookById(context, params,
// showLoading: showLoading);
// if (menuManageProvider.cookbookOneSunModel != null) {
// _nameController.text = menuManageProvider.cookbookOneSunModel.name;
// swichState =
// menuManageProvider.cookbookOneSunModel.status == '1' ? true : false;
// _priceController.text = menuManageProvider.cookbookOneSunModel.price;
// categoryStr = menuManageProvider.cookbookOneSunModel.className;
// specStr = menuManageProvider.cookbookOneSunModel.unit;
// mid = menuManageProvider.cookbookOneSunModel.id;
// if (menuManageProvider.cookbookOneSunModel.image != null &&
// menuManageProvider.cookbookOneSunModel.image != 'null' &&
// menuManageProvider.cookbookOneSunModel.image != '') {
// uploadImageProvider.dish.qiniuUrl =
// menuManageProvider.cookbookOneSunModel.image;
// }
// setState(() {});
// }
// }
// ///计价方式
// _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 (mid != '') {
// params['id'] = mid;
// }
// if (uploadImageProvider.dish.qiniuUrl != null &&
// uploadImageProvider.dish.qiniuUrl != '') {
// params['image'] = uploadImageProvider.dish.qiniuUrl;
// }
// bool sucess = false;
// if (mid != '') {
// sucess = await menuManageProvider.setCookbookById(context, params,
// showLoading: showLoading);
// } else {
// 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.pickImage(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;
// bool need = await Utils.sizeNeed(File(pickedFile.path));
// File file = File(pickedFile.path);
// if (need) {
// file = File(compressedFile.absolute.path);
// }
// UploadImageUtil()
// .startUploadOnly(context, file, 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),
// ))
// ]))));
// }
// }
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import '../../../utils/screen_util.dart';
import '../../../utils/utils.dart';
import '../../../widgets/round_button.dart';
/**
* 菜品做法选择
*/
class MenuDishMethodPage extends StatefulWidget {
MenuDishMethodPage({Key key}) : super(key: key);
@override
_MenuDishMethodPageState createState() => _MenuDishMethodPageState();
}
class _MenuDishMethodPageState extends State<MenuDishMethodPage> {
List data = ['清蒸', '爆炒', '红烧', '椒盐'];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_DBDBDB,
appBar: SystemAppBar('菜品做法选择'),
body: Column(
children: [
Container(
width: double.infinity,
height: w(48),
padding: EdgeInsets.symmetric(horizontal: w(16)),
alignment: Alignment.centerLeft,
color: MyColours.color_ffffff,
child: Text(
'选择当前菜品支持选择的做法:',
style: TextStyle(
fontSize: font(16), color: MyColours.color_515151),
)),
Expanded(
child: ListView.builder(
itemCount: data.length + 1,
shrinkWrap: true,
itemBuilder: (context, index) {
if ((index == 0 && data.length == 0) ||
data.length == index) {
return InkWell(
onTap: () {
DialogUtil.textfeildAlertDialog(context,
title: '添加做法',
hintText: '输入菜品做法名称', rCallback: (name) {
//确定添加
setState(() {
data.add(name);
});
});
},
child: Container(
height: w(64),
color: MyColours.color_ffffff,
margin: EdgeInsets.only(top: w(10)),
alignment: Alignment.center,
child: Text(
'添加做法',
style: TextStyle(
fontSize: font(24),
color: MyColours.color_000000),
),
));
}
return Container(
height: w(48),
color: MyColours.color_ffffff,
margin: EdgeInsets.only(top: w(10)),
padding: EdgeInsets.symmetric(horizontal: w(16)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
data[index],
style: TextStyle(
fontSize: font(16),
color: MyColours.color_515151),
),
InkWell(
onTap: () {
setState(() {});
},
child: Image.asset(
true
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
width: w(44),
height: w(24),
))
],
));
})),
Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.fromLTRB(w(45), w(13), w(45), w(26)),
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),
))
],
),
);
}
}
... ...
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_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/cookbook_category_model.dart';
... ... @@ -10,6 +9,7 @@ import 'package:one_key/provider/menu_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.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';
... ... @@ -21,6 +21,8 @@ import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
import '../../../utils/screen_util.dart';
class MenuManagePage extends StatefulWidget {
MenuManagePage({Key key}) : super(key: key);
... ... @@ -86,13 +88,278 @@ class _MenuManagePageState extends State<MenuManagePage> {
await menuManageProvider.getCookbookByClass(context, params,
showLoading: showLoading);
if (menuManageProvider.menuModel != null) {
List<MenuModel> temp = [];
for (int i = 0; i < menuManageProvider.menuModel.length; i++) {
List<dynamic> listSub = [];
for (int j = 0;
j < menuManageProvider.menuModel[i].cookbooklist.length;
j++) {
MenuSunModel menuSunModel =
menuManageProvider.menuModel[i].cookbooklist[j];
if (menuSunModel.imageType == '1') {
//大图
listSub.add(menuSunModel);
} else {
//小图
//判断下一个是大图还是小图
if (menuManageProvider.menuModel[i].cookbooklist.length - 1 > j) {
if (menuManageProvider
.menuModel[i].cookbooklist[j + 1].imageType ==
'1') {
//下一个是大图
listSub.add(menuSunModel);
} else {
//下一个是小图
List<MenuSunModel> subTemp = [];
subTemp.add(menuSunModel);
subTemp
.add(menuManageProvider.menuModel[i].cookbooklist[j + 1]);
listSub.add(subTemp);
j++;
}
} else {
listSub.add(menuSunModel);
}
}
}
menuManageProvider.menuModel[i].cookbooklistShow = listSub;
temp.add(menuManageProvider.menuModel[i]);
}
menuManageProvider.menuModel = temp;
}
}
//左边
Widget _topLeft(MenuSunModel model) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
model.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(20),
color: MyColours.color_DBDBDB,
shadows: [
BoxShadow(
color: MyColours.color_000000,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
VEmptyView(20),
Text('味型:咸鲜 烹调:熬煮',
style:
TextStyle(fontSize: font(12), color: MyColours.color_DBDBDB)),
VEmptyView(20),
Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_DBDBDB,
shadows: [
BoxShadow(
color: MyColours.color_000000,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
],
),
);
}
//右边
Widget _topRight(MenuSunModel model) {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
model.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(20),
color: MyColours.color_DBDBDB,
shadows: [
BoxShadow(
color: MyColours.color_000000,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
VEmptyView(20),
Text('味型:咸鲜 烹调:熬煮',
style:
TextStyle(fontSize: font(12), color: MyColours.color_DBDBDB)),
VEmptyView(20),
Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_DBDBDB,
shadows: [
BoxShadow(
color: MyColours.color_000000,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
],
),
);
}
//顶部分开
Widget _topBetween(MenuSunModel model) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: w(134),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
model.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(20),
color: MyColours.color_DBDBDB,
shadows: [
BoxShadow(
color: MyColours.color_000000,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
VEmptyView(20),
Text('味型:咸鲜 烹调:熬煮',
style: TextStyle(
fontSize: font(12), color: MyColours.color_DBDBDB))
],
),
),
HEmptyView(10),
Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_DBDBDB,
shadows: [
BoxShadow(
color: MyColours.color_000000,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
),
],
);
}
Widget _smallMenu(MenuSunModel model) {
return Container(
width: ScreenUtil().screenWidth / 2,
color: MyColours.color_4D4E50,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(30),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(10)),
child: Text(
model.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(20),
color: MyColours.color_DBDBDB,
shadows: [
BoxShadow(
color: MyColours.color_000000,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
)),
VEmptyView(20),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(10)),
child: Text('味型:咸鲜 烹调:熬煮',
style: TextStyle(
fontSize: font(12), color: MyColours.color_DBDBDB))),
VEmptyView(20),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(10)),
child: Text(
'¥${model.price}/${model.unit} 会员 ¥${model.price}/${model.unit} ',
textAlign: TextAlign.right,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: font(14),
color: MyColours.color_DBDBDB,
shadows: [
BoxShadow(
color: MyColours.color_000000,
offset: Offset(0, 1),
blurRadius: w(2),
spreadRadius: w(20))
]),
)),
VEmptyView(30),
if (model.image != null)
CachedNetworkImage(
imageUrl: model.image,
fit: BoxFit.cover,
width: ScreenUtil().screenWidth / 2,
height: w(125),
),
if (true)
Padding(
padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)),
child: Text(
'江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。',
style: TextStyle(
color: MyColours.color_DBDBDB, fontSize: font(12)),
),
),
Align(
alignment: Alignment.centerRight,
child: Padding(
padding:
EdgeInsets.only(right: w(20), top: w(19), bottom: w(19)),
child: Image.asset(
Utils.getImgPath('add_area'),
width: w(22),
),
)),
],
),
);
}
@override
Widget build(BuildContext context) {
menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
backgroundColor: MyColours.color_DBDBDB,
appBar: SystemAppBar(
'菜单管理',
onTap: () {
... ... @@ -109,69 +376,99 @@ class _MenuManagePageState extends State<MenuManagePage> {
builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return Column(children: [
Expanded(
child: ExceptionPage(
pageState: model.pageState,
callback: () {
// offset = 0;
// getMessage(showLoading: true);
// _couponNetworkData();
_getCookbookByClass(showLoading: true);
},
emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
!isShow
? SizedBox()
: Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
0,
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(40)),
model.pageState != PageState.Empty
? Expanded(
child: ExceptionPage(
pageState: model.pageState,
callback: () {
// offset = 0;
// getMessage(showLoading: true);
// _couponNetworkData();
_getCookbookByClass(showLoading: true);
},
emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
))
: Expanded(
child: Container(
color: MyColours.color_4D4E50,
padding: EdgeInsets.symmetric(horizontal: w(20)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(222),
Text(
'您还没有创建菜谱,建议按照如下顺序创建店铺专属菜谱:\n1、点击分类管理创建菜谱分类,如热菜、凉菜等;\n2、点击添加菜品,创建菜品;\n3、在菜品列表中,长按菜品,可以配置菜品显示方式。\n',
style: TextStyle(
height: 1.3,
color: MyColours.color_DBDBDB,
fontSize: font(16),
fontWeight: FontWeight.bold),
),
VEmptyView(12),
Text(
'赶快来创建您的专业菜谱吧!',
style: TextStyle(
height: 1.3,
color: MyColours.color_DBDBDB,
fontSize: font(16),
fontWeight: FontWeight.bold),
),
],
),
)),
Container(
padding: EdgeInsets.symmetric(horizontal: w(23)),
// height: w(80),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding:
EdgeInsets.only(top: w(12), bottom: w(25)),
child: RoundButton(
onPressed: () async {
await NavigatorUtil.goMenuAddDishesPage(
context);
bool needRefresh =
await NavigatorUtil.goMenuCategoryPage(
context);
print(needRefresh);
if (needRefresh != null && needRefresh) {
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData();
}
},
text: '添加\n菜品',
fontSize: 26,
isBold: false,
height: ScreenUtil().setWidth(120),
width: ScreenUtil().setWidth(120),
radius: ScreenUtil().setWidth(60),
text: '分类管理',
fontSize: 32,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
isBold: true,
height: w(43),
width: w(100),
radius: r(5),
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
0,
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () async {
bool needRefresh =
await NavigatorUtil.goMenuCategoryPage(
context);
print(needRefresh);
if (needRefresh != null && needRefresh) {
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData();
}
},
text: '分类\n管理',
fontSize: 26,
isBold: false,
height: ScreenUtil().setWidth(120),
width: ScreenUtil().setWidth(120),
radius: ScreenUtil().setWidth(60),
))
],
)
!isShow
? SizedBox()
: Padding(
padding: EdgeInsets.only(
top: w(12), bottom: w(25)),
child: RoundButton(
onPressed: () async {
await NavigatorUtil.goMenuAddDishesPage(
context);
},
text: '添加菜品',
fontSize: 32,
isBold: true,
width: w(218),
height: w(43),
radius: r(5),
))
],
))
]);
} else {
// double cellWidth = (MediaQuery.of(context).size.width -
... ... @@ -181,303 +478,348 @@ class _MenuManagePageState extends State<MenuManagePage> {
return Column(children: [
Expanded(
child: ListView.builder(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(40)),
itemCount: menuManageProvider.menuModel.length,
shrinkWrap: true,
controller: _controller,
itemBuilder: (BuildContext context, int indexOut) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: ScreenUtil().setWidth(10),
height: ScreenUtil().setWidth(10),
decoration: BoxDecoration(
color: MyColours.color_0D0D0D,
shape: BoxShape.circle),
),
MyDivider(ScreenUtil().setWidth(80),
ScreenUtil().setWidth(2),
color: MyColours.color_0D0D0D),
HEmptyView(20),
Text(
menuManageProvider
.menuModel[indexOut].className,
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setSp(28),
),
),
HEmptyView(20),
MyDivider(ScreenUtil().setWidth(80),
ScreenUtil().setWidth(2),
color: MyColours.color_0D0D0D),
Container(
width: ScreenUtil().setWidth(10),
height: ScreenUtil().setWidth(10),
decoration: BoxDecoration(
color: MyColours.color_0D0D0D,
shape: BoxShape.circle),
),
],
),
StaggeredGridView.countBuilder(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(40)),
shrinkWrap: true,
crossAxisCount: 4,
itemCount: menuManageProvider
.menuModel[indexOut].cookbooklist.length,
physics: NeverScrollableScrollPhysics(),
itemBuilder:
(BuildContext context, int index) {
MenuSunModel model = menuManageProvider
Container(
height: w(32),
color: MyColours.color_4D4E50,
margin: EdgeInsets.only(bottom: (w(2))),
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Container(
width: ScreenUtil().setWidth(10),
height: ScreenUtil().setWidth(10),
decoration: BoxDecoration(
color: MyColours.color_DBDBDB,
shape: BoxShape.circle),
),
MyDivider(ScreenUtil().setWidth(80),
ScreenUtil().setWidth(2),
color: MyColours.color_DBDBDB),
HEmptyView(20),
Text(
menuManageProvider
.menuModel[indexOut].className,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(28),
),
),
HEmptyView(20),
MyDivider(ScreenUtil().setWidth(80),
ScreenUtil().setWidth(2),
color: MyColours.color_DBDBDB),
Container(
width: ScreenUtil().setWidth(10),
height: ScreenUtil().setWidth(10),
decoration: BoxDecoration(
color: MyColours.color_DBDBDB,
shape: BoxShape.circle),
),
],
)),
ListView.builder(
itemCount: menuManageProvider
.menuModel[indexOut]
.cookbooklist[index];
double cellWidth = ((MediaQuery.of(context)
.size
.width -
ScreenUtil()
.setWidth(40 * 2 + 15 * 2)) /
2);
return InkWell(
onTap: () async {
await NavigatorUtil
.goMenuAddDishesPage(context,
isNew: false,
idstr: model.id);
},
child: model.image != null
? Stack(children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(
10))),
child: ClipRRect(
borderRadius:
BorderRadius.circular(
.cookbooklistShow
.length,
shrinkWrap: true,
controller: _controller,
itemBuilder: (context, index) {
if (menuManageProvider.menuModel[indexOut]
.cookbooklistShow[index]
is MenuSunModel) {
MenuSunModel model = menuManageProvider
.menuModel[indexOut]
.cookbooklistShow[index];
if (model.imageType == '2') {
//小图
return GestureDetector(
onLongPress: () async {
print('onLongPress 长按事件');
Map object = await DialogUtil
.menuMagageAlertDialog(
context);
if (object != null) {
print(object);
// 'name_type':'1',
// 'image_type':'1',
// 'move':'1'
}
},
child: Stack(
children: [
_smallMenu(model),
Positioned(
bottom: ScreenUtil()
.setWidth(14),
// right: ScreenUtil().setWidth(20),
child: model.status == '1'
? SizedBox()
: Image.asset(
Utils.getImgPath(
'stop-sell'),
width:
ScreenUtil()
.setWidth(
10)),
child:
CachedNetworkImage(
imageUrl:
model.image,
fit: BoxFit.cover,
width: cellWidth,
height: ScreenUtil()
.setWidth(210),
),
)),
VEmptyView(15),
Text(
model.name,
style: TextStyle(
color: MyColours
.color_333333,
fontSize: ScreenUtil()
.setSp(34),
fontWeight:
FontWeight.bold),
),
VEmptyView(8),
Text(
'${model.price}元/${model.unit}',
style: TextStyle(
color: MyColours
.color_333333,
fontSize: ScreenUtil()
.setSp(28),
))
],
),
Positioned(
bottom: ScreenUtil()
.setWidth(14),
right: ScreenUtil()
.setWidth(20),
child: model.status == '1'
? SizedBox()
: Image.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(82),
height: ScreenUtil()
.setWidth(52),
)),
])
: Stack(children: [
Container(
width: cellWidth,
height: ScreenUtil()
.setWidth(210),
182),
// height: ScreenUtil()
// .setWidth(52),
))
],
));
}
decoration: BoxDecoration(
color: index % 2 == 0
? Color.fromRGBO(
247, 230, 230, 1)
: Color.fromRGBO(
234, 236, 252, 1),
borderRadius: BorderRadius
.circular(ScreenUtil()
.setWidth(10))),
child: Container(
padding:
EdgeInsets.symmetric(
horizontal:
ScreenUtil()
.setWidth(
20)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
mainAxisAlignment:
MainAxisAlignment
return GestureDetector(
onLongPress: () {
print('onLongPress 长按事件');
},
child: Stack(children: [
Container(
color: MyColours.color_4D4E50,
margin: EdgeInsets.only(
bottom: (w(2))),
child: Column(
crossAxisAlignment: model
.imageType !=
'2' &&
model.nameType == '1'
? CrossAxisAlignment.start
: model.imageType !=
'2' &&
model.nameType ==
'2'
? CrossAxisAlignment
.end
: CrossAxisAlignment
.center,
children: [
Text(
model.name,
children: [
Container(
padding:
EdgeInsets.only(
top: w(20),
left: w(20),
right: w(20),
bottom: w(15)),
child: model.imageType !=
'2' &&
model.nameType ==
'3'
? _topBetween(model)
: model.imageType !=
'2' &&
model.nameType ==
'2'
? _topRight(
model)
: model.imageType !=
'2' &&
model.nameType ==
'1'
? _topLeft(
model)
: _topLeft(
model)),
if (model.image != null)
CachedNetworkImage(
imageUrl: model.image,
fit: BoxFit.cover,
width: double.infinity,
height: w(250),
),
if (true)
Padding(
padding: EdgeInsets
.symmetric(
horizontal:
w(16),
vertical:
w(10)),
child: Text(
'江南传统名菜,口味咸鲜,汤白汁浓,肉质酥肥,笋清香脆嫩,鲜味浓厚。',
style: TextStyle(
color: MyColours
.color_333333,
.color_DBDBDB,
fontSize:
ScreenUtil()
.setSp(
34),
fontWeight:
FontWeight
.bold),
font(12)),
),
VEmptyView(40),
Text(
'${model.price}元/${model.unit}',
style: TextStyle(
color: MyColours
.color_333333,
fontSize:
ScreenUtil()
.setSp(
28),
))
],
),
),
// VEmptyView(15),
// Text(
// ' ',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize:
// ScreenUtil().setSp(34),
// fontWeight: FontWeight.bold),
// ),
// VEmptyView(20),
// Text(' ',
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize:
// ScreenUtil().setSp(28),
// ))
),
Positioned(
bottom: ScreenUtil()
.setWidth(46),
right: ScreenUtil()
.setWidth(20),
child: model.status == '1'
? SizedBox()
: Image.asset(
),
Align(
alignment: Alignment
.centerRight,
child: Padding(
padding:
EdgeInsets.only(
right: w(40),
top: w(19),
bottom:
w(19)),
child: Image.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(82),
height: ScreenUtil()
.setWidth(52),
)),
]));
},
staggeredTileBuilder: (int index) =>
new StaggeredTile.count(
2,
menuManageProvider
.menuModel[indexOut]
.cookbooklist[index]
.image !=
null
? ScreenUtil().setWidth(4.2)
: ScreenUtil().setWidth(2.85)),
mainAxisSpacing:
ScreenUtil().setWidth(15 * 2),
crossAxisSpacing:
ScreenUtil().setWidth(15 * 2),
),
'add_area'),
width: w(22),
),
))
],
),
),
Positioned(
bottom:
ScreenUtil().setWidth(14),
right:
ScreenUtil().setWidth(20),
child: model.status == '1'
? SizedBox()
: Image.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(182),
// height: ScreenUtil()
// .setWidth(52),
)),
]));
} else if (menuManageProvider
.menuModel[indexOut]
.cookbooklistShow[index] is List) {
List<MenuSunModel> temp =
menuManageProvider
.menuModel[indexOut]
.cookbooklistShow[index];
return Padding(
padding:
EdgeInsets.only(bottom: w(2)),
child: Row(
children: [
Expanded(
flex: 1,
child: GestureDetector(
onLongPress: () {
print(
'onLongPress 长按事件');
},
child: Stack(
children: [
_smallMenu(temp[0]),
Positioned(
bottom:
ScreenUtil()
.setWidth(
14),
// right: ScreenUtil().setWidth(20),
child: temp[0]
.status ==
'1'
? SizedBox()
: Image
.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(182),
// height: ScreenUtil()
// .setWidth(52),
))
],
))),
HEmptyView(4),
Expanded(
flex: 1,
child: GestureDetector(
onLongPress: () {
print(
'onLongPress 长按事件');
},
child: Stack(
children: [
_smallMenu(temp[1]),
Positioned(
bottom:
ScreenUtil()
.setWidth(
14),
// right: ScreenUtil().setWidth(20),
child: temp[1]
.status ==
'1'
? SizedBox()
: Image
.asset(
Utils.getImgPath(
'stop-sell'),
width: ScreenUtil()
.setWidth(182),
// height: ScreenUtil()
// .setWidth(52),
))
],
)))
],
));
}
})
],
);
})),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
!isShow
? SizedBox()
: Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
0,
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(40)),
Container(
padding: EdgeInsets.symmetric(horizontal: w(23)),
// height: w(80),
color: MyColours.color_FAFAFA,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding:
EdgeInsets.only(top: w(12), bottom: w(25)),
child: RoundButton(
onPressed: () async {
await NavigatorUtil.goMenuAddDishesPage(
context);
bool needRefresh =
await NavigatorUtil.goMenuCategoryPage(
context);
print(needRefresh);
if (needRefresh != null && needRefresh) {
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData();
}
},
text: '添加\n菜品',
fontSize: 26,
isBold: false,
height: ScreenUtil().setWidth(120),
width: ScreenUtil().setWidth(120),
radius: ScreenUtil().setWidth(60),
text: '分类管理',
fontSize: 32,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
isBold: true,
height: w(43),
width: w(100),
radius: r(5),
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
0,
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () async {
bool needRefresh =
await NavigatorUtil.goMenuCategoryPage(
context);
print(needRefresh);
if (needRefresh != null && needRefresh) {
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData();
}
},
text: '分类\n管理',
fontSize: 26,
isBold: false,
height: ScreenUtil().setWidth(120),
width: ScreenUtil().setWidth(120),
radius: ScreenUtil().setWidth(60),
))
],
)
!isShow
? SizedBox()
: Padding(
padding: EdgeInsets.only(
top: w(12), bottom: w(25)),
child: RoundButton(
onPressed: () async {
await NavigatorUtil.goMenuAddDishesPage(
context);
},
text: '添加菜品',
fontSize: 32,
isBold: true,
width: w(218),
height: w(43),
radius: r(5),
))
],
))
]);
}
},
... ...
// 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_easyrefresh/easy_refresh.dart';
// import 'package:flutter_screenutil/flutter_screenutil.dart';
// import 'package:one_key/constant/state.dart';
// import 'package:one_key/models/cookbook_category_model.dart';
// import 'package:one_key/models/cookbook_model.dart';
// import 'package:one_key/provider/menu_provider.dart';
// import 'package:one_key/provider/user_model.dart';
// import 'package:one_key/res/colors.dart';
// import 'package:one_key/route/navigator_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';
// import 'package:one_key/widgets/page_exception.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:provider/provider.dart';
// import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
// class MenuManagePage extends StatefulWidget {
// MenuManagePage({Key key}) : super(key: key);
// @override
// _MenuManagePageState createState() => _MenuManagePageState();
// }
// class _MenuManagePageState extends State<MenuManagePage> {
// ScrollController _controller = ScrollController();
// MenuManageProvider menuManageProvider;
// bool isShow = false; //添加菜品按钮
// @override
// void initState() {
// super.initState();
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
// _getCookbookByClass(showLoading: false);
// _getCookbookBySellerId();
// });
// EventBus().on('menu_manage_page', (arg) {
// _getCookbookByClass(showLoading: false);
// _getCookbookBySellerId();
// });
// }
// @override
// void dispose() {
// // TODO: implement dispose
// super.dispose();
// EventBus().off('menu_manage_page');
// }
// ///获取分类数据
// _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);
// List<CookbookCategorySunModel> temp = [];
// if (menuManageProvider.categorySunModel.length > 0) {
// menuManageProvider.categorySunModel.forEach((element) {
// if (element.className != '10道必点菜') {
// temp.add(element);
// }
// });
// }
// if (temp.length == 0) {
// setState(() {
// isShow = false;
// });
// } else {
// setState(() {
// isShow = true;
// });
// }
// }
// _getCookbookByClass({bool showLoading = true}) async {
// Map<String, String> params = {
// "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
// };
// await menuManageProvider.getCookbookByClass(context, params,
// showLoading: showLoading);
// }
// @override
// Widget build(BuildContext context) {
// menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true);
// return Scaffold(
// backgroundColor: MyColours.color_ffffff,
// appBar: SystemAppBar(
// '菜单管理',
// onTap: () {
// EventBus().emit('changeStatusColor');
// Navigator.of(context).pop();
// },
// ),
// body: WillPopScope(
// onWillPop: () {
// EventBus().emit('changeStatusColor');
// Navigator.of(context).pop();
// },
// child: Consumer<MenuManageProvider>(
// builder: (context, model, _) {
// if (model.pageState != PageState.Success) {
// return Column(children: [
// Expanded(
// child: ExceptionPage(
// pageState: model.pageState,
// callback: () {
// // offset = 0;
// // getMessage(showLoading: true);
// // _couponNetworkData();
// _getCookbookByClass(showLoading: true);
// },
// emptyMsg: "菜品是空哒,快点击分类管理添加分类和菜品吧",
// emptyImg: "empty_search",
// showMsg: "加载中,请稍后...",
// )),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// !isShow
// ? SizedBox()
// : Padding(
// padding: EdgeInsets.fromLTRB(
// ScreenUtil().setWidth(40),
// 0,
// ScreenUtil().setWidth(40),
// ScreenUtil().setWidth(40)),
// child: RoundButton(
// onPressed: () async {
// await NavigatorUtil.goMenuAddDishesPage(
// context);
// },
// text: '添加\n菜品',
// fontSize: 26,
// isBold: false,
// height: ScreenUtil().setWidth(120),
// width: ScreenUtil().setWidth(120),
// radius: ScreenUtil().setWidth(60),
// )),
// Padding(
// padding: EdgeInsets.fromLTRB(
// ScreenUtil().setWidth(40),
// 0,
// ScreenUtil().setWidth(40),
// ScreenUtil().setWidth(40)),
// child: RoundButton(
// onPressed: () async {
// bool needRefresh =
// await NavigatorUtil.goMenuCategoryPage(
// context);
// print(needRefresh);
// if (needRefresh != null && needRefresh) {
// //刷新页面数据
// // _controller.callRefresh();
// // _couponNetworkData();
// }
// },
// text: '分类\n管理',
// fontSize: 26,
// isBold: false,
// height: ScreenUtil().setWidth(120),
// width: ScreenUtil().setWidth(120),
// radius: ScreenUtil().setWidth(60),
// ))
// ],
// )
// ]);
// } else {
// // double cellWidth = (MediaQuery.of(context).size.width -
// // ScreenUtil().setWidth(40 * 2 + 15 * 2) / 2);
// // double desiredCellHeight = ScreenUtil().setWidth(700);
// // double childAspectRatio = cellWidth / desiredCellHeight;
// return Column(children: [
// Expanded(
// child: ListView.builder(
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(40),
// vertical: ScreenUtil().setWidth(40)),
// itemCount: menuManageProvider.menuModel.length,
// shrinkWrap: true,
// controller: _controller,
// itemBuilder: (BuildContext context, int indexOut) {
// return Column(
// children: [
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Container(
// width: ScreenUtil().setWidth(10),
// height: ScreenUtil().setWidth(10),
// decoration: BoxDecoration(
// color: MyColours.color_0D0D0D,
// shape: BoxShape.circle),
// ),
// MyDivider(ScreenUtil().setWidth(80),
// ScreenUtil().setWidth(2),
// color: MyColours.color_0D0D0D),
// HEmptyView(20),
// Text(
// menuManageProvider
// .menuModel[indexOut].className,
// style: TextStyle(
// color: MyColours.color_333333,
// fontSize: ScreenUtil().setSp(28),
// ),
// ),
// HEmptyView(20),
// MyDivider(ScreenUtil().setWidth(80),
// ScreenUtil().setWidth(2),
// color: MyColours.color_0D0D0D),
// Container(
// width: ScreenUtil().setWidth(10),
// height: ScreenUtil().setWidth(10),
// decoration: BoxDecoration(
// color: MyColours.color_0D0D0D,
// shape: BoxShape.circle),
// ),
// ],
// ),
// StaggeredGridView.countBuilder(
// padding: EdgeInsets.symmetric(
// vertical: ScreenUtil().setWidth(40)),
// shrinkWrap: true,
// crossAxisCount: 4,
// itemCount: menuManageProvider
// .menuModel[indexOut].cookbooklist.length,
// physics: NeverScrollableScrollPhysics(),
// itemBuilder:
// (BuildContext context, int index) {
// MenuSunModel model = menuManageProvider
// .menuModel[indexOut]
// .cookbooklist[index];
// double cellWidth = ((MediaQuery.of(context)
// .size
// .width -
// ScreenUtil()
// .setWidth(40 * 2 + 15 * 2)) /
// 2);
// return InkWell(
// onTap: () async {
// await NavigatorUtil
// .goMenuAddDishesPage(context,
// isNew: false,
// idstr: model.id);
// },
// child: model.image != null
// ? Stack(children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Container(
// decoration: BoxDecoration(
// borderRadius:
// BorderRadius.circular(
// ScreenUtil()
// .setWidth(
// 10))),
// child: ClipRRect(
// borderRadius:
// BorderRadius.circular(
// ScreenUtil()
// .setWidth(
// 10)),
// child:
// CachedNetworkImage(
// imageUrl:
// model.image,
// fit: BoxFit.cover,
// width: cellWidth,
// height: ScreenUtil()
// .setWidth(210),
// ),
// )),
// VEmptyView(15),
// Text(
// model.name,
// style: TextStyle(
// color: MyColours
// .color_333333,
// fontSize: ScreenUtil()
// .setSp(34),
// fontWeight:
// FontWeight.bold),
// ),
// VEmptyView(8),
// Text(
// '${model.price}元/${model.unit}',
// style: TextStyle(
// color: MyColours
// .color_333333,
// fontSize: ScreenUtil()
// .setSp(28),
// ))
// ],
// ),
// Positioned(
// bottom: ScreenUtil()
// .setWidth(14),
// right: ScreenUtil()
// .setWidth(20),
// child: model.status == '1'
// ? SizedBox()
// : Image.asset(
// Utils.getImgPath(
// 'stop-sell'),
// width: ScreenUtil()
// .setWidth(82),
// height: ScreenUtil()
// .setWidth(52),
// )),
// ])
// : Stack(children: [
// Container(
// width: cellWidth,
// height: ScreenUtil()
// .setWidth(210),
// decoration: BoxDecoration(
// color: index % 2 == 0
// ? Color.fromRGBO(
// 247, 230, 230, 1)
// : Color.fromRGBO(
// 234, 236, 252, 1),
// borderRadius: BorderRadius
// .circular(ScreenUtil()
// .setWidth(10))),
// child: Container(
// padding:
// EdgeInsets.symmetric(
// horizontal:
// ScreenUtil()
// .setWidth(
// 20)),
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment
// .start,
// mainAxisAlignment:
// MainAxisAlignment
// .center,
// children: [
// Text(
// model.name,
// style: TextStyle(
// color: MyColours
// .color_333333,
// fontSize:
// ScreenUtil()
// .setSp(
// 34),
// fontWeight:
// FontWeight
// .bold),
// ),
// VEmptyView(40),
// Text(
// '${model.price}元/${model.unit}',
// style: TextStyle(
// color: MyColours
// .color_333333,
// fontSize:
// ScreenUtil()
// .setSp(
// 28),
// ))
// ],
// ),
// ),
// // VEmptyView(15),
// // Text(
// // ' ',
// // style: TextStyle(
// // color: MyColours.color_333333,
// // fontSize:
// // ScreenUtil().setSp(34),
// // fontWeight: FontWeight.bold),
// // ),
// // VEmptyView(20),
// // Text(' ',
// // style: TextStyle(
// // color: MyColours.color_333333,
// // fontSize:
// // ScreenUtil().setSp(28),
// // ))
// ),
// Positioned(
// bottom: ScreenUtil()
// .setWidth(46),
// right: ScreenUtil()
// .setWidth(20),
// child: model.status == '1'
// ? SizedBox()
// : Image.asset(
// Utils.getImgPath(
// 'stop-sell'),
// width: ScreenUtil()
// .setWidth(82),
// height: ScreenUtil()
// .setWidth(52),
// )),
// ]));
// },
// staggeredTileBuilder: (int index) =>
// new StaggeredTile.count(
// 2,
// menuManageProvider
// .menuModel[indexOut]
// .cookbooklist[index]
// .image !=
// null
// ? ScreenUtil().setWidth(4.2)
// : ScreenUtil().setWidth(2.85)),
// mainAxisSpacing:
// ScreenUtil().setWidth(15 * 2),
// crossAxisSpacing:
// ScreenUtil().setWidth(15 * 2),
// ),
// ],
// );
// })),
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// !isShow
// ? SizedBox()
// : Padding(
// padding: EdgeInsets.fromLTRB(
// ScreenUtil().setWidth(40),
// 0,
// ScreenUtil().setWidth(40),
// ScreenUtil().setWidth(40)),
// child: RoundButton(
// onPressed: () async {
// await NavigatorUtil.goMenuAddDishesPage(
// context);
// },
// text: '添加\n菜品',
// fontSize: 26,
// isBold: false,
// height: ScreenUtil().setWidth(120),
// width: ScreenUtil().setWidth(120),
// radius: ScreenUtil().setWidth(60),
// )),
// Padding(
// padding: EdgeInsets.fromLTRB(
// ScreenUtil().setWidth(40),
// 0,
// ScreenUtil().setWidth(40),
// ScreenUtil().setWidth(40)),
// child: RoundButton(
// onPressed: () async {
// bool needRefresh =
// await NavigatorUtil.goMenuCategoryPage(
// context);
// print(needRefresh);
// if (needRefresh != null && needRefresh) {
// //刷新页面数据
// // _controller.callRefresh();
// // _couponNetworkData();
// }
// },
// text: '分类\n管理',
// fontSize: 26,
// isBold: false,
// height: ScreenUtil().setWidth(120),
// width: ScreenUtil().setWidth(120),
// radius: ScreenUtil().setWidth(60),
// ))
// ],
// )
// ]);
// }
// },
// ),
// // VEmptyView(20),
// ));
// }
// }
... ...
import 'package:flutter/material.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:one_key/route/navigator_util.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 '../../../res/colors.dart';
import '../../../utils/screen_util.dart';
import '../../../utils/utils.dart';
import '../../../widgets/MyDivider.dart';
import '../../../widgets/h_empty_view.dart';
/**
*
* 配置规格和价格
*/
class MenuSetPricePage extends StatefulWidget {
MenuSetPricePage({Key key}) : super(key: key);
@override
_MenuSetPricePageState createState() => _MenuSetPricePageState();
}
class _MenuSetPricePageState extends State<MenuSetPricePage> {
bool swichState = false;
List data = ['', ''];
///输入框
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_515151, fontSize: font(16)),
),
),
HEmptyView(10),
needStar
? Container(
padding: EdgeInsets.only(top: w(5)),
child: Text(
'*',
style: TextStyle(
color: MyColours.color_515151,
),
),
)
: SizedBox(),
// Spacer(),
Expanded(
child: Container(
// height: ScreenUtil().setHeight(120),
padding: EdgeInsets.only(
left: w(10),
right: w(10),
),
child: TextField(
controller: editingController,
textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
inputFormatters: [],
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16),
),
focusNode: focusNode,
decoration: InputDecoration(
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: font(16),
),
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: font(16)),
),
),
],
),
);
}
///选择
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_515151, fontSize: font(16)),
),
),
HEmptyView(10),
needStar
? Container(
padding: EdgeInsets.only(top: w(5)),
child: Text(
'*',
style: TextStyle(
color: MyColours.color_515151,
),
),
)
: SizedBox(),
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '请选择' ||
hintText == '点击配置菜品价格' ||
hintText == '点击配置菜品做法' ||
hintText == '点击配置烹调方法' ||
hintText == '请选择销售单位'
? MyColours.color_999999
: MyColours.color_515151,
fontWeight: FontWeight.normal,
fontSize: font(16),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arr_right_gray'),
width: w(6),
height: w(11),
)
],
),
),
);
}
@override
Widget build(BuildContext context) {
return KeyboardDismissOnTap(
child: Scaffold(
backgroundColor: MyColours.color_DBDBDB,
appBar: SystemAppBar('菜品规格及定价'),
body: Column(
children: [
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: data.length + 1,
itemBuilder: (context, index) {
if ((index == 0 && data.length == 0) ||
index == data.length) {
return InkWell(
onTap: () {
data.add('');
setState(() {});
},
child: Container(
height: w(190),
color: MyColours.color_ffffff,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath('f_add_image'),
width: w(30),
),
VEmptyView(46),
Text(
'添加定价',
style: TextStyle(
color: MyColours.color_000000,
fontSize: font(24)),
)
],
),
));
}
return Container(
color: MyColours.color_ffffff,
margin: EdgeInsets.only(bottom: w(12)),
child: Column(
children: [
InkWell(
onTap: () {
setState(() {
swichState = !swichState;
});
},
child: Container(
height: w(48),
padding: EdgeInsets.symmetric(
horizontal: w(16),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
'启用该规格',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16)),
),
),
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: w(16)),
child: _select('销售单位', '请选择销售单位', () async {
await NavigatorUtil.goMenuUnitPage(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: w(16)),
child:
_textfield('售价', '点击输入售价', null, 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: w(16)),
child: _textfield(
'会员价格', '点击输入会员价格', null, null, '')),
],
),
);
})),
Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.only(
left: w(15), right: w(15), top: w(13), bottom: w(26)),
child: RoundButton(
text: '保存',
textColor: MyColours.color_F8F9FD,
bgColor: MyColours.color_438E93,
radius: r(5),
fontSize: 32,
isBold: true,
onPressed: () {},
),
)
],
),
),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import '../../../utils/screen_util.dart';
/**
* 销售单位 份、位、晚
*/
class MenuUnitPage extends StatefulWidget {
MenuUnitPage({Key key}) : super(key: key);
@override
_MenuUnitPageState createState() => _MenuUnitPageState();
}
class _MenuUnitPageState extends State<MenuUnitPage> {
List data = ['位', '份'];
bool select = true;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_DBDBDB,
appBar: SystemAppBar('销售单位'),
body: ListView.builder(
itemCount: data.length + 1,
itemBuilder: (context, index) {
if ((index == 0 && data.length == 0) || index == data.length) {
return Container(
height: w(48),
margin: EdgeInsets.only(top: w(10), left: w(10), right: w(10)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border:
Border.all(width: w(1), color: MyColours.color_515151),
borderRadius: BorderRadius.circular(r(5))),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
Utils.getImgPath('f_add_image'),
width: w(15),
),
HEmptyView(22),
Text(
'添加新规格',
textAlign: TextAlign.center,
style: TextStyle(
color: MyColours.color_515151, fontSize: font(16)),
),
],
),
);
}
return Container(
height: w(48),
margin: EdgeInsets.only(top: w(10), left: w(10), right: w(10)),
decoration: BoxDecoration(
color:
select ? MyColours.color_438E93 : MyColours.color_ffffff,
border: Border.all(
width: w(1),
color: select
? MyColours.color_438E93
: MyColours.color_515151),
borderRadius: BorderRadius.circular(r(5))),
child: Row(
children: [
Expanded(
child: Text(
'份',
textAlign: TextAlign.center,
style: TextStyle(
color: select
? MyColours.color_F8F9FD
: MyColours.color_515151,
fontSize: font(16)),
)),
InkWell(
onTap: () {
DialogUtil.cupertinoAlertDialog(context,
content:
'确定要删除销售规格“条”吗?删除后,您可以通过添加新规格增加。\n如果有菜品使用该销售单位定价,则无法删除。',
textAlign: TextAlign.left,rCallback: (){
//确定删除
});
},
child: Image.asset(
Utils.getImgPath('close'),
width: w(15),
)),
HEmptyView(20)
],
),
);
}),
);
}
}
... ...
import 'package:flutter/material.dart';
class MyColours {
static const Color color_4D4E50 = Color(0xFF4D4E50);
static const Color color_00715F = Color(0xFF00715F);
static const Color color_80D9D9D9 = Color(0x80D9D9D9);
static const Color color_42A5FF = Color(0xFF42A5FF);
... ...
... ... @@ -1643,4 +1643,30 @@ class NavigatorUtil {
"${Routes.order_share_page}?object=${FluroConvertUtils.object2string(object)}&priceSum=$priceSum&memberPriceSum=$memberPriceSum&planDishText=${Uri.encodeComponent(planDishText)}&name=${Uri.encodeComponent(name)}&remark=${Uri.encodeComponent(remark)}&detail=${FluroConvertUtils.object2string(detailEntity)}&isRecharge=${isRecharge}&isRecommend=${isRecommend}&recommend=${Uri.encodeComponent(recommend)}",
replace: replace);
}
///菜单管理------规格和价格设置
static Future<dynamic> goMenuSetPricePage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.menu_set_price_page}",
replace: replace);
}
///菜单管理-----配置销售单位
static Future<dynamic> goMenuUnitPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.menu_unit_page}", replace: replace);
}
///菜单管理-----做法
static Future<dynamic> goMenuDishMethodPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.menu_dish_method_page}",
replace: replace);
}
}
... ...
... ... @@ -86,6 +86,7 @@ import 'package:one_key/pages/my/feast_manage/feast_deposit_manage_page.dart';
import 'package:one_key/pages/my/feast_manage/feast_personal_page.dart';
import 'package:one_key/pages/my/feast_manage/feast_setmeal_manage_page.dart';
import 'package:one_key/pages/my/marketing_center/book_notification/marking_interaction_page.dart';
import 'package:one_key/pages/my/menu_type/menu_set_price_page.dart';
import 'package:one_key/pages/my/personnel_type/base_info_personnal_page.dart';
import 'package:one_key/pages/my/personnel_type/personnel_detail_page.dart';
import 'package:one_key/pages/my/personnel_type/personnel_manage_page.dart';
... ... @@ -95,9 +96,9 @@ import 'package:one_key/pages/my/personnel_type/personnel_password_show_page.dar
import 'package:one_key/pages/my/base_info.dart';
import 'package:one_key/pages/my/book_time_set.dart';
import 'package:one_key/pages/my/contant_page.dart';
import 'package:one_key/pages/my/menu_type/menu_add_dishes_page.dart';
import 'package:one_key/pages/my/menu_type/menu_add_dishes_page_old.dart';
import 'package:one_key/pages/my/menu_type/menu_category_page.dart';
import 'package:one_key/pages/my/menu_type/menu_manage_page.dart';
import 'package:one_key/pages/my/menu_type/menu_manage_page_old.dart';
import 'package:one_key/pages/my/my_integral_page.dart';
import 'package:one_key/pages/my/photo_type/photo_manager_page.dart';
import 'package:one_key/pages/my/receive_orders_time_set.dart';
... ... @@ -196,6 +197,10 @@ import '../pages/my/marketing_center/recharge/recharge_detail_page.dart';
import '../pages/my/marketing_center/recharge/recharge_edit_page.dart';
import '../pages/my/marketing_center/recharge/recharge_home_page.dart';
import '../pages/my/marketing_center/recharge/recharge_select_store_coupon_page.dart';
import '../pages/my/menu_type/menu_add_dishes_page.dart';
import '../pages/my/menu_type/menu_dish_method_page.dart';
import '../pages/my/menu_type/menu_manage_page.dart';
import '../pages/my/menu_type/menu_unit_page.dart';
import '../pages/my/plan_dish/final_plan_dish_page.dart';
import '../pages/my/plan_dish/my_plan_dish_home_page.dart';
import '../pages/my/plan_dish/plan_dish_create_select_type_page.dart';
... ... @@ -2586,7 +2591,8 @@ var verificationCouponPageHandle = new Handler(
// selectList = selectIDs.split(',');
// }
return ChangeNotifierProvider<CouponProvider>(
create: (_) => CouponProvider(), child: VerificationCouponPage(idstr:idstr));
create: (_) => CouponProvider(),
child: VerificationCouponPage(idstr: idstr));
});
///充值优惠选择
... ... @@ -2603,20 +2609,6 @@ var markingRechargeSelectPageHandle = new Handler(
///排菜单微信分享截屏页
var orderSharePageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String fromPage = params["fromPage"].first;
// String tids = params["tids"].first;
// String tableidNow = params["tableidNow"].first;
// bool canChoose = params["canChoose"].first == "true" ? true : false;
// List<TableList> res = [];
// if (params.keys.contains('object')) {
// Map object = FluroConvertUtils.string2map(params["object"].first);
// List temp = object['object'];
// for (var item in temp) {
// res.add(TableList.fromJson(item));
// }
// }
NotebookDetail detailEntity = NotebookDetail.fromJson(json
.decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
List<MenuModel> res = [];
... ... @@ -2643,7 +2635,6 @@ var orderSharePageHandle = new Handler(
RechargeListSunModel rechargeListSunModel;
if (params.keys.contains('recharge')) {
rechargeListSunModel = RechargeListSunModel.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["recharge"].first)));
}
... ... @@ -2651,8 +2642,7 @@ var orderSharePageHandle = new Handler(
String recommend = params["recommend"].first;
bool isRecommend = FluroConvertUtils.string2bool(params["isRecommend"].first);
bool isRecharge =
FluroConvertUtils.string2bool(params["isRecharge"].first);
bool isRecharge = FluroConvertUtils.string2bool(params["isRecharge"].first);
return ChangeNotifierProvider<PlanDishProvider>(
create: (_) => PlanDishProvider(),
... ... @@ -2671,3 +2661,36 @@ var orderSharePageHandle = new Handler(
isRecommend: isRecommend,
isRecharge: isRecharge)));
});
///菜单管理--设置价格
var menuSetPricePageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String idstr = params["idstr"].first;
// NotebookDetail detailEntity = NotebookDetail.fromJson(json
// .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
return ChangeNotifierProvider<MenuManageProvider>(
create: (_) => MenuManageProvider(), child: MenuSetPricePage());
});
///菜单管理--配置销售单位
var menuUnitPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String idstr = params["idstr"].first;
// NotebookDetail detailEntity = NotebookDetail.fromJson(json
// .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
return ChangeNotifierProvider<MenuManageProvider>(
create: (_) => MenuManageProvider(), child: MenuUnitPage());
});
///菜单管理--做法
var menuDishMethodPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// String idstr = params["idstr"].first;
// NotebookDetail detailEntity = NotebookDetail.fromJson(json
// .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
return ChangeNotifierProvider<MenuManageProvider>(
create: (_) => MenuManageProvider(), child: MenuDishMethodPage());
});
... ...
... ... @@ -237,6 +237,17 @@ class Routes {
"/marking_recharge_select_page"; //充值优惠单选择页面
static String order_share_page = "/order_share_page"; //排菜单微信分享截屏
/** 菜单管理
*/
static String menu_set_price_page = "/menu_set_price_page"; //菜单管理---配置规格和价格
static String menu_unit_page = "/menu_unit_page"; //菜单管理---配置销售单位
static String menu_dish_method_page = "/menu_dish_method_page"; //菜单管理---做法
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
... ... @@ -456,8 +467,11 @@ class Routes {
router.define(marking_recharge_select_page,
handler: markingRechargeSelectPageHandle);
router.define(order_share_page,
handler: orderSharePageHandle);
router.define(order_share_page, handler: orderSharePageHandle);
router.define(menu_set_price_page, handler: menuSetPricePageHandle);
router.define(menu_unit_page, handler: menuUnitPageHandle);
router.define(menu_dish_method_page,handler: menuDishMethodPageHandle);
}
}
... ...
... ... @@ -53,6 +53,145 @@ typedef ClickCallback = void Function(String value);
// };
class DialogUtil {
static Future menuMagageAlertDialog(BuildContext context,
{GestureTapCallback onTap, double fontSize = 32}) async {
final action = await showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Center(
child: Container(
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(30)))), //设置圆角
child: Column(mainAxisSize: MainAxisSize.min, children: [
VEmptyView(92),
Container(
height: ScreenUtil().setWidth(96),
alignment: Alignment.center,
child: Text('菜品名称(味型/烹调)及价格在顶部左侧',
style: TextStyle(
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_515151)),
),
Container(
height: ScreenUtil().setWidth(96),
alignment: Alignment.center,
child: Text('菜品名称(味型/烹调)及价格在顶部右侧',
style: TextStyle(
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_515151)),
),
Container(
height: ScreenUtil().setWidth(96),
alignment: Alignment.center,
child: Text('菜品名称(味型/烹调)及价格在顶部分开',
style: TextStyle(
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_515151)),
),
MyDivider(
ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_efefef),
Container(
height: ScreenUtil().setWidth(96),
alignment: Alignment.center,
child: Text('大图展示菜品',
style: TextStyle(
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_515151)),
),
Container(
height: ScreenUtil().setWidth(96),
alignment: Alignment.center,
child: Text('小图展示菜品',
style: TextStyle(
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_515151)),
),
MyDivider(
ScreenUtil().setWidth(280 * 2), ScreenUtil().setWidth(2),
color: MyColours.color_efefef),
Container(
height: ScreenUtil().setWidth(96),
alignment: Alignment.center,
child: Text('菜品向上移动一个',
style: TextStyle(
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_515151)),
),
Container(
height: ScreenUtil().setWidth(96),
alignment: Alignment.center,
child: Text('菜品向下移动一个',
style: TextStyle(
fontSize: ScreenUtil().setSp(fontSize),
color: MyColours.color_515151)),
),
VEmptyView(60),
MyDivider(double.infinity, ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
RoundButton(
text: '取消',
width: (ScreenUtil().screenWidth -
ScreenUtil().setWidth(62) * 2) /
2,
height: ScreenUtil().setWidth(112),
// radius: ScreenUtil().setWidth(10),
gradientStart: Colors.transparent,
gradientEnd: Colors.transparent,
textColor: MyColours.color_000000,
isBold: false,
fontSize: 34,
onPressed: () {
Navigator.pop(context);
}),
MyDivider(
ScreenUtil().setWidth(2), ScreenUtil().setWidth(112),
color: MyColours.color_f3f3f3),
RoundButton(
text: '确定',
width: (ScreenUtil().screenWidth -
ScreenUtil().setWidth(62) * 2) /
2,
height: ScreenUtil().setWidth(112),
// radius: ScreenUtil().setWidth(10),
gradientStart: Colors.transparent,
gradientEnd: Colors.transparent,
textColor: MyColours.color_438E93,
fontSize: 34,
onPressed: () {
// if (!isRed) {
// if (controller.text.trim() == '') {
// Utils.showToast('请输入区域名称!');
// return;
// }
// onTap(controller.text);
Navigator.pop(context, {
'name_type': '1',
'image_type': '1',
'move': '1'
});
// }
}),
],
),
])),
),
);
},
);
return action;
}
static Future removePersonnalDialog(
BuildContext context, List<FilterBtnModel> managerList,
{CustomCallBackMap onTap}) async {
... ... @@ -6075,7 +6214,7 @@ class DialogUtil {
color: MyColours.color_E6000000))
: SizedBox(),
content: Text(content,
textAlign:textAlign,
textAlign: textAlign,
style: TextStyle(
fontWeight:
isBoldContent ? FontWeight.bold : FontWeight.normal,
... ...
... ... @@ -34,11 +34,23 @@ import 'dart:ui' as ui;
import 'package:permission_handler/permission_handler.dart';
import 'package:path_provider/path_provider.dart';
import 'package:image_cropper/image_cropper.dart';
import 'dart:math';
// import 'dart:typed_data';
typedef BookTimeSetCallback = void Function(bool needChange);
class Utils {
static randomGet(int min, int max) {
//实例化 Random类 并赋值给 私有变量 _random
final _random = new Random();
//定义 指定返回值为 int 的函数方法,传入参数为 min 和 max
//变量c等于 (0+4)+随机数(9-4);实现了最小值不小于4,最大值不大于8的结果
var c = min + _random.nextInt(max - min);
//打印变量 c
print(c); //4~8
}
static bool cnIsNumber(String str) {
final reg = RegExp(r'^-?[0-9.]+$');
return reg.hasMatch(str);
... ...
... ... @@ -14,17 +14,19 @@ class ExceptionPage extends StatefulWidget {
final String showMsg;
final Color defalutColor;
final String showText;
final Color bgColor;
const ExceptionPage(
{Key key,
this.pageState = PageState.Loading,
this.callback,
this.emptyMsg = "数据为空",
this.emptyImg = 'bg_error',
this.showMsg = '',
this.defalutColor = MyColours.color_ffffff,
this.showText})
: super(key: key);
const ExceptionPage({
Key key,
this.pageState = PageState.Loading,
this.callback,
this.emptyMsg = "数据为空",
this.emptyImg = 'bg_error',
this.showMsg = '',
this.defalutColor = MyColours.color_ffffff,
this.showText,
this.bgColor = MyColours.color_ffffff,
}) : super(key: key);
@override
State<StatefulWidget> createState() {
... ... @@ -60,6 +62,7 @@ class ExceptionPageState extends State<ExceptionPage> {
break;
case PageState.Empty:
page = EmptyPage(
bgcolor: widget.bgColor,
content: widget.emptyMsg,
imgname: widget.emptyImg,
showText: widget.showText,
... ...