更新装修管理页面点击事件

hmxc
小赖 4 years ago
parent deb19085eb
commit 4bbf39baba

@ -4,7 +4,9 @@ import 'package:aku_community_manager/provider/manage_provider.dart';
import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/ui/home/home_page.dart'; import 'package:aku_community_manager/ui/home/home_page.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -31,6 +33,14 @@ class MyApp extends StatelessWidget {
navigatorObservers: [ navigatorObservers: [
BotToastNavigatorObserver(), BotToastNavigatorObserver(),
], ],
localizationsDelegates: [
GlobalCupertinoLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
],
supportedLocales: [
const Locale('zh'),
],
), ),
); );
} }

@ -18,6 +18,7 @@ class DecorationData {
userName: '李惠政', userName: '李惠政',
phone: '19298540192', phone: '19298540192',
), ),
cycleCheck: CycleCheck(),
), ),
DecorationModel( DecorationModel(
decorationDate: DateTime(2020, 1, 23, 12, 23, 0), decorationDate: DateTime(2020, 1, 23, 12, 23, 0),

@ -7,6 +7,9 @@ enum FIXER_TYPE {
/// ///
CEMENT, CEMENT,
///
PROPERTY,
} }
class FixerModel { class FixerModel {
@ -28,6 +31,8 @@ class FixerTypedModel {
case FIXER_TYPE.CEMENT: case FIXER_TYPE.CEMENT:
return '水泥组'; return '水泥组';
break; break;
case FIXER_TYPE.PROPERTY:
return '物业组';
default: default:
return ''; return '';
} }
@ -66,4 +71,14 @@ class FixerTypedModel {
], ],
), ),
]; ];
static List<FixerTypedModel> propertyModels = [
FixerTypedModel(
type: FIXER_TYPE.PROPERTY,
fixers: [
FixerModel(name: '李国师傅', phone: '18923747283'),
FixerModel(name: '章则林师傅', phone: '18910298345'),
],
),
];
} }

@ -58,5 +58,7 @@ class FixProvider extends ChangeNotifier {
} }
List<FixerTypedModel> _fixerModels = FixerTypedModel.models; List<FixerTypedModel> _fixerModels = FixerTypedModel.models;
List<FixerTypedModel> _propertyModels = FixerTypedModel.propertyModels;
List<FixerTypedModel> get fixerModels => _fixerModels; List<FixerTypedModel> get fixerModels => _fixerModels;
List<FixerTypedModel> get propertyModels => _propertyModels;
} }

@ -8,7 +8,9 @@ import 'package:aku_community_manager/tools/screen_tool.dart';
class DecorationCheckRow extends StatefulWidget { class DecorationCheckRow extends StatefulWidget {
final List<CHECK_TYPE> details; final List<CHECK_TYPE> details;
final Function(List<CHECK_TYPE> details) onChange; final Function(List<CHECK_TYPE> details) onChange;
DecorationCheckRow({Key key, @required this.details, this.onChange}) final bool canTap;
DecorationCheckRow(
{Key key, @required this.details, this.onChange, this.canTap = false})
: super(key: key); : super(key: key);
@override @override
@ -35,9 +37,10 @@ class _DecorationCheckRowState extends State<DecorationCheckRow> {
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return GestureDetector( return GestureDetector(
onTap: widget.onChange == null onTap: !widget.canTap
? null ? null
: () { : () {
widget.onChange(_checkedDetails);
setState(() { setState(() {
_checkedDetails.indexOf(_tempCheckDetails[index]) != -1 _checkedDetails.indexOf(_tempCheckDetails[index]) != -1
? _checkedDetails.remove(_tempCheckDetails[index]) ? _checkedDetails.remove(_tempCheckDetails[index])
@ -48,7 +51,7 @@ class _DecorationCheckRowState extends State<DecorationCheckRow> {
color: Colors.transparent, color: Colors.transparent,
child: DecorationCheckCardWidget( child: DecorationCheckCardWidget(
type: _tempCheckDetails[index], type: _tempCheckDetails[index],
checked: widget.onChange == null checked: !widget.canTap
? false ? false
: _checkedDetails.indexOf(_tempCheckDetails[index]) != -1, : _checkedDetails.indexOf(_tempCheckDetails[index]) != -1,
), ),

@ -0,0 +1,188 @@
import 'package:aku_community_manager/const/resource.dart';
import 'package:aku_community_manager/mock_models/decoration/decoration_model.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 DecorationDepartmentPage extends StatefulWidget {
final DecorationModel model;
DecorationDepartmentPage({Key key, @required this.model}) : super(key: key);
@override
_DecorationDepartmentPageState createState() =>
_DecorationDepartmentPageState();
}
class _DecorationDepartmentPageState extends State<DecorationDepartmentPage> {
FixerModel _pickedFixer;
@override
Widget build(BuildContext context) {
final fixProvider = Provider.of<FixProvider>(context);
return AkuScaffold(
title: '装修指派',
body: ListView.builder(
padding: EdgeInsets.symmetric(vertical: 16.w),
itemBuilder: (context, index) {
return _buildItem(fixProvider.propertyModels[index], index);
},
itemCount: fixProvider.propertyModels.length,
),
bottom: AkuMaterialButton(
height: 96.w,
onPressed: _pickedFixer == null
? null
: () {
widget.model.cycleCheck.authPerson = _pickedFixer;
Get.back();
},
color: AppStyle.primaryColor,
nullColor: AppStyle.primaryColor.withOpacity(0.5),
child: Text(
'选择完成',
style: TextStyle(
color: _pickedFixer == null
? 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 (_pickedFixer?.name != e.name) {
_pickedFixer = e;
} else {
_pickedFixer = null;
}
setState(() {});
},
child: Row(
children: [
AkuBox.w(72),
Checkbox(
checkColor: AppStyle.primaryTextColor,
activeColor: AppStyle.primaryColor,
value: _pickedFixer?.name == e.name,
onChanged: (state) {
if (_pickedFixer == null) {
_pickedFixer = e;
} else {
_pickedFixer = null;
}
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,
),
),
),
);
}
}

@ -3,14 +3,20 @@ import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_check_row.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_check_row.dart';
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_checkbox.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_checkbox.dart';
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_department_page.dart';
import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_util.dart'; import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_util.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart';
import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.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/aku_title_box.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/const/resource.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:common_utils/common_utils.dart';
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart';
class DecorationManagerDetailPage extends StatefulWidget { class DecorationManagerDetailPage extends StatefulWidget {
final DecorationModel model; final DecorationModel model;
@ -24,6 +30,7 @@ class DecorationManagerDetailPage extends StatefulWidget {
class _DecorationManagerDetailStatePage class _DecorationManagerDetailStatePage
extends State<DecorationManagerDetailPage> { extends State<DecorationManagerDetailPage> {
bool get isWaitHandOut => widget.model.type == DecorationType.WAIT_HAND_OUT;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AkuScaffold( return AkuScaffold(
@ -32,9 +39,13 @@ class _DecorationManagerDetailStatePage
padding: EdgeInsets.symmetric(vertical: 16.w), padding: EdgeInsets.symmetric(vertical: 16.w),
children: [ children: [
_buildInfo(), _buildInfo(),
_buildFinishWorkCheck(), widget.model.workFinishCheck == null
? SizedBox()
: _buildFinishWorkCheck(),
_buildCycleCheck(), _buildCycleCheck(),
_buildCheckDetail(), widget.model.type == DecorationType.WAIT_HAND_OUT
? SizedBox()
: _buildCheckDetail(),
], ],
), ),
); );
@ -209,13 +220,13 @@ class _DecorationManagerDetailStatePage
), ),
_buildRow( _buildRow(
title: '接受人', title: '接受人',
subTitle: widget.model.workFinishCheck.authPerson.name, subTitle: widget.model.workFinishCheck?.authPerson?.name,
), ),
_buildRow(title: '所属项目', subTitle: '装修管理'), _buildRow(title: '所属项目', subTitle: '装修管理'),
_buildRow( _buildRow(
title: '开始日期', title: '开始日期',
subTitle: DateUtil.formatDate( subTitle: DateUtil.formatDate(
widget.model.workFinishCheck.startDate, widget.model.workFinishCheck?.startDate,
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
), ),
), ),
@ -232,7 +243,7 @@ class _DecorationManagerDetailStatePage
), ),
), ),
DecorationCheckRow( DecorationCheckRow(
details: widget.model.workFinishCheck.checkDetails, details: widget.model.workFinishCheck?.checkDetails,
onChange: (details) {}, onChange: (details) {},
), ),
], ],
@ -253,15 +264,164 @@ class _DecorationManagerDetailStatePage
), ),
_buildRow( _buildRow(
title: '接受人', title: '接受人',
subTitle: widget.model.cycleCheck.authPerson.name, subTitle: widget.model.cycleCheck?.authPerson?.name,
onTap: isWaitHandOut
? () {
Get.to(DecorationDepartmentPage(
model: widget.model,
)).then((value) => setState(() {}));
}
: null,
), ),
_buildRow(title: '所属项目', subTitle: '装修管理'), _buildRow(title: '所属项目', subTitle: '装修管理'),
_buildRow( _buildRow(
title: '开始日期', title: '开始日期',
subTitle: DateUtil.formatDate( subTitle: DateUtil.formatDate(
widget.model.cycleCheck.startDate, widget.model.cycleCheck?.startDate,
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
), ),
onTap: isWaitHandOut
? () {
showAkuSheet(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
AkuBox.h(96),
AkuBackButton.text(),
Spacer(),
Text(
'开始日期',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
Spacer(),
AkuMaterialButton(
minWidth: (64 + 56).w,
onPressed: () {
Get.back();
},
child: Text(
'确定',
style: TextStyle(
color: AppStyle.secondaryColor,
fontSize: 28.sp,
),
),
),
],
),
Container(
height: 500.w,
child: CupertinoDatePicker(
onDateTimeChanged: (dateTime) {
widget.model.cycleCheck.startDate = dateTime;
},
),
),
],
),
).then((value) {
setState(() {});
});
}
: null,
),
_buildRow(
title: '检查周期',
subTitle: widget.model.cycleCheck.checkCycle == null
? null
: '${widget.model.cycleCheck.checkCycle}',
onTap: isWaitHandOut
? () {
showAkuSheet(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
AkuBox.h(96),
AkuBackButton.text(),
Spacer(),
Text(
'检查周期',
style: TextStyle(
color: AppStyle.primaryTextColor,
fontSize: 32.sp,
fontWeight: FontWeight.bold,
),
),
Spacer(),
AkuMaterialButton(
minWidth: (64 + 56).w,
onPressed: () {
Get.back();
},
child: Text(
'确定',
style: TextStyle(
color: AppStyle.secondaryColor,
fontSize: 28.sp,
),
),
),
],
),
Container(
height: 500.w,
child: CupertinoPicker(
children: [
Center(
child: Text('1天'),
),
Center(
child: Text('3天'),
),
Center(
child: Text('7天'),
),
Center(
child: Text('14天'),
),
Center(
child: Text('30天'),
),
],
itemExtent: 88.w,
onSelectedItemChanged: (int value) {
int realValue = 0;
switch (value) {
case 0:
realValue = 1;
break;
case 1:
realValue = 3;
break;
case 2:
realValue = 7;
break;
case 3:
realValue = 14;
break;
case 4:
realValue = 30;
break;
}
widget.model.cycleCheck.checkCycle = realValue;
},
),
),
],
),
).then((value) {
setState(() {});
});
}
: null,
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -275,7 +435,19 @@ class _DecorationManagerDetailStatePage
), ),
), ),
), ),
DecorationCheckRow(details: widget.model.cycleCheck.checkDetails), DecorationCheckRow(
details: [
CHECK_TYPE.ELECTRIC,
CHECK_TYPE.WATER,
CHECK_TYPE.WALL,
CHECK_TYPE.DOOR_AND_WINDOWS,
CHECK_TYPE.SECURITY,
],
onChange: (details) {
widget.model.cycleCheck.checkDetails = details;
},
canTap: isWaitHandOut,
)
], ],
); );
} }
@ -407,11 +579,16 @@ class _DecorationManagerDetailStatePage
_buildRow({ _buildRow({
String title, String title,
String subTitle, String subTitle,
VoidCallback onTap,
}) { }) {
return Container( return Material(
color: Colors.transparent,
child: InkWell(
onTap: onTap,
child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
border: border: Border(
Border(bottom: BorderSide(color: Color(0xFFE8E8E8), width: 1.w)), bottom: BorderSide(color: Color(0xFFE8E8E8), width: 1.w)),
), ),
child: InkWell( child: InkWell(
child: Row( child: Row(
@ -426,16 +603,28 @@ class _DecorationManagerDetailStatePage
), ),
Spacer(), Spacer(),
Text( Text(
subTitle, TextUtil.isEmpty(subTitle) ? '请选择' : subTitle,
style: TextStyle( style: TextStyle(
color: AppStyle.primaryTextColor, color: TextUtil.isEmpty(subTitle)
? AppStyle.minorTextColor
: AppStyle.primaryTextColor,
fontSize: 28.w, fontSize: 28.w,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
onTap == null ? SizedBox() : AkuBox.w(24),
onTap == null
? SizedBox()
: Icon(
Icons.arrow_forward_ios,
size: 32.w,
color: AppStyle.minorTextColor,
),
], ],
), ),
), ),
),
),
); );
} }
} }

@ -6,7 +6,7 @@ import 'package:get/get.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
///show bottom sheet ///show bottom sheet
showAkuSheet({ Future showAkuSheet({
Widget child, Widget child,
}) async { }) async {
await Get.bottomSheet( await Get.bottomSheet(
@ -20,12 +20,7 @@ showAkuSheet({
); );
} }
Future showItemSheet({ Future showNormalSheet(String title, List<Widget> children) async {
String title,
List<String> items,
String selectItem,
Function(String result) onTap,
}) async {
await showAkuSheet( await showAkuSheet(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -49,7 +44,21 @@ Future showItemSheet({
Spacer(), Spacer(),
], ],
), ),
...items.map((e) { ...children,
],
),
);
}
Future showItemSheet({
String title,
List<String> items,
String selectItem,
Function(String result) onTap,
}) async {
await showNormalSheet(
title,
items.map((e) {
return AkuMaterialButton( return AkuMaterialButton(
height: 96.w, height: 96.w,
minWidth: double.infinity, minWidth: double.infinity,
@ -68,8 +77,5 @@ Future showItemSheet({
), ),
), ),
); );
}).toList(), }).toList());
],
),
);
} }

@ -141,6 +141,11 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.6" version: "2.1.6"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_plugin_android_lifecycle: flutter_plugin_android_lifecycle:
dependency: transitive dependency: transitive
description: description:
@ -202,6 +207,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.1" version: "1.1.1"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:

@ -23,6 +23,8 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.

Loading…
Cancel
Save