From 6fd92c3edc0224314cfde190c86095ab8515e3b2 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Wed, 23 Jun 2021 10:27:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BA=AB=E4=BB=BD=E8=AF=81?= =?UTF-8?q?=E7=85=A7=E7=89=87=E9=80=89=E6=8B=A9=E5=99=A8=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../house/supplement_information_page.dart | 87 ++++++++++++++++--- .../profile/house/tenant_house_list_page.dart | 10 ++- lib/widget/picker/identify_card_picker.dart | 54 ++++++++++-- 3 files changed, 134 insertions(+), 17 deletions(-) diff --git a/lib/ui/profile/house/supplement_information_page.dart b/lib/ui/profile/house/supplement_information_page.dart index 7497d4f9..866a710d 100644 --- a/lib/ui/profile/house/supplement_information_page.dart +++ b/lib/ui/profile/house/supplement_information_page.dart @@ -1,6 +1,14 @@ +import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:aku_community/widget/buttons/bottom_button.dart'; import 'package:aku_community/widget/others/bee_input_row.dart'; +import 'package:aku_community/widget/picker/identify_card_picker.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:aku_community/extensions/widget_list_ext.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; +import 'package:velocity_x/velocity_x.dart'; class SupplementInformationPage extends StatefulWidget { SupplementInformationPage({Key? key}) : super(key: key); @@ -30,6 +38,7 @@ class _SupplementInformationPageState extends State { title: '补充个人信息', bodyColor: Colors.white, body: ListView( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), children: [ BeeInputRow( title: '承租人', @@ -37,18 +46,74 @@ class _SupplementInformationPageState extends State { hintText: '杨赟', isRequire: true, ), - BeeInputRow.button(title: '性别', onPressed:(){} , hintText: _sex,isRequire: true,), - BeeInputRow(title: '手机号码', controller: _phoneController, hintText: '13742494159',isRequire: true,), - BeeInputRow(title: '身份证号', controller: _codeController, hintText: 'hintText',isRequire: true,), - BeeInputRow(title: '紧急联系人', controller: _emergencyContactController, hintText: 'hintText'), - BeeInputRow(title: '紧急联系人电话', controller: _emergencyPhoneController, hintText: 'hintText'), - BeeInputRow(title: '通讯地址(含诉讼送达地址)', controller: _addressController, hintText: 'hintText'), - BeeInputRow(title: '工作单位', controller: _workUnitController, hintText: 'hintText'), - - - - ], + BeeInputRow.button( + title: '性别', + onPressed: () async { + await Get.bottomSheet(_sexBottomSheet()); + setState(() {}); + }, + hintText: _sex, + isRequire: true, + ), + BeeInputRow( + title: '手机号码', + controller: _phoneController, + hintText: '13742494159', + isRequire: true, + ), + BeeInputRow( + title: '身份证号', + controller: _codeController, + hintText: 'hintText', + isRequire: true, + ), + BeeInputRow( + title: '紧急联系人', + controller: _emergencyContactController, + hintText: 'hintText'), + BeeInputRow( + title: '紧急联系人电话', + controller: _emergencyPhoneController, + hintText: 'hintText'), + BeeInputRow( + title: '通讯地址(含诉讼送达地址)', + controller: _addressController, + hintText: 'hintText'), + BeeInputRow( + title: '工作单位', + controller: _workUnitController, + hintText: 'hintText'), + IdentifyCardPicker.front((file) => () {}), + IdentifyCardPicker.back((file) => () {}), + ].sepWidget(separate: 24.w.heightBox), ), + bottomNavi: BottomButton( + onPressed: () {}, + child: '下一步'.text.size(32.sp).bold.color(ktextPrimary).make()), + ); + } + + Widget _sexBottomSheet() { + return CupertinoActionSheet( + title: + '选择性别'.text.size(32.sp).bold.color(ktextPrimary).isIntrinsic.make(), + cancelButton: TextButton( + onPressed: () => Get.back(), + child: '取消'.text.size(28.sp).color(ktextSubColor).isIntrinsic.make()), + actions: [ + CupertinoActionSheetAction( + onPressed: () { + _sex = '男'; + Get.back(); + }, + child: '男'.text.size(30.sp).color(ktextPrimary).isIntrinsic.make()), + CupertinoActionSheetAction( + onPressed: () { + _sex = '女'; + Get.back(); + }, + child: '女'.text.size(30.sp).color(ktextPrimary).isIntrinsic.make()) + ], ); } } diff --git a/lib/ui/profile/house/tenant_house_list_page.dart b/lib/ui/profile/house/tenant_house_list_page.dart index cc89d000..72b6b86a 100644 --- a/lib/ui/profile/house/tenant_house_list_page.dart +++ b/lib/ui/profile/house/tenant_house_list_page.dart @@ -1,10 +1,12 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/const/resource.dart'; +import 'package:aku_community/ui/profile/house/supplement_information_page.dart'; import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/buttons/card_bottom_button.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; class TenantHouseListPage extends StatefulWidget { @@ -70,7 +72,13 @@ class _TenantHouseListPageState extends State { Widget houseCard() { var buttons = Row( - children: [CardBottomButton.yellow(text: '填写信息', onPressed: () {})], + children: [ + CardBottomButton.yellow( + text: '填写信息', + onPressed: () { + Get.to(() => SupplementInformationPage()); + }) + ], ); var bottom = Row( children: [ diff --git a/lib/widget/picker/identify_card_picker.dart b/lib/widget/picker/identify_card_picker.dart index d692eb04..d70d7c4a 100644 --- a/lib/widget/picker/identify_card_picker.dart +++ b/lib/widget/picker/identify_card_picker.dart @@ -1,19 +1,63 @@ +import 'dart:io'; + import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/const/resource.dart'; +import 'package:aku_community/widget/picker/bee_image_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:velocity_x/velocity_x.dart'; -class IdentifyCardPicker { - static front() { +class IdentifyCardPicker extends StatefulWidget { + static Widget front(Function(File? file) onChange) { return Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ '上传身份证正面'.text.size(28.sp).color(ktextPrimary).make(), 24.w.heightBox, - Container( - width: 350.w, - height: 220.w, + IdentifyCardPicker( + onChange: onChange, + path: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, ) ], ); } + + static Widget back(Function(File? file) onChange) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + '上传身份证背面'.text.size(28.sp).color(ktextPrimary).make(), + 24.w.heightBox, + IdentifyCardPicker( + onChange: onChange, path: R.ASSETS_IMAGES_PLACEHOLDER_WEBP) + ], + ); + } + + final Function(File? file) onChange; + final String path; + IdentifyCardPicker({Key? key, required this.onChange, required this.path}) + : super(key: key); + + @override + _IdentifyCardPickerState createState() => _IdentifyCardPickerState(); +} + +class _IdentifyCardPickerState extends State { + File? _file; + @override + Widget build(BuildContext context) { + return GestureDetector( + onTap: () async { + _file = await BeeImagePicker.pick(title: '选择身份证照片'); + setState(() {}); + widget.onChange(_file); + }, + child: Container( + width: 350.w, + height: 220.w, + child: _file != null ? Image.file(_file!) : Image.asset(widget.path), + ), + ); + } }