diff --git a/lib/base/base_style.dart b/lib/base/base_style.dart index 9faab066..b081be9f 100644 --- a/lib/base/base_style.dart +++ b/lib/base/base_style.dart @@ -9,7 +9,6 @@ const kForeGroundColor = Color(0xFFFFFFFF); const kPrimaryColor = Color(0xFFFFC40C); const kDarkPrimaryColor = Color(0xFFFF8200); const kDangerColor = Color(0xFFFF3B30); -const kEstateName = '宁波华悦茂峰'; const kDarkSubColor = Color(0xFF979797); class BaseStyle { diff --git a/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart b/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart index 388fa0ac..b3e05dc9 100644 --- a/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart +++ b/lib/pages/goods_deto_page/deto_code_page/deto_code_page.dart @@ -1,7 +1,10 @@ +import 'package:akuCommunity/constants/app_values.dart'; +import 'package:akuCommunity/provider/app_provider.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_icons/flutter_icons.dart'; +import 'package:provider/provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:akuCommunity/base/base_style.dart'; @@ -22,7 +25,7 @@ class DetoCodePage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( - kEstateName, + AppValues.plotName, style: TextStyle(fontSize: 40.sp, color: Color(0xffffffff)), ), SizedBox(height: 10.w), @@ -140,6 +143,7 @@ class DetoCodePage extends StatelessWidget { @override Widget build(BuildContext context) { + final AppProvider appProvider = Provider.of(context); return BeeScaffold( title: '出户二维码', body: Container( @@ -149,7 +153,7 @@ class DetoCodePage extends StatelessWidget { Column( children: [ SizedBox(height: 192.w - kToolbarHeight), - _header(model.appArticleOutQRCodeVo.roomName), + _header(appProvider.selectedHouse.roomName), SizedBox(height: 32.w), _card(model.appArticleOutQRCodeVo.applicantName, model.appArticleOutQRCodeVo.effectiveTime), diff --git a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart index 1ebdd3c5..a2da67ed 100644 --- a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart +++ b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart @@ -2,6 +2,8 @@ import 'dart:io'; +import 'package:akuCommunity/constants/app_values.dart'; +import 'package:akuCommunity/provider/app_provider.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -106,7 +108,7 @@ class _DetoCreatePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - kEstateName, + AppValues.plotName, style: TextStyle( fontWeight: FontWeight.w600, fontSize: 32.sp, @@ -268,11 +270,13 @@ class _DetoCreatePageState extends State { onTap: onTap, child: Row( children: [ - (select.isEmptyOrNull ? '请选择' : select) + ((select?.isEmptyOrNull ?? true) ? '请选择' : select) .text - .color(select.isEmptyOrNull ? ktextSubColor : ktextPrimary) + .color((select?.isEmptyOrNull ?? true) + ? ktextSubColor + : ktextPrimary) .size(36.sp) - .fontWeight(select.isEmptyOrNull + .fontWeight((select?.isEmptyOrNull ?? true) ? FontWeight.normal : FontWeight.bold) .make(), @@ -399,12 +403,13 @@ class _DetoCreatePageState extends State { @override Widget build(BuildContext context) { UserProvider userProvider = Provider.of(context); + AppProvider appProvider = Provider.of(context); return BeeScaffold( title: '物品出户', body: ListView( padding: EdgeInsets.all(32.w), children: [ - _houseAddress(userProvider.currentHouse), + _houseAddress(appProvider.selectedHouse.roomName), _getWeight(), _itemPicker('出户时间', datetime, () async { _date = await BeeDatePicker.timePicker(DateTime.now()); diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 619c0f4a..097d7c34 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/constants/app_values.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -79,7 +80,7 @@ class _LifePayPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - kEstateName.text.black.size(32.sp).bold.make(), + AppValues.plotName.text.black.size(32.sp).bold.make(), 10.w.heightBox, userProvider.currentHouse.text.black .size(32.sp) diff --git a/lib/pages/life_pay/widget/life_pay_detail_page.dart b/lib/pages/life_pay/widget/life_pay_detail_page.dart index f0d7f1f3..790dd69f 100644 --- a/lib/pages/life_pay/widget/life_pay_detail_page.dart +++ b/lib/pages/life_pay/widget/life_pay_detail_page.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/constants/app_values.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -93,7 +94,7 @@ class _LifePayDetailPageState extends State { children: [ model.name.text.black.size(30.sp).bold.make(), Spacer(), - '$kEstateName ${userProvider.currentHouse}' + '${AppValues.plotName} ${userProvider.currentHouse}' .text .color(ktextSubColor) .size(24.sp) diff --git a/lib/pages/life_pay/widget/my_house_page.dart b/lib/pages/life_pay/widget/my_house_page.dart index bbcf6636..760dc20f 100644 --- a/lib/pages/life_pay/widget/my_house_page.dart +++ b/lib/pages/life_pay/widget/my_house_page.dart @@ -1,3 +1,5 @@ +import 'package:akuCommunity/constants/app_values.dart'; +import 'package:akuCommunity/provider/app_provider.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -65,6 +67,7 @@ class _MyHousePageState extends State { Widget _buildCard(int currentHouseId, String estateName, int index, {bool paid = false}) { UserProvider userProvider = Provider.of(context); + AppProvider appProvider = Provider.of(context); return Container( padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), child: GestureDetector( @@ -84,10 +87,13 @@ class _MyHousePageState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ - kEstateName.text.size(24.sp).color(ktextSubColor).bold.make(), + AppValues.plotName.text + .size(24.sp) + .color(ktextSubColor) + .bold + .make(), 16.w.heightBox, - BeeParse.getEstateName(estateName) - .text + appProvider.selectedHouse.roomName.text .color(ktextPrimary) .size(28.sp) .bold diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart index 6b3c1a37..09e71315 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:akuCommunity/constants/app_values.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -218,7 +219,7 @@ class _AddFixedSubmitPageState extends State { ListView( children: [ _buildHouseCard( - kEstateName, + AppValues.plotName, userProvider.userDetailModel.estateNames.isEmpty ? '' : BeeParse.getEstateName( diff --git a/lib/pages/visitor_access_page/visitor_access_page.dart b/lib/pages/visitor_access_page/visitor_access_page.dart index c966d23f..7c3964e4 100644 --- a/lib/pages/visitor_access_page/visitor_access_page.dart +++ b/lib/pages/visitor_access_page/visitor_access_page.dart @@ -1,3 +1,5 @@ +import 'package:akuCommunity/constants/app_values.dart'; +import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -45,7 +47,7 @@ class _VisitorAccessPageState extends State { 32.w.heightBox, GestureDetector( onTap: () { - MyHousePage().to(); + Get.to(() => PickMyHousePage()); }, child: Row( children: [ @@ -302,7 +304,7 @@ class _VisitorAccessPageState extends State { child: Column( children: [ _buildHouseCard( - kEstateName, + AppValues.plotName, userProvider.userDetailModel.estateNames.isEmpty ? '' : BeeParse.getEstateName( diff --git a/lib/ui/home/application/all_application.dart b/lib/ui/home/application/all_application.dart index b54b488a..50e25ef2 100644 --- a/lib/ui/home/application/all_application.dart +++ b/lib/ui/home/application/all_application.dart @@ -35,6 +35,7 @@ class _AllApplicationPageState extends State { ? null : () { if (LoginUtil.isNotLogin) return; + if (!LoginUtil.haveRoom(object.title)) return; Get.to(object.page); }, child: Column( diff --git a/lib/ui/profile/house/house_card.dart b/lib/ui/profile/house/house_card.dart index 1d2970b6..c9e29d15 100644 --- a/lib/ui/profile/house/house_card.dart +++ b/lib/ui/profile/house/house_card.dart @@ -109,7 +109,7 @@ class HouseCard extends StatelessWidget { ), ), onPressed: () { - Get.to(PickMyHousePage()); + Get.to(()=>PickMyHousePage()); }, shape: RoundedRectangleBorder( borderRadius: diff --git a/lib/ui/profile/house/pick_my_house_page.dart b/lib/ui/profile/house/pick_my_house_page.dart index 3d7d9b09..11ea4e16 100644 --- a/lib/ui/profile/house/pick_my_house_page.dart +++ b/lib/ui/profile/house/pick_my_house_page.dart @@ -110,9 +110,14 @@ class _HouseCard extends StatelessWidget { final bool highlight; const _HouseCard({Key key, @required this.model, this.highlight = false}) : super(key: key); - bool get canTapSlide => model.status == 4 || model.status == 3 && !highlight; + bool get canTapSlide { + if (model == null) return false; + return model.status == 4 || model.status == 3 && !highlight; + } + @override Widget build(BuildContext context) { + if (model == null) return SizedBox(); return Slidable( actionPane: SlidableDrawerActionPane(), actionExtentRatio: 0.2, @@ -165,10 +170,10 @@ class _HouseCard extends StatelessWidget { children: [ Container( child: Text( - model.houseStatus, + model?.houseStatus ?? '', style: Theme.of(context).textTheme.subtitle2.copyWith( fontWeight: FontWeight.bold, - color: model.houseStatusColor, + color: model?.houseStatusColor ?? Colors.white, ), ), alignment: Alignment.center, diff --git a/lib/ui/search/bee_search.dart b/lib/ui/search/bee_search.dart index e4e47d5b..7f5e9fb8 100644 --- a/lib/ui/search/bee_search.dart +++ b/lib/ui/search/bee_search.dart @@ -40,6 +40,7 @@ class _BeeSearchState extends State { return MaterialButton( onPressed: () { if (LoginUtil.isNotLogin) return; + if (!LoginUtil.haveRoom(e.title)) return; Get.to(e.page); }, shape: StadiumBorder(), diff --git a/lib/utils/login_util.dart b/lib/utils/login_util.dart index 9b6acbc0..8b1018ab 100644 --- a/lib/utils/login_util.dart +++ b/lib/utils/login_util.dart @@ -1,3 +1,6 @@ +import 'package:akuCommunity/provider/app_provider.dart'; +import 'package:akuCommunity/ui/profile/house/add_house_page.dart'; +import 'package:akuCommunity/ui/profile/house/house_owners_page.dart'; import 'package:bot_toast/bot_toast.dart'; import 'package:get/get.dart'; import 'package:provider/provider.dart'; @@ -27,4 +30,20 @@ class LoginUtil { /// /// 未登陆状态用户跳转到登录页面 static bool get isNotLogin => !isLogin; + + static bool haveRoom(String name) { + if (!name.contains(RegExp('访客邀请|报事报修|建议咨询|生活缴费|物品出门|投诉表扬'))) return true; + final appProvider = Provider.of(Get.context, listen: false); + if (appProvider.selectedHouse == null) { + BotToast.showText(text: '请先添加房屋'); + Get.to(() => AddHousePage()); + return false; + } + if (appProvider.selectedHouse.status != 4) { + BotToast.showText(text: '房屋审核中或审核失败'); + Get.to(() => HouseOwnersPage()); + return false; + } + return true; + } } diff --git a/lib/widget/others/bee_header_house.dart b/lib/widget/others/bee_header_house.dart index 558ce40d..dcc01103 100644 --- a/lib/widget/others/bee_header_house.dart +++ b/lib/widget/others/bee_header_house.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/constants/app_values.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -48,7 +49,7 @@ class _BeeHeaderHouseState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - kEstateName.text.black.size(32.sp).bold.make(), + AppValues.plotName.text.black.size(32.sp).bold.make(), 10.w.heightBox, userProvider.currentHouse.text.black .size(32.sp) diff --git a/lib/widget/views/application_view.dart b/lib/widget/views/application_view.dart index c6048088..85bc985c 100644 --- a/lib/widget/views/application_view.dart +++ b/lib/widget/views/application_view.dart @@ -32,6 +32,7 @@ class _ApplicationViewState extends State { padding: EdgeInsets.zero, onPressed: () { if (LoginUtil.isNotLogin) return; + if (!LoginUtil.haveRoom(object.title)) return; Get.to(object.page); }, child: Column(