|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
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/provider/marketing_center_provider.dart';
|
|
|
|
import 'package:one_key/provider/menu_provider.dart';
|
|
|
|
import 'package:one_key/route/route_handles.dart';
|
|
|
|
import 'package:one_key/utils/dialog_util.dart';
|
|
|
|
import 'package:one_key/utils/utils.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';
|
|
|
|
|
|
|
|
import '../../../../app.dart';
|
|
|
|
import '../../../../models/theme_color_model.dart';
|
|
|
|
import '../../../../models/upload_img_model.dart';
|
|
|
|
import '../../../../provider/upload_img_provider.dart';
|
|
|
|
import '../../../../provider/user_model.dart';
|
|
|
|
import '../../../../res/colors.dart';
|
|
|
|
import '../../../../utils/screen_util.dart';
|
|
|
|
import '../../../../utils/upload_image_util.dart';
|
|
|
|
import '../../../../widgets/MyDivider.dart';
|
|
|
|
import '../../../../widgets/round_button.dart';
|
|
|
|
import '../../../constant/state.dart';
|
|
|
|
import '../../../models/cookbook_model.dart';
|
|
|
|
import '../../../widgets/h_empty_view.dart';
|
|
|
|
import '../../../widgets/page_exception.dart';
|
|
|
|
import '../../online_check/photo_view_wiget.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 菜单管理配置
|
|
|
|
*/
|
|
|
|
|
|
|
|
class MenuThemeColorSetPage extends StatefulWidget {
|
|
|
|
final List<MenuModel> menuModel;
|
|
|
|
MenuThemeColorSetPage({Key key, this.menuModel}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_MenuThemeColorSetPageState createState() => _MenuThemeColorSetPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MenuThemeColorSetPageState extends State<MenuThemeColorSetPage> {
|
|
|
|
List<ThemeColorModel> themeColorData = [];
|
|
|
|
int themeColorIndex = 0;
|
|
|
|
|
|
|
|
TextEditingController titleC = TextEditingController();
|
|
|
|
FocusNode titleNode = FocusNode();
|
|
|
|
|
|
|
|
TextEditingController sloganC = TextEditingController();
|
|
|
|
FocusNode sloganNode = FocusNode();
|
|
|
|
|
|
|
|
final picker = ImagePicker();
|
|
|
|
|
|
|
|
ScrollController _controller = ScrollController();
|
|
|
|
|
|
|
|
List<MenuModel> menuModelTemp = [];
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
_initThemeColor();
|
|
|
|
|
|
|
|
_handleData();
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
// getSellerTemplateConf();
|
|
|
|
// _getCookbookByClass(showLoading: true);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
// getSellerTemplateConf() async {
|
|
|
|
// bool success =
|
|
|
|
// await _marketingCenterProvider.getSellerTemplateConf(context);
|
|
|
|
// if (success && _marketingCenterProvider.markDataModel.home != null) {
|
|
|
|
// int colorValue =
|
|
|
|
// int.parse(_marketingCenterProvider.markDataModel.home.themeColor);
|
|
|
|
// if (colorValue == MyColours.color_0C0F0E.value) {
|
|
|
|
// themeColorIndex = 0;
|
|
|
|
// } else if (colorValue == MyColours.color_0143A3.value) {
|
|
|
|
// themeColorIndex = 1;
|
|
|
|
// } else if (colorValue == MyColours.color_438E93.value) {
|
|
|
|
// themeColorIndex = 2;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// titleC.text = _marketingCenterProvider.markDataModel.home.title;
|
|
|
|
// sloganC.text = _marketingCenterProvider.markDataModel.home.slogan;
|
|
|
|
// _uploadImageProvider.firstImage.qiniuUrl =
|
|
|
|
// _marketingCenterProvider.markDataModel.home.image ?? null;
|
|
|
|
// _uploadImageProvider.firstImage.process =
|
|
|
|
// _marketingCenterProvider.markDataModel.home.image != null &&
|
|
|
|
// _marketingCenterProvider.markDataModel.home.image != ''
|
|
|
|
// ? 1
|
|
|
|
// : null;
|
|
|
|
// setState(() {});
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
///初始化主题颜色
|
|
|
|
_initThemeColor() {
|
|
|
|
// int colorValue = App.sp.get("themeColor");
|
|
|
|
|
|
|
|
// if (colorValue != null) {
|
|
|
|
// //缓存里有设置好的主题色
|
|
|
|
// if (colorValue == MyColours.color_0C0F0E.value) {
|
|
|
|
// themeColorIndex = 0;
|
|
|
|
// } else if (colorValue == MyColours.color_0143A3.value) {
|
|
|
|
// themeColorIndex = 1;
|
|
|
|
// } else if (colorValue == MyColours.color_438E93.value) {
|
|
|
|
// themeColorIndex = 2;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
ThemeColorModel colorModel = ThemeColorModel();
|
|
|
|
colorModel.name = '睿智灰';
|
|
|
|
colorModel.color = MyColours.color_4D4E50;
|
|
|
|
themeColorData.add(colorModel);
|
|
|
|
|
|
|
|
ThemeColorModel colorModel1 = ThemeColorModel();
|
|
|
|
colorModel1.name = '珍珠白';
|
|
|
|
colorModel1.color = MyColours.color_FBF6F1;
|
|
|
|
themeColorData.add(colorModel1);
|
|
|
|
|
|
|
|
ThemeColorModel colorModel2 = ThemeColorModel();
|
|
|
|
colorModel2.name = '国风库金';
|
|
|
|
colorModel2.color = MyColours.color_877952;
|
|
|
|
themeColorData.add(colorModel2);
|
|
|
|
|
|
|
|
ThemeColorModel colorModel3 = ThemeColorModel();
|
|
|
|
colorModel3.name = '群青绿';
|
|
|
|
colorModel3.color = MyColours.color_438E93;
|
|
|
|
themeColorData.add(colorModel3);
|
|
|
|
|
|
|
|
ThemeColorModel colorModel4 = ThemeColorModel();
|
|
|
|
colorModel4.name = '国风绿';
|
|
|
|
colorModel4.color = MyColours.color_3E6F51;
|
|
|
|
themeColorData.add(colorModel4);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _item(String title, String subtitle, {GestureTapCallback onTap}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
color: MyColours.color_E7E7E7, width: w(0.5)))),
|
|
|
|
margin: EdgeInsets.only(left: w(16)),
|
|
|
|
padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(12)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
title,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setWidth(32)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Text(
|
|
|
|
subtitle,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setWidth(32)),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: w(7), vertical: w(4)),
|
|
|
|
child: Image.asset(
|
|
|
|
"assets/arrow_right_new.png",
|
|
|
|
width: ScreenUtil().setWidth(18),
|
|
|
|
height: ScreenUtil().setWidth(32),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
//查看大图
|
|
|
|
_showPhotoView(BuildContext context, int index, List imgs,
|
|
|
|
{isShow = false, List dashName}) async {
|
|
|
|
// if (imgs.length == 1 &&
|
|
|
|
// imgs[0] ==
|
|
|
|
// 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
|
|
|
|
// imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
|
|
|
|
// }
|
|
|
|
Utils.setBarStatus(false, color: Colors.black);
|
|
|
|
dynamic result = await showGeneralDialog(
|
|
|
|
context: context,
|
|
|
|
barrierDismissible: false,
|
|
|
|
// barrierColor: Colors.red,
|
|
|
|
barrierLabel:
|
|
|
|
MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
|
transitionDuration: const Duration(milliseconds: 150),
|
|
|
|
pageBuilder: (BuildContext context, Animation animation,
|
|
|
|
Animation secondaryAnimation) {
|
|
|
|
Widget child = Stack(
|
|
|
|
children: <Widget>[
|
|
|
|
PhotoPreview(
|
|
|
|
initialIndex: index,
|
|
|
|
photoList: imgs,
|
|
|
|
isShow: isShow,
|
|
|
|
dashName: dashName)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
return child;
|
|
|
|
});
|
|
|
|
Utils.setBarStatus(true, color: Colors.white);
|
|
|
|
}
|
|
|
|
|
|
|
|
// _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);
|
|
|
|
// _handleData();
|
|
|
|
// }
|
|
|
|
|
|
|
|
///处理数据
|
|
|
|
_handleData({isMove = false}) {
|
|
|
|
if (widget.menuModel != null) {
|
|
|
|
List<MenuModel> temp = [];
|
|
|
|
for (int i = 0; i < widget.menuModel.length; i++) {
|
|
|
|
List<dynamic> listSub = [];
|
|
|
|
// if (widget.menuModel[i].cookbooklist.length > 0 &&
|
|
|
|
// widget.menuModel[i].cookbooklist[0].indexNew == null &&
|
|
|
|
// !isMove) {
|
|
|
|
// //没有设置过顺序
|
|
|
|
// for (int j = 0;
|
|
|
|
// j < widget.menuModel[i].cookbooklist.length;
|
|
|
|
// j++) {
|
|
|
|
// widget.menuModel[i].cookbooklist[j].indexNew = j; //初始化菜单顺序
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
for (int j = 0; j < widget.menuModel[i].cookbooklist.length; j++) {
|
|
|
|
MenuSunModel menuSunModel = widget.menuModel[i].cookbooklist[j];
|
|
|
|
if (menuSunModel.imageType == '1') {
|
|
|
|
//大图
|
|
|
|
menuSunModel.indexNew = j;
|
|
|
|
listSub.add(menuSunModel);
|
|
|
|
} else {
|
|
|
|
//小图
|
|
|
|
//判断下一个是大图还是小图
|
|
|
|
if (widget.menuModel[i].cookbooklist.length - 1 > j) {
|
|
|
|
if (widget.menuModel[i].cookbooklist[j + 1].imageType == '1') {
|
|
|
|
//下一个是大图
|
|
|
|
menuSunModel.indexNew = j;
|
|
|
|
listSub.add(menuSunModel);
|
|
|
|
} else {
|
|
|
|
//下一个是小图
|
|
|
|
|
|
|
|
List<MenuSunModel> subTemp = [];
|
|
|
|
menuSunModel.indexNew = j;
|
|
|
|
subTemp.add(menuSunModel);
|
|
|
|
widget.menuModel[i].cookbooklist[j + 1].indexNew = j + 1;
|
|
|
|
subTemp.add(widget.menuModel[i].cookbooklist[j + 1]);
|
|
|
|
listSub.add(subTemp);
|
|
|
|
j++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
menuSunModel.indexNew = j;
|
|
|
|
listSub.add(menuSunModel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
widget.menuModel[i].cookbooklistShow = listSub;
|
|
|
|
temp.add(widget.menuModel[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
menuModelTemp = temp;
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//左边
|
|
|
|
|
|
|
|
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_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Text('味型:咸鲜 烹调:熬煮',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: font(12),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
])),
|
|
|
|
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_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
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_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Text('味型:咸鲜 烹调:熬煮',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: font(12),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
])),
|
|
|
|
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_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
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_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Text('味型:咸鲜 烹调:熬煮',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: font(12),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
]))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
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_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
]),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _smallMenu(MenuSunModel model, ThemeColorModel themeColerModel) {
|
|
|
|
return Container(
|
|
|
|
width: ScreenUtil().screenWidth / 2,
|
|
|
|
color: themeColerModel.color,
|
|
|
|
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_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
]),
|
|
|
|
)),
|
|
|
|
VEmptyView(20),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(10)),
|
|
|
|
child: Text(
|
|
|
|
'味型:咸鲜 烹调:熬煮',
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: font(12),
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
offset: Offset(0, 1),
|
|
|
|
blurRadius: w(2),
|
|
|
|
spreadRadius: w(20))
|
|
|
|
]),
|
|
|
|
)),
|
|
|
|
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_515151,
|
|
|
|
shadows: [
|
|
|
|
BoxShadow(
|
|
|
|
color: MyColours.color_FBF6F1,
|
|
|
|
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: themeColerModel.name == '珍珠白'
|
|
|
|
? MyColours.color_515151
|
|
|
|
: MyColours.color_FBF6F1,
|
|
|
|
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_store'),
|
|
|
|
width: w(22),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
ThemeColorModel themeColerModel = themeColorData[themeColorIndex];
|
|
|
|
|
|
|
|
// menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true);
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_ffffff,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'菜单管理配置',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
_item('客人所见菜单主题颜色选择', themeColerModel.name, onTap: () {
|
|
|
|
DialogUtil.showMenuThemeColorSelectDialog(
|
|
|
|
context, themeColorData, callback: (object) {
|
|
|
|
print(object);
|
|
|
|
setState(() {
|
|
|
|
themeColorIndex = object;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
VEmptyView(24),
|
|
|
|
Container(
|
|
|
|
height: w(48),
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(16)),
|
|
|
|
child: Text(
|
|
|
|
'效果预览',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setWidth(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(24),
|
|
|
|
menuModelTemp == null || menuModelTemp.length == 0
|
|
|
|
? Expanded(
|
|
|
|
child: Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(20)),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
VEmptyView(222),
|
|
|
|
Text(
|
|
|
|
'您还没有创建菜谱!',
|
|
|
|
style: TextStyle(
|
|
|
|
height: 1.3,
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: font(16),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
))
|
|
|
|
:
|
|
|
|
// double cellWidth = (MediaQuery.of(context).size.width -
|
|
|
|
// ScreenUtil().setWidth(40 * 2 + 15 * 2) / 2);
|
|
|
|
// double desiredCellHeight = ScreenUtil().setWidth(700);
|
|
|
|
// double childAspectRatio = cellWidth / desiredCellHeight;
|
|
|
|
ListView.builder(
|
|
|
|
itemCount: menuModelTemp.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
controller: _controller,
|
|
|
|
itemBuilder: (BuildContext context, int indexOut) {
|
|
|
|
Color classNameColor = themeColerModel.name == '珍珠白'
|
|
|
|
? MyColours.color_515151
|
|
|
|
: MyColours.color_FBF6F1;
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
height: w(32),
|
|
|
|
color: themeColerModel.color,
|
|
|
|
margin: EdgeInsets.only(bottom: (w(2))),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(10),
|
|
|
|
height: ScreenUtil().setWidth(10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: classNameColor,
|
|
|
|
shape: BoxShape.circle),
|
|
|
|
),
|
|
|
|
MyDivider(ScreenUtil().setWidth(80),
|
|
|
|
ScreenUtil().setWidth(2),
|
|
|
|
color: classNameColor),
|
|
|
|
HEmptyView(20),
|
|
|
|
Text(
|
|
|
|
menuModelTemp[indexOut].className,
|
|
|
|
style: TextStyle(
|
|
|
|
color: classNameColor,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
MyDivider(ScreenUtil().setWidth(80),
|
|
|
|
ScreenUtil().setWidth(2),
|
|
|
|
color: classNameColor),
|
|
|
|
Container(
|
|
|
|
width: ScreenUtil().setWidth(10),
|
|
|
|
height: ScreenUtil().setWidth(10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: classNameColor,
|
|
|
|
shape: BoxShape.circle),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
ListView.builder(
|
|
|
|
itemCount: menuModelTemp[indexOut]
|
|
|
|
.cookbooklistShow
|
|
|
|
.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
controller: _controller,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
if (menuModelTemp[indexOut]
|
|
|
|
.cookbooklistShow[index]
|
|
|
|
is MenuSunModel) {
|
|
|
|
MenuSunModel model =
|
|
|
|
menuModelTemp[indexOut]
|
|
|
|
.cookbooklistShow[index];
|
|
|
|
|
|
|
|
if (model.imageType == '2') {
|
|
|
|
//小图
|
|
|
|
return Padding(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(bottom: w(2)),
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
_smallMenu(
|
|
|
|
model, themeColerModel),
|
|
|
|
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),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
return Stack(children: [
|
|
|
|
Container(
|
|
|
|
color: themeColerModel.color,
|
|
|
|
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: [
|
|
|
|
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: themeColerModel
|
|
|
|
.name ==
|
|
|
|
'珍珠白'
|
|
|
|
? MyColours
|
|
|
|
.color_515151
|
|
|
|
: MyColours
|
|
|
|
.color_FBF6F1,
|
|
|
|
fontSize: font(12)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Align(
|
|
|
|
alignment:
|
|
|
|
Alignment.centerRight,
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: w(40),
|
|
|
|
top: w(19),
|
|
|
|
bottom: w(19)),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'add_store'),
|
|
|
|
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 (menuModelTemp[indexOut]
|
|
|
|
.cookbooklistShow[index] is List) {
|
|
|
|
List<MenuSunModel> temp = widget
|
|
|
|
.menuModel[indexOut]
|
|
|
|
.cookbooklistShow[index];
|
|
|
|
return Padding(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(bottom: w(2)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
_smallMenu(temp[0],
|
|
|
|
themeColerModel),
|
|
|
|
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: Stack(
|
|
|
|
children: [
|
|
|
|
_smallMenu(temp[1],
|
|
|
|
themeColerModel),
|
|
|
|
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),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
))
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
|
|
|
})
|
|
|
|
],
|
|
|
|
);
|
|
|
|
})
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(45), right: w(45), top: w(12), bottom: w(25)),
|
|
|
|
child: RoundButton(
|
|
|
|
text: '保存',
|
|
|
|
gradientStart: MyColours.color_199095,
|
|
|
|
gradientEnd: MyColours.color_199095,
|
|
|
|
// borderColor: MyColours.color_999999,
|
|
|
|
radius: r(5),
|
|
|
|
fontSize: 34,
|
|
|
|
height: w(40),
|
|
|
|
isBold: true,
|
|
|
|
onPressed: () async {
|
|
|
|
// App.sp.setInt(
|
|
|
|
// "themeColor", themeColorData[themeColorIndex].color.value);
|
|
|
|
//接口
|
|
|
|
Map homeData = {
|
|
|
|
'theme_color':
|
|
|
|
themeColorData[themeColorIndex].color.value.toString(),
|
|
|
|
'red': themeColorData[themeColorIndex].color.red,
|
|
|
|
'green': themeColorData[themeColorIndex].color.green,
|
|
|
|
'blue': themeColorData[themeColorIndex].color.blue,
|
|
|
|
'alpha': themeColorData[themeColorIndex].color.opacity,
|
|
|
|
};
|
|
|
|
Map<String, String> params = {
|
|
|
|
'sid': Provider.of<UserModel>(context, listen: false)
|
|
|
|
.user
|
|
|
|
.sellerid,
|
|
|
|
'home': json.encode(homeData)
|
|
|
|
};
|
|
|
|
|
|
|
|
// bool success = await menuManageProvider
|
|
|
|
// .setSellerTemplateConf(context, params, showLoading: true);
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('保存成功');
|
|
|
|
// Navigator.pop(context);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|