import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/base/assets_image.dart'; import 'package:akuCommunity/utils/screenutil.dart'; import 'package:akuCommunity/widget/common_input.dart'; import 'package:akuCommunity/widget/common_upload_image.dart'; import 'package:akuCommunity/widget/common_app_bar.dart'; import 'package:akuCommunity/widget/single_image_up.dart'; class CertificationPage extends StatefulWidget { CertificationPage({Key key}) : super(key: key); @override _CertificationPageState createState() => _CertificationPageState(); } class _CertificationPageState extends State { TextEditingController _userName = new TextEditingController(); TextEditingController _userIDCard = new TextEditingController(); List> _uploadImageList = [ { 'imagePath': AssetsImage.LICENSE, 'title': '上传身份证正面照', }, { 'imagePath': AssetsImage.LICENSEBACK, 'title': '上传身份证背面照', }, ]; @override void initState() { super.initState(); } Widget _idCardType() { return Container( padding: EdgeInsets.only( top: Screenutil.length(23), bottom: Screenutil.length(24), ), margin: EdgeInsets.only(bottom: Screenutil.length(60)), decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Color(0xffeeeeee), width: 0.5)), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '证件类型', style: TextStyle( fontSize: Screenutil.size(28), color: Color(0xff333333)), ), SizedBox(height: Screenutil.length(25)), Container( width: Screenutil.length(686), child: Text( '身份证', style: TextStyle( fontSize: Screenutil.size(36), color: Color(0xff333333), fontWeight: FontWeight.w600, ), ), ) ], ), ); } Widget _upLoadImage() { return Container( padding: EdgeInsets.only( top: Screenutil.length(23), bottom: Screenutil.length(24), ), margin: EdgeInsets.only(bottom: Screenutil.length(60)), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( '上传证件照片', style: TextStyle( fontSize: Screenutil.size(28), color: Color(0xff333333)), ), SizedBox(height: Screenutil.length(25)), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: List.generate( _uploadImageList.length, (index) => SingleImageUp( title: _uploadImageList[index]['title'], imagePath: _uploadImageList[index]['imagePath'], ), ), ), ], ), ); } Widget _input(String title, hintText, TextEditingController controller) { return Container( padding: EdgeInsets.only( top: Screenutil.length(23), bottom: Screenutil.length(24), ), margin: EdgeInsets.only(bottom: Screenutil.length(60)), decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Color(0xffeeeeee), width: 0.5)), ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: TextStyle( fontSize: Screenutil.size(28), color: Color(0xff333333)), ), SizedBox(height: Screenutil.length(25)), CommonInput(inputController: controller, hintText: hintText) ], ), ); } InkWell _submit() { return InkWell( child: Container( alignment: Alignment.center, height: Screenutil.length(96), width: Screenutil.length(686), padding: EdgeInsets.symmetric( vertical: Screenutil.length(26), ), decoration: BoxDecoration( color: Color(0xffffc40c), borderRadius: BorderRadius.all(Radius.circular(48))), child: Text( '确认提交', style: TextStyle( fontWeight: FontWeight.w600, fontSize: Screenutil.size(32), color: Color(0xff333333)), ), ), ); } @override Widget build(BuildContext context) { return Scaffold( appBar: PreferredSize( child: CommonAppBar( title: '实名认证', ), preferredSize: Size.fromHeight(kToolbarHeight), ), body: Container( padding: EdgeInsets.only( top: Screenutil.length(32), left: Screenutil.length(32), right: Screenutil.length(32), ), color: Colors.white, child: ListView( children: [ SingleChildScrollView( child: Container( child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Column( children: [ _idCardType(), _upLoadImage(), _input('证件号', '请输入证件号', _userName), _input('姓名', '姓名需与证件上相同', _userIDCard), ], ), ], ), ), ), ), ), _submit(), ], ), ), ); } }