添加房屋页面添加选择身份

hmxc
小赖 4 years ago
parent 0226efdb3b
commit 2176cd7505

@ -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<AddHousePage> {
TextEditingController _idController = TextEditingController();
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
HouseItem _item;
int _roleType;
TextStyle get _hintStyle => TextStyle(
fontSize: 36.sp,
fontWeight: FontWeight.bold,
@ -131,20 +133,27 @@ class _AddHousePageState extends State<AddHousePage> {
_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(

@ -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<PickRolePage> {
static const Map<int, String> _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(),
),
);
}
}

@ -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 {

Loading…
Cancel
Save