diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index dc196fa..a0fa928 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -1,4 +1,5 @@ // Flutter imports: +import 'package:aku_community_manager/tools/user_tool.dart'; import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_page.dart'; import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; @@ -69,8 +70,9 @@ class _ApplicationPageState extends State AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, () => WarningPage()), AppApplication( '访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, () => VisitorManagerPage()), - AppApplication( - '报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, () => BusinessAndFixPage()), + if (UserTool.userProvider.infoModel!.manager) + AppApplication( + '报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, () => BusinessAndFixPage()), AppApplication( '物品出户', R.ASSETS_HOME_IC_ARTICLE_PNG, () => ItemsOutdoorPage()), AppApplication( @@ -91,9 +93,11 @@ class _ApplicationPageState extends State AppApplication('规程管理', R.ASSETS_HOME_RULES_PNG, () => RulesManagePage()), AppApplication( '卫生管理', R.ASSETS_HOME_HYGIENICE_PNG, () => HygienceManagePage()), - AppApplication('考勤管理', R.ASSETS_HOME_CLOCK_IN_OUT_PNG, () => ClockInOutPage()), + AppApplication( + '考勤管理', R.ASSETS_HOME_CLOCK_IN_OUT_PNG, () => ClockInOutPage()), AppApplication('访谈管理', R.ASSETS_HOME_INTERVIEW_PNG, () => InterviewPage()), - AppApplication('家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()), + AppApplication( + '家政服务', R.ASSETS_HOME_HOUSE_KEEPING_PNG, () => HouseKeepingPage()), ]; @override diff --git a/lib/ui/home/search_workorder_page.dart b/lib/ui/home/search_workorder_page.dart index f01863f..d1052d8 100644 --- a/lib/ui/home/search_workorder_page.dart +++ b/lib/ui/home/search_workorder_page.dart @@ -1,4 +1,5 @@ // Flutter imports: +import 'package:aku_community_manager/tools/user_tool.dart'; import 'package:aku_community_manager/ui/manage_pages/clock_in_out/clock_in_out_page.dart'; import 'package:aku_community_manager/ui/manage_pages/facilities/facilities_select_page.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_page.dart'; @@ -43,17 +44,24 @@ class SearchWorkOrderPage extends StatefulWidget { class _SearchWorkOrderpageState extends State { TextEditingController? _textController; List _wisdomApplications = [ - AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, ()=>WarningPage()), - AppApplication('访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, ()=>VisitorManagerPage()), - AppApplication('报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, ()=>BusinessAndFixPage()), - AppApplication('物品出户', R.ASSETS_HOME_IC_ARTICLE_PNG,()=> ItemsOutdoorPage()), + AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, () => WarningPage()), AppApplication( - '装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, ()=>NewRenovationPage()), + '访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, () => VisitorManagerPage()), + if (UserTool.userProvider.infoModel!.manager) + AppApplication( + '报事报修', R.ASSETS_HOME_IC_SERVICE_PNG, () => BusinessAndFixPage()), AppApplication( - '活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, ()=>ActivityManagerPage()), - AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG,()=> BorrowManagerPage()), - AppApplication('巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, ()=>InspectionManagePage()), - AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG,()=> GreenManagePage()), + '物品出户', R.ASSETS_HOME_IC_ARTICLE_PNG, () => ItemsOutdoorPage()), + AppApplication( + '装修管理', R.ASSETS_HOME_IC_DECORATION_PNG, () => NewRenovationPage()), + AppApplication( + '活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, () => ActivityManagerPage()), + AppApplication( + '借还管理', R.ASSETS_HOME_IC_BORROW_PNG, () => BorrowManagerPage()), + AppApplication( + '巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, () => InspectionManagePage()), + AppApplication( + '绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, () => GreenManagePage()), AppApplication( '设施检查', R.ASSETS_HOME_IC_FACILITIES_PNG, () => FacilitiesSelectPage()), AppApplication( diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart index da8043e..73540b6 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_card.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_card.dart @@ -1,95 +1,350 @@ -import 'package:aku_community_manager/models/manager/house_keeping/house_keeping_list_model.dart'; +import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/style/app_style.dart'; -import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:aku_community_manager/tools/user_tool.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_detail_page.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; -import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; -class HouseKeepingCard extends StatefulWidget { - final HouseKeepingListModel model; - HouseKeepingCard({Key? key, required this.model}) : super(key: key); +// class HouseKeepingCard extends StatefulWidget { +// final HouseKeepingListModel model; +// HouseKeepingCard({Key? key, required this.model}) : super(key: key); - @override - _HouseKeepingCardState createState() => _HouseKeepingCardState(); -} +// @override +// _HouseKeepingCardState createState() => _HouseKeepingCardState(); +// } + +// class _HouseKeepingCardState extends State { +// @override +// Widget build(BuildContext context) { +// return MaterialButton( +// minWidth: double.infinity, +// color: Colors.white, +// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)), +// elevation: 0, +// padding: EdgeInsets.all(24.w), +// onPressed: () { +// Get.to(() => HouseKeepingDetailPage(model:widget.model)); +// }, +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Row( +// children: [ +// '家政服务'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), +// Spacer(), +// ], +// ), +// 16.w.heightBox, +// AkuDivider.horizontal(), +// 24.w.heightBox, +// ...[ +// _rowTile( +// R.ASSETS_MANAGE_IC_RENWU_PNG, +// '房产名称', +// widget.model.roomName!.text +// .size(24.sp) +// .color(kTextSubColor) +// .make()), +// _rowTile( +// R.ASSETS_MANAGE_IC_RENWU_PNG, +// '人数', +// widget.model.num +// .toString() +// .text +// .size(24.sp) +// .color(kTextSubColor) +// .make()), +// _rowTile( +// R.ASSETS_MANAGE_IC_RENWU_PNG, +// '负责人姓名', +// widget.model.leaderName!.text +// .size(24.sp) +// .color(kTextSubColor) +// .make()), +// _rowTile( +// R.ASSETS_MESSAGE_IC_PHONE_PNG, +// '负责人手机', +// widget.model.leaderTel!.text +// .size(24.sp) +// .color(kTextSubColor) +// .make()), +// ].sepWidget(separate: 12.w.heightBox), +// ], +// ), +// ); +// } + +// Widget _rowTile(String iconPath, String title, Widget content) { +// return Row( +// children: [ +// SizedBox( +// width: 40.w, +// height: 40.w, +// child: Image.asset(iconPath), +// ), +// 12.w.widthBox, +// title.text.size(24.sp).color(kTextSubColor).make(), +// Spacer(), +// content, +// ], +// ); +// } +// } +class HouseKeepingCard extends StatelessWidget { + final VoidCallback callRefresh; + const HouseKeepingCard({Key? key, required this.callRefresh}) + : super(key: key); -class _HouseKeepingCardState extends State { @override Widget build(BuildContext context) { - return MaterialButton( - minWidth: double.infinity, - color: Colors.white, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)), - elevation: 0, - padding: EdgeInsets.all(24.w), - onPressed: () { - Get.to(() => HouseKeepingDetailPage(model:widget.model)); + return GestureDetector( + onTap: () async { + await Get.to(() => HouseKeepingDetailPage()); + callRefresh(); }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - '家政服务'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), - Spacer(), - ], - ), - 16.w.heightBox, - AkuDivider.horizontal(), - 24.w.heightBox, - ...[ - _rowTile( - R.ASSETS_MANAGE_IC_RENWU_PNG, - '房产名称', - widget.model.roomName!.text - .size(24.sp) - .color(kTextSubColor) - .make()), - _rowTile( - R.ASSETS_MANAGE_IC_RENWU_PNG, - '人数', - widget.model.num - .toString() - .text - .size(24.sp) - .color(kTextSubColor) - .make()), - _rowTile( - R.ASSETS_MANAGE_IC_RENWU_PNG, - '负责人姓名', - widget.model.leaderName!.text - .size(24.sp) - .color(kTextSubColor) - .make()), - _rowTile( - R.ASSETS_MESSAGE_IC_PHONE_PNG, - '负责人手机', - widget.model.leaderTel!.text - .size(24.sp) - .color(kTextSubColor) - .make()), - ].sepWidget(separate: 12.w.heightBox), - ], + child: Container( + padding: EdgeInsets.all(24.w), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + AkuChipBox(title: '家政服务'), + 16.w.widthBox, + Expanded( + child: Text( + 'dateStart', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.sp, + ), + ), + ), + Text( + // widget.hasFinished + // ? '已处理' + // : AkuMap.fixStatus(userInfoModel!.canSendTicket, + + // userInfoModel!.canPickUpTicket, widget.model.status!), + '', + style: + // widget.hasFinished + true + ? TextStyle(color: AppStyle.minorTextColor) + : TextStyle( + // color: widget.model.status! < 4 + // ? Color(0XFFFF4501) + // : AppStyle.minorTextColor, + ), + ), + ], + ), + 24.w.heightBox, + Text( + // widget.model.reportDetail! + '', + // maxLines: widget.homeDisplay ? 1 : null, + // overflow: !widget.homeDisplay + // ? TextOverflow.visible + // : TextOverflow.ellipsis, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + 16.w.heightBox, + _buildImgs(), + // !widget.canSeeBottomButton ? SizedBox() : _getBottomCard(), + _getBottomCard() + ], + ), + // margin: + // widget.homeDisplay ? EdgeInsets.zero : EdgeInsets.only(top: 16.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), ), ); } - Widget _rowTile(String iconPath, String title, Widget content) { - return Row( + _buildImgs() { + return Container( + height: 168.w, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) { + // var imgObj = widget.model.imgUrls![index].url; + var imgObj = ''; + return Container( + margin: EdgeInsets.symmetric(horizontal: 8.w), + height: 168.w, + width: 168.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.w), + ), + clipBehavior: Clip.antiAlias, + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: API.image('')), + ); + }, + // itemCount: widget.model.imgUrls!.length, + itemCount: 1, + ), + ); + } + + _getBottomCard() { + return Column( children: [ - SizedBox( - width: 40.w, - height: 40.w, - child: Image.asset(iconPath), - ), - 12.w.widthBox, - title.text.size(24.sp).color(kTextSubColor).make(), - Spacer(), - content, + Divider(height: 48.w), + Align( + alignment: Alignment.centerRight, + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: _getButtons())), ], ); } + + _getButtons() { + switch (1) { + case 1: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async { + // Get.to(() => BusinessAndFixDetailPage(model: widget.model)); + // if (widget.callRefresh != null) { + // widget.callRefresh!(); + // } + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + (UserTool.userProvider.infoModel!.canSendTicket + ? '立即派单' + : '查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 2: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async { + // Get.to(() => BusinessAndFixDetailPage(model: widget.model)); + // if (widget.callRefresh != null) { + // widget.callRefresh!(); + // } + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + (UserTool.userProvider.infoModel!.canSendTicket + ? '改派' + : UserTool.userProvider.infoModel!.canPickUpTicket + ? '立即接单' + : '查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 3: + return [ + UserTool.userProvider.infoModel!.canPickUpTicket + ? AkuMaterialButton( + height: 64.w, + onPressed: () async { + // Get.to(() => Get.to(() => + // FixMoreTimePage(dispatchId: widget.model.dispatchId!))); + // if (widget.callRefresh != null) { + // widget.callRefresh!(); + // } + }, + 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, + ), + ), + ) + : SizedBox(), + AkuMaterialButton( + height: 64.w, + onPressed: () async { + // Get.to(() => BusinessAndFixDetailPage(model: widget.model)); + // if (widget.callRefresh != null) { + // widget.callRefresh!(); + // } + }, + radius: 4, + color: AppStyle.primaryColor, + padding: EdgeInsets.symmetric(horizontal: 24.w), + child: Text( + (UserTool.userProvider.infoModel!.canPickUpTicket + ? '处理完成' + : '查看详情'), + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.sp, + height: 40 / 28, + ), + ), + ), + ]; + case 4: + return [ + AkuMaterialButton( + height: 64.w, + onPressed: () async { + // Get.to(() => BusinessAndFixDetailPage(model: widget.model)); + // if (widget.callRefresh != null) { + // widget.callRefresh!(); + // } + }, + 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, + ), + ), + ), + ]; + default: + return []; + } + } } diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart new file mode 100644 index 0000000..a87f170 --- /dev/null +++ b/lib/ui/manage_pages/house_keeping/house_keeping_department_page.dart @@ -0,0 +1,167 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:expandable/expandable.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community_manager/utils/extension/list_extension.dart'; + +class HouseKeepingDepartmentPage extends StatefulWidget { + HouseKeepingDepartmentPage({Key? key}) : super(key: key); + + @override + _HouseKeepingDepartmentPageState createState() => + _HouseKeepingDepartmentPageState(); +} + +class _HouseKeepingDepartmentPageState + extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '派单人员列表', + body: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async {}, + child: ListView( + children: [ + _buildItem(1), + ], + )), + ); + } + + _buildItem(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.name!', + 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, + ), + ...[].map((e) { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + AkuMaterialButton( + height: 96.w, + onPressed: () { + // if (_pickedFixers + // .indexWhere((element) => element.id == e.id) == + // -1) { + // _pickedFixers.add(e); + // } else { + // _pickedFixers.remove(e); + // } + // _reportModel!.operato = e.id; + setState(() {}); + }, + child: Row( + children: [ + 72.w.widthBox, + Checkbox( + checkColor: AppStyle.primaryTextColor, + activeColor: AppStyle.primaryColor, + value: false, + onChanged: (state) { + // if (_pickedFixers.indexOf(e) == -1) { + // _pickedFixers.add(e); + // } else { + // _pickedFixers.remove(e); + // } + // if (_reportModel!.operato == e.id) { + // _reportModel!.operato = -1; + // } else { + // _reportModel!.operato = e.id; + // } + 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.tel!, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + 100.w.widthBox, + ], + ), + ), + ].sepWidget( + separate: 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, + ), + ), + ), + ); + } +} diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart index 411049e..8d1014a 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_detail_page.dart @@ -1,15 +1,151 @@ -import 'package:aku_community_manager/models/manager/house_keeping/house_keeping_list_model.dart'; +import 'package:aku_community_manager/const/api.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart'; +import 'package:aku_community_manager/ui/widgets/app_widgets/bee_grid_image_view.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; -import 'package:aku_community_manager/tools/extensions/list_extension_tool.dart'; +import 'package:aku_community_manager/utils/extension/list_extension.dart'; +// class HouseKeepingDetailPage extends StatefulWidget { +// final HouseKeepingListModel model; +// HouseKeepingDetailPage({Key? key, required this.model}) : super(key: key); +// @override +// _HouseKeepingDetailPageState createState() => _HouseKeepingDetailPageState(); +// } + +// class _HouseKeepingDetailPageState extends State { +// @override +// Widget build(BuildContext context) { +// return AkuScaffold( +// title: '服务详情', +// body: ListView( +// padding: EdgeInsets.all(32.w), +// children: [ +// _interviewInfo(), +// 20.w.heightBox, +// _contentWidget(), +// ], +// ), +// ); +// } + +// Widget _interviewInfo() { +// return Container( +// width: double.infinity, +// decoration: BoxDecoration( +// color: Colors.white, borderRadius: BorderRadius.circular(8.w)), +// padding: EdgeInsets.all(24.w), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Row( +// children: [ +// '家政服务'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), +// Spacer(), +// ], +// ), +// 16.w.heightBox, +// AkuDivider.horizontal(), +// 24.w.heightBox, +// ...[ +// _rowTile( +// R.ASSETS_MANAGE_IC_RENWU_PNG, +// '房产名称', +// widget.model.roomName!.text +// .size(24.sp) +// .color(kTextSubColor) +// .make()), +// _rowTile( +// R.ASSETS_MANAGE_IC_RENWU_PNG, +// '人数', +// widget.model.num +// .toString() +// .text +// .size(24.sp) +// .color(kTextSubColor) +// .make()), +// _rowTile( +// R.ASSETS_MANAGE_IC_RENWU_PNG, +// '负责人姓名', +// widget.model.leaderName!.text +// .size(24.sp) +// .color(kTextSubColor) +// .make()), +// _rowTile( +// R.ASSETS_MESSAGE_IC_PHONE_PNG, +// '负责人手机', +// widget.model.leaderTel!.text +// .size(24.sp) +// .color(kTextSubColor) +// .make()), +// ].sepWidget(separate: 12.w.heightBox), +// // _getBottomButtons(widget.model.status), +// ], +// ), +// ); +// } + +// Widget _contentWidget() { +// return Container( +// width: double.infinity, +// decoration: BoxDecoration( +// color: Colors.white, borderRadius: BorderRadius.circular(8.w)), +// padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), +// child: Column( +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Row( +// children: [ +// '访谈内容'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), +// Spacer(), +// ], +// ), +// 16.w.heightBox, +// AkuDivider.horizontal(), +// 20.w.heightBox, +// widget.model.content!.text.size(28.sp).color(kTextPrimaryColor).make(), +// 40.w.heightBox, +// Row( +// children: [ +// Spacer(), +// widget.model.createDate!.text +// .size(24.sp) +// .color(kTextSubColor) +// .make(), +// ], +// ), +// ], +// ), +// ); +// } + +// Widget _rowTile(String iconPath, String title, Widget content) { +// return Row( +// children: [ +// SizedBox( +// width: 40.w, +// height: 40.w, +// child: Image.asset(iconPath), +// ), +// 12.w.widthBox, +// title.text.size(24.sp).color(kTextSubColor).make(), +// Spacer(), +// content, +// ], +// ); +// } +// } class HouseKeepingDetailPage extends StatefulWidget { - final HouseKeepingListModel model; - HouseKeepingDetailPage({Key? key, required this.model}) : super(key: key); + HouseKeepingDetailPage({Key? key}) : super(key: key); @override _HouseKeepingDetailPageState createState() => _HouseKeepingDetailPageState(); @@ -18,121 +154,258 @@ class HouseKeepingDetailPage extends StatefulWidget { class _HouseKeepingDetailPageState extends State { @override Widget build(BuildContext context) { + var payfeePrice = Container( + padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.w), + color: Colors.white, + child: Row( + children: [ + '服务费用'.text.size(28.sp).black.make(), + Spacer(), + '¥ ${0}'.text.size(32.sp).color(Colors.red).make() + ], + ), + ); return AkuScaffold( title: '服务详情', body: ListView( - padding: EdgeInsets.all(32.w), - children: [ - _interviewInfo(), - 20.w.heightBox, - _contentWidget(), - ], + children: [ + _buildInfo(), + _buildProcess(), + _serviceFeedBack(), + payfeePrice, + _buildEvaluate(), + ].sepWidget(separate: 16.w.heightBox), ), + bottom: _getBottomButtons(1), ); } - Widget _interviewInfo() { + Widget _getBottomButtons(int status) { + switch (status) { + case 1: + return AkuBottomButton( + title: '立即提交', + onTap: () { + Get.to(() => HouseKeepingFeedBackPage()); + }, + ); + case 2: + return AkuBottomButton( + title: '', + onTap: () {}, + ); + default: + return SizedBox(); + } + } + + Widget _serviceFeedBack() { return Container( width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(8.w)), - padding: EdgeInsets.all(24.w), + color: Colors.white, + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + '服务反馈'.text.size(36.sp).bold.black.make(), + 40.w.heightBox, Row( children: [ - '家政服务'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), + '完成情况'.text.size(28.sp).color(kTextSubColor).make(), Spacer(), + 'widget.model.completionString'.text.size(32.sp).black.make() + ], + ), + 40.w.heightBox, + Row( + children: [ + Image.asset( + R.ASSETS_PLACEHOLDER_WEBP, + width: 40.w, + height: 40.w, + ), + 8.w.widthBox, + '维修人'.text.size(28.sp).color(kTextSubColor).make(), + Spacer(), + 'widget.model.proposerName'.text.size(28.sp).black.make(), ], ), 16.w.heightBox, - AkuDivider.horizontal(), + Row( + children: [ + Image.asset( + R.ASSETS_PLACEHOLDER_WEBP, + width: 40.w, + height: 40.w, + ), + 8.w.widthBox, + '联系电话'.text.size(28.sp).color(kTextSubColor).make(), + Spacer(), + 'widget.model.proposerTel'.text.size(28.sp).black.make(), + ], + ), + 16.w.heightBox, + 40.w.heightBox, + '处理描述'.text.size(28.sp).color(kTextSubColor).make(), 24.w.heightBox, - ...[ - _rowTile( - R.ASSETS_MANAGE_IC_RENWU_PNG, - '房产名称', - widget.model.roomName!.text - .size(24.sp) - .color(kTextSubColor) - .make()), - _rowTile( - R.ASSETS_MANAGE_IC_RENWU_PNG, - '人数', - widget.model.num - .toString() - .text - .size(24.sp) - .color(kTextSubColor) - .make()), - _rowTile( - R.ASSETS_MANAGE_IC_RENWU_PNG, - '负责人姓名', - widget.model.leaderName!.text - .size(24.sp) - .color(kTextSubColor) - .make()), - _rowTile( - R.ASSETS_MESSAGE_IC_PHONE_PNG, - '负责人手机', - widget.model.leaderTel!.text - .size(24.sp) - .color(kTextSubColor) - .make()), - ].sepWidget(separate: 12.w.heightBox), - // _getBottomButtons(widget.model.status), + ('widget.model.processDescription') + .text + .size(2) + .black + .softWrap(true) + .make(), + BeeGridImageView(urls: []) ], ), ); } - Widget _contentWidget() { + Widget _buildEvaluate() { return Container( width: double.infinity, - decoration: BoxDecoration( - color: Colors.white, borderRadius: BorderRadius.circular(8.w)), - padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w), + color: Colors.white, child: Column( + mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ + '服务评价'.text.size(36.sp).bold.black.make(), + 40.w.heightBox, Row( children: [ - '访谈内容'.text.size(32.sp).color(kTextPrimaryColor).bold.make(), - Spacer(), + '综合评价'.text.size(28.sp).color(kTextSubColor).make(), + 40.w.widthBox, + RatingBar( + ignoreGestures: true, + allowHalfRating: true, + itemPadding: EdgeInsets.symmetric(horizontal: 15.w), + itemSize: 32.w, + initialRating: (0).toDouble(), + ratingWidget: RatingWidget( + empty: Icon( + CupertinoIcons.star, + ), + full: Icon( + CupertinoIcons.star_fill, + color: kPrimaryColor, + ), + half: Icon( + CupertinoIcons.star_lefthalf_fill, + color: kPrimaryColor, + )), + onRatingUpdate: (value) {}) ], ), - 16.w.heightBox, + 40.w.heightBox, AkuDivider.horizontal(), - 20.w.heightBox, - widget.model.content!.text.size(28.sp).color(kTextPrimaryColor).make(), 40.w.heightBox, - Row( - children: [ - Spacer(), - widget.model.createDate!.text - .size(24.sp) - .color(kTextSubColor) - .make(), - ], - ), + ('').text.size(28.sp).black.softWrap(true).make(), + BeeGridImageView(urls: []) ], ), ); } - Widget _rowTile(String iconPath, String title, Widget content) { + _buildInfo() { + return AkuTitleBox( + title: '报修信息', + suffix: ''.text.size(28.sp).black.make(), + children: [ + 16.w.heightBox, + _buildTile(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '报修人', ''), + _buildTile(R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话', ''), + _buildTile(R.ASSETS_MESSAGE_IC_AREA_PNG, '报修区域', ''), + 8.w.heightBox, + Text( + '', + 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: [].map((e) { + return ClipRRect( + borderRadius: BorderRadius.circular(4.w), + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: API.image('')), + ); + }).toList(), + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + ), + ], + ); + } + + Widget _buildTile(String asset, String title, String subTitle) { return Row( children: [ - SizedBox( - width: 40.w, + 56.w.heightBox, + Image.asset( + asset, height: 40.w, - child: Image.asset(iconPath), + width: 40.w, + ), + 4.w.widthBox, + Text( + title, + style: TextStyle( + fontSize: 28.sp, + color: AppStyle.minorTextColor, + ), ), - 12.w.widthBox, - title.text.size(24.sp).color(kTextSubColor).make(), Spacer(), - content, + Text( + subTitle, + style: TextStyle( + fontSize: 28.sp, + color: AppStyle.primaryTextColor, + ), + ), + ], + ); + } + + _buildProcess() { + return AkuTitleBox( + title: '报修进程', + children: [].map((e) { + return _buildProcessTile( + '', + DateUtil.formatDateStr(e.operationDate!, + format: 'yyyy-MM-dd HH:mm:ss'), + ); + }).toList(), + ); + } + + Widget _buildProcessTile(String title, String date) { + return Row( + children: [ + 56.w.heightBox, + Text( + title, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + Spacer(), + Text( + date, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), ], ); } diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart new file mode 100644 index 0000000..3890802 --- /dev/null +++ b/lib/ui/manage_pages/house_keeping/house_keeping_feed_back_page.dart @@ -0,0 +1,191 @@ +import 'dart:io'; + +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/tools/aku_divider.dart'; +import 'package:aku_community_manager/ui/widgets/app_widgets/aku_pick_image_widget.dart'; +import 'package:aku_community_manager/ui/widgets/app_widgets/aku_single_check_button.dart'; +import 'package:aku_community_manager/ui/widgets/app_widgets/bee_grid_image_view.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +class HouseKeepingFeedBackPage extends StatefulWidget { + HouseKeepingFeedBackPage({Key? key}) : super(key: key); + + @override + _HouseKeepingFeedBackPageState createState() => + _HouseKeepingFeedBackPageState(); +} + +class _HouseKeepingFeedBackPageState extends State { + int _feedBackStatus = 0; + late TextEditingController _editingController; + late TextEditingController _priceController; + + List _files = []; + @override + void initState() { + super.initState(); + _editingController = TextEditingController(); + _priceController = TextEditingController(); + } + + @override + void dispose() { + _editingController.dispose(); + _priceController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '工作汇报', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + _buidlInfo(), + 16.w.heightBox, + _buildFeedBack(), + 16.w.heightBox, + _payTile(), + ], + ), + ); + } + + Widget _buidlInfo() { + return Container( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), + color: Colors.white, + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '服务信息'.text.size(36.sp).black.bold.make(), + 40.w.heightBox, + ''.text.size(28.sp).black.make(), + 16.w.heightBox, + BeeGridImageView(urls: []), + ], + ), + ); + } + + Widget _buildFeedBack() { + return Container( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 24.w), + width: double.infinity, + color: Colors.white, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '服务反馈'.text.size(36.sp).black.bold.make(), + 40.w.heightBox, + '完成情况'.text.size(28.sp).black.make(), + 24.w.heightBox, + Row( + children: [ + AkuSingleCheckButton( + text: '未完成', + value: 1, + gropValue: _feedBackStatus, + onPressed: () { + _feedBackStatus = 1; + setState(() {}); + }), + 40.w.widthBox, + AkuSingleCheckButton( + text: '已完成', + value: 2, + gropValue: _feedBackStatus, + onPressed: () { + _feedBackStatus = 2; + setState(() {}); + }), + ], + ), + 40.w.heightBox, + '处理描述'.text.size(28.sp).black.make(), + 24.w.heightBox, + Container( + padding: EdgeInsets.all(24.w), + width: double.infinity, + decoration: BoxDecoration( + border: Border.all(color: Colors.black, width: 1.w), + borderRadius: BorderRadius.circular(22.w)), + child: TextField( + controller: _editingController, + decoration: InputDecoration( + contentPadding: EdgeInsets.zero, + isDense: true, + border: InputBorder.none, + hintText: '请输入处理描述', + hintStyle: TextStyle( + fontSize: 28.sp, + color: kTextSubColor, + fontWeight: FontWeight.bold, + )), + style: TextStyle( + fontSize: 28.sp, + color: Colors.black, + ), + maxLines: 10, + minLines: 5, + ), + ), + 40.w.heightBox, + '上传服务完成照片'.text.size(28.sp).black.make(), + 24.w.heightBox, + AkuPickImageWidget(onChanged: (files) { + _files = files; + }) + ], + ), + ); + } + + Widget _payTile() { + return Container( + width: double.infinity, + padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w), + color: Colors.white, + child: Column( + children: [ + Row( + children: [ + '支付费用'.text.size(28.sp).black.make(), + 350.w.widthBox, + '¥'.text.size(32.sp).bold.color(Colors.red).make(), + 24.w.widthBox, + TextField( + controller: _editingController, + inputFormatters: [ + FilteringTextInputFormatter.allow( + RegExp(r'^[0-9][\.\d]*(,\d+)?$')) + ], + keyboardType: TextInputType.number, + decoration: InputDecoration( + contentPadding: EdgeInsets.zero, + isDense: true, + border: InputBorder.none, + hintText: '请输入金额', + hintStyle: TextStyle( + fontSize: 32.sp, + color: kTextSubColor, + fontWeight: FontWeight.bold)), + style: TextStyle( + fontSize: 32.sp, + color: Colors.black, + ), + ).expand(), + ], + ), + 24.w.heightBox, + AkuDivider.horizontal() + ], + ), + ); + } +} diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_page.dart b/lib/ui/manage_pages/house_keeping/house_keeping_page.dart index 92003b4..e5279e6 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_page.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_page.dart @@ -1,6 +1,7 @@ import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_add_page.dart'; import 'package:aku_community_manager/ui/manage_pages/house_keeping/house_keeping_view.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_tab_bar.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -15,7 +16,7 @@ class HouseKeepingPage extends StatefulWidget { class _HouseKeepingPageState extends State with TickerProviderStateMixin { - List _tabs = ['未处理', '已处理']; + List _tabs = ['全部', '待派单', '已派单', '处理中', '待支付', '待评价', '已完成']; late TabController _tabController; @override void initState() { @@ -33,27 +34,34 @@ class _HouseKeepingPageState extends State Widget build(BuildContext context) { return AkuScaffold( title: '家政服务', - // appBarBottom: PreferredSize( - // preferredSize: Size.fromHeight(88.w), - // child: AkuTabBar(controller: _tabController, tabs: _tabs), - // ), - // body: TabBarView( - // children: List.generate( - // _tabs.length, - // (index) => HouseKeepingView( - // index:index, - // ), - // ), - // ), + appBarBottom: PreferredSize( + preferredSize: Size.fromHeight(88.w), + child: AkuTabBar(controller: _tabController, tabs: _tabs,isScrollable: true,), + ), + body: TabBarView( + controller: _tabController, + children: List.generate( + _tabs.length, + (index) => HouseKeepingView( + index: index, + ), + ), + ), actions: [ IconButton( - iconSize: 40.w, - icon: Icon(CupertinoIcons.plus_circle,size: 40.w,color: Colors.black,), + iconSize: 40.w, + icon: Icon( + CupertinoIcons.plus_circle, + size: 40.w, + color: Colors.black, + ), onPressed: () { Get.to(() => HouseKeepingAddPage()); }) ], - body: HouseKeepingView(index: 0,), + // body: HouseKeepingView( + // index: 0, + // ), ); } } diff --git a/lib/ui/manage_pages/house_keeping/house_keeping_view.dart b/lib/ui/manage_pages/house_keeping/house_keeping_view.dart index 33ab7a3..14fee53 100644 --- a/lib/ui/manage_pages/house_keeping/house_keeping_view.dart +++ b/lib/ui/manage_pages/house_keeping/house_keeping_view.dart @@ -26,7 +26,7 @@ class _HouseKeepingViewState extends State { @override void dispose() { - _refreshController!.dispose(); + _refreshController?.dispose(); super.dispose(); } @@ -34,6 +34,7 @@ class _HouseKeepingViewState extends State { Widget build(BuildContext context) { return BeeListView( path: API.manage.houseKeepingList, + // extraParams: {"status": widget.index == 0 ? null : widget.index}, controller: _refreshController, convert: (models) { return models.tableList! @@ -44,7 +45,11 @@ class _HouseKeepingViewState extends State { return ListView.separated( padding: EdgeInsets.all(24.w), itemBuilder: (context, index) { - return HouseKeepingCard(model: items[index]); + return HouseKeepingCard( + callRefresh: () { + _refreshController!.callRefresh(); + }, + ); }, separatorBuilder: (_, __) { return 24.w.heightBox; diff --git a/lib/ui/widgets/app_widgets/bee_grid_image_view.dart b/lib/ui/widgets/app_widgets/bee_grid_image_view.dart new file mode 100644 index 0000000..ebb7e51 --- /dev/null +++ b/lib/ui/widgets/app_widgets/bee_grid_image_view.dart @@ -0,0 +1,51 @@ +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/const/resource.dart'; +import 'package:aku_community_manager/ui/widgets/inner/bee_image_preview.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class BeeGridImageView extends StatelessWidget { + final List urls; + final EdgeInsetsGeometry padding; + const BeeGridImageView({ + Key? key, + required this.urls, + this.padding = EdgeInsets.zero, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + if (urls.isEmpty) return SizedBox(); + return GridView.builder( + padding: padding, + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, + crossAxisSpacing: 16.w, + mainAxisSpacing: 16.w, + ), + itemBuilder: (context, index) { + return GestureDetector( + onTap: () { + BeeImagePreview.toPath(path: urls[index], tag: urls[index]); + }, + child: Hero( + tag: urls[index], + child: ClipRRect( + borderRadius: BorderRadius.circular(8.w), + child: FadeInImage.assetNetwork( + height: 184.w, + width: 184.w, + placeholder: R.ASSETS_PLACEHOLDER_WEBP, + image: API.image(urls[index]), + fit: BoxFit.cover, + ), + ), + ), + ); + }, + itemCount: urls.length, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + ); + } +} diff --git a/lib/ui/widgets/common/aku_button.dart b/lib/ui/widgets/common/aku_button.dart index c9ede70..9c10dde 100644 --- a/lib/ui/widgets/common/aku_button.dart +++ b/lib/ui/widgets/common/aku_button.dart @@ -5,12 +5,10 @@ import 'package:aku_community_manager/ui/widgets/common/aku_material_button.dart import 'package:flutter/material.dart'; class AkuButton extends StatefulWidget { - @required final Widget child; final double height; final double radius; final EdgeInsets padding; - @required final VoidCallback? onPressed; final Color color; final double width; diff --git a/lib/ui/widgets/common/bee_list_view.dart b/lib/ui/widgets/common/bee_list_view.dart index f2a30fd..7e325e8 100644 --- a/lib/ui/widgets/common/bee_list_view.dart +++ b/lib/ui/widgets/common/bee_list_view.dart @@ -63,10 +63,10 @@ class BeeListView extends StatefulWidget { final Map? extraParams; BeeListView({ Key? key, - /*required*/ required this.path, - /*required*/ required this.controller, - /*required*/ required this.convert, - /*required*/ required this.builder, + required this.path, + required this.controller, + required this.convert, + required this.builder, this.size = 10, this.extraParams, }) : super(key: key); diff --git a/lib/ui/widgets/inner/aku_tab_bar.dart b/lib/ui/widgets/inner/aku_tab_bar.dart index 931dc21..bf20405 100644 --- a/lib/ui/widgets/inner/aku_tab_bar.dart +++ b/lib/ui/widgets/inner/aku_tab_bar.dart @@ -8,7 +8,8 @@ import 'package:aku_community_manager/tools/screen_tool.dart'; class AkuTabBar extends StatefulWidget { final TabController controller; final List tabs; - AkuTabBar({Key? key, /*required*/ required this.controller, /*required*/ required this.tabs}) + final bool isScrollable; + AkuTabBar({Key? key, required this.controller, required this.tabs, this.isScrollable=false}) : super(key: key); @override @@ -19,7 +20,7 @@ class _AkuTabBarState extends State { @override Widget build(BuildContext context) { return TabBar( - // isScrollable: true, + isScrollable: widget.isScrollable, labelColor: AppStyle.primaryTextColor, unselectedLabelColor: AppStyle.minorTextColor, labelStyle: TextStyle( diff --git a/lib/ui/widgets/inner/bee_image_preview.dart b/lib/ui/widgets/inner/bee_image_preview.dart new file mode 100644 index 0000000..725af97 --- /dev/null +++ b/lib/ui/widgets/inner/bee_image_preview.dart @@ -0,0 +1,92 @@ +import 'dart:io'; + +import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/const/resource.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class BeeImagePreview extends StatefulWidget { + static Future toFile({required File file, String? tag}) async { + return await navigator!.push( + PageRouteBuilder( + opaque: false, + fullscreenDialog: true, + pageBuilder: (context, animation, secondAnimation) { + return FadeTransition( + opacity: animation, + child: BeeImagePreview.file(file: file, tag: tag), + ); + }, + transitionsBuilder: (context, animation, secondaryAnimation, child) { + return child; + }, + ), + ); + } + + static toPath({required String? path, String? tag}) { + navigator!.push( + PageRouteBuilder( + opaque: false, + fullscreenDialog: true, + pageBuilder: (context, animation, secondAnimation) { + return BeeImagePreview.path(path: path, tag: tag); + }, + transitionsBuilder: (context, animation, secondaryAnimation, child) { + return FadeTransition( + opacity: animation, + child: child, + ); + }, + ), + ); + } + + final File? file; + final String? path; + final String? tag; + BeeImagePreview.file({Key? key, required this.file, this.tag}) + : path = null, + super(key: key); + + BeeImagePreview.path({Key? key, required this.path, this.tag}) + : file = null, + super(key: key); + + @override + _BeeImagePreviewState createState() => _BeeImagePreviewState(); +} + +class _BeeImagePreviewState extends State { + Widget get image { + if (widget.file == null) + return Hero( + tag: widget.tag ?? widget.path!, + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_PLACEHOLDER_WEBP, + image: API.image(widget.path!), + ), + ); + else + return Hero( + tag: widget.tag ?? widget.file.hashCode, + child: Image.file(widget.file!), + ); + } + + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: Get.back, + child: Scaffold( + backgroundColor: Colors.black54, + body: InteractiveViewer( + boundaryMargin: EdgeInsets.all(48), + minScale: 0.2, + maxScale: 10, + child: Center(child: image), + ), + ), + ); + } +} \ No newline at end of file diff --git a/tool/config.dart b/tool/config.dart index 59b0abf..bf35fff 100644 --- a/tool/config.dart +++ b/tool/config.dart @@ -3,7 +3,7 @@ class Config { static const String homeDir = '/users/zhangmeng'; ///包名 - static const String packageName = 'aku_community'; + static const String packageName = 'aku_community_manager'; ///打包目录 static String get buildPath =>