From f910d38daa370e023fd3f824b6e435c91a579b48 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Mon, 31 May 2021 18:54:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=91=E7=9A=84=E6=88=BF?= =?UTF-8?q?=E5=B1=8B=E9=80=BB=E8=BE=91=20=20=E7=99=BB=E9=99=86=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=94=A8=E6=88=B7=E6=88=BF=E5=B1=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=B8=80=E5=AE=9A=E4=B8=BA=E5=B7=B2=E9=80=9A=E8=BF=87=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=EF=BC=8C=E6=9C=AA=E9=80=9A=E8=BF=87=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E5=8F=AA=E5=8F=AF=E5=9C=A8=E6=88=91=E7=9A=84=E6=88=BF=E5=B1=8B?= =?UTF-8?q?-=E5=AE=A1=E6=A0=B8=E8=AE=B0=E5=BD=95=E6=9F=A5=E7=9C=8B=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=88=91=E7=9A=84=E6=88=BF=E5=B1=8B-?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E8=AE=B0=E5=BD=95=E9=A1=B5=E9=9D=A2=20?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=20=E6=88=91=E7=9A=84=E6=88=BF=E5=B1=8B-?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E8=AE=B0=E5=BD=95=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=88=91=E7=9A=84=E6=88=BF=E5=B1=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 5 +- lib/model/user/house_model.dart | 2 +- .../new_renovation_list_model.g.dart | 3 +- lib/models/user/passed_house_list_model.dart | 84 +++++++++++++ .../user/passed_house_list_model.g.dart | 18 +++ .../deto_code_page/deto_code_page.dart | 2 +- .../deto_create_page/deto_create_page.dart | 2 +- lib/pages/life_pay/life_pay_page.dart | 2 +- lib/pages/one_alarm/widget/alarm_page.dart | 4 +- .../new_renovation_add_page.dart | 2 +- .../visitor_access_page.dart | 2 +- lib/provider/app_provider.dart | 14 +-- lib/provider/user_provider.dart | 2 +- lib/ui/profile/house/house_card.dart | 10 +- lib/ui/profile/house/house_func.dart | 15 ++- lib/ui/profile/house/house_owners_page.dart | 25 ++-- lib/ui/profile/house/my_house_list.dart | 115 ++++++++++++++++++ lib/ui/profile/house/pick_my_house_page.dart | 17 +-- lib/utils/login_util.dart | 2 +- lib/widget/others/bee_row_tile.dart | 33 +++++ lib/widget/picker/bee_house_picker.dart | 2 +- 21 files changed, 317 insertions(+), 44 deletions(-) create mode 100644 lib/models/user/passed_house_list_model.dart create mode 100644 lib/models/user/passed_house_list_model.g.dart create mode 100644 lib/ui/profile/house/my_house_list.dart create mode 100644 lib/widget/others/bee_row_tile.dart diff --git a/lib/constants/api.dart b/lib/constants/api.dart index c91e86a3..92ac4ad9 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -75,7 +75,10 @@ class _User { String get authHouse => '/user/myHouse/authentication'; ///我的房屋:查询所有的房屋审核信息 - String get houseList => '/user/myHouse/list'; + String get examineHouseList => '/user/myHouse/examineList'; + + ///我的房屋:查询用户所有拥有的房屋信息 + String get passedHouseList => '/user/myHouse/houseList'; ///我的房屋:假删除审核信息 String get deleteHouse => '/user/myHouse/falseDelete'; diff --git a/lib/model/user/house_model.dart b/lib/model/user/house_model.dart index b4795dc3..7a83f213 100644 --- a/lib/model/user/house_model.dart +++ b/lib/model/user/house_model.dart @@ -28,7 +28,7 @@ class HouseModel { case 2: return '租客'; case 3: - return '情书'; + return '亲属'; } return ''; } diff --git a/lib/models/new_renovation/new_renovation_list_model.g.dart b/lib/models/new_renovation/new_renovation_list_model.g.dart index 2532e6e7..43cc91ff 100644 --- a/lib/models/new_renovation/new_renovation_list_model.g.dart +++ b/lib/models/new_renovation/new_renovation_list_model.g.dart @@ -28,7 +28,8 @@ NewRenovationListModel _$NewRenovationListModelFromJson( createName: json['createName'] as String, createDate: json['createDate'] as String, checkVoList: (json['checkVoList'] as List) - .map((e) => CheckVoList.fromJson(e as Map)) + .map((e) => + e == null ? null : CheckVoList.fromJson(e as Map)) .toList(), ); } diff --git a/lib/models/user/passed_house_list_model.dart b/lib/models/user/passed_house_list_model.dart new file mode 100644 index 00000000..0190c056 --- /dev/null +++ b/lib/models/user/passed_house_list_model.dart @@ -0,0 +1,84 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter/material.dart'; +import 'package:json_annotation/json_annotation.dart'; +part 'passed_house_list_model.g.dart'; + +@JsonSerializable() +class PassedHouseListModel extends Equatable { + final int id; + final int estateId; + final String roomName; + final int type; + final String? effectiveTimeStart; + final String? effectiveTimeEnd; + PassedHouseListModel({ + required this.id, + required this.estateId, + required this.roomName, + required this.type, + this.effectiveTimeStart, + this.effectiveTimeEnd, + }); + + @override + List get props { + return [ + id, + estateId, + roomName, + type, + effectiveTimeStart, + effectiveTimeEnd, + ]; + } + + factory PassedHouseListModel.fromJson(Map json) => + _$PassedHouseListModelFromJson(json); + + String get houseStatus { + if (type == 1) return '业主'; + if (type == 2) return '亲属'; + if (type == 3) return '租客'; + return ''; + } + Color get houseStatusColor { + // if (status != 4) return Color(0xFF666666); + if (type == 1) return Color(0xFF333333); + return Colors.white; + } + + ///我的房屋页面背景颜色 + /// + List get backgroundColor { + //TODO 未通过状态 + // if (status != 4) + // return [ + // Color(0xFFF5F5F5), + // Color(0xFFEFEEEE), + // Color(0xFFE8E8E8), + // ]; + if (type == 1) + return [ + Color(0xFFFFDF7D), + Color(0xFFFFD654), + Color(0xFFFFC40C), + ]; + if (type == 2) + return [ + Color(0xFFFFA446), + Color(0xFFFFA547), + Color(0xFFFF8200), + ]; + if (type == 3) + return [ + Color(0xFF9ADE79), + Color(0xFF91DE6B), + Color(0xFF6ECB41), + ]; + return [ + Color(0xFFF5F5F5), + Color(0xFFEFEEEE), + Color(0xFFE8E8E8), + ]; + } +} diff --git a/lib/models/user/passed_house_list_model.g.dart b/lib/models/user/passed_house_list_model.g.dart new file mode 100644 index 00000000..2958db92 --- /dev/null +++ b/lib/models/user/passed_house_list_model.g.dart @@ -0,0 +1,18 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'passed_house_list_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PassedHouseListModel _$PassedHouseListModelFromJson(Map json) { + return PassedHouseListModel( + id: json['id'] as int, + estateId: json['estateId'] as int, + roomName: json['roomName'] as String, + type: json['type'] as int, + effectiveTimeStart: json['effectiveTimeStart'] as String?, + effectiveTimeEnd: json['effectiveTimeEnd'] as String?, + ); +} 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 542af825..bde7b276 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 @@ -152,7 +152,7 @@ class DetoCodePage extends StatelessWidget { Column( children: [ SizedBox(height: 192.w - kToolbarHeight), - _header(appProvider.selectedHouse!.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 7bfd1981..56377232 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 @@ -408,7 +408,7 @@ class _DetoCreatePageState extends State { body: ListView( padding: EdgeInsets.all(32.w), children: [ - _houseAddress(appProvider.selectedHouse!.roomName!), + _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 d8e4efaf..fd20bf0b 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -98,7 +98,7 @@ class _LifePayPageState extends State { .bold .make(), 10.w.heightBox, - appProvider.selectedHouse!.roomName!.text.black + appProvider.selectedHouse!.roomName.text.black .size(32.sp) .bold .make() diff --git a/lib/pages/one_alarm/widget/alarm_page.dart b/lib/pages/one_alarm/widget/alarm_page.dart index 1c14de34..bc59789a 100644 --- a/lib/pages/one_alarm/widget/alarm_page.dart +++ b/lib/pages/one_alarm/widget/alarm_page.dart @@ -226,11 +226,11 @@ class _AlarmPageState extends State { _makephonenum('tel:110'); }); - if (appProvider.selectedHouse?.status == 4) { + if (appProvider.selectedHouse!=null) { await NetUtil() .post(API.manager.recordAlarmInfo, params: { "estateId": - appProvider.selectedHouse?.estateId, + appProvider.selectedHouse!.estateId, }); } }, diff --git a/lib/pages/renovation_manage/new_renovation/new_renovation_add_page.dart b/lib/pages/renovation_manage/new_renovation/new_renovation_add_page.dart index e45a01d2..7a0b7881 100644 --- a/lib/pages/renovation_manage/new_renovation/new_renovation_add_page.dart +++ b/lib/pages/renovation_manage/new_renovation/new_renovation_add_page.dart @@ -59,7 +59,7 @@ class _NewRenovationAddPageState extends State { ), bottomNavi: BottomButton( onPressed: () async { - if (UserTool.appProveider.selectedHouse?.status == 4) { + if (UserTool.appProveider.selectedHouse!=null) { BaseModel baseModel = await NetUtil().post(API.manager.insertNewRenovation, params: { diff --git a/lib/pages/visitor_access_page/visitor_access_page.dart b/lib/pages/visitor_access_page/visitor_access_page.dart index 4c83fc36..6272d5f0 100644 --- a/lib/pages/visitor_access_page/visitor_access_page.dart +++ b/lib/pages/visitor_access_page/visitor_access_page.dart @@ -316,7 +316,7 @@ class _VisitorAccessPageState extends State { children: [ _buildHouseCard( S.of(context)!.tempPlotName, - appProvider.selectedHouse!.roomName!, + appProvider.selectedHouse!.roomName, ), _input( '访客姓名', diff --git a/lib/provider/app_provider.dart b/lib/provider/app_provider.dart index 224ba09f..21f58dd2 100644 --- a/lib/provider/app_provider.dart +++ b/lib/provider/app_provider.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:aku_community/models/user/passed_house_list_model.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -16,7 +17,6 @@ import 'package:aku_community/model/common/real_time_weather_model.dart'; import 'package:aku_community/model/community/hot_topic_model.dart'; import 'package:aku_community/model/message/message_center_model.dart'; import 'package:aku_community/model/user/car_parking_model.dart'; -import 'package:aku_community/model/user/house_model.dart'; import 'package:aku_community/utils/hive_store.dart'; import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/net_util.dart'; @@ -196,13 +196,13 @@ class AppProvider extends ChangeNotifier { notifyListeners(); } - List _houses = []; + List _houses = []; ///我的房屋列表 - List get houses => _houses; + List get houses => _houses; ///更新房屋列表 - updateHouses(List items) { + updateHouses(List items) { if (items.isEmpty) return; _selectedHouse = items.firstWhereOrNull( (element) => element.id == (_selectedHouse?.id ?? -1), @@ -211,17 +211,17 @@ class AppProvider extends ChangeNotifier { notifyListeners(); } - HouseModel? _selectedHouse; + PassedHouseListModel? _selectedHouse; ///选中的房屋 - HouseModel? get selectedHouse { + PassedHouseListModel? get selectedHouse { if (_houses.isEmpty) return null; if (_selectedHouse == null) _selectedHouse = _houses.first; return _selectedHouse; } ///设置当前选中的房屋 - setCurrentHouse(HouseModel? model) { + setCurrentHouse(PassedHouseListModel? model) { _selectedHouse = model; notifyListeners(); } diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 5e16ba63..884a7867 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -30,7 +30,7 @@ class UserProvider extends ChangeNotifier { HiveStore.appBox!.put('login', true); await updateProfile(); await updateUserDetail(); - await appProvider.updateHouses(await HouseFunc.houses); + await appProvider.updateHouses(await HouseFunc.passedHouses); notifyListeners(); } diff --git a/lib/ui/profile/house/house_card.dart b/lib/ui/profile/house/house_card.dart index a50ffedc..6ccde580 100644 --- a/lib/ui/profile/house/house_card.dart +++ b/lib/ui/profile/house/house_card.dart @@ -1,9 +1,9 @@ +import 'package:aku_community/models/user/passed_house_list_model.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:aku_community/const/resource.dart'; -import 'package:aku_community/model/user/house_model.dart'; import 'package:aku_community/ui/profile/house/pick_my_house_page.dart'; import 'package:aku_community/utils/headers.dart'; @@ -13,7 +13,7 @@ enum CardAuthType { } class HouseCard extends StatelessWidget { - final HouseModel? model; + final PassedHouseListModel? model; final CardAuthType type; const HouseCard({ Key? key, @@ -39,7 +39,7 @@ class HouseCard extends StatelessWidget { case CardAuthType.SUCCESS: return R.ASSETS_STATIC_HOUSE_AUTH_SUCCESS_WEBP; } - return ''; + // return ''; } String get _roleName { @@ -74,7 +74,7 @@ class HouseCard extends StatelessWidget { ), ]; } - return []; + // return []; } @override @@ -125,7 +125,7 @@ class HouseCard extends StatelessWidget { ), 10.hb, Text( - model!.roomName!, + model!.roomName, style: Theme.of(context).textTheme.subtitle1, ), Spacer(), diff --git a/lib/ui/profile/house/house_func.dart b/lib/ui/profile/house/house_func.dart index c9e8b85b..d392f999 100644 --- a/lib/ui/profile/house/house_func.dart +++ b/lib/ui/profile/house/house_func.dart @@ -1,12 +1,21 @@ import 'package:aku_community/constants/api.dart'; import 'package:aku_community/model/user/house_model.dart'; +import 'package:aku_community/models/user/passed_house_list_model.dart'; import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/net_util.dart'; class HouseFunc { - static Future> get houses async { - BaseModel model = await NetUtil().get(API.user.houseList); + ///查询所有的房屋审核信息 + static Future> get examineHouses async { + BaseModel model = await NetUtil().get(API.user.examineHouseList); if (!model.status!) return []; return (model.data as List).map((e) => HouseModel.fromJson(e)).toList(); } -} + + ///查询用户所拥有的房屋信息 + static Future get passedHouses async{ + BaseModel model = await NetUtil().get(API.user.passedHouseList); + if (!model.status!) return []; + return (model.data as List).map((e) => PassedHouseListModel.fromJson(e)).toList(); + } + } diff --git a/lib/ui/profile/house/house_owners_page.dart b/lib/ui/profile/house/house_owners_page.dart index bbd7dc76..dc157567 100644 --- a/lib/ui/profile/house/house_owners_page.dart +++ b/lib/ui/profile/house/house_owners_page.dart @@ -1,3 +1,6 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/ui/profile/house/my_house_list.dart'; +import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; @@ -31,14 +34,15 @@ class _HouseOwnersPageState extends State { ///存在已认证的房屋 bool get _haveAuthedHouse { final appProvider = Provider.of(context, listen: false); - return (appProvider.selectedHouse?.status ?? 0) == 4; + // return (appProvider.selectedHouse?.status ?? 0) == 4; + return appProvider.selectedHouse != null; } Widget get _houseTitle { - final appProvider = Provider.of(context, listen: false); + // final appProvider = Provider.of(context, listen: false); if (_emptyHouse) return Text('还没有绑定房屋'); - if (appProvider.selectedHouse!.status == 1) return Text('您的身份正在审核中,请耐心等待'); - if (appProvider.selectedHouse!.status == 3) return Text('审核未通过'); + // if (appProvider.selectedHouse!.status == 1) return Text('您的身份正在审核中,请耐心等待'); + // if (appProvider.selectedHouse!.status == 3) return Text('审核未通过'); return SizedBox(); } @@ -49,8 +53,10 @@ class _HouseOwnersPageState extends State { title: '我的房屋', actions: [ TextButton( - onPressed: _addHouse, - child: Text('新增房屋'), + onPressed: () { + Get.to(MyHouseList()); + }, + child: Text('审核记录'), ), ], body: EasyRefresh( @@ -58,7 +64,7 @@ class _HouseOwnersPageState extends State { controller: _refreshController, firstRefresh: true, onRefresh: () async { - appProvider.updateHouses(await HouseFunc.houses); + appProvider.updateHouses(await HouseFunc.passedHouses); }, child: ListView( children: [ @@ -67,7 +73,7 @@ class _HouseOwnersPageState extends State { : Padding( padding: EdgeInsets.all(32.w), child: HouseCard( - type: appProvider.selectedHouse!.reviewed + type: appProvider.selectedHouse!=null ? CardAuthType.SUCCESS : CardAuthType.FAIL, model: appProvider.selectedHouse, @@ -99,6 +105,9 @@ class _HouseOwnersPageState extends State { ], ), ), + bottomNavi: BottomButton( + onPressed: _addHouse, + child: '新增房屋'.text.size(32.sp).color(ktextPrimary).bold.make()), ); } diff --git a/lib/ui/profile/house/my_house_list.dart b/lib/ui/profile/house/my_house_list.dart new file mode 100644 index 00000000..58c14140 --- /dev/null +++ b/lib/ui/profile/house/my_house_list.dart @@ -0,0 +1,115 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/model/user/house_model.dart'; +import 'package:aku_community/ui/profile/house/house_func.dart'; +import 'package:aku_community/widget/bee_divider.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/others/bee_row_tile.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community/const/resource.dart'; + +class MyHouseList extends StatefulWidget { + MyHouseList({Key? key}) : super(key: key); + + @override + _MyHouseListState createState() => _MyHouseListState(); +} + +class _MyHouseListState extends State { + late EasyRefreshController _refreshController; + + List models = []; + @override + void initState() { + super.initState(); + _refreshController = EasyRefreshController(); + } + + @override + void dispose() { + _refreshController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '审核记录', + body: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + controller: _refreshController, + onRefresh: () async { + models = await HouseFunc.examineHouses; + print(models); + setState(() {}); + }, + child: models.isEmpty + ? Container() + : ListView.separated( + padding: + EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + itemBuilder: (context, index) { + return _buildCard(models[index]); + }, + separatorBuilder: (_, __) { + return 24.w.heightBox; + }, + itemCount: models.length)), + ); + } + + Widget _buildCard(HouseModel model) { + return Container( + padding: EdgeInsets.all(24.w), + width: double.infinity, + decoration: BoxDecoration( + gradient: LinearGradient( + colors: model.backgroundColor, + begin: Alignment.topCenter, + end: Alignment.bottomCenter), + borderRadius: BorderRadius.circular(8.w), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + model.roomName!.text.size(32.sp).color(ktextPrimary).bold.make(), + Spacer(), + // model.houseStatus.text + // .size(30.sp) + // .color(model.houseStatusColor) + // .make() + ], + ), + 16.w.heightBox, + BeeDivider.horizontal(), + 20.w.heightBox, + BeeRowTile( + assetPath: R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + titile: '房屋状态', + content: model.houseStatus.text + .size(30.sp) + .color(model.houseStatusColor) + .make()), + 12.w.heightBox, + model.effectiveTimeStart == null + ? SizedBox() + : BeeRowTile( + assetPath: R.ASSETS_ICONS_APPOINTMENT_CODE_PNG, + titile: '生效时间', + content: + ('${DateUtil.formatDate(model.effectiveStartDate, format: 'yyyy-MM-dd HH:mm')}-${DateUtil.formatDate(model.effectiveEndDate, format: 'HH:mm')}') + .text + .size(28.sp) + .color(ktextPrimary) + .make()) + ], + ), + ); + } +} diff --git a/lib/ui/profile/house/pick_my_house_page.dart b/lib/ui/profile/house/pick_my_house_page.dart index 799b095a..00169990 100644 --- a/lib/ui/profile/house/pick_my_house_page.dart +++ b/lib/ui/profile/house/pick_my_house_page.dart @@ -1,3 +1,4 @@ +import 'package:aku_community/models/user/passed_house_list_model.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -9,7 +10,6 @@ import 'package:provider/provider.dart'; import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/app_theme.dart'; -import 'package:aku_community/model/user/house_model.dart'; import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/ui/profile/house/add_house_page.dart'; import 'package:aku_community/ui/profile/house/house_func.dart'; @@ -37,13 +37,13 @@ class _PickMyHousePageState extends State { Widget get _renderSep => SliverToBoxAdapter(child: 24.hb); - List get housesWithoutSelected { + List get housesWithoutSelected { final appProvider = Provider.of(context, listen: false); - List models = List.from(appProvider.houses); + List models = List.from(appProvider.houses); models.removeWhere( (element) => element.id == (appProvider.selectedHouse?.id ?? -1), ); - if (models == null || models.isEmpty) return []; + if ( models.isEmpty) return []; return models; } @@ -77,7 +77,7 @@ class _PickMyHousePageState extends State { controller: _refreshController, onRefresh: () async { final appProvider = Provider.of(context, listen: false); - appProvider.updateHouses(await HouseFunc.houses); + appProvider.updateHouses(await HouseFunc.passedHouses); }, firstRefresh: true, child: CustomScrollView( @@ -113,7 +113,7 @@ class _PickMyHousePageState extends State { } class _HouseCard extends StatelessWidget { - final HouseModel? model; + final PassedHouseListModel? model; final bool highlight; final EasyRefreshController controller; const _HouseCard({ @@ -124,7 +124,8 @@ class _HouseCard extends StatelessWidget { }) : super(key: key); bool get canTapSlide { if (model == null) return false; - return model!.status == 4 || model!.status == 3 && !highlight; + return true; + // return model!.status == 4 || model!.status == 3 && !highlight; } @override @@ -219,7 +220,7 @@ class _HouseCard extends StatelessWidget { ), 8.hb, Text( - model!.roomName!, + model!.roomName, style: Theme.of(context).textTheme.subtitle2!.copyWith( color: Color(0xFF999999), ), diff --git a/lib/utils/login_util.dart b/lib/utils/login_util.dart index 30c4dcaf..a8d9e434 100644 --- a/lib/utils/login_util.dart +++ b/lib/utils/login_util.dart @@ -40,7 +40,7 @@ class LoginUtil { Get.to(() => AddHousePage()); return false; } - if (appProvider.selectedHouse!.status != 4) { + if (appProvider.selectedHouse == null) { BotToast.showText(text: '房屋审核中或审核失败'); Get.to(() => HouseOwnersPage()); return false; diff --git a/lib/widget/others/bee_row_tile.dart b/lib/widget/others/bee_row_tile.dart new file mode 100644 index 00000000..291a49ba --- /dev/null +++ b/lib/widget/others/bee_row_tile.dart @@ -0,0 +1,33 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class BeeRowTile extends StatelessWidget { + final String assetPath; + final String titile; + final Widget content; + const BeeRowTile( + {Key? key, + required this.assetPath, + required this.titile, + required this.content}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Image.asset( + assetPath, + width: 40.w, + height: 40.w, + ), + 12.w.widthBox, + titile.text.size(24.sp).color(ktextSubColor).make(), + Spacer(), + content, + ], + ); + } +} diff --git a/lib/widget/picker/bee_house_picker.dart b/lib/widget/picker/bee_house_picker.dart index e53bd3a2..4f818b3c 100644 --- a/lib/widget/picker/bee_house_picker.dart +++ b/lib/widget/picker/bee_house_picker.dart @@ -34,7 +34,7 @@ class BeeHousePicker extends StatelessWidget { children: [ S.of(context)!.tempPlotName.text.black.size(32.sp).bold.make(), 10.w.heightBox, - appProvider.selectedHouse!.roomName!.text.black + appProvider.selectedHouse!.roomName.text.black .size(32.sp) .bold .make()