From 3b5ada0858100502b8ab38fb92b4e07fbc87160c Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 27 Jan 2021 20:03:37 +0800 Subject: [PATCH] update deto create page --- .../deto_create_page/deto_create_page.dart | 170 ++++++++++-------- .../widget/common_picker.dart | 1 + .../deto_create_page/widget/common_radio.dart | 7 +- .../goods_deto_page/goods_deto_page.dart | 5 +- .../things_evaluate_page.dart | 2 +- .../things_page/widget/fixed_detail_page.dart | 6 +- .../widget/fixed_evaluate_page.dart | 17 +- lib/widget/buttons/bee_check_box.dart | 5 +- lib/widget/buttons/bee_check_button.dart | 40 +++++ lib/widget/picker/bee_custom_picker.dart | 48 +++++ 10 files changed, 208 insertions(+), 93 deletions(-) create mode 100644 lib/widget/buttons/bee_check_button.dart create mode 100644 lib/widget/picker/bee_custom_picker.dart diff --git a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart index da500cde..b9f2401d 100644 --- a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart +++ b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart @@ -1,28 +1,33 @@ // Flutter imports: +// Dart imports: import 'dart:io'; +// Flutter imports: +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +// Package imports: +import 'package:flustars/flustars.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; + +// Project imports: import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/provider/user_provider.dart'; +import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_divider.dart'; +import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/buttons/bee_check_box.dart'; +import 'package:akuCommunity/widget/buttons/bee_check_button.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart'; import 'package:akuCommunity/widget/buttons/radio_button.dart'; import 'package:akuCommunity/widget/picker/bee_custom_picker.dart'; import 'package:akuCommunity/widget/picker/bee_date_picker.dart'; -import 'package:flustars/flustars.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// Project imports: -import 'package:akuCommunity/utils/headers.dart'; -import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/picker/grid_image_picker.dart'; -import 'package:get/get.dart'; -import 'package:provider/provider.dart'; import 'widget/common_picker.dart'; import 'widget/common_radio.dart'; -import 'package:akuCommunity/const/resource.dart'; class DetoCreatePage extends StatefulWidget { DetoCreatePage({Key key}) : super(key: key); @@ -156,40 +161,58 @@ class _DetoCreatePageState extends State { Widget _getWeight() { return Container( - height: 96.w, - padding: EdgeInsets.symmetric(vertical: 28.w), - decoration: BoxDecoration( - border: - Border(bottom: BorderSide(color: Color(0xffeeeeee), width: 0.5)), - ), - child: Row( + // margin: EdgeInsets.fromLTRB(0, 40.w, 0, 40.w), + // child: Row( + // children: [ + // Container( + // margin: EdgeInsets.only(right: 30.w), + // child: Text( + // '物品重量', + // style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), + // ), + // ), + // ...List.generate( + // _listWeight.length, + // (index) => GestureDetector( + // onTap: () { + // setState(() { + // _selectWeight = index; + // }); + // }, + // child: CommonRadio( + // size: 30.w, + // text: _listWeight[index] + // .text + // .color(ktextPrimary) + // .size(28.sp) + // .make(), + // value: index, + // groupValue: _selectWeight, + // ), + // )), + // ], + // ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only(right: 30.w), - child: Text( - '物品重量', - style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), - ), + '物品重量'.text.color(ktextPrimary).size(28.sp).make(), + 24.w.heightBox, + Wrap( + spacing: 40.w, + children: [ + ..._listWeight + .map((e) => BeeCheckButton( + title: e, + value: _listWeight.indexOf(e), + groupValue: _selectWeight, + onChange: (value) { + _selectWeight = value; + setState(() {}); + }, + )) + .toList() + ], ), - ...List.generate( - _listWeight.length, - (index) => GestureDetector( - onTap: () { - setState(() { - _selectWeight = index; - }); - }, - child: CommonRadio( - size: 30.w, - text: _listWeight[index] - .text - .color(ktextPrimary) - .size(28.sp) - .make(), - value: index, - groupValue: _selectWeight, - ), - )), ], ), ); @@ -197,40 +220,27 @@ class _DetoCreatePageState extends State { Widget _getApproach() { return Container( - height: 96.w, - padding: EdgeInsets.symmetric(vertical: 28.w), - decoration: BoxDecoration( - border: - Border(bottom: BorderSide(color: Color(0xffeeeeee), width: 0.5)), - ), - child: Row( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - margin: EdgeInsets.only(right: 30.w), - child: Text( - '搬运方式', - style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), - ), + '搬运方式'.text.color(ktextPrimary).size(28.sp).make(), + 24.w.heightBox, + Wrap( + spacing: 40.w, + children: [ + ..._listMode + .map((e) => BeeCheckButton( + title: e, + value: _listMode.indexOf(e), + groupValue: _selectApproach, + onChange: (value) { + _selectApproach = value; + setState(() {}); + }, + )) + .toList() + ], ), - ...List.generate( - _listMode.length, - (index) => GestureDetector( - onTap: () { - setState(() { - _selectApproach = index; - }); - }, - child: CommonRadio( - size: 30.w, - text: _listMode[index] - .text - .color(ktextPrimary) - .size(28.sp) - .make(), - value: index, - groupValue: _selectApproach, - ), - )), ], ), ); @@ -241,18 +251,22 @@ class _DetoCreatePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ + 40.w.heightBox, + title.text.color(ktextPrimary).size(28.sp).make(), + 16.w.widthBox, Padding( - padding: EdgeInsets.symmetric(vertical: 28.w), + padding: EdgeInsets.symmetric(vertical: 30.w), child: InkWell( onTap: onTap, child: Row( children: [ - title.text.color(ktextPrimary).size(28.sp).make(), - 36.w.widthBox, (select.isEmptyOrNull ? '请选择' : select) .text .color(select.isEmptyOrNull ? ktextSubColor : ktextPrimary) - .size(28.sp) + .size(36.sp) + .fontWeight(select.isEmptyOrNull + ? FontWeight.normal + : FontWeight.bold) .make(), Spacer(), Icon( diff --git a/lib/pages/goods_deto_page/deto_create_page/widget/common_picker.dart b/lib/pages/goods_deto_page/deto_create_page/widget/common_picker.dart index 37272b63..0f331ebe 100644 --- a/lib/pages/goods_deto_page/deto_create_page/widget/common_picker.dart +++ b/lib/pages/goods_deto_page/deto_create_page/widget/common_picker.dart @@ -10,6 +10,7 @@ import 'package:flutter_picker/flutter_picker.dart'; // Project imports: import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/picker/bee_date_picker.dart'; + @Deprecated('s**t code should be remove') class CommonPicker extends StatefulWidget { final String title; diff --git a/lib/pages/goods_deto_page/deto_create_page/widget/common_radio.dart b/lib/pages/goods_deto_page/deto_create_page/widget/common_radio.dart index ca5d86fc..b9aceab2 100644 --- a/lib/pages/goods_deto_page/deto_create_page/widget/common_radio.dart +++ b/lib/pages/goods_deto_page/deto_create_page/widget/common_radio.dart @@ -1,7 +1,10 @@ -import 'package:akuCommunity/base/base_style.dart'; -import 'package:akuCommunity/widget/animated/animated_scale.dart'; +// Flutter imports: import 'package:flutter/material.dart'; + +// Project imports: +import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/utils/headers.dart'; +import 'package:akuCommunity/widget/animated/animated_scale.dart'; class CommonRadio extends StatefulWidget { final T value; diff --git a/lib/pages/goods_deto_page/goods_deto_page.dart b/lib/pages/goods_deto_page/goods_deto_page.dart index 38fca7bc..5b97888c 100644 --- a/lib/pages/goods_deto_page/goods_deto_page.dart +++ b/lib/pages/goods_deto_page/goods_deto_page.dart @@ -1,12 +1,13 @@ // Flutter imports: -import 'package:akuCommunity/base/base_style.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // Package imports: import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/velocity_x.dart'; // Project imports: +import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/goods_out_model.dart'; import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/deto_create_page.dart'; @@ -14,7 +15,7 @@ import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'widget/goods_info_card.dart'; -import 'package:velocity_x/velocity_x.dart'; + class GoodsDetoPage extends StatefulWidget { GoodsDetoPage({Key key}) : super(key: key); diff --git a/lib/pages/things_page/things_evaluate_page/things_evaluate_page.dart b/lib/pages/things_page/things_evaluate_page/things_evaluate_page.dart index c06b91f0..bcd804d3 100644 --- a/lib/pages/things_page/things_evaluate_page/things_evaluate_page.dart +++ b/lib/pages/things_page/things_evaluate_page/things_evaluate_page.dart @@ -1,5 +1,4 @@ // Flutter imports: -import 'package:akuCommunity/base/base_style.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -8,6 +7,7 @@ import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart'; // Project imports: +import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; diff --git a/lib/pages/things_page/widget/fixed_detail_page.dart b/lib/pages/things_page/widget/fixed_detail_page.dart index a8bab8e6..afb9f517 100644 --- a/lib/pages/things_page/widget/fixed_detail_page.dart +++ b/lib/pages/things_page/widget/fixed_detail_page.dart @@ -1,11 +1,9 @@ // Flutter imports: -import 'package:akuCommunity/pages/things_page/widget/fixed_evaluate_page.dart'; -import 'package:akuCommunity/utils/network/base_model.dart'; -import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // Package imports: +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -16,8 +14,10 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/model/manager/fixed_detail_model.dart'; import 'package:akuCommunity/pages/manager_func.dart'; +import 'package:akuCommunity/pages/things_page/widget/fixed_evaluate_page.dart'; import 'package:akuCommunity/utils/bee_map.dart'; import 'package:akuCommunity/utils/headers.dart'; +import 'package:akuCommunity/utils/network/base_model.dart'; import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/views/horizontal_image_view.dart'; diff --git a/lib/pages/things_page/widget/fixed_evaluate_page.dart b/lib/pages/things_page/widget/fixed_evaluate_page.dart index a4488e55..4d4b131f 100644 --- a/lib/pages/things_page/widget/fixed_evaluate_page.dart +++ b/lib/pages/things_page/widget/fixed_evaluate_page.dart @@ -1,15 +1,20 @@ -import 'package:akuCommunity/base/base_style.dart'; -import 'package:akuCommunity/model/manager/fixed_detail_model.dart'; -import 'package:akuCommunity/pages/manager_func.dart'; -import 'package:akuCommunity/utils/network/base_model.dart'; -import 'package:akuCommunity/widget/bee_scaffold.dart'; -import 'package:bot_toast/bot_toast.dart'; +// Flutter imports: import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; + +// Package imports: +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; + +// Project imports: +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/model/manager/fixed_detail_model.dart'; +import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/utils/headers.dart'; +import 'package:akuCommunity/utils/network/base_model.dart'; +import 'package:akuCommunity/widget/bee_scaffold.dart'; class FixedEvaluatePage extends StatefulWidget { final FixedDetailModel model; diff --git a/lib/widget/buttons/bee_check_box.dart b/lib/widget/buttons/bee_check_box.dart index 669dc31d..34cb0a1b 100644 --- a/lib/widget/buttons/bee_check_box.dart +++ b/lib/widget/buttons/bee_check_box.dart @@ -1,6 +1,9 @@ -import 'package:akuCommunity/base/base_style.dart'; +// Flutter imports: import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; + +// Project imports: +import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/utils/headers.dart'; class BeeCheckBox extends StatefulWidget { diff --git a/lib/widget/buttons/bee_check_button.dart b/lib/widget/buttons/bee_check_button.dart new file mode 100644 index 00000000..38cfac04 --- /dev/null +++ b/lib/widget/buttons/bee_check_button.dart @@ -0,0 +1,40 @@ +// Flutter imports: +import 'package:flutter/material.dart'; + +// Project imports: +import 'package:akuCommunity/base/base_style.dart'; +import 'package:akuCommunity/utils/headers.dart'; + +class BeeCheckButton extends StatefulWidget { + final Function(T value) onChange; + final T value; + final T groupValue; + final String title; + BeeCheckButton( + {Key key, this.onChange, this.value, this.groupValue, this.title}) + : super(key: key); + + @override + _BeeCheckButtonState createState() => _BeeCheckButtonState(); +} + +class _BeeCheckButtonState extends State { + bool get isSelect => widget.groupValue == widget.value; + @override + Widget build(BuildContext context) { + return FlatButton( + onPressed: () { + widget.onChange(widget.value); + }, + child: widget.title.text + .color(isSelect ? ktextPrimary : Color(0xFF979797)) + .size(32.sp) + .make(), + padding: EdgeInsets.symmetric(horizontal: 34.w, vertical: 14.w), + shape: RoundedRectangleBorder( + side: BorderSide( + color: isSelect ? kPrimaryColor : ktextSubColor, width: 3.w), + borderRadius: BorderRadius.circular(36.w)), + ); + } +} diff --git a/lib/widget/picker/bee_custom_picker.dart b/lib/widget/picker/bee_custom_picker.dart new file mode 100644 index 00000000..1410c875 --- /dev/null +++ b/lib/widget/picker/bee_custom_picker.dart @@ -0,0 +1,48 @@ +// Flutter imports: +import 'package:flutter/material.dart'; + +// Package imports: +import 'package:get/get.dart'; + +// Project imports: +import 'package:akuCommunity/utils/headers.dart'; + +class BeeCustomPicker extends StatefulWidget { + + final Widget body; + final VoidCallback onPressed; + BeeCustomPicker({Key key, this.body, this.onPressed}) : super(key: key); + + @override + _BeeCustomPickerState createState() => _BeeCustomPickerState(); +} + +class _BeeCustomPickerState extends State { + @override + Widget build(BuildContext context) { + return SizedBox( + child: Material( + borderRadius: BorderRadius.vertical(top: Radius.circular(10)), + child: Column( + children: [ + SizedBox( + height: 48, + child: NavigationToolbar( + leading: TextButton( + onPressed: Get.back, + child: '取消'.text.black.make(), + ), + trailing: TextButton( + onPressed: widget.onPressed, + child: '确定'.text.black.make(), + ), + ), + ), + widget.body, + ], + ), + ), + height: Get.height / 3, + ); + } +}