diff --git a/README.md b/README.md index dac408b..3048626 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,7 @@ A new Flutter application. ## Getting Started ### 使用`fgen`生成图片 + +### password + +password `1Xpn6hhbxztA6PC0oFiZ` diff --git a/android/app/build.gradle b/android/app/build.gradle index a008811..9bf4780 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -25,6 +25,11 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" +def keystoreProperties = new Properties() + def keystorePropertiesFile = rootProject.file('key.properties') + if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) + } android { compileSdkVersion 29 @@ -45,13 +50,19 @@ android { versionName flutterVersionName } - buildTypes { - release { - // TODO: Add your own signing config for the release build. - // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug - } - } + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } + buildTypes { + release { + signingConfig signingConfigs.release + } + } } flutter { diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8c38806..29e1b03 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,47 +1,30 @@ - - - - - - - - - - - - - - - - + + diff --git a/assets/manage/article.png b/assets/manage/article.png new file mode 100644 index 0000000..dd55c3f Binary files /dev/null and b/assets/manage/article.png differ diff --git a/assets/manage/borrow.png b/assets/manage/borrow.png new file mode 100644 index 0000000..66458a8 Binary files /dev/null and b/assets/manage/borrow.png differ diff --git a/assets/manage/info.png b/assets/manage/info.png new file mode 100644 index 0000000..fad8ff9 Binary files /dev/null and b/assets/manage/info.png differ diff --git a/assets/manage/remaining.png b/assets/manage/remaining.png new file mode 100644 index 0000000..82f86db Binary files /dev/null and b/assets/manage/remaining.png differ diff --git a/assets/static_temp/drill.png b/assets/static_temp/drill.png new file mode 100644 index 0000000..9db0504 Binary files /dev/null and b/assets/static_temp/drill.png differ diff --git a/assets/static_temp/hammer.png b/assets/static_temp/hammer.png new file mode 100644 index 0000000..b8811e2 Binary files /dev/null and b/assets/static_temp/hammer.png differ diff --git a/assets/static_temp/ladder.png b/assets/static_temp/ladder.png new file mode 100644 index 0000000..30df7aa Binary files /dev/null and b/assets/static_temp/ladder.png differ diff --git a/keys/key.jks b/keys/key.jks new file mode 100644 index 0000000..f82a7d9 Binary files /dev/null and b/keys/key.jks differ diff --git a/lib/main.dart b/lib/main.dart index 0ba12a3..ac472cf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,6 +4,7 @@ import 'package:aku_community_manager/provider/manage_provider.dart'; import 'package:aku_community_manager/provider/outdoor_provider.dart'; import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/ui/home/home_page.dart'; +import 'package:amap_map_fluttify/amap_map_fluttify.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -11,7 +12,8 @@ import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; -void main() { +void main() async { + await AmapCore.init(''); runApp(MyApp()); } diff --git a/lib/mock_models/borrow/borrow_data.dart b/lib/mock_models/borrow/borrow_data.dart new file mode 100644 index 0000000..da06a3f --- /dev/null +++ b/lib/mock_models/borrow/borrow_data.dart @@ -0,0 +1,92 @@ +import 'package:aku_community_manager/const/resource.dart'; +import 'package:aku_community_manager/mock_models/borrow/borrow_model.dart'; + +class BorrowData { + static List get checkModels => models.where((e) { + return e.borrowGoods.status == BORROW_STATUS.WAIT_CHECK; + }).toList(); + static List get borrowModels => models.where((e) { + return e.borrowGoods.status == BORROW_STATUS.BORROWING; + }).toList(); + + static List get doneModels => models.where((e) { + return e.borrowGoods.status == BORROW_STATUS.DONE; + }).toList(); + + static List models = [ + BorrowModel( + title: '归还梯子一个', + borrowPerson: '李慧珍', + borrowTime: 5, + goodsStatus: GOODS_STATUS.BROKEN, + phone: '19981712931', + borrowGoods: SingleBorrowGoods( + name: '梯子', + assetpath: R.ASSETS_STATIC_TEMP_LADDER_PNG, + code: '3193713894', + status: BORROW_STATUS.WAIT_CHECK, + ), + date: DateTime(2020, 5, 5, 12, 35, 45), + ), + BorrowModel( + title: '归还梯子一个', + borrowPerson: '李慧珍', + borrowTime: 5, + goodsStatus: GOODS_STATUS.BROKEN, + phone: '19981712931', + borrowGoods: SingleBorrowGoods( + name: '梯子', + assetpath: R.ASSETS_STATIC_TEMP_LADDER_PNG, + code: '3193713894', + status: BORROW_STATUS.DONE, + ), + date: DateTime(2020, 5, 5, 12, 35, 45), + ), + BorrowModel( + title: '借用电钻一把', + borrowPerson: '刘虎门', + borrowTime: 12, + goodsStatus: GOODS_STATUS.NORMAL, + phone: '19981738879', + borrowGoods: SingleBorrowGoods( + name: '电钻', + assetpath: R.ASSETS_STATIC_TEMP_DRILL_PNG, + code: '31937293841', + status: BORROW_STATUS.BORROWING, + ), + date: DateTime(2020, 4, 5, 12, 35, 45), + ), + BorrowModel( + borrowPerson: '刘海保', + borrowTime: 5, + title: '借用榔头一把', + goodsStatus: GOODS_STATUS.NORMAL, + phone: '19981738879', + borrowGoods: SingleBorrowGoods( + name: '榔头', + assetpath: R.ASSETS_STATIC_TEMP_HAMMER_PNG, + code: '3193794102481', + status: BORROW_STATUS.BORROWING, + ), + date: DateTime(2020, 3, 5, 12, 35, 45), + ), + ]; + + static List borrowObjects = [ + BorrowObject.init( + name: '电钻', + assetPath: R.ASSETS_STATIC_TEMP_DRILL_PNG, + allNumber: 5, + ), + BorrowObject.init( + name: '梯子', + assetPath: R.ASSETS_STATIC_TEMP_LADDER_PNG, + allNumber: 3, + ), + BorrowObject.init( + name: '三角榔头', + assetPath: R.ASSETS_STATIC_TEMP_HAMMER_PNG, + allNumber: 8, + ), + ]; +} diff --git a/lib/mock_models/borrow/borrow_model.dart b/lib/mock_models/borrow/borrow_model.dart new file mode 100644 index 0000000..343c73b --- /dev/null +++ b/lib/mock_models/borrow/borrow_model.dart @@ -0,0 +1,88 @@ +import 'dart:math'; + +import 'package:meta/meta.dart'; + +enum BORROW_STATUS { + ///出借中 + BORROWING, + + ///待检查 + WAIT_CHECK, + + ///未出借 + NOT_BORROW, + + ///已归还 + DONE, +} + +enum GOODS_STATUS { + NORMAL, + BROKEN, + LOST, +} + +class BorrowModel { + String borrowPerson; + String phone; + int borrowTime; + GOODS_STATUS goodsStatus; + String title; + SingleBorrowGoods borrowGoods; + DateTime date; + + BorrowModel({ + @required this.borrowPerson, + @required this.phone, + @required this.borrowTime, + @required this.goodsStatus, + @required this.borrowGoods, + @required this.title, + @required this.date, + }); +} + +class BorrowObject { + String name; + int allNumber; + dynamic assetPath; + int borrowNumber; + int get restNumber => allNumber - borrowNumber; + List items; + + BorrowObject.init({ + this.name, + this.allNumber, + this.assetPath, + }) { + this.borrowNumber = 0; + items = List.generate( + this.allNumber, + (index) => SingleBorrowGoods( + name: '${this.name}${index + 1}', + code: (179264234 + Random().nextInt(999999)).toString(), + status: BORROW_STATUS.NOT_BORROW, + assetpath: this.assetPath, + ), + ); + } +} + +class SingleBorrowGoods { + String name; + String code; + dynamic assetpath; + BORROW_STATUS status; + String get borrowValue => { + BORROW_STATUS.BORROWING: '出借中', + BORROW_STATUS.DONE: '已归还', + BORROW_STATUS.NOT_BORROW: '未出借', + BORROW_STATUS.WAIT_CHECK: '待检查', + }[status]; + SingleBorrowGoods({ + this.name, + this.code, + this.assetpath, + this.status, + }); +} diff --git a/lib/mock_models/decoration/decoration_data.dart b/lib/mock_models/decoration/decoration_data.dart index e607017..e5a11e7 100644 --- a/lib/mock_models/decoration/decoration_data.dart +++ b/lib/mock_models/decoration/decoration_data.dart @@ -20,6 +20,101 @@ class DecorationData { ), cycleCheck: CycleCheck(), ), + DecorationModel( + decorationDate: DateTime(2020, 1, 23, 12, 23, 0), + type: DecorationType.HAND_OUT, + statusType: DecorationStatusType.DONE, + userHomeModel: UserHomeModel( + userName: '李慧珍', + plot: '深圳华茂悦峰', + detailAddr: '1幢-1单元-302室', + phone: '18201939840', + ), + decorationTeamModel: DecorationTeamModel( + name: '深圳莫川装修有限公司', + userName: '李惠政', + phone: '19298540192', + ), + cycleCheck: CycleCheck( + authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), + startDate: DateTime(2020, 1, 23, 20, 23, 0), + checkCycle: 7, + checkDetails: [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + ], + ), + workFinishCheck: WorkFinishCheck( + authPerson: FixerModel(name: '林鸿章', phone: '18294859301'), + startDate: DateTime(2020, 1, 23, 20, 23, 0), + checkDetails: [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + CHECK_TYPE.SECURITY, + ], + ), + checkInfomations: [ + CheckInfomation( + checkDate: DateTime(2020, 3, 20, 12, 00), + info: '正常', + checkType: '完工检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 2, 14, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 2, 7, 12, 00), + info: '厨房水路异常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER, status: false), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 1, 30, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + CheckInfomation( + checkDate: DateTime(2020, 1, 23, 12, 00), + info: '正常', + checkType: '周期检查', + details: [ + CheckDetail(type: CHECK_TYPE.ELECTRIC), + CheckDetail(type: CHECK_TYPE.WATER), + CheckDetail(type: CHECK_TYPE.WALL), + CheckDetail(type: CHECK_TYPE.DOOR_AND_WINDOWS), + ], + ), + ], + ), DecorationModel( decorationDate: DateTime(2020, 1, 23, 12, 23, 0), type: DecorationType.DONE, diff --git a/lib/mock_models/decoration/decoration_model.dart b/lib/mock_models/decoration/decoration_model.dart index 5ebf0eb..1dbd68e 100644 --- a/lib/mock_models/decoration/decoration_model.dart +++ b/lib/mock_models/decoration/decoration_model.dart @@ -112,7 +112,13 @@ class CycleCheck { ///check cycle in days int checkCycle; - List checkDetails; + List checkDetails = [ + CHECK_TYPE.ELECTRIC, + CHECK_TYPE.WATER, + CHECK_TYPE.WALL, + CHECK_TYPE.DOOR_AND_WINDOWS, + CHECK_TYPE.SECURITY, + ]; CycleCheck({ this.authPerson, this.startDate, diff --git a/lib/mock_models/fix/fix_model.dart b/lib/mock_models/fix/fix_model.dart index 333ec11..6288538 100644 --- a/lib/mock_models/fix/fix_model.dart +++ b/lib/mock_models/fix/fix_model.dart @@ -1,6 +1,7 @@ -import 'package:aku_community_manager/const/resource.dart'; import 'package:flutter/material.dart'; +import 'package:aku_community_manager/const/resource.dart'; + enum FIX_ENUM { ///待派单 HAND_OUT, @@ -110,15 +111,6 @@ class FixModel { 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( @@ -130,7 +122,7 @@ class FixModel { userName: '杨建', userPhoneNumber: '18882929292', fixArea: 'A区', - type: FIX_PAYMENT_TYPE.FREE, + type: FIX_PAYMENT_TYPE.PAY, limit: FIX_DATE_LIMIT.HOUR_24, subType: FIX_SUB_TYPE.NORMAL, fixStatuses: [ @@ -149,6 +141,10 @@ class FixModel { rate: 5, content: '师傅太用心了', ), + priceDetail: FixPriceDetail( + humanPrice: 10, + materialPrice: 0, + ), ), ), ]; @@ -228,6 +224,8 @@ class FixDetailModel { FixResult result; UserReviewInfo review; + + FixPriceDetail priceDetail; FixDetailModel({ this.userName, this.userPhoneNumber, @@ -238,6 +236,7 @@ class FixDetailModel { this.fixStatuses, this.result, this.review, + this.priceDetail, }); } @@ -271,3 +270,13 @@ class UserReviewInfo { this.content, }); } + +class FixPriceDetail { + double humanPrice; + double materialPrice; + FixPriceDetail({ + this.humanPrice, + this.materialPrice, + }); + double get allPrice => humanPrice + materialPrice; +} diff --git a/lib/mock_models/manage_models/manage_model.dart b/lib/mock_models/manage_models/manage_model.dart index 2629f41..517c7d2 100644 --- a/lib/mock_models/manage_models/manage_model.dart +++ b/lib/mock_models/manage_models/manage_model.dart @@ -1,6 +1,3 @@ -import 'package:flutter/material.dart'; -import 'package:aku_community_manager/const/resource.dart'; - class GreenManageCardModel { String title; String task; diff --git a/lib/style/app_style.dart b/lib/style/app_style.dart index 917077e..9bc19a9 100644 --- a/lib/style/app_style.dart +++ b/lib/style/app_style.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; export 'package:flutter_screenutil/flutter_screenutil.dart'; +export 'package:aku_community_manager/const/resource.dart'; class AppStyle { //颜色,渐变主颜色和次级颜色 diff --git a/lib/ui/agreements/agreement_page.dart b/lib/ui/agreements/agreement_page.dart new file mode 100644 index 0000000..d6a3817 --- /dev/null +++ b/lib/ui/agreements/agreement_page.dart @@ -0,0 +1,13 @@ +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; + +class AgreementPage extends StatelessWidget { + const AgreementPage({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '服务协议', + ); + } +} diff --git a/lib/ui/agreements/privacy_page.dart b/lib/ui/agreements/privacy_page.dart new file mode 100644 index 0000000..e25871d --- /dev/null +++ b/lib/ui/agreements/privacy_page.dart @@ -0,0 +1,13 @@ +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:flutter/material.dart'; + +class PrivacyPage extends StatelessWidget { + const PrivacyPage({Key key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '隐私协议', + ); + } +} diff --git a/lib/ui/home/application/applications_page.dart b/lib/ui/home/application/applications_page.dart index 44b10e8..1fc94c8 100644 --- a/lib/ui/home/application/applications_page.dart +++ b/lib/ui/home/application/applications_page.dart @@ -1,6 +1,8 @@ import 'package:aku_community_manager/ui/manage_pages/green_manage/green_manage_page.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_manage_page.dart'; import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_manager_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_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/sub_pages/decoration_manager/decoration_manager_page.dart'; import 'package:aku_community_manager/ui/sub_pages/items_outdoor/items_outdoor_page.dart'; import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; @@ -45,19 +47,21 @@ class _ApplicationPageState extends State AppApplication( '活动管理', R.ASSETS_HOME_IC_ACTIVITY_PNG, ActivityManagerPage()), AppApplication('访客管理', R.ASSETS_HOME_IC_VISITORS_PNG, VisitorManagerPage()), - AppApplication('便民电话', '', Scaffold()), - AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, Scaffold()), - AppApplication('工单管理', '', Scaffold()), - AppApplication('语音管家', '', Scaffold()), + AppApplication('借还管理', R.ASSETS_HOME_IC_BORROW_PNG, BorrowManagerPage()), AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, Scaffold()), - AppApplication('问卷调查', '', Scaffold()), ]; List _wisdomApplications = [ - AppApplication('绿化管理', R.ASSETS_HOME_IC_GREENING_PNG, GreenManagePage()), - AppApplication('巡检管理', R.ASSETS_HOME_IC_PATROL_PNG, InspectionManagePage()), + AppApplication('一键报警', R.ASSETS_HOME_IC_POLICE_PNG, Scaffold()), + 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_DECORATION_PNG, DecorationManagerPage()), - AppApplication('物品出户', R.ASSETS_HOME_IC_ARTICLE_PNG, ItemsOutdoorPage()), + 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()), ]; @override @@ -174,7 +178,6 @@ class _ApplicationPageState extends State ///应用组 _buildBottomApps() { - final appProvider = Provider.of(context); return Expanded( child: Row( children: [ diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index a2b4bfc..a900a26 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -1,4 +1,5 @@ import 'package:aku_community_manager/const/resource.dart'; +import 'package:aku_community_manager/provider/app_provider.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/screen_tool.dart'; @@ -30,6 +31,7 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { ///自定义bar的菜单按钮 Widget _menuButton(String assetPath, String text, Widget page) { + final appProvider = Provider.of(context); return Expanded( child: AkuButton( radius: 8.w, @@ -37,9 +39,10 @@ class _HomePageState extends State { onPressed: () { final userProvider = Provider.of(context, listen: false); - if (userProvider.isSigned) + if (userProvider.isSigned) { Get.to(page); - else + appProvider.addRecentApp(AppApplication(text, assetPath, page)); + } else Get.to(LoginPage()); }, child: Column( diff --git a/lib/ui/home/personal_draw.dart b/lib/ui/home/personal_draw.dart index 7d38a43..99129dd 100644 --- a/lib/ui/home/personal_draw.dart +++ b/lib/ui/home/personal_draw.dart @@ -56,56 +56,62 @@ class _PersonalDrawState extends State { child: ListView( children: [ SizedBox( - height: 80.w - 40.w + ScreenUtil().statusBarHeight, + height: ScreenUtil().statusBarHeight, ), //leading - Container( - margin: EdgeInsets.only(bottom: 80.w), - width: double.infinity, - child: Row( - children: [ - SizedBox(width: 32.w), - //头像按钮 - AkuRoundButton( - height: 72.w, - onPressed: () {}, - child: CircleAvatar( - radius: 36.w, - backgroundImage: userProvider.userInfoModel.avatar == null - ? null - : FileImage(userProvider.userInfoModel.avatar), - backgroundColor: Colors.white, - child: userProvider.isSigned - ? userProvider.userInfoModel.avatar == null - ? Icon(Icons.person_outline) - : null - : Icon(Icons.person), - ), - ), - SizedBox(width: 24.w), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - //登录按钮 - InkWell( - onTap: () {}, + InkWell( + onTap: () { + if (!userProvider.isSigned) { + Get.to(LoginPage()); + } + }, + child: Container( + margin: EdgeInsets.only(bottom: 80.w, top: 40.w), + width: double.infinity, + child: Row( + children: [ + SizedBox(width: 32.w), + //头像按钮 + AkuRoundButton( + height: 72.w, + onPressed: () {}, + child: CircleAvatar( + radius: 36.w, + backgroundImage: + userProvider.userInfoModel.avatar == null + ? null + : FileImage(userProvider.userInfoModel.avatar), + backgroundColor: Colors.white, child: userProvider.isSigned + ? userProvider.userInfoModel.avatar == null + ? Icon(Icons.person_outline) + : null + : Icon(Icons.person), + ), + ), + SizedBox(width: 24.w), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + //登录按钮 + userProvider.isSigned ? Text( userProvider.userInfoModel.nickName, style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold), + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), ) - : Text('登录', + : Text( + '登录', style: TextStyle( - color: AppStyle.primaryTextColor, - fontSize: 28.sp, - fontWeight: FontWeight.bold)), - ), - InkWell( - onTap: () {}, - child: Row( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + Row( children: [ Icon(Icons.location_on_outlined, size: 33.w), Text( @@ -116,10 +122,10 @@ class _PersonalDrawState extends State { ), ], ), - ), - ], - ), - ], + ], + ), + ], + ), ), ), _myListTile( diff --git a/lib/ui/login/login_page.dart b/lib/ui/login/login_page.dart index 4afa613..70705cf 100644 --- a/lib/ui/login/login_page.dart +++ b/lib/ui/login/login_page.dart @@ -2,6 +2,8 @@ import 'dart:ui'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/agreements/agreement_page.dart'; +import 'package:aku_community_manager/ui/agreements/privacy_page.dart'; import 'package:aku_community_manager/ui/login/login_sms_page.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_back_button.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; @@ -67,7 +69,6 @@ class _LoginPageState extends State { Container( width: double.infinity, child: TextField( - autofocus: true, controller: _textController, onChanged: (text) { setState(() {}); @@ -148,6 +149,9 @@ class _LoginPageState extends State { ), ExtendedWidgetSpan( child: GestureDetector( + onTap: () { + Get.to(AgreementPage()); + }, child: Text( '《服务协议》', style: TextStyle( @@ -162,6 +166,9 @@ class _LoginPageState extends State { ), ExtendedWidgetSpan( child: GestureDetector( + onTap: () { + Get.to(PrivacyPage()); + }, child: Text( '《隐私政策》', style: TextStyle( diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart index 592db42..8e65b2a 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_page.dart @@ -1,14 +1,10 @@ -import 'package:aku_community_manager/mock_models/manage_models/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/inspection_manage/inspection_manage_card.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:provider/provider.dart'; -import 'package:aku_community_manager/const/resource.dart'; class InspectionManagePage extends StatefulWidget { InspectionManagePage({Key key}) : super(key: key); diff --git a/lib/ui/settings/settings_page.dart b/lib/ui/settings/settings_page.dart index e264d03..c63a63b 100644 --- a/lib/ui/settings/settings_page.dart +++ b/lib/ui/settings/settings_page.dart @@ -21,6 +21,7 @@ class SettingsPage extends StatefulWidget { } class _SettingsPageState extends State { + bool _info = false; @override Widget build(BuildContext context) { final userProvider = Provider.of(context); @@ -35,8 +36,12 @@ class _SettingsPageState extends State { title: Text('是否接受信息通知'), arrow: false, suffix: CupertinoSwitch( - value: false, - onChanged: (value) {}, + value: _info, + onChanged: (value) { + setState(() { + _info = value; + }); + }, ), ), Divider(height: 1.w), diff --git a/lib/ui/settings/user_info_page.dart b/lib/ui/settings/user_info_page.dart index 9df3337..289f482 100644 --- a/lib/ui/settings/user_info_page.dart +++ b/lib/ui/settings/user_info_page.dart @@ -4,7 +4,6 @@ import 'package:aku_community_manager/ui/widgets/common/aku_tile.dart'; import 'package:aku_community_manager/ui/widgets/inner/pick_image.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 UserInfoPage extends StatefulWidget { diff --git a/lib/ui/sub_pages/borrow_manager/add_borrow_item_page.dart b/lib/ui/sub_pages/borrow_manager/add_borrow_item_page.dart new file mode 100644 index 0000000..c70b29a --- /dev/null +++ b/lib/ui/sub_pages/borrow_manager/add_borrow_item_page.dart @@ -0,0 +1,174 @@ +import 'dart:io'; +import 'dart:math'; + +import 'package:aku_community_manager/mock_models/borrow/borrow_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_community_manager/ui/widgets/inner/pick_image.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; + +class AddBorrowItemPage extends StatefulWidget { + final BorrowObject object; + AddBorrowItemPage({Key key, @required this.object}) : super(key: key); + + @override + _AddBorrowItemPageState createState() => _AddBorrowItemPageState(); +} + +class _AddBorrowItemPageState extends State { + TextEditingController _textEditingController = TextEditingController(); + String code = ''; + File file; + @override + void initState() { + super.initState(); + code = (10000000 + Random().nextInt(999999)).toString(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '物品详情', + actions: [ + AkuMaterialButton( + minWidth: 120.w, + onPressed: () { + if (TextUtil.isEmpty(_textEditingController.text)) { + BotToast.showText(text: '名称不能为空'); + } else if (file == null) { + BotToast.showText(text: '图片不能为空'); + } else { + widget.object.items.insert( + 0, + SingleBorrowGoods( + name: _textEditingController.text, + code: code, + assetpath: file, + status: BORROW_STATUS.NOT_BORROW, + )); + } + }, + child: Text( + '完成', + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + ), + ], + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + children: [ + _buildRow( + '物品名称', + TextField( + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + controller: _textEditingController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入物品名称', + ), + )), + Divider(height: 1.w), + _buildRow( + '物品单号', + Text( + code, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + )), + _buildRow( + '物品图片', + file == null + ? InkWell( + onTap: () { + akuPickImage().then((value) { + if (value != null) file = value; + setState(() {}); + }); + }, + child: Container( + height: 184.w, + width: 184.w, + alignment: Alignment.center, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.image, + size: 60.w, + color: AppStyle.minorTextColor, + ), + Text( + '上传图片', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.sp, + ), + ), + ], + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all( + width: 1.w, + color: AppStyle.minorTextColor, + ), + ), + ), + ) + : Image.file( + file, + height: 184.w, + width: 184.w, + fit: BoxFit.cover, + ), + ), + AkuBox.h(28), + ], + ), + ), + ], + ), + ); + } + + _buildRow(String title, Widget child) { + return Row( + children: [ + AkuBox.h(96), + Text( + title, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + AkuBox.w(80), + Expanded( + child: Align( + alignment: Alignment.centerLeft, + child: child, + ), + ), + ], + ); + } +} diff --git a/lib/ui/sub_pages/borrow_manager/add_borrow_object_page.dart b/lib/ui/sub_pages/borrow_manager/add_borrow_object_page.dart new file mode 100644 index 0000000..256a818 --- /dev/null +++ b/lib/ui/sub_pages/borrow_manager/add_borrow_object_page.dart @@ -0,0 +1,214 @@ +import 'dart:io'; + +import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart'; +import 'package:aku_community_manager/mock_models/borrow/borrow_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:aku_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; + +class AddBorrowObjectPage extends StatefulWidget { + AddBorrowObjectPage({Key key}) : super(key: key); + + @override + _AddBorrowObjectPageState createState() => _AddBorrowObjectPageState(); +} + +class _AddBorrowObjectPageState extends State { + TextEditingController _textEditingController = TextEditingController(); + TextEditingController _numberController = TextEditingController(); + File file; + List get objects => BorrowData.borrowObjects; + + @override + Widget build(BuildContext context) { + final userProvider = Provider.of(context); + return AkuScaffold( + title: '物品详情', + actions: [ + userProvider.userInfoModel.role != USER_ROLE.MANAGER + ? AkuMaterialButton( + minWidth: 120.w, + onPressed: () { + if (TextUtil.isEmpty(_textEditingController.text)) { + BotToast.showText(text: '名称不能为空'); + } else if (file == null) { + BotToast.showText(text: '图片不能为空'); + } else if (int.tryParse(_numberController.text) == null) { + BotToast.showText(text: '数量错误'); + } else { + objects.insert( + 0, + BorrowObject.init( + name: _textEditingController.text, + allNumber: int.parse(_numberController.text), + assetPath: file, + ), + ); + Get.back(); + } + }, + child: Text( + '完成', + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + ) + : SizedBox(), + ], + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + children: [ + _buildRow( + '总类名称', + TextField( + onChanged: (_) { + setState(() {}); + }, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + controller: _textEditingController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入总类名称', + ), + )), + Divider(height: 1.w), + _buildRow( + '物品数量', + TextField( + onChanged: (_) { + setState(() {}); + }, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + controller: _numberController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入物品数量', + ), + )), + Divider(height: 1.w), + AkuBox.h(24), + _buildRow( + '物品图片', + file == null + ? InkWell( + onTap: () { + akuPickImage().then((value) { + if (value != null) file = value; + setState(() {}); + }); + }, + child: Container( + height: 184.w, + width: 184.w, + alignment: Alignment.center, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Icons.image, + size: 60.w, + color: AppStyle.minorTextColor, + ), + Text( + '上传图片', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 22.sp, + ), + ), + ], + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + border: Border.all( + width: 1.w, + color: AppStyle.minorTextColor, + ), + ), + ), + ) + : Image.file( + file, + height: 184.w, + width: 184.w, + fit: BoxFit.cover, + ), + ), + AkuBox.h(28), + ], + ), + ), + AkuBox.h(470), + Padding( + padding: EdgeInsets.symmetric(horizontal: 64.w), + child: AkuBottomButton( + title: '确定', + onTap: TextUtil.isEmpty(_textEditingController.text) || + TextUtil.isEmpty(_numberController.text) || + file == null || + int.tryParse(_numberController.text) == null + ? null + : () { + BorrowData.borrowObjects.add( + BorrowObject.init( + name: _textEditingController.text, + allNumber: int.parse(_numberController.text), + assetPath: file, + ), + ); + Get.back(); + }, + ), + ), + ], + ), + ); + } + + _buildRow(String title, Widget child) { + return Row( + children: [ + AkuBox.h(96), + Text( + title, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + AkuBox.w(80), + Expanded( + child: Align( + alignment: Alignment.centerLeft, + child: child, + ), + ), + ], + ); + } +} diff --git a/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart b/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart new file mode 100644 index 0000000..019b096 --- /dev/null +++ b/lib/ui/sub_pages/borrow_manager/all_borrow_goods.dart @@ -0,0 +1,130 @@ +import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart'; +import 'package:aku_community_manager/mock_models/borrow/borrow_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/borrow_manager/add_borrow_object_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_items_page.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:aku_community_manager/const/resource.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; + +class AllBorrowGoods extends StatefulWidget { + AllBorrowGoods({Key key}) : super(key: key); + + @override + _AllBorrowGoodsState createState() => _AllBorrowGoodsState(); +} + +class _AllBorrowGoodsState extends State { + @override + Widget build(BuildContext context) { + final userProvider = Provider.of(context); + return AkuScaffold( + title: '全部物品', + actions: [ + userProvider.userInfoModel.role == USER_ROLE.MANAGER + ? AkuMaterialButton( + minWidth: 120.w, + onPressed: () { + Get.to(AddBorrowObjectPage()); + }, + child: Text( + '新增', + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + ) + : SizedBox(), + ], + body: ListView.builder( + padding: EdgeInsets.symmetric( + horizontal: 32.w, + ), + itemBuilder: (context, index) { + return _buildCard(BorrowData.borrowObjects[index]); + }, + itemCount: BorrowData.borrowObjects.length, + ), + ); + } + + _buildCard(BorrowObject object) { + return GestureDetector( + onTap: () => Get.to(BorrowItemPage(object: object)), + child: Container( + padding: EdgeInsets.all(24.w), + margin: EdgeInsets.only(top: 16.w), + child: Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(4.w), + child: (object.assetPath is String) + ? Image.asset( + object.assetPath, + width: 184.w, + height: 184.w, + fit: BoxFit.cover, + ) + : Image.file( + object.assetPath, + width: 184.w, + height: 184.w, + fit: BoxFit.cover, + ), + ), + AkuBox.w(24), + Expanded( + child: Column( + children: [ + _buildRow(R.ASSETS_MANAGE_ARTICLE_PNG, '物品名称', object.name), + AkuBox.h(12), + _buildRow(R.ASSETS_MANAGE_BORROW_PNG, '借出数量', + object.borrowNumber.toString()), + AkuBox.h(12), + _buildRow(R.ASSETS_MANAGE_REMAINING_PNG, '剩余数量', + object.items.length.toString()), + ], + )), + ], + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Colors.white, + ), + ), + ); + } + + _buildRow(String assetPath, String title, String subTitle) { + return Row( + children: [ + Image.asset( + assetPath, + height: 40.w, + width: 40.w, + ), + Text( + '$title\:', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + Text( + subTitle, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + ), + ), + ], + ); + } +} diff --git a/lib/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart new file mode 100644 index 0000000..c579cab --- /dev/null +++ b/lib/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart @@ -0,0 +1,154 @@ +import 'package:aku_community_manager/mock_models/borrow/borrow_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:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class BorrowItemDetailPage extends StatefulWidget { + final SingleBorrowGoods item; + BorrowItemDetailPage({Key key, this.item}) : super(key: key); + + @override + _BorrowItemDetailPageState createState() => _BorrowItemDetailPageState(); +} + +class _BorrowItemDetailPageState extends State { + bool _isEditing = false; + TextEditingController _textEditingController; + @override + void initState() { + super.initState(); + _textEditingController = TextEditingController(text: widget.item.name); + } + + @override + void dispose() { + _textEditingController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final userProvider = Provider.of(context); + return AkuScaffold( + title: '物品详情', + actions: [ + userProvider.userInfoModel.role == USER_ROLE.MANAGER + ? AkuMaterialButton( + minWidth: 120.w, + onPressed: () { + setState(() { + _isEditing = !_isEditing; + }); + }, + child: Text( + _isEditing ? '完成' : '编辑', + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + ) + : SizedBox(), + ], + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + children: [ + _buildRow( + '物品名称', + TextField( + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + controller: _textEditingController, + enabled: _isEditing, + onChanged: (text) { + widget.item.name = text; + }, + decoration: InputDecoration( + border: InputBorder.none, + ), + )), + Divider(height: 1.w), + _buildRow( + '物品单号', + Text( + widget.item.code, + style: TextStyle( + color: _isEditing + ? AppStyle.minorTextColor + : AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + )), + _buildRow( + '出借状态', + Text( + '未出借', + style: TextStyle( + color: _isEditing + ? AppStyle.minorTextColor + : AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + )), + _buildRow( + '物品图片', + (widget.item.assetpath is String) + ? Image.asset( + widget.item.assetpath, + height: 184.w, + width: 184.w, + fit: BoxFit.cover, + ) + : Image.file( + widget.item.assetpath, + height: 184.w, + width: 184.w, + fit: BoxFit.cover, + ), + ), + AkuBox.h(28), + ], + ), + ), + ], + ), + ); + } + + _buildRow(String title, Widget child) { + return Row( + children: [ + AkuBox.h(96), + Text( + title, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + AkuBox.w(80), + Expanded( + child: Align( + alignment: Alignment.centerLeft, + child: child, + ), + ), + ], + ); + } +} diff --git a/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart new file mode 100644 index 0000000..bc2609a --- /dev/null +++ b/lib/ui/sub_pages/borrow_manager/borrow_items_page.dart @@ -0,0 +1,211 @@ +import 'package:aku_community_manager/mock_models/borrow/borrow_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/borrow_manager/add_borrow_item_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_item_detail_page.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; + +class BorrowItemPage extends StatefulWidget { + final BorrowObject object; + BorrowItemPage({Key key, @required this.object}) : super(key: key); + + @override + _BorrowItemPageState createState() => _BorrowItemPageState(); +} + +class _BorrowItemPageState extends State { + @override + Widget build(BuildContext context) { + final userProvider = Provider.of(context); + return AkuScaffold( + title: '物品查看', + actions: [ + userProvider.userInfoModel.role == USER_ROLE.MANAGER + ? AkuMaterialButton( + minWidth: 120.w, + onPressed: () { + Get.to(AddBorrowItemPage(object: widget.object)); + }, + child: Text( + '新增', + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + ) + : SizedBox(), + ], + body: ListView.builder( + padding: EdgeInsets.symmetric(horizontal: 32.w), + itemBuilder: (context, index) { + return _buildCard(widget.object.items[index]); + }, + itemCount: widget.object.items.length, + ), + ); + } + + _buildCard(SingleBorrowGoods item) { + final userProvider = Provider.of(context); + return GestureDetector( + onTap: () { + Get.to(BorrowItemDetailPage(item: item)); + }, + child: Container( + margin: EdgeInsets.only(top: 16.w), + child: Column( + children: [ + Row( + children: [ + AkuBox.h(93), + AkuBox.w(24), + Text( + item.name, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 32.sp, + ), + ), + Spacer(), + userProvider.userInfoModel.role == USER_ROLE.MANAGER + ? AkuMaterialButton( + padding: EdgeInsets.symmetric(horizontal: 24.w), + onPressed: () { + showCupertinoDialog( + context: context, + builder: (context) { + return CupertinoAlertDialog( + title: Text('删除物品'), + content: Text('确定要删除${item.name}该物品吗?'), + actions: [ + CupertinoDialogAction( + child: Text('取消'), + onPressed: () { + Get.back(); + }, + ), + CupertinoDialogAction( + child: Text('删除'), + onPressed: () { + widget.object.items.remove(item); + setState(() {}); + Get.back(); + }, + ), + ], + ); + }, + ); + }, + child: Row( + children: [ + Icon( + Icons.delete, + color: AppStyle.minorTextColor, + size: 40.w, + ), + Text( + '删除', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.sp, + ), + ), + ], + ), + ) + : SizedBox(), + ], + ), + Divider( + height: 1.w, + ), + AkuBox.h(28), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + AkuBox.w(24), + ClipRRect( + borderRadius: BorderRadius.circular(4.w), + child: (item.assetpath is String) + ? Image.asset( + item.assetpath, + height: 184.w, + width: 184.w, + fit: BoxFit.cover, + ) + : Image.file( + item.assetpath, + height: 184.w, + width: 184.w, + fit: BoxFit.cover, + ), + ), + AkuBox.w(24), + Expanded( + child: Column( + children: [ + _buildRow( + R.ASSETS_MANAGE_IC_RENWU_PNG, '物品单号', item.code), + _buildRow( + R.ASSETS_MANAGE_BORROW_PNG, + '出借状态', + '未借出', + color: AppStyle.secondaryColor, + ), + ], + ), + ), + ], + ), + AkuBox.h(32), + ], + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + ), + ); + } + + _buildRow( + String assetPath, + String title, + String subTitle, { + Color color = AppStyle.primaryTextColor, + }) { + return Row( + children: [ + Image.asset( + assetPath, + height: 40.w, + width: 40.w, + ), + Text( + '$title\:', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + Text( + subTitle, + style: TextStyle( + color: color, + fontSize: 28.w, + ), + ), + ], + ); + } +} diff --git a/lib/ui/sub_pages/borrow_manager/borrow_manager_card.dart b/lib/ui/sub_pages/borrow_manager/borrow_manager_card.dart new file mode 100644 index 0000000..755ccef --- /dev/null +++ b/lib/ui/sub_pages/borrow_manager/borrow_manager_card.dart @@ -0,0 +1,221 @@ +import 'package:aku_community_manager/mock_models/borrow/borrow_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/borrow_manager/borrow_manager_check_page.dart'; +import 'package:aku_community_manager/ui/widgets/inner/aku_chip_box.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class BorrowManagerCard extends StatefulWidget { + final BorrowModel model; + BorrowManagerCard({Key key, this.model}) : super(key: key); + + @override + _BorrowManagerCardState createState() => _BorrowManagerCardState(); +} + +class _BorrowManagerCardState extends State { + USER_ROLE get role => + Provider.of(context, listen: false).userInfoModel.role; + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 16.w), + padding: EdgeInsets.all(24.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + AkuChipBox(title: '借还管理'), + AkuBox.w(24), + Text( + DateUtil.formatDate(widget.model.date), + style: TextStyle(), + ), + Spacer(), + Text( + widget.model.borrowGoods.borrowValue, + style: TextStyle( + color: AppStyle.failColor, + fontWeight: FontWeight.bold, + fontSize: 24.sp, + ), + ), + ], + ), + AkuBox.h(24), + Text( + widget.model.title, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold, + ), + ), + AkuBox.h(16), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + (widget.model.borrowGoods.assetpath is String) + ? Image.asset( + widget.model.borrowGoods.assetpath, + height: 184.w, + width: 183.w, + fit: BoxFit.cover, + ) + : Image.file( + widget.model.borrowGoods.assetpath, + height: 184.w, + width: 183.w, + fit: BoxFit.cover, + ), + AkuBox.w(24), + Expanded( + child: Column( + children: [ + _buildRow(R.ASSETS_MESSAGE_IC_PEOPLE_PNG, '借用人员', + widget.model.borrowPerson), + _buildRow(R.ASSETS_MESSAGE_IC_PHONE_PNG, '联系电话', + widget.model.phone), + _buildRow(R.ASSETS_MANAGE_IC_TIME_PNG, '借用时常', + '${widget.model.borrowTime}天'), + _buildRow( + R.ASSETS_MANAGE_INFO_PNG, + '物品状态', + widget.model.goodsStatus == GOODS_STATUS.BROKEN + ? '损坏' + : widget.model.goodsStatus == GOODS_STATUS.LOST + ? '丢失' + : '正常', + color: widget.model.goodsStatus == GOODS_STATUS.NORMAL + ? AppStyle.primaryTextColor + : AppStyle.failColor, + ), + ], + ), + ), + ], + ), + ..._buildCard(), + ], + ), + ); + } + + List _buildCard() { + if (role != USER_ROLE.MANAGER) + return []; + else if (widget.model.borrowGoods.status == BORROW_STATUS.DONE) { + return []; + } else + return [ + Divider(height: 48.w), + Row( + children: [ + Spacer(), + MaterialButton( + minWidth: 160.w, + height: 64.w, + child: Text( + '电话联系', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + onPressed: () { + launch('tel:${widget.model.phone}'); + }, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(4.w), + side: BorderSide(color: AppStyle.primaryColor, width: 2.w), + ), + ), + AkuBox.w(24), + widget.model.borrowGoods.status == BORROW_STATUS.BORROWING + ? AkuMaterialButton( + minWidth: 160.w, + height: 64.w, + color: AppStyle.primaryColor, + radius: 4.w, + onPressed: () { + BotToast.showText(text: '已提醒用户'); + }, + child: Text( + '提醒归还', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.w, + ), + ), + ) + : SizedBox(), + widget.model.borrowGoods.status == BORROW_STATUS.WAIT_CHECK + ? AkuMaterialButton( + minWidth: 160.w, + height: 64.w, + color: AppStyle.primaryColor, + radius: 4.w, + onPressed: () { + Get.to(BorrowManagerCheckPage(model: widget.model)); + }, + child: Text( + '检查信息', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontWeight: FontWeight.bold, + fontSize: 28.w, + ), + ), + ) + : SizedBox(), + ], + ), + ]; + } + + _buildRow( + String assetPath, + String title, + String subTitle, { + Color color = AppStyle.primaryTextColor, + }) { + return Row( + children: [ + Image.asset( + assetPath, + height: 40.w, + width: 40.w, + ), + Text( + '$title\:', + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + Text( + subTitle, + style: TextStyle( + color: color, + fontSize: 28.w, + ), + ), + ], + ); + } +} diff --git a/lib/ui/sub_pages/borrow_manager/borrow_manager_check_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_manager_check_page.dart new file mode 100644 index 0000000..4114a9c --- /dev/null +++ b/lib/ui/sub_pages/borrow_manager/borrow_manager_check_page.dart @@ -0,0 +1,170 @@ +import 'package:aku_community_manager/mock_models/borrow/borrow_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_community_manager/ui/widgets/inner/aku_bottom_button.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class BorrowManagerCheckPage extends StatefulWidget { + final BorrowModel model; + BorrowManagerCheckPage({Key key, @required this.model}) : super(key: key); + + @override + _BorrowManagerCheckPageState createState() => _BorrowManagerCheckPageState(); +} + +class _BorrowManagerCheckPageState extends State { + GOODS_STATUS borrowStatus = GOODS_STATUS.NORMAL; + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '检查物品', + bottom: AkuBottomButton( + title: '确认归还', + onTap: () { + widget.model.goodsStatus = borrowStatus; + widget.model.borrowGoods.status = BORROW_STATUS.DONE; + Get.back(); + }, + ), + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.symmetric(horizontal: 32.w), + child: Column( + children: [ + _buildRow( + '物品名称', + Text( + widget.model.borrowGoods.name, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + ), + Divider(height: 1.w), + _buildRow( + '物品单号', + Text( + widget.model.borrowGoods.code, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + ), + ), + Divider(height: 1.w), + _buildRow( + '归还数量', + Text( + '1', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold, + ), + )), + Divider(height: 1.w), + _buildRow( + '物品情况', + Row( + children: [ + _buildCard(GOODS_STATUS.NORMAL), + AkuBox.w(24), + _buildCard(GOODS_STATUS.BROKEN), + AkuBox.w(24), + _buildCard(GOODS_STATUS.LOST), + ], + ), + ), + Divider(height: 1.w), + AkuBox.h(16), + _buildRow( + '物品图片', + (widget.model.borrowGoods.assetpath is String) + ? Image.asset( + widget.model.borrowGoods.assetpath, + height: 184.w, + width: 184.w, + fit: BoxFit.cover, + ) + : Image.file( + widget.model.borrowGoods.assetpath, + height: 184.w, + width: 184.w, + fit: BoxFit.cover, + ), + ), + AkuBox.h(28), + ], + ), + ), + ], + ), + ); + } + + _buildRow(String title, Widget child) { + return Row( + children: [ + AkuBox.h(96), + Text( + title, + style: TextStyle( + color: AppStyle.minorTextColor, + fontSize: 28.w, + ), + ), + AkuBox.w(80), + Expanded( + child: Align( + alignment: Alignment.centerLeft, + child: child, + ), + ), + ], + ); + } + + _buildCard(GOODS_STATUS status) { + return GestureDetector( + onTap: () { + borrowStatus = status; + setState(() {}); + }, + child: Container( + height: 56.w, + width: 112.w, + child: Text( + { + GOODS_STATUS.NORMAL: '完好', + GOODS_STATUS.BROKEN: '损坏', + GOODS_STATUS.LOST: '丢失', + }[status], + style: TextStyle( + color: borrowStatus == status + ? AppStyle.secondaryColor + : AppStyle.minorTextColor, + fontSize: 28.sp, + ), + ), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4), + border: Border.all( + color: borrowStatus == status + ? AppStyle.secondaryColor + : AppStyle.minorTextColor, + width: 2.w, + ), + ), + ), + ); + } +} diff --git a/lib/ui/sub_pages/borrow_manager/borrow_manager_page.dart b/lib/ui/sub_pages/borrow_manager/borrow_manager_page.dart new file mode 100644 index 0000000..4d793bc --- /dev/null +++ b/lib/ui/sub_pages/borrow_manager/borrow_manager_page.dart @@ -0,0 +1,99 @@ +import 'package:aku_community_manager/mock_models/borrow/borrow_data.dart'; +import 'package:aku_community_manager/mock_models/borrow/borrow_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/ui/sub_pages/borrow_manager/all_borrow_goods.dart'; +import 'package:aku_community_manager/ui/sub_pages/borrow_manager/borrow_manager_card.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:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:provider/provider.dart'; + +class BorrowManagerPage extends StatefulWidget { + BorrowManagerPage({Key key}) : super(key: key); + + @override + _BorrowManagerPageState createState() => _BorrowManagerPageState(); +} + +class _BorrowManagerPageState extends State + with TickerProviderStateMixin { + USER_ROLE get role => + Provider.of(context, listen: false).userInfoModel.role; + TabController _tabController; + List get _tabs { + switch (role) { + case USER_ROLE.MANAGER: + return ['全部', '出借中', '待检查', '已归还']; + default: + return ['全部', '出借中', '已归还']; + } + } + + @override + void initState() { + super.initState(); + _tabController = TabController(length: _tabs.length, vsync: this); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '物品清单', + appBarBottom: PreferredSize( + child: AkuTabBar( + controller: _tabController, + tabs: _tabs, + ), + preferredSize: Size.fromHeight(96.w)), + actions: [ + AkuMaterialButton( + minWidth: 178.w, + onPressed: () { + Get.to(AllBorrowGoods()); + }, + child: Text( + '全部物品', + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + ), + ], + body: TabBarView( + controller: _tabController, + children: _getChildren(), + ), + ); + } + + List _getChildren() { + switch (role) { + case USER_ROLE.MANAGER: + return [ + getView(BorrowData.models), + getView(BorrowData.borrowModels), + getView(BorrowData.checkModels), + getView(BorrowData.doneModels), + ]; + break; + default: + return []; + } + } +} + +Widget getView(List models) { + return ListView.builder( + itemBuilder: (context, index) { + return BorrowManagerCard( + model: models[index], + ); + }, + itemCount: models.length, + ); +} diff --git a/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart b/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart index d4452a2..53a909d 100644 --- a/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart +++ b/lib/ui/sub_pages/business_and_fix/fix_work_finish_page.dart @@ -8,6 +8,7 @@ import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/ui/widgets/inner/aku_title_box.dart'; import 'package:aku_community_manager/ui/widgets/inner/pick_image.dart'; import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:common_utils/common_utils.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -24,6 +25,18 @@ class _FixWorkFinishPageState extends State { List _imgs = []; TextEditingController _descriptionController = TextEditingController(); TextEditingController _materialController = TextEditingController(); + + TextEditingController _humanController = TextEditingController(); + TextEditingController _materialPriceController = TextEditingController(); + @override + void dispose() { + _descriptionController?.dispose(); + _materialController?.dispose(); + _materialPriceController?.dispose(); + _humanController?.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { return AkuScaffold( @@ -243,10 +256,85 @@ class _FixWorkFinishPageState extends State { ) ], ), + // widget.model.detail.type == FIX_PAYMENT_TYPE.FREE + // ? SizedBox() + // : AkuTitleBox( title: '费用明细', + spacing: 16, children: [ - + Row( + children: [ + AkuBox.h(96), + Text('人工费'), + Expanded( + child: TextField( + controller: _humanController, + onChanged: (_) => setState(() {}), + keyboardType: TextInputType.number, + textAlign: TextAlign.end, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入', + hintStyle: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 28.sp, + color: AppStyle.minorTextColor, + ), + ), + ), + ), + ], + ), + Divider(height: 1.w), + Row( + children: [ + AkuBox.h(96), + Text('材料费'), + Expanded( + child: TextField( + onChanged: (_) => setState(() {}), + controller: _materialPriceController, + textAlign: TextAlign.end, + keyboardType: TextInputType.number, + decoration: InputDecoration( + border: InputBorder.none, + hintText: '请输入', + hintStyle: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 28.sp, + color: AppStyle.minorTextColor, + ), + ), + ), + ), + ], + ), + Divider(height: 1.w), + Row( + children: [ + AkuBox.h(96), + Text('总计费用'), + Spacer(), + Builder( + builder: (context) { + double humanPrice = + double.tryParse(_humanController.text); + double materialPrice = + double.tryParse(_materialPriceController.text); + + if (TextUtil.isEmpty(_humanController.text) || + TextUtil.isEmpty(_materialPriceController.text)) { + return Text('人工费或材料费不能为空'); + } else if (humanPrice == null || materialPrice == null) + return Text('输入有误'); + else + return Text( + '¥${(humanPrice + materialPrice).toStringAsFixed(2)}'); + }, + ), + ], + ), ], ), ], @@ -269,6 +357,11 @@ class _FixWorkFinishPageState extends State { imgs: _imgs, ); widget.model.type = FIX_ENUM.DONE; + if (widget.model.detail.type == FIX_PAYMENT_TYPE.PAY) + widget.model.detail.priceDetail = FixPriceDetail( + humanPrice: double.parse(_humanController.text), + materialPrice: double.parse(_materialController.text), + ); Get.back(); }, ), diff --git a/lib/ui/sub_pages/decoration_manager/decoration_department_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_department_page.dart index c981799..388ea4f 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_department_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_department_page.dart @@ -1,6 +1,5 @@ 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'; diff --git a/lib/ui/sub_pages/decoration_manager/decoration_follow_check.dart b/lib/ui/sub_pages/decoration_manager/decoration_follow_check.dart new file mode 100644 index 0000000..6b75ea0 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_follow_check.dart @@ -0,0 +1,270 @@ +import 'package:aku_community_manager/mock_models/decoration/decoration_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/sub_pages/decoration_manager/decoration_checkbox.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_success_page.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:common_utils/common_utils.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class DecorationFollowCheck extends StatefulWidget { + final DecorationModel model; + DecorationFollowCheck({Key key, @required this.model}) : super(key: key); + + @override + _DecorationFollowCheckState createState() => _DecorationFollowCheckState(); +} + +class _DecorationFollowCheckState extends State { + Map checkStatus = { + CHECK_TYPE.ELECTRIC: true, + CHECK_TYPE.WATER: true, + CHECK_TYPE.WALL: true, + CHECK_TYPE.DOOR_AND_WINDOWS: true, + CHECK_TYPE.SECURITY: true, + }; + + bool get success { + for (var item in checkStatus.keys) { + if (checkStatus[item] == false) return false; + } + return true; + } + + TextEditingController _textEditingController = TextEditingController(); + @override + void dispose() { + _textEditingController?.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '跟踪检查', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 16.w), + children: [ + Container( + color: Colors.white, + padding: EdgeInsets.symmetric( + horizontal: 32.w, + vertical: 16.w, + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + child: Row( + children: [ + Container( + height: 56.w, + width: 56.w, + alignment: Alignment.center, + child: Text( + '家', + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold, + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(28.w), + color: Color(0xFFE9F2FF), + ), + ), + AkuBox.w(30), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.model.userHomeModel.plot, + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + fontSize: 24.sp, + ), + ), + Text( + widget.model.userHomeModel.detailAddr, + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + fontSize: 24.sp, + ), + ), + ], + ), + ), + ], + ), + padding: EdgeInsets.symmetric( + vertical: 26.w, + horizontal: 32.w, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Color(0xFFF9F9F9), + ), + ), + AkuBox.h(16), + Container( + child: Row( + children: [ + Container( + height: 56.w, + width: 56.w, + alignment: Alignment.center, + child: Text( + '装', + style: TextStyle( + color: AppStyle.secondaryColor, + fontSize: 24.sp, + fontWeight: FontWeight.bold, + ), + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(28.w), + color: Color(0xFFE9F2FF), + ), + ), + AkuBox.w(30), + Expanded( + child: Text( + widget.model.decorationTeamModel.name, + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + fontSize: 24.sp, + ), + ), + ), + ], + ), + padding: EdgeInsets.symmetric( + vertical: 26.w, + horizontal: 32.w, + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Color(0xFFF9F9F9), + ), + ), + AkuBox.h(16), + Row( + children: [ + Text( + '${DateUtil.formatDate( + DateTime.now(), + format: 'yyyy-MM-dd', + )} 周期检查', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + Spacer(), + AkuBox.h(96), + Text( + success ? '正常' : '异常', + style: TextStyle( + color: success + ? AppStyle.successColor + : AppStyle.failColor, + fontSize: 28.w, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + _buildRow(CHECK_TYPE.ELECTRIC), + _buildRow(CHECK_TYPE.WATER), + _buildRow(CHECK_TYPE.WALL), + _buildRow(CHECK_TYPE.DOOR_AND_WINDOWS), + _buildRow(CHECK_TYPE.SECURITY), + TextField( + minLines: 3, + maxLines: 99, + controller: _textEditingController, + decoration: InputDecoration( + contentPadding: EdgeInsets.symmetric( + vertical: 16.w, + horizontal: 24.w, + ), + hintText: '请输入检查描述', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.w), + borderSide: BorderSide( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(8.w), + borderSide: BorderSide( + width: 2.w, + color: Color(0xFFE8E8E8), + ), + ), + ), + ), + ], + ), + ), + ], + ), + bottom: AkuBottomButton( + onTap: () { + widget.model.checkInfomations.add( + CheckInfomation( + checkDate: DateTime.now(), + checkType: '周期检查', + info: _textEditingController.text, + details: checkStatus.entries.map((e) { + return CheckDetail(type: e.key, status: e.value); + }).toList(), + ), + ); + widget.model.type = DecorationType.DONE; + Get.off(DecorationSuccessPage()); + }, + title: '确认提交', + ), + ); + } + + _buildRow( + CHECK_TYPE type, + ) { + return Row( + children: [ + Image.asset( + checkAssetMap[type], + height: 40.w, + width: 40.w, + ), + Text( + checkTypeMap[type], + style: TextStyle( + fontSize: 28.w, + color: AppStyle.primaryTextColor, + ), + ), + Spacer(), + DecorationCheckBox( + initValue: checkStatus[type], + onChange: (state) { + checkStatus[type] = state; + setState(() {}); + }, + ), + Spacer(), + ], + ); + } +} diff --git a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart index e44f94b..b2679ed 100644 --- a/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart +++ b/lib/ui/sub_pages/decoration_manager/decoration_manager_detail_page.dart @@ -1,12 +1,16 @@ import 'package:aku_community_manager/mock_models/decoration/decoration_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/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_department_page.dart'; +import 'package:aku_community_manager/ui/sub_pages/decoration_manager/decoration_follow_check.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/inner/aku_bottom_button.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/const/resource.dart'; @@ -17,6 +21,7 @@ import 'package:expandable/expandable.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:provider/provider.dart'; class DecorationManagerDetailPage extends StatefulWidget { final DecorationModel model; @@ -31,6 +36,8 @@ class DecorationManagerDetailPage extends StatefulWidget { class _DecorationManagerDetailStatePage extends State { bool get isWaitHandOut => widget.model.type == DecorationType.WAIT_HAND_OUT; + USER_ROLE get role => + Provider.of(context, listen: false).userInfoModel.role; @override Widget build(BuildContext context) { return AkuScaffold( @@ -43,11 +50,51 @@ class _DecorationManagerDetailStatePage ? SizedBox() : _buildFinishWorkCheck(), _buildCycleCheck(), - widget.model.type == DecorationType.WAIT_HAND_OUT + widget.model.checkInfomations == null ? SizedBox() : _buildCheckDetail(), ], ), + bottom: Builder(builder: (context) { + final CycleCheck cycleCheck = widget.model.cycleCheck; + if (role == USER_ROLE.MANAGER) { + switch (widget.model.type) { + case DecorationType.WAIT_HAND_OUT: + return AkuBottomButton( + title: '立即安排', + onTap: cycleCheck.authPerson != null && + cycleCheck.checkCycle != null && + cycleCheck.startDate != null + ? () { + widget.model.type = DecorationType.HAND_OUT; + setState(() {}); + } + : null, + ); + break; + default: + return SizedBox(); + break; + } + + // else if(widget.model.type) + } else if (role == USER_ROLE.PROPERTY) { + switch (widget.model.type) { + case DecorationType.HAND_OUT: + return AkuBottomButton( + title: '立即执行', + onTap: () { + Get.to(DecorationFollowCheck(model: widget.model)); + }, + ); + break; + default: + return SizedBox(); + break; + } + } else + return SizedBox(); + }), ); } diff --git a/lib/ui/sub_pages/decoration_manager/decoration_success_page.dart b/lib/ui/sub_pages/decoration_manager/decoration_success_page.dart new file mode 100644 index 0000000..28f6ba6 --- /dev/null +++ b/lib/ui/sub_pages/decoration_manager/decoration_success_page.dart @@ -0,0 +1,71 @@ +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/common_widgets/aku_material_button.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; + +class DecorationSuccessPage extends StatefulWidget { + DecorationSuccessPage({Key key}) : super(key: key); + + @override + _DecorationSuccessPageState createState() => _DecorationSuccessPageState(); +} + +class _DecorationSuccessPageState extends State { + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '跟踪检查', + backgroundColor: Color(0xFFF9F9F9), + body: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 100.w, + width: 100.w, + child: Placeholder(), + ), + Text( + '提交成功', + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.primaryTextColor, + fontSize: 40.sp, + ), + ), + Text( + '你的装修跟踪检查记录已提交', + style: TextStyle( + fontWeight: FontWeight.bold, + color: AppStyle.minorTextColor, + fontSize: 26.sp, + ), + ), + AkuBox.h(80), + AkuMaterialButton( + height: 88.w, + minWidth: 280.w, + radius: 8.w, + onPressed: () { + Get.back(); + Get.back(); + }, + color: AppStyle.primaryColor, + child: Text( + '查看', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.w, + fontWeight: FontWeight.bold, + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/ui/sub_pages/visitor_manager/visitor_manager_card.dart b/lib/ui/sub_pages/visitor_manager/visitor_manager_card.dart index d716d22..702427a 100644 --- a/lib/ui/sub_pages/visitor_manager/visitor_manager_card.dart +++ b/lib/ui/sub_pages/visitor_manager/visitor_manager_card.dart @@ -4,35 +4,46 @@ import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/ui/sub_pages/visitor_manager/visitor_manager_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; + class VisitorManagerCard extends StatefulWidget { final String adress; final String name; final String plate; final String time; final VisitorStatus status; - VisitorManagerCard({Key key, @required this.adress,@required this.name, this.plate, this.time,@required this.status}) : super(key: key); + VisitorManagerCard( + {Key key, + @required this.adress, + @required this.name, + this.plate, + this.time, + @required this.status}) + : super(key: key); @override _VisitorManagerCardState createState() => _VisitorManagerCardState(); } class _VisitorManagerCardState extends State { - -TextStyle _textStyle=TextStyle(color:AppStyle.primaryTextColor,fontSize:28.sp,); -String _adress; -String _name; -String _plate; -String _time; -VisitorStatus _status; + TextStyle _textStyle = TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + ); + String _adress; + String _name; + String _plate; + String _time; + VisitorStatus _status; @override - void initState() { + void initState() { super.initState(); - _adress=widget.adress; - _name=widget.name; - _plate=widget.plate??'无信息'; - _time=widget.time??'无信息'; - _status=widget.status; + _adress = widget.adress; + _name = widget.name; + _plate = widget.plate ?? '无信息'; + _time = widget.time ?? '无信息'; + _status = widget.status; } + @override Widget build(BuildContext context) { return Column( @@ -42,49 +53,80 @@ VisitorStatus _status; color: Color(0xFFFFFFFF), width: double.infinity, height: 201.w, - padding: EdgeInsets.only(top:24.w,left:24.w,bottom: 28.w), - child: Stack(children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children:[ - Text(_adress,style: TextStyle(color:AppStyle.primaryTextColor,fontSize:32.sp,fontWeight: FontWeight.bold),), - AkuBox.h(16), - Row(children: [ - Image.asset(R.ASSETS_USER_IC_PERSON_PNG,width:40.w ,height: 40.w,), - AkuBox.w(8), - Text('$_name先生',style:_textStyle,), - AkuBox.w(137), - Image.asset(R.ASSETS_HOME_IC_BORROW_PNG,width: 40.w,height: 40.w,), - AkuBox.w(8), - Text(_plate,style: _textStyle,), + padding: EdgeInsets.only(top: 24.w, left: 24.w, bottom: 28.w), + child: Stack( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _adress, + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.bold), + ), + AkuBox.h(16), + Row( + children: [ + Image.asset( + R.ASSETS_USER_IC_PERSON_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(8), + Text( + '$_name先生', + style: _textStyle, + ), + AkuBox.w(137), + Image.asset( + R.ASSETS_HOME_IC_BORROW_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(8), + Text( + _plate, + style: _textStyle, + ), + Spacer(), + ], + ), Spacer(), - ],), - Spacer(), - Row(children: [ - Image.asset(R.ASSETS_HOME_IC_ARTICLE_PNG,width: 40.w,height: 40.w,), - AkuBox.w(8), - Text(_time,style:_textStyle), - Spacer(), - ],), - ], - ), - Positioned( - left: 582.w, - bottom: 104.w, - child:_statusImage(_status) ), - ],), + Row( + children: [ + Image.asset( + R.ASSETS_HOME_IC_ARTICLE_PNG, + width: 40.w, + height: 40.w, + ), + AkuBox.w(8), + Text(_time, style: _textStyle), + Spacer(), + ], + ), + ], + ), + Positioned( + left: 582.w, bottom: 104.w, child: _statusImage(_status)), + ], + ), ), ], ); } - Widget _statusImage(VisitorStatus status){ + + Widget _statusImage(VisitorStatus status) { switch (status) { case VisitorStatus.NOT_VISIT: - return Placeholder(); - case VisitorStatus.VISIT_DONE: - return Placeholder(); - case VisitorStatus.OUTDATE: - return Placeholder(); + return Placeholder(); + case VisitorStatus.VISIT_DONE: + return Placeholder(); + case VisitorStatus.OUTDATE: + return Placeholder(); + default: + return Placeholder(); } } -} \ No newline at end of file +} diff --git a/lib/ui/widgets/common/aku_scaffold.dart b/lib/ui/widgets/common/aku_scaffold.dart index d86d74f..34f6b82 100644 --- a/lib/ui/widgets/common/aku_scaffold.dart +++ b/lib/ui/widgets/common/aku_scaffold.dart @@ -6,7 +6,7 @@ import 'package:aku_community_manager/tools/screen_tool.dart'; class AkuScaffold extends StatefulWidget { ///AppBar 使用该值 `title`,`titleStyle`,`leading`, - ///`brightness`,`appBarColor`,``将失效 + ///`brightness`,`appBarColor`,`actions`将失效 final PreferredSizeWidget appBar; ///title @@ -45,6 +45,8 @@ class AkuScaffold extends StatefulWidget { final Color appBarColor; + final List actions; + final PreferredSizeWidget appBarBottom; AkuScaffold({ Key key, @@ -58,6 +60,7 @@ class AkuScaffold extends StatefulWidget { this.bottom, this.appBarColor = Colors.white, this.appBarBottom, + this.actions = const [], }) : super(key: key); @override @@ -86,6 +89,7 @@ class _AkuScaffoldState extends State { child: Text(widget.title ?? ''), ), bottom: widget.appBarBottom, + actions: widget.actions, ), body: widget.body, bottomNavigationBar: widget.bottom, diff --git a/lib/ui/widgets/common/aku_tile.dart b/lib/ui/widgets/common/aku_tile.dart index 4570dc1..2eed6be 100644 --- a/lib/ui/widgets/common/aku_tile.dart +++ b/lib/ui/widgets/common/aku_tile.dart @@ -1,4 +1,3 @@ -import 'package:aku_ui/common_widgets/aku_material_button.dart'; import 'package:flutter/material.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; diff --git a/lib/ui/widgets/inner/aku_bottom_button.dart b/lib/ui/widgets/inner/aku_bottom_button.dart new file mode 100644 index 0000000..482e01b --- /dev/null +++ b/lib/ui/widgets/inner/aku_bottom_button.dart @@ -0,0 +1,34 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_ui/common_widgets/aku_material_button.dart'; +import 'package:flutter/material.dart'; + +class AkuBottomButton extends StatefulWidget { + final VoidCallback onTap; + final String title; + AkuBottomButton({Key key, this.onTap, @required this.title}) + : super(key: key); + + @override + _AkuBottomButtonState createState() => _AkuBottomButtonState(); +} + +class _AkuBottomButtonState extends State { + @override + Widget build(BuildContext context) { + return AkuMaterialButton( + height: 98.w, + color: AppStyle.primaryColor, + nullColor: AppStyle.minorColor, + onPressed: widget.onTap, + child: Text( + widget.title, + style: TextStyle( + fontWeight: FontWeight.bold, + color: widget.onTap == null + ? AppStyle.minorTextColor + : AppStyle.primaryTextColor, + ), + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index d2f6c2f..43a5358 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -10,6 +10,34 @@ packages: url: "http://test.akuhotel.com:8099/aku_fe/aku_ui.git" source: git version: "0.0.1" + amap_core_fluttify: + dependency: transitive + description: + name: amap_core_fluttify + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.12.0" + amap_location_fluttify: + dependency: transitive + description: + name: amap_location_fluttify + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.18.0" + amap_map_fluttify: + dependency: "direct main" + description: + name: amap_map_fluttify + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.29.0" + amap_search_fluttify: + dependency: transitive + description: + name: amap_search_fluttify + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.14.0" async: dependency: transitive description: @@ -80,6 +108,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "2.1.1" + core_location_fluttify: + dependency: transitive + description: + name: core_location_fluttify + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.4.1" crypto: dependency: transitive description: @@ -172,6 +207,18 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + foundation_fluttify: + dependency: transitive + description: + name: foundation_fluttify + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.9.10+1" get: dependency: "direct main" description: @@ -338,6 +385,48 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.3.0-nullsafety.3" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + url: "https://pub.flutter-io.cn" + source: hosted + version: "5.7.10" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+4" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+9" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + url: "https://pub.flutter-io.cn" + source: hosted + version: "1.0.9" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.1.5+1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.1+3" vector_math: dependency: transitive description: @@ -347,4 +436,4 @@ packages: version: "2.1.0-nullsafety.3" sdks: dart: ">=2.10.0 <2.11.0" - flutter: ">=1.20.0 <2.0.0" + flutter: ">=1.22.0 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c180439..d9fef7d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,6 +56,10 @@ dependencies: expandable: ^4.1.4 + url_launcher: ^5.7.10 + + amap_map_fluttify: ^0.29.0 + aku_ui: git: url: http://test.akuhotel.com:8099/aku_fe/aku_ui.git