|
|
@ -1,5 +1,8 @@
|
|
|
|
// Flutter imports:
|
|
|
|
// Flutter imports:
|
|
|
|
|
|
|
|
import 'package:aku_community_manager/const/api.dart';
|
|
|
|
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
|
|
|
|
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
|
|
|
|
|
|
|
|
import 'package:aku_community_manager/models/user/user_info_model.dart';
|
|
|
|
|
|
|
|
import 'package:aku_community_manager/provider/user_provider.dart';
|
|
|
|
import 'package:aku_community_manager/tools/aku_map.dart';
|
|
|
|
import 'package:aku_community_manager/tools/aku_map.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/business_and_fix_detail_page.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
@ -11,8 +14,6 @@ import 'package:get/get.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
|
|
// Project imports:
|
|
|
|
// Project imports:
|
|
|
|
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/style/app_style.dart';
|
|
|
|
import 'package:aku_community_manager/tools/screen_tool.dart';
|
|
|
|
import 'package:aku_community_manager/tools/screen_tool.dart';
|
|
|
|
import 'package:aku_community_manager/tools/widget_tool.dart';
|
|
|
|
import 'package:aku_community_manager/tools/widget_tool.dart';
|
|
|
@ -29,9 +30,9 @@ class BusinessFixCard extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
USER_ROLE get userRole {
|
|
|
|
UserInfoModel get userInfoModel {
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
return userProvider.userInfoModel.role;
|
|
|
|
return userProvider.infoModel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String get dateStart => DateUtil.formatDateStr(widget.model.repairDate,
|
|
|
|
String get dateStart => DateUtil.formatDateStr(widget.model.repairDate,
|
|
|
@ -61,10 +62,9 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
|
|
|
|
return GestureDetector(
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
onTap: () {
|
|
|
|
Get.to(BusinessAndFixDetailPage(model: widget.model));
|
|
|
|
Get.to(() => BusinessAndFixDetailPage(model: widget.model));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
|
padding: EdgeInsets.all(24.w),
|
|
|
@ -86,12 +86,10 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
AkuMap.fixStatus(
|
|
|
|
AkuMap.fixStatus(userInfoModel.canOperation,
|
|
|
|
userProvider.infoModel.canOperation,
|
|
|
|
userInfoModel.canPickUpTicket, widget.model.status),
|
|
|
|
userProvider.infoModel.canPickUpTicket,
|
|
|
|
|
|
|
|
widget.model.status),
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
color: widget.model.status <4
|
|
|
|
color: widget.model.status < 4
|
|
|
|
? Color(0XFFFF4501)
|
|
|
|
? Color(0XFFFF4501)
|
|
|
|
: AppStyle.minorTextColor,
|
|
|
|
: AppStyle.minorTextColor,
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -141,7 +139,8 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
child: FadeInImage.assetNetwork(
|
|
|
|
child: FadeInImage.assetNetwork(
|
|
|
|
placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: imgObj),
|
|
|
|
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
|
|
|
|
|
|
|
|
image: API.image(imgObj ?? '')),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
itemCount: widget.model.imgUrls.length,
|
|
|
|
itemCount: widget.model.imgUrls.length,
|
|
|
@ -150,8 +149,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_buildBottomCard() {
|
|
|
|
_buildBottomCard() {
|
|
|
|
switch (userRole) {
|
|
|
|
if (userInfoModel.canPickUpTicket) {
|
|
|
|
case USER_ROLE.FIXER:
|
|
|
|
|
|
|
|
if (widget.model.status > 4) return SizedBox();
|
|
|
|
if (widget.model.status > 4) return SizedBox();
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
@ -233,8 +231,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
default:
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
widget.homeDisplay ? Divider(height: 24.w) : Divider(height: 48.w),
|
|
|
|
widget.homeDisplay ? Divider(height: 24.w) : Divider(height: 48.w),
|
|
|
@ -243,7 +240,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
child: AkuMaterialButton(
|
|
|
|
child: AkuMaterialButton(
|
|
|
|
height: 64.w,
|
|
|
|
height: 64.w,
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
// Get.to(BusinessAndFixDetailPage(model: widget.model));
|
|
|
|
Get.to(() => BusinessAndFixDetailPage(model: widget.model));
|
|
|
|
},
|
|
|
|
},
|
|
|
|
radius: 4,
|
|
|
|
radius: 4,
|
|
|
|
color: AppStyle.primaryColor,
|
|
|
|
color: AppStyle.primaryColor,
|
|
|
@ -261,7 +258,6 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|