From dfe149b8c9baa155c54b70c44a5e5bc307241ff6 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 4 Nov 2020 11:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=BF=E5=8C=96=E7=AE=A1=E7=90=86=E9=A1=B5?= =?UTF-8?q?=E5=92=8C=E7=AE=A1=E7=90=86=E8=AF=A6=E6=83=85=E9=A1=B5=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 2 + .../manage_models/green_manage_model.dart | 36 +++++ lib/provider/manage_provider.dart | 8 + lib/ui/manage_pages/green_manage_details.dart | 140 ++++++++++++++++++ lib/ui/manage_pages/green_manage_page.dart | 49 +++--- 5 files changed, 208 insertions(+), 27 deletions(-) create mode 100644 lib/mock_models/manage_models/green_manage_model.dart create mode 100644 lib/provider/manage_provider.dart create mode 100644 lib/ui/manage_pages/green_manage_details.dart diff --git a/lib/main.dart b/lib/main.dart index 9a5bff1..9e2419b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'package:aku_community_manager/provider/app_provider.dart'; import 'package:aku_community_manager/provider/fix_provider.dart'; +import 'package:aku_community_manager/provider/manage_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'; @@ -20,6 +21,7 @@ class MyApp extends StatelessWidget { ChangeNotifierProvider(create: (context) => UserProvider()), ChangeNotifierProvider(create: (context) => AppProvider()), ChangeNotifierProvider(create: (context) => FixProvider()), + ChangeNotifierProvider(create: (context)=> GreenManageProvider()), ], child: GetMaterialApp( title: '小蜜蜂管家', diff --git a/lib/mock_models/manage_models/green_manage_model.dart b/lib/mock_models/manage_models/green_manage_model.dart new file mode 100644 index 0000000..11e222a --- /dev/null +++ b/lib/mock_models/manage_models/green_manage_model.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +class GreenManageCardModel { + String title; + String task; + String timestart; + String timeend; + String name; + String body; + GreenManageCardModel( + this.title, this.task, this.timestart, this.timeend, this.name, + this.body); + + static List initList() { + return [ + GreenManageCardModel( + '中部广场周围绿化调整', '除杂草、松土、培土', '2020-10-08', '2020-10-18', '陈晖洁', + '''详细描述 +1.在小区的园林建设中首先要保证小区园林设计的美观 +性以及与小区其他建筑的协调性,不仅能够吸引小区居 +民的目光,丰富人们的精神生活,也要使小区园林设计 +起到减少噪音污染,为人们遮风避凉。 +2.营造小区美丽园林中要选择合适的树木品种绿化小区 +内不同地方的环境在小区的园路树选择中不能种植矮小 +的树这样不会起到遮阴的作用还有在小区水池周围不能 +选择落叶较多的树这样不利于清理另外,还有小区其他 +的绿化地方,要根据实际情况,合理科学的选择。'''), + GreenManageCardModel( + '东区周围绿化调整', '修剪、造型', '2020-10-08', '2020-10-18', '刘小青',''), + GreenManageCardModel( + '西区周围绿化调整', '修剪、造型', '2020-10-10', '2020-10-20', '张空间',''), + GreenManageCardModel( + '北区周围绿化调整', '修剪造型', '2020-10-15', '2020-10-25', '凯尔希',''), + ]; + } +} diff --git a/lib/provider/manage_provider.dart b/lib/provider/manage_provider.dart new file mode 100644 index 0000000..df8bb6a --- /dev/null +++ b/lib/provider/manage_provider.dart @@ -0,0 +1,8 @@ + +import 'package:aku_community_manager/mock_models/manage_models/green_manage_model.dart'; +import 'package:flutter/material.dart'; +class GreenManageProvider extends ChangeNotifier{ + List _greenManageModel =GreenManageCardModel.initList(); + List get greenManageModels => _greenManageModel; + notifyListeners(); +} \ No newline at end of file diff --git a/lib/ui/manage_pages/green_manage_details.dart b/lib/ui/manage_pages/green_manage_details.dart new file mode 100644 index 0000000..8c9828b --- /dev/null +++ b/lib/ui/manage_pages/green_manage_details.dart @@ -0,0 +1,140 @@ +import 'package:aku_community_manager/mock_models/manage_models/green_manage_model.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_ui/aku_ui.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community_manager/const/resource.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class GreenManageDetails extends StatelessWidget { + final GreenManageCardModel cardModel; + + GreenManageDetails(this.cardModel); + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '详情', + body: Column( + children: [ + AkuBox.h(16), + AkuButton( + onPressed: () {}, + child: Container( + height: 302.w, + width: double.infinity, + padding: EdgeInsets.only( + left: 32.w, + right: 32.w, + bottom: 40.w, + ), + color: Color(0xFFFFFFFF), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 93.w, + alignment: Alignment.centerLeft, + child: Text( + cardModel.title, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.w, + fontWeight: FontWeight.bold), + ), + ), + // Divider( + // height: 1.w, + // ), + AkuBox.h(24), + Row( + children: [ + Image.asset( + R.ASSETS_MANAGE_IC_RENWU_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text('任务概要', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + )), + Spacer(), + Text( + cardModel.task, + style: AppStyle().primaryStyle, + ), + ], + ), + Spacer(), + Row( + children: [ + Image.asset( + R.ASSETS_MANAGE_IC_TIME_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text('时间期限', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp)), + Spacer(), + Text( + '${cardModel.timestart}至${cardModel.timeend}', + style: AppStyle().primaryStyle, + ), + ], + ), + Spacer(), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(4), + Text('负责人员', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + )), + Spacer(), + Text( + cardModel.name, + style: AppStyle().primaryStyle, + ), + ], + ), + ], + ), + ), + ), + AkuBox.h(16), + Expanded( + child: Container( + alignment: Alignment.centerLeft, + width: double.infinity, + color: Color(0xFFFFFFFF), + padding: EdgeInsets.only(top: 16.w,left: 32.w,right: 32.w), + child: Column( + children: [ + Text('详细描述', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.w, + fontWeight: FontWeight.bold)), + AkuBox.h(16), + Text(cardModel.body,style: TextStyle(color:AppStyle.primaryTextColor,fontSize: 28.w),), + ], + ), + )), + ], + ), + ); + } +} diff --git a/lib/ui/manage_pages/green_manage_page.dart b/lib/ui/manage_pages/green_manage_page.dart index b691f2d..c198d30 100644 --- a/lib/ui/manage_pages/green_manage_page.dart +++ b/lib/ui/manage_pages/green_manage_page.dart @@ -1,19 +1,15 @@ +import 'package:aku_community_manager/mock_models/manage_models/green_manage_model.dart'; +import 'package:aku_community_manager/provider/manage_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/manage_pages/green_manage_details.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_ui/common_widgets/aku_common_widgets.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:aku_community_manager/const/resource.dart'; - -class GreenManageCardModel { - String title; - String task; - String timestart; - String timeend; - String name; - GreenManageCardModel(this.title,this.task,this.timestart,this.timeend,this.name); -} +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; class GreenManagePage extends StatefulWidget { GreenManagePage({Key key}) : super(key: key); @@ -23,33 +19,32 @@ class GreenManagePage extends StatefulWidget { } class _GreenManagePageState extends State { - - List _cards=[ - GreenManageCardModel('中部广场周围绿化调整', '除杂草、松土、培土', '2020-10-08','2020-10-18', '杨雄会', ), - GreenManageCardModel('东区周围绿化调整', '修剪、造型', '2020-10-08', '2020-10-18', '刘小青'), - GreenManageCardModel('西区周围绿化调整', '修剪、造型', '2020-10-10', '2020-10-20', '张空间'), - GreenManageCardModel('北区周围绿化调整', '修剪造型', '2020-10-15', '2020-10-25', '凯尔希'), - ]; - @override Widget build(BuildContext context) { + final greenManageProvider = Provider.of(context); return AkuScaffold( title: '绿化管理', - body: ListView( + body: ListView.builder( + itemBuilder: (context, index) { + return _greenManageCard(greenManageProvider.greenManageModels[index]); + }, padding: EdgeInsets.only(left: 32.w, right: 32.w), - children: _cards.map((e) => _greenManageCard(e.title, e.task, e.timestart, e.timeend, e.name),).toList(), + itemCount: greenManageProvider.greenManageModels.length, ), ); } -///绿化管理页面卡片 - Widget _greenManageCard(String title, String task, String timestart, - String timeend, String name) { + + ///绿化管理页面卡片 + Widget _greenManageCard(GreenManageCardModel cardModel) { return Column( children: [ AkuBox.h(16), //跳转管理详情按钮 AkuButton( - onPressed: () {}, + onPressed: () { + Get.to(GreenManageDetails(cardModel) + ); + }, child: Container( height: 302.w, width: 686.w, @@ -67,7 +62,7 @@ class _GreenManagePageState extends State { height: 93.w, alignment: Alignment.centerLeft, child: Text( - title, + cardModel.title, style: TextStyle( color: AppStyle.primaryTextColor, fontSize: 32.w, @@ -93,7 +88,7 @@ class _GreenManagePageState extends State { )), Spacer(), Text( - task, + cardModel.task, style: AppStyle().primaryStyle, ), ], @@ -112,7 +107,7 @@ class _GreenManagePageState extends State { color: AppStyle.primaryTextColor, fontSize: 28.sp)), Spacer(), Text( - '$timestart至$timeend', + '${cardModel.timestart}至${cardModel.timeend}', style: AppStyle().primaryStyle, ), ], @@ -133,7 +128,7 @@ class _GreenManagePageState extends State { )), Spacer(), Text( - name, + cardModel.name, style: AppStyle().primaryStyle, ), ],