From 0cba0ae6d1ed43bf06bd6003c3a8ab23361faf52 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 12 May 2021 08:50:29 +0800 Subject: [PATCH 1/3] update version --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 9164e8d..b2d5c3f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A new Flutter application. publish_to: "none" -version: 1.0.8+9 +version: 1.5.0+10 environment: sdk: ">=2.7.0 <3.0.0" From 68da3711909863fcd91a16fed49e2884b702ecec Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 12 May 2021 10:24:36 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=BB=84=E4=BB=B6=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BF=9D=E4=BF=AE=E5=BB=B6=E6=97=B6=E5=A4=84=E7=90=86=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tools/aku_map.dart | 40 +- lib/ui/home/home_page.dart | 441 +++++++++--------- .../business_and_fix_detail_page.dart | 10 +- pubspec.lock | 2 +- pubspec.yaml | 2 +- 5 files changed, 263 insertions(+), 232 deletions(-) diff --git a/lib/tools/aku_map.dart b/lib/tools/aku_map.dart index 9f685cd..a7e94b6 100644 --- a/lib/tools/aku_map.dart +++ b/lib/tools/aku_map.dart @@ -63,17 +63,35 @@ class AkuMap { static Map fixAreaType = {1: '公区维修', 2: '家庭维修'}; ///报事报修处理进程-操作类型 - static Map operationType = { - 1: '提交报修', - 2: '派单', - 3: '开始处理', - 4: '处理完成', - 5: '确认', - 6: '回访', - 7: '回退', - 8: '作废', - 9: '取消' - }; + static String operationType(int operationType) { + switch (operationType) { + case 1: + return '提交保修'; + case 2: + return '派单'; + case 3: + return '开始处理'; + case 4: + return '处理完成'; + case 5: + return '确认'; + case 6: + return '回访'; + case 7: + return '回退'; + case 8: + return '作废'; + case 9: + return '取消'; + break; + case 10: + return '改派'; + case 11: + return '延时'; + default: + return ''; + } + } static Map dispatchType = {1: '无偿服务', 2: '有偿服务'}; } diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 7582f07..7528b3a 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -15,6 +15,7 @@ import 'package:dio/dio.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:shimmer/shimmer.dart'; import 'package:velocity_x/velocity_x.dart'; @@ -61,6 +62,7 @@ class _HomePageState extends State { List _todoModelList; List _anounceMentList; bool _onload = true; + EasyRefreshController _refreshController; ///自定义bar的菜单按钮 Widget _menuButton(String assetPath, String text, Widget page) { @@ -152,17 +154,7 @@ class _HomePageState extends State { SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle( statusBarColor: Colors.transparent, )); - Future.delayed(Duration(milliseconds: 300), () async { - final userProvider = Provider.of(context, listen: false); - if (userProvider.isLogin) { - _itemNumModel = await _getItemNum(); - var dataList = await BussinessFunc.getBussinessModelList(1); - _todoModelList = dataList.map((e) => ToDoModel.fromJson(e)).toList(); - _anounceMentList = await _getAnouncement(); - _onload = false; - setState(() {}); - } - }); + _refreshController = EasyRefreshController(); } int _currentIndicator = 0; @@ -407,227 +399,248 @@ class _HomePageState extends State { ), ), //需要重构 - body: (!UserTool.userProvider.isLogin) - ? SizedBox() - : _onload - ? loadingWidget - : ListView( - padding: EdgeInsets.all(32.w), - children: [ - Container( - //公告标题行 - width: double.infinity, - height: 45.w, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '今日公告', - style: TextStyle( - color: Color(0xFF4A4B51), - fontSize: 32.sp, - fontWeight: FontWeight.bold, + body: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + controller: _refreshController, + onRefresh: () async { + final userProvider = + Provider.of(context, listen: false); + if (userProvider.isLogin) { + _itemNumModel = await _getItemNum(); + var dataList = await BussinessFunc.getBussinessModelList(1); + _todoModelList = + dataList.map((e) => ToDoModel.fromJson(e)).toList(); + _anounceMentList = await _getAnouncement(); + _onload = false; + setState(() {}); + } + }, + child: (!UserTool.userProvider.isLogin) + ? SizedBox() + : _onload + ? loadingWidget + : ListView( + padding: EdgeInsets.all(32.w), + children: [ + Container( + //公告标题行 + width: double.infinity, + height: 45.w, + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + '今日公告', + style: TextStyle( + color: Color(0xFF4A4B51), + fontSize: 32.sp, + fontWeight: FontWeight.bold, + ), + ), + Spacer(), + AkuButton( + //全部公告按钮 + onPressed: () { + Get.to(() => AllAnouncement()); + }, + child: Row( + children: [ + Text( + '全部公告', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold, + ), + ), + Icon( + Icons.arrow_forward_ios, + size: 22.w, + color: AppStyle.minorTextColor, + ) + ], + ), + ), + ], + ), + ), + SizedBox(height: 16.w), + //公告栏 + Container( + color: Color(0xFFFFFFFF), + width: double.infinity, + height: 172.w, + child: Stack(children: [ + CarouselSlider( + items: _anounceMentList + .map( + (e) => AllAnouncementState.anounceCard(e)) + .toList(), + options: CarouselOptions( + viewportFraction: 1.0, + aspectRatio: 686 / 172, + autoPlay: true, + onPageChanged: (index, _) { + setState(() { + _currentIndicator = index; + }); + }, ), ), - Spacer(), - AkuButton( - //全部公告按钮 - onPressed: () { - Get.to(() => AllAnouncement()); - }, + Positioned( + top: 144.w, + left: 0, + bottom: 16.w, + right: 0, child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: _anounceMentList.map((e) { + int index = _anounceMentList.indexOf(e); + return Container( + width: 12.w, + height: 12.w, + margin: + EdgeInsets.symmetric(horizontal: 12.w), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _currentIndicator == index + ? Color(0xFFFFC40C) + : Color(0xFFE8E8E8), + ), + ); + }).toList(), + ), + ), + ]), + ), + SizedBox(height: 16.w), + //待办事项标题行 + !userProvider.isLogin + ? SizedBox() + : Row( children: [ Text( - '全部公告', + '待办事项', style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 24.sp, + color: Color(0xFF4A4B51), + fontSize: 32.sp, fontWeight: FontWeight.bold, ), ), - Icon( - Icons.arrow_forward_ios, - size: 22.w, - color: AppStyle.minorTextColor, - ) + Spacer(), + AkuButton( + padding: + EdgeInsets.symmetric(vertical: 16.w), + onPressed: () { + Get.to(BusinessPage(initIndex: 3)); + }, + child: Row( + children: [ + Text( + '全部事项', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold), + ), + Icon( + Icons.arrow_forward_ios, + size: 22.w, + color: AppStyle.minorTextColor, + ), + ], + ), + ), ], ), - ), - ], - ), - ), - SizedBox(height: 16.w), - //公告栏 - Container( - color: Color(0xFFFFFFFF), - width: double.infinity, - height: 172.w, - child: Stack(children: [ - CarouselSlider( - items: _anounceMentList - .map((e) => AllAnouncementState.anounceCard(e)) - .toList(), - options: CarouselOptions( - viewportFraction: 1.0, - aspectRatio: 686 / 172, - autoPlay: true, - onPageChanged: (index, _) { - setState(() { - _currentIndicator = index; - }); - }, - ), - ), - Positioned( - top: 144.w, - left: 0, - bottom: 16.w, - right: 0, - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.center, - children: _anounceMentList.map((e) { - int index = _anounceMentList.indexOf(e); - return Container( - width: 12.w, - height: 12.w, - margin: - EdgeInsets.symmetric(horizontal: 12.w), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: _currentIndicator == index - ? Color(0xFFFFC40C) - : Color(0xFFE8E8E8), - ), - ); - }).toList(), - ), - ), - ]), - ), - SizedBox(height: 16.w), - //待办事项标题行 - !userProvider.isLogin - ? SizedBox() - : Row( - children: [ - Text( - '待办事项', - style: TextStyle( - color: Color(0xFF4A4B51), - fontSize: 32.sp, - fontWeight: FontWeight.bold, - ), - ), - Spacer(), - AkuButton( - padding: EdgeInsets.symmetric(vertical: 16.w), - onPressed: () { - Get.to(BusinessPage(initIndex: 3)); + SizedBox(height: 16.w), + //待办事项栏 + !userProvider.isLogin + ? SizedBox() + : Container( + height: 480.w, + child: ListView.separated( + separatorBuilder: (context, index) { + return AkuBox.w(16); }, - child: Row( - children: [ - Text( - '全部事项', - style: TextStyle( - color: AppStyle.minorTextColor, - fontSize: 24.sp, - fontWeight: FontWeight.bold), - ), - Icon( - Icons.arrow_forward_ios, - size: 22.w, - color: AppStyle.minorTextColor, + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) { + return Container( + width: 526.w, + child: Builder( + builder: (context) { + if (_todoModelList[index] + .dynamicModel + .runtimeType == + BussinessAndFixModel) { + return BusinessFixCard( + model: _todoModelList[index] + .dynamicModel); + } else if (_todoModelList[index] + .dynamicModel + .runtimeType == + ToDoOutDoorModel) { + return ToDoOutDoorCard( + model: _todoModelList[index] + .dynamicModel, + ); + } else + return SizedBox(); + }, ), - ], - ), + ); + }, + itemCount: _todoModelList.length, ), - ], - ), - SizedBox(height: 16.w), - //待办事项栏 - !userProvider.isLogin - ? SizedBox() - : Container( - height: 480.w, - child: ListView.separated( - separatorBuilder: (context, index) { - return AkuBox.w(16); - }, - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - return Container( - width: 526.w, - child: Builder( - builder: (context) { - if (_todoModelList[index] - .dynamicModel - .runtimeType == - BussinessAndFixModel) { - return BusinessFixCard( - model: _todoModelList[index] - .dynamicModel); - } else if (_todoModelList[index] - .dynamicModel - .runtimeType == - ToDoOutDoorModel) { - return ToDoOutDoorCard( - model: _todoModelList[index] - .dynamicModel, - ); - } else - return SizedBox(); - }, - ), - ); - }, - itemCount: _todoModelList.length, ), - ), - SizedBox(height: 24.w), - //底部信息栏 - !userProvider.isLogin - ? SizedBox() - : Container( - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.w), - color: Colors.white, - ), - child: Column( - children: [ - Row( - children: [ - _card(_itemNumModel.unProcessedNum ?? 0, - '未处理事项', Color(0xFFFF4E0D), 0), + SizedBox(height: 24.w), + //底部信息栏 + !userProvider.isLogin + ? SizedBox() + : Container( + width: double.infinity, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Colors.white, + ), + child: Column( + children: [ + Row( + children: [ + _card(_itemNumModel.unProcessedNum ?? 0, + '未处理事项', Color(0xFFFF4E0D), 0), + GridientDiveder() + .verticalDivider(166.5.w), + _card(_itemNumModel.processingNum ?? 0, + '处理中事项', Color(0xFFFFC40C), 1), + ], + ), + Row(children: [ GridientDiveder() - .verticalDivider(166.5.w), - _card(_itemNumModel.processingNum ?? 0, - '处理中事项', Color(0xFFFFC40C), 1), - ], - ), - Row(children: [ - GridientDiveder().horizontalDivider(343.w), - GridientDiveder(isReverse: true) - .horizontalDivider(343.w) - ]), - Row( - children: [ - _card(_itemNumModel.processedNum ?? 0, - '已处理事项', Color(0xFF3F8FFE), 2), + .horizontalDivider(343.w), GridientDiveder(isReverse: true) - .verticalDivider( - 166.5.w, - ), - _card(_itemNumModel.allNum ?? 0, '全部事项', - Color(0xFF333333), 3), - ], - ), - ], + .horizontalDivider(343.w) + ]), + Row( + children: [ + _card(_itemNumModel.processedNum ?? 0, + '已处理事项', Color(0xFF3F8FFE), 2), + GridientDiveder(isReverse: true) + .verticalDivider( + 166.5.w, + ), + _card(_itemNumModel.allNum ?? 0, '全部事项', + Color(0xFF333333), 3), + ], + ), + ], + ), ), - ), - ], - ), + ], + ), + ), ), value: SystemUiOverlayStyle.dark, ); 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 fb70c57..1483e07 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 @@ -42,7 +42,6 @@ class BusinessAndFixDetailPage extends StatefulWidget { } class _BusinessAndFixDetailPageState extends State { - bool get isHandOut => widget.model.status == 1; FixedDetailModel _detailModel; bool _onload = true; @@ -138,7 +137,7 @@ class _BusinessAndFixDetailPageState extends State { ), ); } else if (widget.model.status == 2) { - if (userProvider.infoModel.canSendTicket){ + if (userProvider.infoModel.canSendTicket) { return AkuMaterialButton( color: AppStyle.primaryColor, nullColor: AppStyle.minorColor, @@ -204,9 +203,10 @@ class _BusinessAndFixDetailPageState extends State { color: AppStyle.primaryColor, ), ), - onPressed: () { - Get.to( + onPressed: () async { + await Get.to( FixMoreTimePage(dispatchId: widget.model.dispatchId)); + _easyRefreshController.callRefresh(); }, child: Text( '申请延时', @@ -404,7 +404,7 @@ class _BusinessAndFixDetailPageState extends State { title: '报修进程', children: _detailModel.processRecord.map((e) { return _buildProcessTile( - AkuMap.operationType[e.operationType], + AkuMap.operationType(e.operationType), DateUtil.formatDateStr(e.operationDate, format: 'yyyy-MM-dd HH:mm:ss'), ); diff --git a/pubspec.lock b/pubspec.lock index 0c3051f..1a6e5d0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -86,7 +86,7 @@ packages: name: badges url: "https://pub.flutter-io.cn" source: hosted - version: "1.2.0" + version: "2.0.0-nullsafety.1" boolean_selector: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0536aa1..49d947f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,7 +69,7 @@ dependencies: url: http://159.75.73.143:8080/third_packages/jpush_flutter shimmer: ^2.0.0-nullsafety.0 - badges: ^1.2.0 + badges: ^2.0.0-nullsafety.1 dev_dependencies: flutter_test: From f9d4911149dd5fb6edd256bcc4772ec2378554d0 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 12 May 2021 13:47:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/home/business/business_view.dart | 15 +- lib/ui/home/business/todo_outdoor_card.dart | 12 +- lib/ui/home/home_page.dart | 7 +- .../business_and_fix/business_fix_card.dart | 48 ++++-- .../bussiness_and_fix_view.dart | 6 +- .../fix_submit_finish_page.dart | 1 + .../fix_work_finish_page.dart | 142 ++++++++++-------- pubspec.lock | 14 ++ pubspec.yaml | 2 + 9 files changed, 162 insertions(+), 85 deletions(-) diff --git a/lib/ui/home/business/business_view.dart b/lib/ui/home/business/business_view.dart index f2c7dba..7fe71be 100644 --- a/lib/ui/home/business/business_view.dart +++ b/lib/ui/home/business/business_view.dart @@ -47,7 +47,8 @@ class _BussinessViewState extends State controller: _refreshController, header: MaterialHeader(), onRefresh: () async { - var dataList = await BussinessFunc.getBussinessModelList(widget.backlogStatus); + var dataList = + await BussinessFunc.getBussinessModelList(widget.backlogStatus); _modelList = dataList.map((e) => ToDoModel.fromJson(e)).toList(); setState(() {}); }, @@ -58,10 +59,18 @@ class _BussinessViewState extends State children: [ ..._modelList.map((e) { if (e.dynamicModel.runtimeType == BussinessAndFixModel) { - return BusinessFixCard(model: e.dynamicModel); + return BusinessFixCard( + model: e.dynamicModel, + callRefresh: () { + _refreshController.callRefresh(); + }, + ); } else if (e.dynamicModel.runtimeType == ToDoOutDoorModel) { return ToDoOutDoorCard( model: e.dynamicModel, + callRefresh: () { + _refreshController.callRefresh(); + }, ); } }).toList() @@ -74,8 +83,6 @@ class _BussinessViewState extends State return SizedBox(); } - - @override bool get wantKeepAlive => true; } diff --git a/lib/ui/home/business/todo_outdoor_card.dart b/lib/ui/home/business/todo_outdoor_card.dart index 2545981..3ac84b0 100644 --- a/lib/ui/home/business/todo_outdoor_card.dart +++ b/lib/ui/home/business/todo_outdoor_card.dart @@ -8,8 +8,9 @@ import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; class ToDoOutDoorCard extends StatefulWidget { - final ToDoOutDoorModel model; - ToDoOutDoorCard({Key key, this.model}) : super(key: key); + final ToDoOutDoorModel model; + final VoidCallback callRefresh; + ToDoOutDoorCard({Key key, this.model, this.callRefresh}) : super(key: key); @override _ToDoOutDoorCardState createState() => _ToDoOutDoorCardState(); @@ -191,8 +192,11 @@ class _ToDoOutDoorCardState extends State { height: 112.w, alignment: Alignment.centerRight, child: AkuButton( - onPressed: () { - Get.to(ItemsOutdoorDetailsPage(id: widget.model.id)); + onPressed: () async { + await Get.to(ItemsOutdoorDetailsPage(id: widget.model.id)); + if (widget.callRefresh != null) { + widget.callRefresh(); + } }, child: Container( alignment: Alignment.center, diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 7528b3a..59569be 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -560,8 +560,9 @@ class _HomePageState extends State { !userProvider.isLogin ? SizedBox() : Container( - height: 480.w, + height: 500.w, child: ListView.separated( + padding: EdgeInsets.zero, separatorBuilder: (context, index) { return AkuBox.w(16); }, @@ -576,6 +577,10 @@ class _HomePageState extends State { .runtimeType == BussinessAndFixModel) { return BusinessFixCard( + callRefresh: () { + _refreshController + .callRefresh(); + }, model: _todoModelList[index] .dynamicModel); } else if (_todoModelList[index] 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 ff0853c..4e3bbd3 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 @@ -25,11 +25,16 @@ class BusinessFixCard extends StatefulWidget { final BussinessAndFixModel model; final bool homeDisplay; final bool canSeeBottomButton; + final VoidCallback callRefresh; + //是否是报事保修处理完成页面调用 + final bool hasFinished; BusinessFixCard( {Key key, @required this.model, this.homeDisplay = false, - this.canSeeBottomButton = true}) + this.canSeeBottomButton = true, + this.callRefresh, + this.hasFinished = false}) : super(key: key); @override @@ -70,8 +75,11 @@ class _BusinessFixCardState extends State { @override Widget build(BuildContext context) { return GestureDetector( - onTap: () { - Get.to(() => BusinessAndFixDetailPage(model: widget.model)); + onTap: () async { + await Get.to(() => BusinessAndFixDetailPage(model: widget.model)); + if (widget.callRefresh != null) { + widget.callRefresh(); + } }, child: Container( padding: EdgeInsets.all(24.w), @@ -93,13 +101,17 @@ class _BusinessFixCardState extends State { ), ), Text( - AkuMap.fixStatus(userInfoModel.canSendTicket, - userInfoModel.canPickUpTicket, widget.model.status), - style: TextStyle( - color: widget.model.status < 4 - ? Color(0XFFFF4501) - : AppStyle.minorTextColor, - ), + widget.hasFinished + ? '已处理' + : AkuMap.fixStatus(userInfoModel.canSendTicket, + userInfoModel.canPickUpTicket, widget.model.status), + style: widget.hasFinished + ? TextStyle(color: AppStyle.minorTextColor) + : TextStyle( + color: widget.model.status < 4 + ? Color(0XFFFF4501) + : AppStyle.minorTextColor, + ), ), ], ), @@ -194,8 +206,8 @@ class _BusinessFixCardState extends State { widget.model.status == 3 ? AkuBox.w(24) : SizedBox(), widget.model.status == 3 ? AkuMaterialButton( - onPressed: () { - Get.to(() => BusinessAndFixDetailPage( + onPressed: () async { + await Get.to(() => BusinessAndFixDetailPage( model: widget.model, )); }, @@ -214,7 +226,7 @@ class _BusinessFixCardState extends State { : SizedBox(), (widget.model.status == 2) && (userInfoModel.canPickUpTicket) ? AkuMaterialButton( - onPressed: () { + onPressed: () async { // final userProvider = // Provider.of(context, listen: false); // widget.model.detail.fixStatuses.add(FixStatus( @@ -223,9 +235,12 @@ class _BusinessFixCardState extends State { // )); // widget.model.type = FIX_ENUM.PROCESSING; // Get.back(); - Get.to(() => BusinessAndFixDetailPage( + await Get.to(() => BusinessAndFixDetailPage( model: widget.model, )); + if (widget.callRefresh != null) { + widget.callRefresh(); + } }, radius: 4.w, color: AppStyle.primaryColor, @@ -252,8 +267,11 @@ class _BusinessFixCardState extends State { alignment: Alignment.centerRight, child: AkuMaterialButton( height: 64.w, - onPressed: () { + onPressed: () async { Get.to(() => BusinessAndFixDetailPage(model: widget.model)); + if (widget.callRefresh != null) { + widget.callRefresh(); + } }, radius: 4, color: AppStyle.primaryColor, diff --git a/lib/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart b/lib/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart index 0a837fc..b1761c7 100644 --- a/lib/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart +++ b/lib/ui/sub_pages/business_and_fix/bussiness_and_fix_view.dart @@ -47,7 +47,11 @@ class _BussinessAndFixViewState extends State builder: (items) { return ListView.separated( itemBuilder: (context, index) { - return BusinessFixCard(model: items[index]); + return BusinessFixCard( + model: items[index], + callRefresh: () { + _easyRefreshController.callRefresh(); + }); }, separatorBuilder: (_, __) { return 16.w.heightBox; diff --git a/lib/ui/sub_pages/business_and_fix/fix_submit_finish_page.dart b/lib/ui/sub_pages/business_and_fix/fix_submit_finish_page.dart index bd87dc7..a000003 100644 --- a/lib/ui/sub_pages/business_and_fix/fix_submit_finish_page.dart +++ b/lib/ui/sub_pages/business_and_fix/fix_submit_finish_page.dart @@ -23,6 +23,7 @@ class FixSubmitFinishPage extends StatelessWidget { '您已处理完成该报修'.text.black.size(40.sp).bold.make(), 120.w.heightBox, BusinessFixCard( + hasFinished: true, model: this.model, canSeeBottomButton: false, ), 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 index 3b9972a..47b99ef 100644 --- 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 @@ -289,76 +289,97 @@ class _FixWorkFinishPageState extends State { title: '费用明细', spacing: 16, children: [ - Row( - children: [ - AkuBox.h(96), - Text('人工费'), - Expanded( - child: TextField( - controller: _humanController, - onChanged: (_) => setState(() {}), - keyboardType: TextInputType.number, - textAlign: TextAlign.end, - decoration: InputDecoration( - border: InputBorder.none, - hintText: '请输入', - hintStyle: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 28.sp, - color: AppStyle.minorTextColor, + SizedBox( + height: 96.w, + child: Row( + children: [ + Text( + '人工费', + style: + TextStyle(color: Colors.black, fontSize: 28.sp), + ), + Expanded( + child: TextField( + controller: _humanController, + onChanged: (_) => setState(() {}), + keyboardType: TextInputType.number, + textAlign: TextAlign.end, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入', + hintStyle: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 28.sp, + color: AppStyle.minorTextColor, + ), ), ), ), - ), - ], + ], + ), ), Divider(height: 1.w), - Row( - children: [ - AkuBox.h(96), - Text('材料费'), - Expanded( - child: TextField( - onChanged: (_) => setState(() {}), - controller: _materialPriceController, - textAlign: TextAlign.end, - keyboardType: TextInputType.number, - decoration: InputDecoration( - border: InputBorder.none, - hintText: '请输入', - hintStyle: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 28.sp, - color: AppStyle.minorTextColor, + SizedBox( + height: 96.w, + child: Row( + children: [ + Text( + '材料费', + style: + TextStyle(color: Colors.black, fontSize: 28.sp), + ), + Expanded( + child: TextField( + onChanged: (_) => setState(() {}), + controller: _materialPriceController, + textAlign: TextAlign.end, + keyboardType: TextInputType.number, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入', + hintStyle: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 28.sp, + color: AppStyle.minorTextColor, + ), ), ), ), - ), - ], + ], + ), ), Divider(height: 1.w), - Row( - children: [ - AkuBox.h(96), - Text('总计费用'), - Spacer(), - Builder( - builder: (context) { - if (TextUtil.isEmpty(_humanController.text) || - TextUtil.isEmpty( - _materialPriceController.text)) { - return Text('人工费或材料费不能为空'); - } else { - humanPrice = - double.tryParse(_humanController.text); - materialPrice = double.tryParse( - _materialPriceController.text); - } - return Text( - '¥${(humanPrice + materialPrice).toStringAsFixed(2)}'); - }, - ), - ], + SizedBox( + height: 96.w, + child: Row( + children: [ + Text( + '总计费用', + style: + TextStyle(color: Colors.black, fontSize: 28.sp), + ), + Spacer(), + Builder( + builder: (context) { + if (TextUtil.isEmpty(_humanController.text) || + TextUtil.isEmpty( + _materialPriceController.text)) { + return Text('人工费或材料费不能为空'); + } else { + humanPrice = + double.tryParse(_humanController.text); + materialPrice = double.tryParse( + _materialPriceController.text); + } + return Text( + '¥${(humanPrice + materialPrice).toStringAsFixed(2)}', + style: TextStyle( + color: Colors.black, fontSize: 28.sp), + ); + }, + ), + ], + ), ), ], ), @@ -409,6 +430,7 @@ class _FixWorkFinishPageState extends State { if (baseModel.status) { FixSubmitFinishPage( model: widget.fixModel, + ).to(); } else { BotToast.showText(text: baseModel.message); diff --git a/pubspec.lock b/pubspec.lock index 1a6e5d0..1d8ca6a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -241,6 +241,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "5.0.1" + extended_list_library: + dependency: transitive + description: + name: extended_list_library + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.0" extended_text: dependency: "direct main" description: @@ -800,6 +807,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + waterfall_flow: + dependency: "direct main" + description: + name: waterfall_flow + url: "https://pub.flutter-io.cn" + source: hosted + version: "3.0.1" yaml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 49d947f..044ad9e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -55,6 +55,8 @@ dependencies: firebase_crashlytics: ^2.0.0 #json序列化 json_serializable: ^4.1.1 + #瀑布流 + waterfall_flow: ^3.0.1 power_logger: ^1.0.1-nullsafety.1 logger: ^1.0.0