Commit ef85648adbc7fac657766c5be275ad74e5f1f0a3

Authored by wdn127929
1 parent 64b5db77

主厨介绍UI ok

  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/widgets/v_empty_view.dart';
  4 +import 'package:provider/provider.dart';
  5 +
  6 +import '../../../../provider/user_model.dart';
  7 +import '../../../../res/colors.dart';
  8 +import '../../../../utils/screen_util.dart';
  9 +import '../../../../utils/utils.dart';
  10 +import '../../../../widgets/MyDivider.dart';
  11 +import '../../../../widgets/common_button_flat.dart';
  12 +import '../../../../widgets/round_button.dart';
  13 +import '../../../../widgets/system_app_bar.dart';
  14 +
  15 +/***
  16 + *
  17 + *
  18 + * 主厨介绍
  19 + */
  20 +
  21 +class ChefIntroducePage extends StatefulWidget {
  22 + ChefIntroducePage({Key key}) : super(key: key);
  23 +
  24 + @override
  25 + _ChefIntroducePageState createState() => _ChefIntroducePageState();
  26 +}
  27 +
  28 +class _ChefIntroducePageState extends State<ChefIntroducePage> {
  29 + int currIndex = 0; //样式按钮默认选中第一个
  30 +
  31 + String sellername; //店铺名称
  32 +
  33 + TextEditingController chefIntroduceC = TextEditingController();
  34 + FocusNode chefIntroduceNode = FocusNode();
  35 +
  36 + TextEditingController chefNameC = TextEditingController();
  37 + FocusNode chefNameNode = FocusNode();
  38 +
  39 + @override
  40 + void initState() {
  41 + super.initState();
  42 +
  43 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  44 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  45 + sellername = userModel.user.sellername;
  46 + setState(() {});
  47 + });
  48 + }
  49 +
  50 + ///图文合并,图文分开,无文字
  51 + Widget _selectBtnWidget() {
  52 + return Container(
  53 + decoration: BoxDecoration(
  54 + border: Border(
  55 + bottom:
  56 + BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
  57 + margin: EdgeInsets.only(left: w(16)),
  58 + padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
  59 + child: Row(
  60 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  61 + children: [
  62 + Text(
  63 + '附加主厨介绍',
  64 + style: TextStyle(
  65 + color: MyColours.color_515151,
  66 + fontSize: ScreenUtil().setWidth(32)),
  67 + ),
  68 + Container(
  69 + height: ScreenUtil().setWidth(74),
  70 + decoration: BoxDecoration(
  71 + color: Color.fromRGBO(232, 232, 232, 1),
  72 + borderRadius: BorderRadius.circular(
  73 + r(11),
  74 + ),
  75 + // border: Border.all(
  76 + // width: w(1), color: MyColours.color_438E93),
  77 + ),
  78 + child: Row(
  79 + // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  80 + // crossAxisAlignment: CrossAxisAlignment.center,
  81 + children: <Widget>[
  82 + CommonButtonFlat(
  83 + content: "无介绍",
  84 + state: currIndex == 0 ? 1 : 0,
  85 + fontSize: 28,
  86 + right: false,
  87 + width: w(52),
  88 + onPress: () {
  89 + if (currIndex == 0) return;
  90 + setState(() {
  91 + currIndex = 0;
  92 + });
  93 + },
  94 + ),
  95 + currIndex == 2
  96 + ? MyDivider(
  97 + ScreenUtil().setWidth(4),
  98 + ScreenUtil().setWidth(46),
  99 + color: MyColours.color_dfdfdf,
  100 + )
  101 + : SizedBox(),
  102 + CommonButtonFlat(
  103 + content: "图文合并",
  104 + state: currIndex == 1 ? 1 : 0,
  105 + fontSize: 28,
  106 + width: w(66),
  107 + left: false,
  108 + right: false,
  109 + onPress: () {
  110 + if (currIndex == 1) return;
  111 + setState(() {
  112 + currIndex = 1;
  113 + });
  114 + },
  115 + ),
  116 + currIndex == 0
  117 + ? MyDivider(
  118 + ScreenUtil().setWidth(4),
  119 + ScreenUtil().setWidth(46),
  120 + color: MyColours.color_dfdfdf,
  121 + )
  122 + : SizedBox(),
  123 + Container(
  124 + child: CommonButtonFlat(
  125 + content: "图文分开",
  126 + left: false,
  127 + state: currIndex == 2 ? 1 : 0,
  128 + fontSize: 28,
  129 + width: w(66),
  130 + onPress: () {
  131 + if (currIndex == 2) return;
  132 + setState(() {
  133 + currIndex = 2;
  134 + });
  135 + },
  136 + )),
  137 + ],
  138 + ),
  139 + ),
  140 + ],
  141 + ));
  142 + }
  143 +
  144 + Widget _introduceWidget(EdgeInsets edgeInsets,
  145 + {double width = double.infinity,
  146 + Color textColor = MyColours.color_515151,
  147 + Color hintColor = MyColours.color_999999,
  148 + BoxDecoration boxDecoration}) {
  149 + return Container(
  150 + width: width,
  151 + alignment: Alignment.centerRight,
  152 + padding: edgeInsets,
  153 + decoration: boxDecoration,
  154 + child: Column(
  155 + crossAxisAlignment: CrossAxisAlignment.end,
  156 + children: [
  157 + Text(
  158 + 'Chief Cook',
  159 + style: TextStyle(color: MyColours.color_B39437, fontSize: font(14)),
  160 + ),
  161 + Text(
  162 + '知名主厨',
  163 + style: TextStyle(color: MyColours.color_B39437, fontSize: font(14)),
  164 + ),
  165 + VEmptyView(16),
  166 + // Text(
  167 + // '${sellername}',
  168 + // style: TextStyle(color: textColor, fontSize: font(14)),
  169 + // ),
  170 + Container(
  171 + width: double.infinity,
  172 + alignment: Alignment.topRight,
  173 + child: TextField(
  174 + textAlign: TextAlign.right,
  175 + controller: chefNameC,
  176 + focusNode: chefNameNode,
  177 + style: TextStyle(
  178 + color: textColor,
  179 + fontSize: ScreenUtil().setSp(28),
  180 + textBaseline: TextBaseline.alphabetic),
  181 + textAlignVertical: TextAlignVertical.center,
  182 + maxLines: 1,
  183 + decoration: InputDecoration(
  184 + hintText: "点这里录入主厨姓名",
  185 + hintStyle: TextStyle(
  186 + color: hintColor,
  187 + fontSize: ScreenUtil().setSp(28),
  188 + ),
  189 + contentPadding: EdgeInsets.zero,
  190 + border: OutlineInputBorder(borderSide: BorderSide.none),
  191 + ),
  192 + keyboardType: TextInputType.text,
  193 + onChanged: (value) {
  194 + setState(() {
  195 + // currentRemark = value ?? "";
  196 + });
  197 + }),
  198 + ),
  199 + VEmptyView(32),
  200 + Container(
  201 + width: double.infinity,
  202 + // margin: EdgeInsets.symmetric(horizontal: w(10)),
  203 + // padding: EdgeInsets.symmetric(horizontal: w(6)),
  204 + decoration: BoxDecoration(
  205 + border: Border(
  206 + right: BorderSide(
  207 + width: w(2), color: MyColours.color_EEAE74))),
  208 + child: Container(
  209 + width: double.infinity,
  210 + padding: EdgeInsets.symmetric(
  211 + horizontal: ScreenUtil().setWidth(12),
  212 + ),
  213 + alignment: Alignment.topRight,
  214 + child: TextField(
  215 + textAlign: TextAlign.right,
  216 + controller: chefIntroduceC,
  217 + focusNode: chefIntroduceNode,
  218 + style: TextStyle(
  219 + height: 2,
  220 + color: textColor,
  221 + fontSize: ScreenUtil().setSp(20),
  222 + textBaseline: TextBaseline.alphabetic),
  223 + textAlignVertical: TextAlignVertical.center,
  224 + maxLines: 7,
  225 + decoration: InputDecoration(
  226 + hintText: "点这里录入主厨介绍文字",
  227 + hintStyle: TextStyle(
  228 + color: hintColor,
  229 + fontSize: ScreenUtil().setSp(20),
  230 + ),
  231 + contentPadding: EdgeInsets.zero,
  232 + border: OutlineInputBorder(borderSide: BorderSide.none),
  233 + ),
  234 + keyboardType: TextInputType.text,
  235 + onChanged: (value) {
  236 + setState(() {
  237 + // currentRemark = value ?? "";
  238 + });
  239 + }),
  240 + )),
  241 + ],
  242 + ),
  243 + );
  244 + }
  245 +
  246 + Widget _uploadImage(bool hasupload, {EdgeInsets padding = EdgeInsets.zero}) {
  247 + return InkWell(
  248 + onTap: () {},
  249 + child: hasupload
  250 + ? InkWell(
  251 + onTap: () {
  252 + print('object');
  253 + },
  254 + child: Stack(alignment: Alignment.bottomCenter, children: [
  255 + Image.network(
  256 + 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg',
  257 + fit: BoxFit.cover,
  258 + height: w(280),
  259 + ),
  260 + Container(
  261 + width: w(150),
  262 + height: w(30),
  263 + color: MyColours.color_4D000000,
  264 + margin: padding,
  265 + alignment: Alignment.center,
  266 + child: Text(
  267 + '点击图片可以更换',
  268 + style: TextStyle(
  269 + color: MyColours.color_F8F9FD,
  270 + fontSize: font(14),
  271 + fontWeight: FontWeight.bold),
  272 + )),
  273 + ]))
  274 + : Container(
  275 + color: MyColours.color_d9d9d9,
  276 + width: double.infinity,
  277 + height: w(280),
  278 + padding: padding,
  279 + child: Column(
  280 + mainAxisAlignment: MainAxisAlignment.center,
  281 + children: [
  282 + Image.asset(
  283 + Utils.getImgPath('add_img'),
  284 + width: w(63),
  285 + ),
  286 + VEmptyView(28),
  287 + Container(
  288 + width: w(139),
  289 + height: w(60),
  290 + child: Text(
  291 + '点击上传照片\n为了更好的效果\n建议上传4:3照片',
  292 + textAlign: TextAlign.center,
  293 + style: TextStyle(
  294 + height: 1.4,
  295 + color: MyColours.color_ffffff,
  296 + fontSize: font(14),
  297 + fontWeight: FontWeight.bold),
  298 + ))
  299 + ],
  300 + ),
  301 + ));
  302 + }
  303 +
  304 + ///无文字
  305 + Widget _noTextWidget() {
  306 + return Column(
  307 + children: [
  308 + _uploadImage(false),
  309 + VEmptyView(18),
  310 + ],
  311 + );
  312 + }
  313 +
  314 + ///图文合并
  315 + Widget _mergingWidget() {
  316 + return Column(
  317 + children: [
  318 + Stack(
  319 + children: [
  320 + _uploadImage(
  321 + true,
  322 + padding: EdgeInsets.only(left: w(160)),
  323 + ),
  324 + Positioned(
  325 + child: _introduceWidget(
  326 + EdgeInsets.only(
  327 + left: w(15), top: w(23), right: w(7), bottom: w(42)),
  328 + textColor: MyColours.color_ffffff,
  329 + hintColor: MyColours.color_ffffff,
  330 + boxDecoration: BoxDecoration(
  331 + gradient: LinearGradient(
  332 + stops: [0, 1],
  333 + begin: Alignment.topCenter,
  334 + end: Alignment.bottomCenter,
  335 + colors: [
  336 + MyColours.color_0C0F0E,
  337 + MyColours.color_4D0C0F0E,
  338 + ],
  339 + ),
  340 + )),
  341 + width: w(160),
  342 + ),
  343 + ],
  344 + ),
  345 + ],
  346 + );
  347 + }
  348 +
  349 + ///图文分开
  350 + Widget _separateWidget() {
  351 + return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
  352 + _introduceWidget(EdgeInsets.all(w(15)),
  353 + boxDecoration: BoxDecoration(color: MyColours.color_ffffff)),
  354 + VEmptyView(18),
  355 + _uploadImage(false),
  356 + ]);
  357 + }
  358 +
  359 + @override
  360 + Widget build(BuildContext context) {
  361 + return Scaffold(
  362 + backgroundColor: MyColours.color_ffffff,
  363 + appBar: SystemAppBar(
  364 + '主厨介绍',
  365 + onTap: () {
  366 + Navigator.pop(context);
  367 + },
  368 + ),
  369 + body: Column(
  370 + children: [
  371 + Expanded(
  372 + child: SingleChildScrollView(
  373 + child: Column(
  374 + children: [
  375 + _selectBtnWidget(),
  376 + VEmptyView(24),
  377 + Container(
  378 + alignment: Alignment.centerLeft,
  379 + padding: EdgeInsets.only(left: w(16)),
  380 + height: w(48),
  381 + child: Text(
  382 + '效果预览',
  383 + style: TextStyle(
  384 + fontSize: font(16), color: MyColours.color_515151),
  385 + ),
  386 + ),
  387 + VEmptyView(24),
  388 + currIndex == 0
  389 + ? _noTextWidget()
  390 + : currIndex == 1
  391 + ? _mergingWidget()
  392 + : _separateWidget(),
  393 + VEmptyView(18),
  394 + ],
  395 + ),
  396 + )),
  397 + Container(
  398 + color: MyColours.color_ffffff,
  399 + padding: EdgeInsets.only(
  400 + left: w(45), right: w(45), top: w(12), bottom: w(25)),
  401 + child: RoundButton(
  402 + text: '保存',
  403 + gradientStart: MyColours.color_199095,
  404 + gradientEnd: MyColours.color_199095,
  405 + // borderColor: MyColours.color_999999,
  406 + radius: r(5),
  407 + fontSize: 34,
  408 + height: w(40),
  409 + isBold: true,
  410 + onPressed: () {},
  411 + ),
  412 + )
  413 + ],
  414 + ));
  415 + }
  416 +}
@@ -152,7 +152,9 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> { @@ -152,7 +152,9 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> {
152 _item('店铺介绍展示', onTap: () { 152 _item('店铺介绍展示', onTap: () {
153 NavigatorUtil.goStoreIntroducePage(context); 153 NavigatorUtil.goStoreIntroducePage(context);
154 }), 154 }),
155 - _item('主厨介绍展示', onTap: () {}), 155 + _item('主厨介绍展示', onTap: () {
  156 + NavigatorUtil.goChefIntroducePage(context);
  157 + }),
156 _item('招牌菜展示', onTap: () {}), 158 _item('招牌菜展示', onTap: () {}),
157 _item('营销及客户互动功能', onTap: () {}), 159 _item('营销及客户互动功能', onTap: () {}),
158 ], 160 ],
@@ -1419,4 +1419,13 @@ class NavigatorUtil { @@ -1419,4 +1419,13 @@ class NavigatorUtil {
1419 return _navigateTo(context, "${Routes.store_introduce_page}", 1419 return _navigateTo(context, "${Routes.store_introduce_page}",
1420 replace: replace); 1420 replace: replace);
1421 } 1421 }
  1422 +
  1423 + ///预订安排通知定制------主厨介绍
  1424 + static Future<dynamic> goChefIntroducePage(
  1425 + BuildContext context, {
  1426 + replace = false,
  1427 + }) {
  1428 + return _navigateTo(context, "${Routes.chef_introduce_page}",
  1429 + replace: replace);
  1430 + }
1422 } 1431 }
@@ -178,6 +178,7 @@ import '../pages/my/feast_manage/feast_type_page.dart'; @@ -178,6 +178,7 @@ import '../pages/my/feast_manage/feast_type_page.dart';
178 import '../pages/my/feast_manage/feast_wine_manage_edit_page.dart'; 178 import '../pages/my/feast_manage/feast_wine_manage_edit_page.dart';
179 import '../pages/my/feast_manage/feast_wine_manage_page.dart'; 179 import '../pages/my/feast_manage/feast_wine_manage_page.dart';
180 import '../pages/my/marketing_center/book_notification/book_info_page.dart'; 180 import '../pages/my/marketing_center/book_notification/book_info_page.dart';
  181 +import '../pages/my/marketing_center/book_notification/chef_introduce_page.dart';
181 import '../pages/my/marketing_center/book_notification/first_image_page.dart'; 182 import '../pages/my/marketing_center/book_notification/first_image_page.dart';
182 import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; 183 import '../pages/my/marketing_center/book_notification/store_introduce_page.dart';
183 import '../pages/my/marketing_center/marketing_center_home_page.dart'; 184 import '../pages/my/marketing_center/marketing_center_home_page.dart';
@@ -2329,3 +2330,13 @@ var storeIntroducePageHandle = new Handler( @@ -2329,3 +2330,13 @@ var storeIntroducePageHandle = new Handler(
2329 return ChangeNotifierProvider<MarketingCenterProvider>( 2330 return ChangeNotifierProvider<MarketingCenterProvider>(
2330 create: (_) => MarketingCenterProvider(), child: StoreIntroducePage()); 2331 create: (_) => MarketingCenterProvider(), child: StoreIntroducePage());
2331 }); 2332 });
  2333 +
  2334 +//我的----营销中心-主厨介绍
  2335 +var chefIntroducePageHandle = new Handler(
  2336 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  2337 + // String idstr = params["idstr"].first;
  2338 + // NotebookDetail detailEntity = NotebookDetail.fromJson(json
  2339 + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
  2340 + return ChangeNotifierProvider<MarketingCenterProvider>(
  2341 + create: (_) => MarketingCenterProvider(), child: ChefIntroducePage());
  2342 +});
@@ -195,6 +195,8 @@ class Routes { @@ -195,6 +195,8 @@ class Routes {
195 static String book_info_page = "/book_info_page"; //预订安排通知定制------预订信息展示 195 static String book_info_page = "/book_info_page"; //预订安排通知定制------预订信息展示
196 static String store_introduce_page = 196 static String store_introduce_page =
197 "/store_introduce_page"; //预订安排通知定制------店铺介绍 197 "/store_introduce_page"; //预订安排通知定制------店铺介绍
  198 + static String chef_introduce_page =
  199 + "/chef_introduce_page"; //预订安排通知定制------主厨介绍
198 200
199 static void configureRoutes(FluroRouter router) { 201 static void configureRoutes(FluroRouter router) {
200 router.notFoundHandler = new Handler( 202 router.notFoundHandler = new Handler(
@@ -384,5 +386,6 @@ class Routes { @@ -384,5 +386,6 @@ class Routes {
384 386
385 router.define(book_info_page, handler: bookInfoPageHandle); 387 router.define(book_info_page, handler: bookInfoPageHandle);
386 router.define(store_introduce_page, handler: storeIntroducePageHandle); 388 router.define(store_introduce_page, handler: storeIntroducePageHandle);
  389 + router.define(chef_introduce_page, handler: chefIntroducePageHandle);
387 } 390 }
388 } 391 }