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