parent
f925c7bf9f
commit
0226efdb3b
After Width: | Height: | Size: 27 KiB |
@ -0,0 +1,195 @@
|
|||||||
|
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/widget/bee_scaffold.dart';
|
||||||
|
import 'package:flustars/flustars.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:akuCommunity/utils/headers.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class AddHousePage extends StatefulWidget {
|
||||||
|
AddHousePage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AddHousePageState createState() => _AddHousePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AddHousePageState extends State<AddHousePage> {
|
||||||
|
TextEditingController _nameController = TextEditingController();
|
||||||
|
TextEditingController _idController = TextEditingController();
|
||||||
|
GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
||||||
|
HouseItem _item;
|
||||||
|
TextStyle get _hintStyle => TextStyle(
|
||||||
|
fontSize: 36.sp,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: Color(0xFF999999),
|
||||||
|
);
|
||||||
|
|
||||||
|
TextStyle get _textStyle => _hintStyle.copyWith(color: Color(0xFF333333));
|
||||||
|
|
||||||
|
bool get _buttonCanTap =>
|
||||||
|
_nameController.text.isNotEmpty && _idController.text.isNotEmpty;
|
||||||
|
_renderTile({
|
||||||
|
String title,
|
||||||
|
Widget item,
|
||||||
|
}) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w),
|
||||||
|
child: Text(title, style: Theme.of(context).textTheme.subtitle1),
|
||||||
|
),
|
||||||
|
item ?? SizedBox(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderTextField({
|
||||||
|
String hintText,
|
||||||
|
TextEditingController controller,
|
||||||
|
FormFieldValidator validator,
|
||||||
|
}) {
|
||||||
|
return TextFormField(
|
||||||
|
controller: controller,
|
||||||
|
validator: validator,
|
||||||
|
style: _textStyle,
|
||||||
|
onChanged: (_) => setState(() {}),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: InputBorder.none,
|
||||||
|
hintText: hintText,
|
||||||
|
hintStyle: _hintStyle,
|
||||||
|
isDense: true,
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 32.w,
|
||||||
|
vertical: 30.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_renderPicker({
|
||||||
|
@required String text,
|
||||||
|
@required String hintText,
|
||||||
|
VoidCallback onTap,
|
||||||
|
}) {
|
||||||
|
bool showText = text?.isNotEmpty ?? false;
|
||||||
|
return MaterialButton(
|
||||||
|
onPressed: onTap,
|
||||||
|
minWidth: double.infinity,
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 30.w),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
showText ? text : hintText,
|
||||||
|
style: showText ? _textStyle : _hintStyle,
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
if (onTap != null)
|
||||||
|
Icon(
|
||||||
|
CupertinoIcons.chevron_forward,
|
||||||
|
size: 38.w,
|
||||||
|
color: Color(0xFFE8E8E8),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_nameController?.dispose();
|
||||||
|
_idController?.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '添加房屋',
|
||||||
|
body: Material(
|
||||||
|
color: Colors.white,
|
||||||
|
child: Form(
|
||||||
|
key: _formKey,
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
_renderTile(
|
||||||
|
title: '小区名称',
|
||||||
|
item: _renderPicker(
|
||||||
|
text: '人才公寓智慧小区',
|
||||||
|
hintText: '请选择小区',
|
||||||
|
// 跳转到选择小区页面
|
||||||
|
// TODO 小区页面
|
||||||
|
// onTap: () {
|
||||||
|
// Get.to(() => PickPlotPage());
|
||||||
|
// },
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_renderTile(
|
||||||
|
title: '楼栋、单元、室',
|
||||||
|
item: _renderPicker(
|
||||||
|
text: _item.houseName,
|
||||||
|
hintText: '请选择楼栋、单元、室',
|
||||||
|
onTap: () async {
|
||||||
|
HouseItem tempItem = await Get.to(() => PickBuildingPage());
|
||||||
|
if (tempItem != null) _item = tempItem;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_renderTile(
|
||||||
|
title: '身份',
|
||||||
|
item: _renderPicker(
|
||||||
|
text: '',
|
||||||
|
hintText: '请选择身份',
|
||||||
|
onTap: () {},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_renderTile(
|
||||||
|
title: '姓名',
|
||||||
|
item: _renderTextField(
|
||||||
|
hintText: '请输入姓名',
|
||||||
|
controller: _nameController,
|
||||||
|
validator: (text) {
|
||||||
|
if (!RegexUtil.isZh(text)) return '请输入正确的姓名';
|
||||||
|
return null;
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
_renderTile(
|
||||||
|
title: '身份证号',
|
||||||
|
item: _renderTextField(
|
||||||
|
hintText: '请输入身份证号',
|
||||||
|
controller: _idController,
|
||||||
|
validator: (text) {
|
||||||
|
if (!RegexUtil.isIDCard(text)) return '请输入正确的身份证号码';
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
].sepWidget(
|
||||||
|
separate: Divider(
|
||||||
|
indent: 32.w,
|
||||||
|
endIndent: 32.w,
|
||||||
|
height: 1.w,
|
||||||
|
thickness: 1.w,
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
bottomNavi: ElevatedButton(
|
||||||
|
child: Text('提交审核'),
|
||||||
|
onPressed: _buttonCanTap
|
||||||
|
? () {
|
||||||
|
if (_formKey.currentState.validate()) {}
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding:
|
||||||
|
MaterialStateProperty.all(EdgeInsets.symmetric(vertical: 26.w)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
import 'package:akuCommunity/model/user/pick_building_model.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
class HouseItem {
|
||||||
|
PickBuildingModel building;
|
||||||
|
PickBuildingModel house;
|
||||||
|
HouseItem({
|
||||||
|
@required this.building,
|
||||||
|
@required this.house,
|
||||||
|
});
|
||||||
|
|
||||||
|
int get houseCode => house.value;
|
||||||
|
|
||||||
|
String get houseName => '${building.label}-${house.label}';
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
import 'package:akuCommunity/ui/profile/house/add_house_page.dart';
|
||||||
|
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:akuCommunity/const/resource.dart';
|
||||||
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class HouseOwnersPage extends StatefulWidget {
|
||||||
|
HouseOwnersPage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_HouseOwnersPageState createState() => _HouseOwnersPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HouseOwnersPageState extends State<HouseOwnersPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '我的房屋',
|
||||||
|
body: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 75.w),
|
||||||
|
child: Image.asset(R.ASSETS_STATIC_REVIEWING_WEBP),
|
||||||
|
),
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: _addHouse,
|
||||||
|
child: Text('添加房屋'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
_addHouse() async {
|
||||||
|
await Get.to(() => AddHousePage());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
import 'package:akuCommunity/ui/profile/house/house_item.dart';
|
||||||
|
import 'package:akuCommunity/ui/profile/house/pick_unit_page.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:velocity_x/velocity_x.dart';
|
||||||
|
|
||||||
|
import 'package:akuCommunity/model/user/pick_building_model.dart';
|
||||||
|
import 'package:akuCommunity/pages/sign/sign_func.dart';
|
||||||
|
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||||
|
|
||||||
|
class PickBuildingPage extends StatefulWidget {
|
||||||
|
PickBuildingPage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PickBuildingPageState createState() => _PickBuildingPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PickBuildingPageState extends State<PickBuildingPage> {
|
||||||
|
List<PickBuildingModel> _buildingModels = [];
|
||||||
|
_buildItem(PickBuildingModel model) {
|
||||||
|
return ListTile(
|
||||||
|
title: model.label.text.make(),
|
||||||
|
onTap: () async {
|
||||||
|
PickBuildingModel houseModel =
|
||||||
|
await Get.to(() => PickUnitPage(buildingId: model.value));
|
||||||
|
if (houseModel != null) {
|
||||||
|
HouseItem item = HouseItem(building: model, house: houseModel);
|
||||||
|
Get.back(result: item);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
).material(color: Colors.white);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '选择楼栋',
|
||||||
|
body: EasyRefresh(
|
||||||
|
header: MaterialHeader(),
|
||||||
|
firstRefresh: true,
|
||||||
|
onRefresh: () async {
|
||||||
|
_buildingModels = await SignFunc.getBuildingInfo();
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: ListView.builder(
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return _buildItem(_buildingModels[index]);
|
||||||
|
},
|
||||||
|
itemCount: _buildingModels.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class PickPlotPage extends StatefulWidget {
|
||||||
|
PickPlotPage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PickPlotPageState createState() => _PickPlotPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PickPlotPageState extends State<PickPlotPage> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '选择小区',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
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 {
|
||||||
|
final int buildingId;
|
||||||
|
PickUnitPage({Key key, this.buildingId}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PickUnitPageState createState() => _PickUnitPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PickUnitPageState extends State<PickUnitPage> {
|
||||||
|
List<PickBuildingModel> _buildingModels = [];
|
||||||
|
_buildItem(PickBuildingModel model) {
|
||||||
|
return ListTile(
|
||||||
|
title: model.label.text.make(),
|
||||||
|
onTap: () {
|
||||||
|
Get.back(result: model);
|
||||||
|
},
|
||||||
|
).material(color: Colors.white);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BeeScaffold(
|
||||||
|
title: '选择楼栋',
|
||||||
|
body: EasyRefresh(
|
||||||
|
header: MaterialHeader(),
|
||||||
|
firstRefresh: true,
|
||||||
|
onRefresh: () async {
|
||||||
|
_buildingModels = await SignFunc.getUnitInfo(widget.buildingId);
|
||||||
|
setState(() {});
|
||||||
|
},
|
||||||
|
child: ListView.builder(
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return _buildItem(_buildingModels[index]);
|
||||||
|
},
|
||||||
|
itemCount: _buildingModels.length,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class HouseOwnersPage extends StatefulWidget {
|
|
||||||
HouseOwnersPage({Key key}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_HouseOwnersPageState createState() => _HouseOwnersPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _HouseOwnersPageState extends State<HouseOwnersPage> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BeeScaffold(title: '我的房屋');
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue