diff --git a/lib/ui/profile/house/add_house_page.dart b/lib/ui/profile/house/add_house_page.dart index 68551a0b..26c7c7d7 100644 --- a/lib/ui/profile/house/add_house_page.dart +++ b/lib/ui/profile/house/add_house_page.dart @@ -1,6 +1,7 @@ import 'package:akuCommunity/ui/profile/house/house_item.dart'; import 'package:akuCommunity/ui/profile/house/pick_building_page.dart'; import 'package:akuCommunity/ui/profile/house/pick_plot_page.dart'; +import 'package:akuCommunity/ui/profile/house/pick_role_page.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flustars/flustars.dart'; import 'package:flutter/cupertino.dart'; @@ -21,6 +22,7 @@ class _AddHousePageState extends State { TextEditingController _idController = TextEditingController(); GlobalKey _formKey = GlobalKey(); HouseItem _item; + int _roleType; TextStyle get _hintStyle => TextStyle( fontSize: 36.sp, fontWeight: FontWeight.bold, @@ -131,20 +133,27 @@ class _AddHousePageState extends State { _renderTile( title: '楼栋、单元、室', item: _renderPicker( - text: _item.houseName, + text: _item?.houseName, hintText: '请选择楼栋、单元、室', onTap: () async { HouseItem tempItem = await Get.to(() => PickBuildingPage()); if (tempItem != null) _item = tempItem; + setState(() {}); }, ), ), _renderTile( title: '身份', item: _renderPicker( - text: '', + text: PickRolePage.getType(_roleType), hintText: '请选择身份', - onTap: () {}, + onTap: () async { + int role = await Get.to(() => PickRolePage()); + if (role != null) { + _roleType = role; + setState(() {}); + } + }, ), ), _renderTile( diff --git a/lib/ui/profile/house/pick_role_page.dart b/lib/ui/profile/house/pick_role_page.dart new file mode 100644 index 00000000..245d590e --- /dev/null +++ b/lib/ui/profile/house/pick_role_page.dart @@ -0,0 +1,83 @@ +import 'package:akuCommunity/widget/bee_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:akuCommunity/utils/headers.dart'; +import 'package:get/get.dart'; + +///选择身份 +/// +///业主 亲属 租客 +class PickRolePage extends StatefulWidget { + static String getType(int index) { + switch (index) { + case 1: + return '业主'; + case 2: + return '亲属'; + case 3: + return '租客'; + default: + return ''; + } + } + + PickRolePage({Key key}) : super(key: key); + + @override + _PickRolePageState createState() => _PickRolePageState(); +} + +class _PickRolePageState extends State { + static const Map _role = { + 1: '业主', + 2: '亲属', + 3: '租客', + }; + int _pickedValue; + Widget _renderTile(int index, String title) { + return MaterialButton( + padding: EdgeInsets.symmetric( + horizontal: 32.w, + vertical: 28.w, + ), + onPressed: () { + setState(() => _pickedValue = index); + Get.back(result: _pickedValue); + }, + child: Row( + children: [ + Radio( + value: index, + groupValue: _pickedValue, + onChanged: (value) { + setState(() { + _pickedValue = value; + }); + }, + ), + 16.wb, + Text( + title, + style: TextStyle( + fontSize: 28.sp, + color: Color(0xFF333333), + ), + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '选择身份', + body: ListView( + children: _role.entries + .map((e) => _renderTile(e.key, e.value)) + .toList() + .sepWidget(), + ), + ); + } +} diff --git a/lib/ui/profile/house/pick_unit_page.dart b/lib/ui/profile/house/pick_unit_page.dart index 528f3505..40a7fc47 100644 --- a/lib/ui/profile/house/pick_unit_page.dart +++ b/lib/ui/profile/house/pick_unit_page.dart @@ -1,11 +1,9 @@ import 'package:akuCommunity/model/user/pick_building_model.dart'; import 'package:akuCommunity/pages/sign/sign_func.dart'; -import 'package:akuCommunity/provider/sign_up_provider.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:get/get.dart'; -import 'package:provider/provider.dart'; import 'package:velocity_x/velocity_x.dart'; class PickUnitPage extends StatefulWidget {