|
|
|
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),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
))
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
},
|
...
|
...
|
|