From b3c88506249e1a7dd5b02859f9fa8098e48f5105 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Wed, 4 Nov 2020 11:40:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8A=A5=E4=BA=8B=E6=8A=A5=E4=BF=AE?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/mock_models/fix/fixer_model.dart | 55 ++++- lib/provider/fix_provider.dart | 4 + .../business_and_fix_detail_page.dart | 24 +- .../business_and_fix/business_fix_card.dart | 11 +- .../fixer_department_page.dart | 205 ++++++++++++++++++ pubspec.lock | 7 + pubspec.yaml | 2 + 7 files changed, 303 insertions(+), 5 deletions(-) create mode 100644 lib/ui/sub_pages/fixer_department/fixer_department_page.dart diff --git a/lib/mock_models/fix/fixer_model.dart b/lib/mock_models/fix/fixer_model.dart index 92c2c19..dbf0528 100644 --- a/lib/mock_models/fix/fixer_model.dart +++ b/lib/mock_models/fix/fixer_model.dart @@ -10,7 +10,60 @@ enum FIXER_TYPE { } class FixerModel { - FIXER_TYPE type; String name; String phone; + FixerModel({this.name, this.phone}); +} + +class FixerTypedModel { + FIXER_TYPE type; + String get typeName { + switch (type) { + case FIXER_TYPE.AIR_CONDITION: + return '空调组'; + break; + case FIXER_TYPE.ELECTRIC: + return '电力组'; + break; + case FIXER_TYPE.CEMENT: + return '水泥组'; + break; + default: + return ''; + } + } + + List fixers; + FixerTypedModel({ + this.type, + this.fixers, + }); + + static List models = [ + FixerTypedModel( + type: FIXER_TYPE.AIR_CONDITION, + fixers: [ + FixerModel(name: '刘能建师傅', phone: '18923747283'), + FixerModel(name: '李惠政师傅', phone: '18910298345'), + FixerModel(name: '李慧珍师傅', phone: '17872342382'), + FixerModel(name: '林 芝师傅', phone: '18292847752'), + ], + ), + FixerTypedModel( + type: FIXER_TYPE.CEMENT, + fixers: [ + FixerModel(name: '李雷师傅', phone: '18923747283'), + FixerModel(name: '林智师傅', phone: '18910298345'), + FixerModel(name: '刘凯欣师傅', phone: '17872342382'), + FixerModel(name: '张亮师傅', phone: '18292847752'), + ], + ), + FixerTypedModel( + type: FIXER_TYPE.ELECTRIC, + fixers: [ + FixerModel(name: '李建国师傅', phone: '18923747283'), + FixerModel(name: '李历程师傅', phone: '18910298345'), + ], + ), + ]; } diff --git a/lib/provider/fix_provider.dart b/lib/provider/fix_provider.dart index 0f3b19c..7a91953 100644 --- a/lib/provider/fix_provider.dart +++ b/lib/provider/fix_provider.dart @@ -1,4 +1,5 @@ import 'package:aku_community_manager/mock_models/fix/fix_model.dart'; +import 'package:aku_community_manager/mock_models/fix/fixer_model.dart'; import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:flutter/material.dart'; @@ -55,4 +56,7 @@ class FixProvider extends ChangeNotifier { break; } } + + List _fixerModels = FixerTypedModel.models; + List get fixerModels => _fixerModels; } diff --git a/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart index 8e43353..31f59ef 100644 --- a/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart +++ b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart @@ -4,12 +4,14 @@ import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/sub_pages/fixer_department/fixer_department_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_community_manager/ui/widgets/inner/show_bottom_sheet.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:get/get.dart'; import 'package:provider/provider.dart'; class BusinessAndFixDetailPage extends StatefulWidget { @@ -122,7 +124,9 @@ class _BusinessAndFixDetailPageState extends State { onPressed: detailModel.type != null && detailModel.subType != null && detailModel.limit != null - ? () {} + ? () { + Get.to(FixerDepartmentPage(model: widget.model)); + } : null, child: Text( '立即派单', @@ -136,7 +140,12 @@ class _BusinessAndFixDetailPageState extends State { return AkuMaterialButton( color: AppStyle.primaryColor, nullColor: AppStyle.minorColor, - onPressed: () {}, + onPressed: () { + Get.to(FixerDepartmentPage( + model: widget.model, + changeType: true, + )); + }, child: Text( '改派', style: TextStyle( @@ -148,7 +157,16 @@ class _BusinessAndFixDetailPageState extends State { return AkuMaterialButton( color: AppStyle.primaryColor, nullColor: AppStyle.minorColor, - onPressed: () {}, + onPressed: () { + final userProvider = + Provider.of(context, listen: false); + detailModel.fixStatuses.add(FixStatus( + title: '${userProvider.userInfoModel.nickName}已接单', + date: DateTime.now(), + )); + widget.model.type = FIX_ENUM.PROCESSING; + Get.back(); + }, child: Text( '立即接单', style: TextStyle( diff --git a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart index 05ff7f9..7b9e51b 100644 --- a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart +++ b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart @@ -200,7 +200,16 @@ class _BusinessFixCardState extends State { : SizedBox(), widget.model.type == FIX_ENUM.WAIT_PICKUP ? AkuMaterialButton( - onPressed: () {}, + onPressed: () { + final userProvider = + Provider.of(context, listen: false); + widget.model.detail.fixStatuses.add(FixStatus( + title: '${userProvider.userInfoModel.nickName}已接单', + date: DateTime.now(), + )); + widget.model.type = FIX_ENUM.PROCESSING; + Get.back(); + }, radius: 4.w, color: AppStyle.primaryColor, minWidth: 160.w, diff --git a/lib/ui/sub_pages/fixer_department/fixer_department_page.dart b/lib/ui/sub_pages/fixer_department/fixer_department_page.dart new file mode 100644 index 0000000..b304491 --- /dev/null +++ b/lib/ui/sub_pages/fixer_department/fixer_department_page.dart @@ -0,0 +1,205 @@ +import 'package:aku_community_manager/const/resource.dart'; +import 'package:aku_community_manager/mock_models/fix/fix_model.dart'; +import 'package:aku_community_manager/mock_models/fix/fixer_model.dart'; +import 'package:aku_community_manager/provider/fix_provider.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:expandable/expandable.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; + +class FixerDepartmentPage extends StatefulWidget { + final FixModel model; + final bool changeType; + FixerDepartmentPage({Key key, @required this.model, this.changeType = false}) + : super(key: key); + + @override + _FixerDepartmentPageState createState() => _FixerDepartmentPageState(); +} + +class _FixerDepartmentPageState extends State { + List _pickedFixers = []; + @override + Widget build(BuildContext context) { + final fixProvider = Provider.of(context); + + return AkuScaffold( + title: '房屋管理维修部', + body: ListView.builder( + padding: EdgeInsets.symmetric(vertical: 16.w), + itemBuilder: (context, index) { + return _buildItem(fixProvider.fixerModels[index], index); + }, + itemCount: fixProvider.fixerModels.length, + ), + bottom: AkuMaterialButton( + height: 96.w, + onPressed: _pickedFixers.isEmpty + ? null + : () { + if (widget.changeType) { + Get.back(); + _pickedFixers.forEach((element) { + widget.model.detail.fixStatuses.add( + FixStatus( + title: '改派给${element.name}', date: DateTime.now()), + ); + }); + } else { + Get.back(); + Get.back(); + widget.model.type = FIX_ENUM.WAIT_PICKUP; + _pickedFixers.forEach((element) { + widget.model.detail.fixStatuses.add( + FixStatus( + title: '分配给${element.name}', date: DateTime.now()), + ); + }); + } + }, + color: AppStyle.primaryColor, + nullColor: AppStyle.primaryColor.withOpacity(0.5), + child: Text( + '立即派单', + style: TextStyle( + color: _pickedFixers.isEmpty + ? AppStyle.minorTextColor + : AppStyle.primaryTextColor, + fontSize: 32.w, + fontWeight: FontWeight.bold, + ), + ), + ), + ); + } + + _buildItem(FixerTypedModel model, int index) { + return Container( + decoration: BoxDecoration( + border: Border( + top: index == 0 + ? BorderSide.none + : BorderSide(color: Color(0xFFE8E8E8), width: 1.w), + bottom: BorderSide(color: Color(0xFFE8E8E8), width: 1.w), + ), + ), + child: Material( + color: Colors.white, + child: ExpandablePanel( + controller: ExpandableController(initialExpanded: true), + header: Container( + height: 96.w, + alignment: Alignment.centerLeft, + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Text( + model.typeName, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold, + ), + ), + ), + collapsed: SizedBox(), + expanded: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Divider( + color: Color(0xFFE8E8E8), + height: 1.w, + thickness: 1.w, + ), + ...model.fixers.map((e) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + AkuMaterialButton( + height: 96.w, + onPressed: () { + if (_pickedFixers.indexOf(e) == -1) { + _pickedFixers.add(e); + } else { + _pickedFixers.remove(e); + } + setState(() {}); + }, + child: Row( + children: [ + AkuBox.w(72), + Checkbox( + checkColor: AppStyle.primaryTextColor, + activeColor: AppStyle.primaryColor, + value: _pickedFixers.indexOf(e) != -1, + onChanged: (state) { + if (_pickedFixers.indexOf(e) == -1) { + _pickedFixers.add(e); + } else { + _pickedFixers.remove(e); + } + setState(() {}); + }, + materialTapTargetSize: + MaterialTapTargetSize.shrinkWrap, + ), + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + height: 40.w, + width: 40.w, + ), + Text( + e.name, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + Spacer(), + Image.asset( + R.ASSETS_MESSAGE_IC_PHONE_PNG, + height: 40.w, + width: 40.w, + ), + Text( + e.phone, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + AkuBox.w(101), + ], + ), + ), + model.fixers.last == e + ? SizedBox() + : Divider( + indent: 32.w, + endIndent: 32.w, + height: 1.w, + thickness: 1.w, + color: Color(0xFFE8E8E8), + ), + ], + ); + }).toList() + ], + ), + theme: ExpandableThemeData( + tapHeaderToExpand: true, + iconPlacement: ExpandablePanelIconPlacement.right, + iconPadding: EdgeInsets.only(top: 32.w, right: 32.w), + iconSize: 32.w, + iconColor: AppStyle.minorTextColor, + ), + ), + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 55bb1a6..f59367b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -101,6 +101,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.3.5" + expandable: + dependency: "direct main" + description: + name: expandable + url: "https://pub.flutter-io.cn" + source: hosted + version: "4.1.4" extended_text: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index cd22008..fd4c1eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -52,6 +52,8 @@ dependencies: flutter_rating_bar: ^3.0.1+1 + expandable: ^4.1.4 + aku_ui: git: url: http://test.akuhotel.com:8099/aku_fe/aku_ui.git From 68eb7c52a46d87fe6983c93af007785c224b0e8b Mon Sep 17 00:00:00 2001 From: laiiihz Date: Wed, 4 Nov 2020 20:54:35 +0800 Subject: [PATCH 2/3] add check page --- assets/manage/check.png | Bin 0 -> 1625 bytes lib/ui/settings/user_info_page.dart | 2 +- .../business_and_fix_detail_page.dart | 68 ++--- .../business_and_fix/business_fix_card.dart | 10 +- .../business_and_fix/fix_more_time_page.dart | 168 +++++++++++ .../fix_work_finish_page.dart | 277 ++++++++++++++++++ .../fixer_department_page.dart | 0 lib/ui/widgets/inner/aku_title_box.dart | 49 ++++ 8 files changed, 527 insertions(+), 47 deletions(-) create mode 100644 assets/manage/check.png create mode 100644 lib/ui/sub_pages/business_and_fix/fix_more_time_page.dart create mode 100644 lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart rename lib/ui/sub_pages/{fixer_department => business_and_fix}/fixer_department_page.dart (100%) create mode 100644 lib/ui/widgets/inner/aku_title_box.dart diff --git a/assets/manage/check.png b/assets/manage/check.png new file mode 100644 index 0000000000000000000000000000000000000000..7ef54937f2a27c10f00aa1e2ad2591937348faee GIT binary patch literal 1625 zcmV-f2B!ImP)f`g9rAumCMC{ZIpVj}!S3?vefY&<3)VDJ$lF(P9K zgMd6tG%?0#q5(3Ayp-^m3|GJ*6A}p^tgu^`jI8a}_Ly_KlCE33-rHN&ZvAiBz32Wu z_jm4j{O%=0{J3LyNq~HdD8OF=;W5tnpvYs=^=~4yQz&@eV9pG5IJXe^63)TW6%{LP z0%Qd&u)M=r!#RJUKSDz$B3xI%en);aI4|qZSYac=B@)jpNBhP8+Kt1LNWf|GUwE_% zfxwFXp54w2AErQkegg+L4+JoXzNUa9zqLP2J+TtUK@b9WmpCb zm<4_ztJyc`SIP1!b@Qr+GqQ1~OBr{8vhWMP^r5n{etC%j05m{aPQUWZn>voy&t0OmR_NI(;V{^F^83y%(76BcUV;n)nx10MM?Dq$; zC+eePpD77qGc(jK{cLr8uLsJ)cG6OP2d zP8{pTmZgbdl^_YbC7bK*@PJiKOEbzw!tL!|&=f16O=Wj6%@P|euOK^=QM*CZz@Fn-^L!hZxHRoG>f~({|oGg`%E}o8w=|})v_jC zumn27?DC6|!Kljc)ti}k^OM2{&v0a8V%qqu%!#R`UD2EaAM725!?n?C`cD^ouywf; z#>{}K@gUm44D5NbH=jrdEKU{~UcR*;CR$7*V(t__f&FOTFw~rljUU|WTLSW%s1 zcGt5#-3(P34mEJT(TEkF7r@&&T1Pf4=1hT}Y<6SAm&0)AbabqBR1hmhe7$~5l4g-Ndb#Sf4`iKmDM8C@uSB*;lcI_Cvvm(!zw_A zJ(AV+R;;_8P=-Sd*ER&v?H#?NONu3S_ zYO*ViO*^nM-x}ySQB+rpO*=4w+KBO)WObd@f=w$h0X~wXInj1O@!o*6=+X+7u{X%t z{B69jq-`D&4WPI4m2NDtxrt^rbe)vWurfd~%ueK)jl7{L3s$BciC)$^8mCp4Ru&aR z^R&#fy*?spU$yksU?Tq)6${Q$$!wN&YFAM4UN>dBbnw$&wm{8BAYNqnaVY^-_Op_4 ze!N>eEzp!0r8`IAHL%G0KAp5jSi@Gr}l*cNi>W%CZ zu<~)XBz>&cib?BDN&28A-r^BxV^1%(v<98Xc}W2ip@jqAF$3+5d_S8=uzH-U8(4fT z1EQaa_*cluI}rYvfgXYC)kZ>K@r4`bIK~)12BYz((5FFq1(%F=;s%TFjRD*M=sa;8 zhXKd*Uf3rC*lo8IaO8Qx(F#H~roQ$Ipj5mTZ8ZkKgDivM#JdB`{d5!-8 XNw13Anqz?P00000NkvXXu0mjfNQni0 literal 0 HcmV?d00001 diff --git a/lib/ui/settings/user_info_page.dart b/lib/ui/settings/user_info_page.dart index d25da56..abe6b22 100644 --- a/lib/ui/settings/user_info_page.dart +++ b/lib/ui/settings/user_info_page.dart @@ -26,7 +26,7 @@ class _UserInfoPageState extends State { AkuTile( onTap: () { akuPickImage().then((file) { - userProvider.setAvatar(file); + if (file != null) userProvider.setAvatar(file); }); }, title: Text('头像'), diff --git a/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart index 31f59ef..d04b6c9 100644 --- a/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart +++ b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart @@ -4,8 +4,11 @@ import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; -import 'package:aku_community_manager/ui/sub_pages/fixer_department/fixer_department_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fixer_department_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart'; import 'package:aku_community_manager/ui/widgets/inner/show_bottom_sheet.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:common_utils/common_utils.dart'; @@ -203,7 +206,9 @@ class _BusinessAndFixDetailPageState extends State { color: AppStyle.primaryColor, ), ), - onPressed: () {}, + onPressed: () { + Get.to(FixMoreTimePage(model: widget.model)); + }, child: Text( '申请延时', style: TextStyle( @@ -217,7 +222,9 @@ class _BusinessAndFixDetailPageState extends State { minWidth: 304.w, radius: 4.w, color: AppStyle.primaryColor, - onPressed: () {}, + onPressed: () { + Get.to(FixWorkFinishPage(model: widget.model)); + }, child: Text( '处理完成', style: TextStyle( @@ -237,7 +244,7 @@ class _BusinessAndFixDetailPageState extends State { } _buildInfo() { - return _buildRawBox( + return AkuTitleBox( title: '报修信息', suffix: fixTypeWidget, children: [ @@ -287,7 +294,7 @@ class _BusinessAndFixDetailPageState extends State { } _buildType(bool canTap) { - return _buildRawBox( + return AkuTitleBox( title: '工单类型', children: [ _buildTypeTile( @@ -349,7 +356,7 @@ class _BusinessAndFixDetailPageState extends State { } _buildProcess() { - return _buildRawBox( + return AkuTitleBox( title: '报修进程', children: detailModel.fixStatuses.map((e) { return _buildProcessTile( @@ -361,7 +368,7 @@ class _BusinessAndFixDetailPageState extends State { } _buildResult() { - return _buildRawBox( + return AkuTitleBox( title: '处理情况', spacing: 24, children: [ @@ -416,7 +423,15 @@ class _BusinessAndFixDetailPageState extends State { children: detailModel.result.imgs.map((e) { return ClipRRect( borderRadius: BorderRadius.circular(4.w), - child: (e is String) ? Image.asset(e) : Image.file(e), + child: (e is String) + ? Image.asset( + e, + fit: BoxFit.cover, + ) + : Image.file( + e, + fit: BoxFit.cover, + ), ); }).toList(), ), @@ -425,7 +440,7 @@ class _BusinessAndFixDetailPageState extends State { } _buildRating() { - return _buildRawBox( + return AkuTitleBox( title: '评价信息', spacing: 24, children: [ @@ -570,39 +585,4 @@ class _BusinessAndFixDetailPageState extends State { children: children..removeLast(), ); } - - _buildRawBox({ - String title, - List children, - Widget suffix, - double spacing = 0, - }) { - return Container( - padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), - color: Colors.white, - margin: EdgeInsets.only(bottom: 16.w), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( - title, - style: TextStyle( - color: AppStyle.primaryTextColor, - fontWeight: FontWeight.bold, - fontSize: 36.sp, - ), - ), - Spacer(), - suffix ?? SizedBox(), - ], - ), - AkuBox.h(spacing), - ...children, - ], - ), - ); - } } diff --git a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart index 7b9e51b..3b5f754 100644 --- a/lib/ui/sub_pages/business_and_fix/business_fix_card.dart +++ b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart @@ -4,6 +4,8 @@ import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_more_time_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/business_and_fix/fix_work_finish_page.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:common_utils/common_utils.dart'; import 'package:flutter/material.dart'; @@ -176,7 +178,9 @@ class _BusinessFixCardState extends State { fontSize: 28.sp, ), ), - onPressed: () {}, + onPressed: () { + Get.to(FixMoreTimePage(model: widget.model)); + }, ) : SizedBox(), widget.model.type == FIX_ENUM.PROCESSING @@ -184,7 +188,9 @@ class _BusinessFixCardState extends State { : SizedBox(), widget.model.type == FIX_ENUM.PROCESSING ? AkuMaterialButton( - onPressed: () {}, + onPressed: () { + Get.to(FixWorkFinishPage(model: widget.model)); + }, radius: 4.w, color: AppStyle.primaryColor, minWidth: 160.w, diff --git a/lib/ui/sub_pages/business_and_fix/fix_more_time_page.dart b/lib/ui/sub_pages/business_and_fix/fix_more_time_page.dart new file mode 100644 index 0000000..2d6796e --- /dev/null +++ b/lib/ui/sub_pages/business_and_fix/fix_more_time_page.dart @@ -0,0 +1,168 @@ +import 'package:aku_community_manager/const/resource.dart'; +import 'package:aku_community_manager/mock_models/fix/fix_model.dart'; +import 'package:aku_community_manager/provider/user_provider.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; + +class FixMoreTimePage extends StatefulWidget { + final FixModel model; + FixMoreTimePage({Key key, @required this.model}) : super(key: key); + + @override + _FixMoreTimePageState createState() => _FixMoreTimePageState(); +} + +class _FixMoreTimePageState extends State { + String _nowSelect = '24h'; + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '申请延时', + backgroundColor: Colors.white, + body: ListView( + children: [ + Container( + height: 16.w, + color: Color(0xFFF9F9F9), + ), + Container( + padding: EdgeInsets.symmetric( + vertical: 24.w, + horizontal: 32.w, + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + '延长时间', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 32.sp, + ), + ), + AkuBox.h(24), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: ['24h', '48h', '72h', '未知'].map((e) { + return GestureDetector( + onTap: () { + setState(() { + _nowSelect = e; + }); + }, + child: Stack( + children: [ + Container( + width: 160.w, + height: 80.w, + alignment: Alignment.center, + child: Text( + e, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + ), + ), + decoration: BoxDecoration( + color: Color(0xFFF9F9F9), + borderRadius: BorderRadius.circular(4.w), + border: _nowSelect == e + ? Border.all( + width: 3.w, + color: AppStyle.primaryTextColor, + ) + : null, + ), + ), + Positioned( + left: 3.w, + top: 3.w, + child: _nowSelect == e + ? Image.asset( + R.ASSETS_MANAGE_CHECK_PNG, + height: 30.w, + width: 30.w, + ) + : SizedBox(), + ), + ], + ), + ); + }).toList(), + ), + AkuBox.h(40), + Text( + '备注', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 32.sp, + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + margin: EdgeInsets.only( + top: 24.w, + bottom: 340.w, + ), + padding: EdgeInsets.symmetric( + vertical: 16.w, + horizontal: 24.w, + ), + child: TextField( + minLines: 7, + maxLines: 7, + decoration: InputDecoration( + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + hintText: '请输入延长时间说明…', + ), + ), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: AkuMaterialButton( + onPressed: () { + final userProvider = + Provider.of(context, listen: false); + widget.model.detail.fixStatuses.add( + FixStatus( + title: '${userProvider.userInfoModel.nickName}申请延时', + date: DateTime.now()), + ); + Get.back(); + }, + radius: 8.w, + child: Text( + '确定', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 32.sp, + ), + ), + color: AppStyle.primaryColor, + ), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart b/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart new file mode 100644 index 0000000..d4452a2 --- /dev/null +++ b/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart @@ -0,0 +1,277 @@ +import 'dart:io'; + +import 'package:aku_community_manager/mock_models/fix/fix_model.dart'; +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart'; +import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class FixWorkFinishPage extends StatefulWidget { + final FixModel model; + FixWorkFinishPage({Key key, @required this.model}) : super(key: key); + + @override + _FixWorkFinishPageState createState() => _FixWorkFinishPageState(); +} + +class _FixWorkFinishPageState extends State { + List _imgs = []; + TextEditingController _descriptionController = TextEditingController(); + TextEditingController _materialController = TextEditingController(); + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '处理完成', + body: ListView( + padding: EdgeInsets.symmetric( + vertical: 16.w, + ), + children: [ + AkuTitleBox( + title: '报修信息', + spacing: 24, + children: [ + Text( + widget.model.title, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + AkuBox.h(16), + GridView.builder( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + crossAxisSpacing: 16.w, + mainAxisSpacing: 16.w, + ), + itemBuilder: (context, index) { + final img = widget.model.imgs[index]; + return ClipRRect( + borderRadius: BorderRadius.circular(4.w), + child: (img is String) ? Image.asset(img) : Image.file(img), + ); + }, + itemCount: widget.model.imgs.length, + ), + ], + ), + AkuTitleBox( + title: '处理情况', + spacing: 24.w, + children: [ + Text( + '处理描述', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + AkuBox.h(24), + TextField( + controller: _descriptionController, + minLines: 4, + maxLines: 99, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 16.w, + horizontal: 24.w, + ), + hintText: '请输入处理描述…', + hintStyle: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFE8E8E8), + width: 2.w, + ), + ), + border: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFE8E8E8), + width: 2.w, + ), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFE8E8E8), + width: 2.w, + ), + ), + ), + ), + AkuBox.h(32), + Text( + '更换材料(含辅料)', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + AkuBox.h(24), + TextField( + controller: _materialController, + minLines: 3, + maxLines: 99, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 16.w, + horizontal: 24.w, + ), + hintText: '请输入材料描述…', + hintStyle: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFE8E8E8), + width: 2.w, + ), + ), + border: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFE8E8E8), + width: 2.w, + ), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xFFE8E8E8), + width: 2.w, + ), + ), + ), + ), + AkuBox.h(32), + Text( + '上传维修完成照片', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + AkuBox.h(24), + GridView.builder( + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + crossAxisSpacing: 16.w, + mainAxisSpacing: 16.w, + ), + itemBuilder: (context, index) { + if (index == 0) + return AkuMaterialButton( + radius: 8.w, + onPressed: () { + akuPickImage().then((file) { + setState(() { + if (file != null) _imgs.insert(0, file); + }); + }); + }, + child: Container( + alignment: Alignment.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.image, + size: 60.w, + color: AppStyle.minorTextColor, + ), + Text( + '上传图片', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.sp, + ), + ), + ], + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all( + color: AppStyle.minorTextColor, + width: 2.w, + ), + ), + ), + ); + else + return Stack( + children: [ + Positioned( + top: 0, + left: 0, + right: 0, + bottom: 0, + child: ClipRRect( + borderRadius: BorderRadius.circular(4.w), + child: Image.file( + _imgs[index - 1], + fit: BoxFit.cover, + ), + ), + ), + Positioned( + right: 0, + top: 0, + child: GestureDetector( + onTap: () { + _imgs.removeAt(index - 1); + setState(() {}); + }, + child: Icon(CupertinoIcons.clear_circled_solid), + ), + ), + ], + ); + }, + itemCount: _imgs.length + 1, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + ) + ], + ), + AkuTitleBox( + title: '费用明细', + children: [ + + ], + ), + ], + ), + bottom: AkuMaterialButton( + child: Text( + '立即提交', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold, + ), + ), + height: 96.w, + color: AppStyle.primaryColor, + onPressed: () { + widget.model.detail.result = FixResult( + detail: _descriptionController.text, + material: _materialController.text, + imgs: _imgs, + ); + widget.model.type = FIX_ENUM.DONE; + Get.back(); + }, + ), + ); + } +} diff --git a/lib/ui/sub_pages/fixer_department/fixer_department_page.dart b/lib/ui/sub_pages/business_and_fix/fixer_department_page.dart similarity index 100% rename from lib/ui/sub_pages/fixer_department/fixer_department_page.dart rename to lib/ui/sub_pages/business_and_fix/fixer_department_page.dart diff --git a/lib/ui/widgets/inner/aku_title_box.dart b/lib/ui/widgets/inner/aku_title_box.dart new file mode 100644 index 0000000..0ac717a --- /dev/null +++ b/lib/ui/widgets/inner/aku_title_box.dart @@ -0,0 +1,49 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; + +class AkuTitleBox extends StatelessWidget { + final String title; + final Widget suffix; + final double spacing; + final List children; + const AkuTitleBox({ + Key key, + @required this.title, + this.suffix, + this.spacing = 0, + this.children, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + color: Colors.white, + margin: EdgeInsets.only(bottom: 16.w), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + title, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 36.sp, + ), + ), + Spacer(), + suffix ?? SizedBox(), + ], + ), + AkuBox.h(spacing), + ...children, + ], + ), + ); + } +} From ddcd31654bb26a5861eccac5844cb91382ee45c9 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Wed, 4 Nov 2020 21:11:57 +0800 Subject: [PATCH 3/3] add decoration page --- lib/mock_models/users/user_info_model.dart | 13 ++++++++++ lib/provider/user_provider.dart | 1 - .../home/application/applications_page.dart | 11 +++++--- lib/ui/home/home_page.dart | 26 ++++++++++++------- lib/ui/settings/user_info_page.dart | 1 + .../decoration_manager_page.dart | 18 +++++++++++++ 6 files changed, 56 insertions(+), 14 deletions(-) create mode 100644 lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart diff --git a/lib/mock_models/users/user_info_model.dart b/lib/mock_models/users/user_info_model.dart index 2226d3e..ab7fb96 100644 --- a/lib/mock_models/users/user_info_model.dart +++ b/lib/mock_models/users/user_info_model.dart @@ -18,16 +18,26 @@ class UserInfoModel { String nickName; File avatar; USER_ROLE role; + String phone; + String get securePhone { + if (phone.length < 8) + return phone; + else + return '${phone.substring(0, 3)}****${phone.substring(7)}'; + } + UserInfoModel({ this.nickName, this.avatar, this.role, + this.phone, }); UserInfoModel.empty({ this.nickName = '', this.avatar, this.role = USER_ROLE.EMPTY, + this.phone = '', }); ///管家角色生成 @@ -36,6 +46,7 @@ class UserInfoModel { this.nickName = '李管家', this.avatar, this.role = USER_ROLE.MANAGER, + this.phone = '18819289976', }); ///师傅角色生成 @@ -44,6 +55,7 @@ class UserInfoModel { this.nickName = '王师傅', this.avatar, this.role = USER_ROLE.FIXER, + this.phone = '18927139123', }); ///师傅角色生成 @@ -52,5 +64,6 @@ class UserInfoModel { this.nickName = '林保安', this.avatar, this.role = USER_ROLE.SECURITY, + this.phone = '13918237877', }); } diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 8ab535d..09d0cb4 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; import 'package:flutter/material.dart'; diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index d651a54..4a3593d 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -1,5 +1,6 @@ import 'package:aku_community_manager/ui/manage_pages/green_manage_page.dart'; import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_manager_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:flutter/material.dart'; @@ -49,9 +50,11 @@ class _ApplicationPageState extends State AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, Scaffold()), AppApplication('问卷调查', '', Scaffold()), ]; -List _wisdomApplications=[ - AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, GreenManagePage()), -]; + List _wisdomApplications = [ + AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, GreenManagePage()), + AppApplication( + '装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, DecorationManagerPage()), + ]; @override Widget build(BuildContext context) { final appProvider = Provider.of(context); @@ -202,7 +205,7 @@ List _wisdomApplications=[ }, itemCount: _recommandApplications.length, ), - GridView.builder( + GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, ), diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index b14f99b..a2b4bfc 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -275,17 +275,25 @@ class _HomePageState extends State { ]), ), SizedBox(height: 24.w), - Container( - margin: EdgeInsets.only( - left: 32.w, - ), - height: 67.w, - child: Text( - 'HI,李大海', - style: TextStyle( + GestureDetector( + onTap: () { + if (!userProvider.isSigned) Get.to(LoginPage()); + }, + child: Container( + margin: EdgeInsets.only( + left: 32.w, + ), + height: 67.w, + child: Text( + userProvider.isSigned + ? 'HI,${userProvider.userInfoModel.nickName}' + : '登录/注册', + style: TextStyle( color: AppStyle.primaryTextColor, fontWeight: FontWeight.bold, - fontSize: 48.sp), + fontSize: 48.sp, + ), + ), ), ), SizedBox(height: 16.w), diff --git a/lib/ui/settings/user_info_page.dart b/lib/ui/settings/user_info_page.dart index abe6b22..9df3337 100644 --- a/lib/ui/settings/user_info_page.dart +++ b/lib/ui/settings/user_info_page.dart @@ -50,6 +50,7 @@ class _UserInfoPageState extends State { AkuTile( onTap: () {}, title: Text('手机'), + suffix: Text(userProvider.userInfoModel.securePhone), ), ], ), diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart new file mode 100644 index 0000000..36136d7 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_page.dart @@ -0,0 +1,18 @@ +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; + +class DecorationManagerPage extends StatefulWidget { + DecorationManagerPage({Key key}) : super(key: key); + + @override + _DecorationManagerPageState createState() => _DecorationManagerPageState(); +} + +class _DecorationManagerPageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '装修管理', + ); + } +}