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 51ff6971..e9bfc1cb 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 @@ -6,6 +6,7 @@ import 'dart:io'; // Flutter imports: import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/pages/goods_deto_page/select_move_company_page.dart'; +import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart'; import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/utils/network/base_model.dart'; @@ -44,7 +45,8 @@ class _DetoCreatePageState extends State { String _itemName; DateTime _date; - String get datetime=>DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss"); + String get datetime => + DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss"); int _selectWeight; String _selectTel; List _listWeight = [ @@ -67,7 +69,7 @@ class _DetoCreatePageState extends State { bool needMoveCompany = false; - Widget _houseAddress(String title, subtitle) { + Widget _houseAddress(String subtitle) { return Container( padding: EdgeInsets.only(bottom: 24.w), margin: EdgeInsets.only(bottom: 40.w), @@ -88,41 +90,51 @@ class _DetoCreatePageState extends State { ), ), ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only(right: 42.w), - child: Image.asset( - R.ASSETS_IMAGES_HOUSE_ATTESTATION_PNG, - height: 59.w, - width: 59.w, - ), - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 32.sp, - color: Color(0xff333333), - ), + GestureDetector( + onTap: () { + MyHousePage().to(); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only(right: 42.w), + child: Image.asset( + R.ASSETS_IMAGES_HOUSE_ATTESTATION_PNG, + height: 59.w, + width: 59.w, ), - SizedBox(height: 10.w), - Text( - subtitle, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 32.sp, - color: Color(0xff333333), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + kEstateName, + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 32.sp, + color: Color(0xff333333), + ), ), - ) - ], - ), - ], + SizedBox(height: 10.w), + Text( + BeeParse.getEstateName(subtitle), + style: TextStyle( + fontWeight: FontWeight.w600, + fontSize: 32.sp, + color: Color(0xff333333), + ), + ) + ], + ), + Spacer(), + Icon( + CupertinoIcons.chevron_forward, + size: 40.w, + ), + ], + ).material(color: Colors.transparent), ), ], ), @@ -350,9 +362,7 @@ class _DetoCreatePageState extends State { InkWell( onTap: () async { _selectTel = await SelectMoveCompanyPage().to(); - setState(() { - - }); + setState(() {}); }, child: Padding( padding: EdgeInsets.symmetric(vertical: 30.w), @@ -398,16 +408,9 @@ class _DetoCreatePageState extends State { body: ListView( padding: EdgeInsets.all(32.w), children: [ - _houseAddress( - kEstateName, - userProvider.userDetailModel.estateNames.isEmpty - ? '' - : BeeParse.getEstateName( - userProvider.userDetailModel.estateNames[0])), + _houseAddress(userProvider.currentHouse), _getWeight(), - _itemPicker( - '出户时间', datetime, - () async { + _itemPicker('出户时间', datetime, () async { _date = await BeeDatePicker.timePicker(DateTime.now()); setState(() {}); }), diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 913564a4..c18d1d8b 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -4,18 +4,16 @@ import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/life_pay_model.dart'; import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart'; -import 'package:akuCommunity/pages/personal/widget/order_card.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/provider/user_provider.dart'; import 'package:akuCommunity/utils/bee_parse.dart'; -import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/buttons/bee_check_box.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:provider/provider.dart'; + // Package imports: import 'package:velocity_x/velocity_x.dart'; @@ -85,7 +83,7 @@ class _LifePayPageState extends State { size: 40.w, ), ], - ), + ).material(color: Colors.transparent), ), 24.w.heightBox, ], diff --git a/lib/pages/life_pay/widget/my_house_page.dart b/lib/pages/life_pay/widget/my_house_page.dart index ee2aacc2..169cb9df 100644 --- a/lib/pages/life_pay/widget/my_house_page.dart +++ b/lib/pages/life_pay/widget/my_house_page.dart @@ -1,13 +1,15 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/widget/common_radio.dart'; +import 'package:akuCommunity/provider/user_provider.dart'; +import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flutter/material.dart'; import 'package:akuCommunity/utils/headers.dart'; +import 'package:provider/provider.dart'; class MyHousePage extends StatefulWidget { - final List estateNames; - MyHousePage({Key key, this.estateNames}) : super(key: key); + MyHousePage({Key key}) : super(key: key); @override _MyHousePageState createState() => _MyHousePageState(); @@ -39,27 +41,35 @@ Widget _unPaidTag() { class _MyHousePageState extends State { int _select; - Widget _buildCard(bool currentHouse, {bool paid = false}) { + Widget _buildCard(String currentHouse, String estateName, int index, + {bool paid = false}) { return Container( padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 32.w), child: Row( children: [ - CommonRadio( - value: 1, - groupValue: _select, - size: 32.w, + GestureDetector( + onTap: () { + _select = index; + setState(() {}); + }, + child: CommonRadio( + value: index, + groupValue: _select, + size: 32.w, + ), ), 24.w.widthBox, Column( + crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ kEstateName.text.size(24.sp).color(ktextSubColor).bold.make(), 16.w.heightBox, - ''.text.color(ktextPrimary).size(28.sp).bold.make(), + BeeParse.getEstateName(estateName).text.color(ktextPrimary).size(28.sp).bold.make(), ], ), Spacer(), - currentHouse + currentHouse == estateName ? _currentHouseTag() : paid ? _unPaidTag() @@ -71,11 +81,15 @@ class _MyHousePageState extends State { @override Widget build(BuildContext context) { + UserProvider userProvider = Provider.of(context); return BeeScaffold( title: '我的房屋', body: ListView( - children: [ - _buildCard(true), + children: [ + ...userProvider.userDetailModel.estateNames + .map((e) => _buildCard(userProvider.currentHouse, e, + userProvider.userDetailModel.estateNames.indexOf(e))) + .toList(), ].sepWidget(separate: BeeDivider.horizontal()), ), ); 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 189cd7a4..6d975d22 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -2,6 +2,7 @@ import 'dart:io'; // Flutter imports: +import 'package:akuCommunity/pages/life_pay/widget/my_house_page.dart'; import 'package:akuCommunity/utils/bee_parse.dart'; import 'package:akuCommunity/widget/buttons/bottom_button.dart'; import 'package:flutter/cupertino.dart'; @@ -65,7 +66,9 @@ class _AddFixedSubmitPageState extends State { '报修房屋'.text.black.size(28.sp).make(), 32.w.heightBox, GestureDetector( - onTap: () {}, + onTap: () { + MyHousePage().to(); + }, child: Row( children: [ Image.asset( diff --git a/lib/provider/user_provider.dart b/lib/provider/user_provider.dart index 2285d891..d34bc917 100644 --- a/lib/provider/user_provider.dart +++ b/lib/provider/user_provider.dart @@ -31,6 +31,7 @@ class UserProvider extends ChangeNotifier { HiveStore.appBox.put('login', true); await updateProfile(); await updateUserDetail(); + await setCurrentHouse(_userDetailModel?.estateNames?.first??''); notifyListeners(); } @@ -135,8 +136,7 @@ class UserProvider extends ChangeNotifier { } ///设置默认房屋 - String _currentHouse = - await SignFunc.getUserDetail().then((value) => value.estateNames.first); + String _currentHouse; String get currentHouse => _currentHouse; setCurrentHouse(String house) { _currentHouse = house;