diff --git a/assets/static_fix/air1.png b/assets/static_fix/air1.png new file mode 100644 index 0000000..9f6bcf4 Binary files /dev/null and b/assets/static_fix/air1.png differ diff --git a/assets/static_fix/air2.png b/assets/static_fix/air2.png new file mode 100644 index 0000000..a721090 Binary files /dev/null and b/assets/static_fix/air2.png differ diff --git a/assets/static_fix/food.png b/assets/static_fix/food.png new file mode 100644 index 0000000..e8b24f3 Binary files /dev/null and b/assets/static_fix/food.png differ diff --git a/assets/static_fix/food2.png b/assets/static_fix/food2.png new file mode 100644 index 0000000..6475407 Binary files /dev/null and b/assets/static_fix/food2.png differ diff --git a/lib/main.dart b/lib/main.dart index 89a3109..9a5bff1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:aku_community_manager/provider/app_provider.dart'; +import 'package:aku_community_manager/provider/fix_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/ui/home/home_page.dart'; import 'package:bot_toast/bot_toast.dart'; @@ -18,6 +19,7 @@ class MyApp extends StatelessWidget { providers: [ ChangeNotifierProvider(create: (context) => UserProvider()), ChangeNotifierProvider(create: (context) => AppProvider()), + ChangeNotifierProvider(create: (context) => FixProvider()), ], child: GetMaterialApp( title: '小蜜蜂管家', diff --git a/lib/mock_models/fix/fix_model.dart b/lib/mock_models/fix/fix_model.dart new file mode 100644 index 0000000..3f1f6cd --- /dev/null +++ b/lib/mock_models/fix/fix_model.dart @@ -0,0 +1,227 @@ +import 'package:aku_community_manager/const/resource.dart'; +import 'package:flutter/material.dart'; + +enum FIX_ENUM { + ///待派单 + HAND_OUT, + + ///已派单&&待接单 + WAIT_PICKUP, + + ///处理中 + PROCESSING, + + ///已处理 + DONE, +} + +class FixModel { + static Map managerRoleMap = { + FIX_ENUM.HAND_OUT: '待派单', + FIX_ENUM.WAIT_PICKUP: '已派单', + FIX_ENUM.PROCESSING: '处理中', + FIX_ENUM.DONE: '已处理', + }; + + static Map otherRoleMap = { + FIX_ENUM.HAND_OUT: '', + FIX_ENUM.WAIT_PICKUP: '待接单', + FIX_ENUM.PROCESSING: '处理中', + FIX_ENUM.DONE: '已处理', + }; + + String title; + DateTime dateStart; + FIX_ENUM type; + + ///dynamic type + /// + ///当img 的类型为String时渲染asset图片,当img 类型为File 时渲染File图片 + List imgs; + FixDetailModel detail; + FixModel({ + @required this.title, + @required this.dateStart, + @required this.type, + @required this.imgs, + @required this.detail, + }); + + static List initList() { + return [ + FixModel( + title: '小区西大门车栏坏了,请物业尽快修理更换。', + dateStart: DateTime(2020, 10, 21, 7, 28, 56), + type: FIX_ENUM.WAIT_PICKUP, + imgs: [R.ASSETS_STATIC_FIX_AIR1_PNG, R.ASSETS_STATIC_FIX_AIR2_PNG], + detail: FixDetailModel( + userName: '杨建', + userPhoneNumber: '18882928888', + fixArea: 'B区', + type: FIX_PAYMENT_TYPE.FREE, + limit: FIX_DATE_LIMIT.HOUR_24, + subType: FIX_SUB_TYPE.NORMAL, + fixStatuses: [ + FixStatus(title: '申请保修', date: DateTime(2020, 10, 23, 10, 28, 56)), + FixStatus( + title: '分派给李保国师傅', date: DateTime(2020, 10, 23, 10, 32, 14)), + FixStatus(title: '师傅已接单', date: DateTime(2020, 10, 23, 10, 38, 26)), + ], + result: FixResult( + detail: '电饭煲插头没插', + material: '无', + imgs: [R.ASSETS_STATIC_FIX_FOOD_PNG], + ), + review: UserReviewInfo( + rate: 5, + content: '师傅太用心了', + ), + ), + ), + FixModel( + title: '家里空调坏了,请师傅抓紧时间尽快维修。', + dateStart: DateTime(2020, 10, 21, 7, 28, 56), + type: FIX_ENUM.PROCESSING, + imgs: [R.ASSETS_STATIC_FIX_AIR1_PNG, R.ASSETS_STATIC_FIX_AIR2_PNG], + detail: FixDetailModel( + userName: '杨建', + userPhoneNumber: '18882929292', + fixArea: 'A区', + type: FIX_PAYMENT_TYPE.FREE, + limit: FIX_DATE_LIMIT.HOUR_24, + subType: FIX_SUB_TYPE.NORMAL, + fixStatuses: [ + FixStatus(title: '申请保修', date: DateTime(2020, 10, 23, 10, 28, 56)), + FixStatus( + title: '分派给李保国师傅', date: DateTime(2020, 10, 23, 10, 32, 14)), + FixStatus(title: '师傅已接单', date: DateTime(2020, 10, 23, 10, 38, 26)), + ], + result: FixResult( + detail: '电饭煲插头没插', + material: '无', + imgs: [R.ASSETS_STATIC_FIX_FOOD_PNG], + ), + review: UserReviewInfo( + rate: 5, + content: '师傅太用心了', + ), + ), + ), + FixModel( + title: '家中电饭煲出问题了,请师傅速来。', + dateStart: DateTime(2020, 10, 22, 9, 28, 56), + type: FIX_ENUM.DONE, + imgs: [R.ASSETS_STATIC_FIX_FOOD2_PNG, R.ASSETS_STATIC_FIX_FOOD_PNG], + detail: FixDetailModel( + userName: '杨建', + userPhoneNumber: '18882929292', + fixArea: 'A区', + type: FIX_PAYMENT_TYPE.FREE, + limit: FIX_DATE_LIMIT.HOUR_24, + subType: FIX_SUB_TYPE.NORMAL, + fixStatuses: [ + FixStatus(title: '申请保修', date: DateTime(2020, 10, 23, 10, 28, 56)), + FixStatus( + title: '分派给李保国师傅', date: DateTime(2020, 10, 23, 10, 32, 14)), + FixStatus(title: '师傅已接单', date: DateTime(2020, 10, 23, 10, 38, 26)), + FixStatus(title: '处理完成', date: DateTime(2020, 10, 23, 11, 01, 08)), + ], + result: FixResult( + detail: '电饭煲插头没插', + material: '无', + imgs: [R.ASSETS_STATIC_FIX_FOOD_PNG], + ), + review: UserReviewInfo( + rate: 5, + content: '师傅太用心了', + ), + ), + ), + ]; + } +} + +///派单类型 +enum FIX_PAYMENT_TYPE { + FREE, + PAY, +} + +///工单子类 +enum FIX_SUB_TYPE { + ///一般单 + NORMAL, + + ///加急单 + HURRY, +} + +///工单时限 +enum FIX_DATE_LIMIT { + HOUR_24, + HOUR_12, + HOUR_8, +} + +class FixDetailModel { + ///报修人 + String userName; + + String userPhoneNumber; + + String fixArea; + + FIX_PAYMENT_TYPE type; + + FIX_DATE_LIMIT limit; + + FIX_SUB_TYPE subType; + + List fixStatuses; + + FixResult result; + + UserReviewInfo review; + FixDetailModel({ + this.userName, + this.userPhoneNumber, + this.fixArea, + this.type, + this.limit, + this.subType, + this.fixStatuses, + this.result, + this.review, + }); +} + +class FixStatus { + String title; + DateTime date; + FixStatus({ + this.title, + this.date, + }); +} + +class FixResult { + String detail; + String material; + + ///dynamic img + List imgs; + FixResult({ + this.detail, + this.material, + this.imgs, + }); +} + +class UserReviewInfo { + double rate; + String content; + UserReviewInfo({ + this.rate, + this.content, + }); +} diff --git a/lib/mock_models/fix/fixer_model.dart b/lib/mock_models/fix/fixer_model.dart new file mode 100644 index 0000000..92c2c19 --- /dev/null +++ b/lib/mock_models/fix/fixer_model.dart @@ -0,0 +1,16 @@ +enum FIXER_TYPE { + ///空调组 + AIR_CONDITION, + + ///电力组 + ELECTRIC, + + ///水泥组 + CEMENT, +} + +class FixerModel { + FIXER_TYPE type; + String name; + String phone; +} diff --git a/lib/provider/fix_provider.dart b/lib/provider/fix_provider.dart new file mode 100644 index 0000000..590ae5e --- /dev/null +++ b/lib/provider/fix_provider.dart @@ -0,0 +1,54 @@ +import 'package:aku_community_manager/mock_models/fix/fix_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'; +import 'package:provider/provider.dart'; + +class FixProvider extends ChangeNotifier { + List _fixModels = FixModel.initList(); + List get fixModels => _fixModels; + addFixModel(FixModel model) { + _fixModels.insert(0, model); + notifyListeners(); + } + + List getFixModel(int index, BuildContext context) { + final userProvider = Provider.of(context, listen: false); + USER_ROLE role = userProvider.userInfoModel.role; + List _doneModels = + _fixModels.where((element) => element.type == FIX_ENUM.DONE).toList(); + + List _processingModels = _fixModels + .where((element) => element.type == FIX_ENUM.PROCESSING) + .toList(); + + List _handOutModels = _fixModels + .where((element) => element.type == FIX_ENUM.HAND_OUT) + .toList(); + + List _waitPickUpModels = _fixModels + .where((element) => element.type == FIX_ENUM.WAIT_PICKUP) + .toList(); + + switch (role) { + case USER_ROLE.MANAGER: + return [ + _handOutModels, + _waitPickUpModels, + _processingModels, + _doneModels, + _fixModels, + ][index]; + break; + + default: + return [ + _waitPickUpModels, + _processingModels, + _doneModels, + _fixModels, + ][index]; + break; + } + } +} diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index cc6e44b..81e79c0 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -8,6 +8,7 @@ import 'package:aku_community_manager/ui/home/business/business_page.dart'; import 'package:aku_community_manager/ui/home/messages/message.dart'; import 'package:aku_community_manager/ui/home/application/applications_page.dart'; import 'package:aku_community_manager/ui/home/personal_draw.dart'; +import 'package:aku_community_manager/ui/login/login_page.dart'; import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_page.dart'; import 'package:aku_community_manager/ui/tool_pages/scan_page.dart'; @@ -34,7 +35,12 @@ class _HomePageState extends State { radius: 8.w, height: 75.w + 8.w + 33.w, onPressed: () { - Get.to(page); + final userProvider = + Provider.of(context, listen: false); + if (userProvider.isSigned) + Get.to(page); + else + Get.to(LoginPage()); }, child: Column( mainAxisAlignment: MainAxisAlignment.center, 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 new file mode 100644 index 0000000..a47b94c --- /dev/null +++ b/lib/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart @@ -0,0 +1,366 @@ +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/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/widgets/common/aku_scaffold.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/tools/screen_tool.dart'; +import 'package:provider/provider.dart'; + +class BusinessAndFixDetailPage extends StatefulWidget { + final FixModel model; + BusinessAndFixDetailPage({Key key, this.model}) : super(key: key); + + @override + _BusinessAndFixDetailPageState createState() => + _BusinessAndFixDetailPageState(); +} + +class _BusinessAndFixDetailPageState extends State { + USER_ROLE get userRole { + final userProvider = Provider.of(context, listen: false); + return userProvider.userInfoModel.role; + } + + FixDetailModel get detailModel => widget.model.detail; + + String get fixType { + switch (detailModel.type) { + case FIX_PAYMENT_TYPE.FREE: + return '无偿服务'; + break; + case FIX_PAYMENT_TYPE.PAY: + return '有偿服务'; + break; + default: + return ''; + break; + } + } + + String get dateLimit { + switch (detailModel.limit) { + case FIX_DATE_LIMIT.HOUR_24: + return '24小时内处理'; + break; + case FIX_DATE_LIMIT.HOUR_12: + return '12小时内处理'; + break; + case FIX_DATE_LIMIT.HOUR_8: + return '8小时内处理'; + break; + default: + return ''; + break; + } + } + + String get subType { + switch (detailModel.subType) { + case FIX_SUB_TYPE.NORMAL: + return '一般单'; + break; + case FIX_SUB_TYPE.HURRY: + return '加急单'; + break; + default: + return ''; + break; + } + } + + Widget get fixTypeWidget { + if (userRole == USER_ROLE.MANAGER) { + return Text( + FixModel.managerRoleMap[widget.model.type], + style: TextStyle( + color: widget.model.type != FIX_ENUM.DONE + ? Color(0XFFFF4501) + : AppStyle.minorTextColor, + ), + ); + } else { + return Text( + FixModel.otherRoleMap[widget.model.type], + style: TextStyle( + color: widget.model.type != FIX_ENUM.DONE + ? Color(0XFFFF4501) + : AppStyle.minorTextColor, + ), + ); + } + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '报修详情', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + _buildInfo(), + _buildType(), + _buildProcess(), + _buildResult(), + ], + ), + ); + } + + _buildInfo() { + return _buildRawBox( + title: '报修信息', + suffix: fixTypeWidget, + children: [ + AkuBox.h(16), + _buildTile( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + '报修人', + widget.model.detail.userName, + ), + _buildTile( + R.ASSETS_MESSAGE_IC_PHONE_PNG, + '联系电话', + widget.model.detail.userPhoneNumber, + ), + _buildTile( + R.ASSETS_MESSAGE_IC_AREA_PNG, + '报修区域', + widget.model.detail.fixArea, + ), + AkuBox.h(8), + Text( + widget.model.title, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.w, + ), + ), + GridView( + padding: EdgeInsets.only(top: 16.w), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 16.w, + mainAxisSpacing: 16.w, + ), + children: widget.model.imgs.map((e) { + return ClipRRect( + borderRadius: BorderRadius.circular(4.w), + child: (e is String) ? Image.asset(e) : Image.file(e), + ); + }).toList(), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + ), + ], + ); + } + + _buildType() { + return _buildRawBox( + title: '工单类型', + children: [ + _buildTypeTile('派单类型', fixType, false), + _buildTypeTile('工单时限', dateLimit, false), + _buildTypeTile('工单子类', subType, false), + ], + ); + } + + _buildProcess() { + return _buildRawBox( + title: '报修进程', + children: detailModel.fixStatuses.map((e) { + return _buildProcessTile( + e.title, + DateUtil.formatDate(e.date, format: 'yyyy-MM-dd HH:mm:ss'), + ); + }).toList(), + ); + } + + _buildResult() { + return _buildRawBox( + title: '处理情况', + spacing: 24, + children: [ + Text( + '处理描述', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + AkuBox.h(8), + Text( + detailModel.result.detail, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + AkuBox.h(24), + Text( + '更换材料', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + AkuBox.h(8), + Text( + detailModel.result.material, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + AkuBox.h(24), + Text( + '上传照片', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + AkuBox.h(8), + GridView( + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 4, + ), + children: detailModel.result.imgs.map((e) { + return ClipRRect( + borderRadius: BorderRadius.circular(4.w), + child: (e is String) ? Image.asset(e) : Image.file(e), + ); + }).toList(), + ), + ], + ); + } + + Widget _buildTile(String asset, String title, String subTitle) { + return Row( + children: [ + AkuBox.h(56), + Image.asset( + asset, + height: 40.w, + width: 40.w, + ), + AkuBox.w(4), + Text( + title, + style: TextStyle( + fontSize: 28.sp, + color: AppStyle.minorTextColor, + ), + ), + Spacer(), + Text( + subTitle, + style: TextStyle( + fontSize: 28.sp, + color: AppStyle.primaryTextColor, + ), + ), + ], + ); + } + + Widget _buildTypeTile(String title, String content, bool canTap) { + return Material( + color: Colors.transparent, + child: InkWell( + onTap: canTap ? () {} : null, + child: Row( + children: [ + AkuBox.h(96), + Text( + title, + style: TextStyle( + fontSize: 28.sp, + color: AppStyle.primaryTextColor, + ), + ), + Spacer(), + Text( + content, + style: TextStyle( + fontSize: 28.sp, + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + ), + ), + ], + ), + ), + ); + } + + Widget _buildProcessTile(String title, String date) { + return Row( + children: [ + AkuBox.h(56), + Text( + title, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + Spacer(), + Text( + date, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + ], + ); + } + + _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_and_fix_page.dart b/lib/ui/sub_pages/business_and_fix/business_and_fix_page.dart index ec82f4b..96fef6d 100644 --- a/lib/ui/sub_pages/business_and_fix/business_and_fix_page.dart +++ b/lib/ui/sub_pages/business_and_fix/business_and_fix_page.dart @@ -1,5 +1,8 @@ +import 'package:aku_community_manager/mock_models/fix/fix_model.dart'; import 'package:aku_community_manager/mock_models/users/user_info_model.dart'; +import 'package:aku_community_manager/provider/fix_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; +import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_fix_card.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_tab_bar.dart'; @@ -21,10 +24,10 @@ class _BusinessAndFixPageState extends State final userProvider = Provider.of(context, listen: false); switch (userProvider.userInfoModel.role) { case USER_ROLE.MANAGER: - return []; + return ['待派单', '已派单', '处理中', '已处理', '全部']; break; case USER_ROLE.FIXER: - return []; + return ['待接单', '处理中', '已处理', '全部']; break; case USER_ROLE.SECURITY: return []; @@ -51,13 +54,28 @@ class _BusinessAndFixPageState extends State Widget build(BuildContext context) { return AkuScaffold( title: '报事报修', - bottom: PreferredSize( + appBarBottom: PreferredSize( preferredSize: Size.fromHeight(88.w), child: AkuTabBar( controller: _tabController, tabs: _tabs, ), ), + body: TabBarView( + controller: _tabController, + children: _tabs.map((e) => _buildTabView(_tabs.indexOf(e))).toList(), + ), + ); + } + + Widget _buildTabView(int index) { + final fixProvider = Provider.of(context, listen: false); + List models = fixProvider.getFixModel(index, context); + return ListView.builder( + itemBuilder: (context, index) { + return BusinessFixCard(model: models[index]); + }, + itemCount: models.length, ); } } 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 new file mode 100644 index 0000000..7b912ec --- /dev/null +++ b/lib/ui/sub_pages/business_and_fix/business_fix_card.dart @@ -0,0 +1,248 @@ +import 'package:aku_community_manager/mock_models/fix/fix_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: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_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 BusinessFixCard extends StatefulWidget { + final FixModel model; + BusinessFixCard({Key key, @required this.model}) : super(key: key); + + @override + _BusinessFixCardState createState() => _BusinessFixCardState(); +} + +class _BusinessFixCardState extends State { + USER_ROLE get userRole { + final userProvider = Provider.of(context, listen: false); + return userProvider.userInfoModel.role; + } + + String get dateStart => DateUtil.formatDate(widget.model.dateStart, + format: 'yyyy-MM-dd HH:mm:ss'); + + Widget get fixTypeWidget { + if (userRole == USER_ROLE.MANAGER) { + return Text( + FixModel.managerRoleMap[widget.model.type], + style: TextStyle( + color: widget.model.type != FIX_ENUM.DONE + ? Color(0XFFFF4501) + : AppStyle.minorTextColor, + ), + ); + } else { + return Text( + FixModel.otherRoleMap[widget.model.type], + style: TextStyle( + color: widget.model.type != FIX_ENUM.DONE + ? Color(0XFFFF4501) + : AppStyle.minorTextColor, + ), + ); + } + } + + @override + Widget build(BuildContext context) { + return Container( + padding: EdgeInsets.all(24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Container( + child: Text( + '报事报修', + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 20.sp, + fontWeight: FontWeight.bold, + ), + ), + padding: EdgeInsets.symmetric(vertical: 6.w, horizontal: 16.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2.w), + border: + Border.all(width: 2.w, color: AppStyle.secondaryColor), + ), + ), + AkuBox.w(16), + Expanded( + child: Text( + dateStart, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.sp, + ), + ), + ), + fixTypeWidget, + ], + ), + AkuBox.h(24), + Text( + widget.model.title, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + AkuBox.h(16), + _buildImgs(), + _buildBottomCard(), + ], + ), + margin: EdgeInsets.symmetric( + horizontal: 32.w, + vertical: 8.w, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + ); + } + + _buildImgs() { + return Container( + height: 168.w, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) { + var imgObj = widget.model.imgs[index]; + return Container( + margin: EdgeInsets.symmetric(horizontal: 8.w), + height: 168.w, + width: 168.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.w), + image: DecorationImage( + image: (imgObj is String) + ? AssetImage(imgObj) + : FileImage(imgObj)), + ), + ); + }, + itemCount: widget.model.imgs.length, + ), + ); + } + + _buildBottomCard() { + switch (userRole) { + case USER_ROLE.FIXER: + if (widget.model.type == FIX_ENUM.DONE) return SizedBox(); + return Column( + children: [ + Divider( + height: 48.w, + ), + Row( + children: [ + Spacer(), + widget.model.type == FIX_ENUM.PROCESSING + ? MaterialButton( + padding: EdgeInsets.zero, + height: 64.w, + minWidth: 160.w, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.w), + side: BorderSide( + width: 2.w, + color: AppStyle.primaryColor, + ), + ), + child: Text( + '申请延时', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 28.sp, + ), + ), + onPressed: () {}, + ) + : SizedBox(), + widget.model.type == FIX_ENUM.PROCESSING + ? AkuBox.w(24) + : SizedBox(), + widget.model.type == FIX_ENUM.PROCESSING + ? AkuMaterialButton( + onPressed: () {}, + radius: 4.w, + color: AppStyle.primaryColor, + minWidth: 160.w, + height: 64.w, + child: Text( + '处理完成', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 28.sp, + ), + ), + ) + : SizedBox(), + widget.model.type == FIX_ENUM.WAIT_PICKUP + ? AkuMaterialButton( + onPressed: () {}, + radius: 4.w, + color: AppStyle.primaryColor, + minWidth: 160.w, + height: 64.w, + child: Text( + '立即接单', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 28.sp, + ), + ), + ) + : SizedBox(), + ], + ), + ], + ); + break; + default: + return Column( + children: [ + Divider( + height: 48.w, + ), + Align( + alignment: Alignment.centerRight, + child: AkuMaterialButton( + height: 64.w, + onPressed: () { + Get.to(BusinessAndFixDetailPage(model: widget.model)); + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + '查看详情', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ), + ], + ); + break; + } + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 9091d6f..2b7800a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -75,6 +75,7 @@ flutter: - assets/manage/ - assets/static_temp/ + - assets/static_fix/ # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg