import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:ysairplane/base/YSBase.dart'; import 'package:ysairplane/tools/YSTools.dart'; import 'package:image_picker/image_picker.dart'; class YSUserInfo extends StatefulWidget { @override _YSUserInfoState createState() => _YSUserInfoState(); } class _YSUserInfoState extends State { ImagePicker _picker = ImagePicker(); List array = [{'title':'头像','content':''},{'title':'真实姓名','content':'请输入真实姓名'},{'title':'性别','content':'请选择性别'},{'title':'地区','content':'请选择地区'},{'title':'登录手机','content':'199 9999 0000'}, {'title':'邮箱地址','content':'请输入邮箱地址'},{'title':'绑定微信','content':''},{'title':'绑定支付宝','content':''},{'title':'公司名称','content':'请输入公司名称'},{'title':'公司职务','content':'请选择职务'}, {'title':'公司行业','content':'请选择行业'},{'title':'网址','content':'请输入网址'},{'title':'所在地区','content':'请输入所在地区'}]; List chooses = ['选择1','选择2','选择3']; @override Widget build(BuildContext context) { return YSBase( ystitle: '个人资料', yschild: Container( height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44, width: MediaQuery.of(context).size.width, color: Color(0xFFF5F6F8), child: ListView.separated( itemBuilder: (context,index){ return GestureDetector( onTap: (){ if(index==0){ showCupertinoModalPopup( context: context, builder: (context) { return CupertinoActionSheet( actions: [ CupertinoActionSheetAction( child: Text('拍摄照片'), onPressed: () { Navigator.pop(context); _picker.getImage(source: ImageSource.camera,imageQuality: 50).then((value) => { }); }, ), CupertinoActionSheetAction( child: Text('选择图片'), onPressed: () { Navigator.pop(context); _picker.getImage(source: ImageSource.gallery,imageQuality: 50).then((value) => { }); }, ), ], cancelButton: CupertinoActionSheetAction( child: Text('取消'), onPressed: () { Navigator.pop(context); }, ), ); } ); }else if(index==6||index==7){ }else if(index==1||index==5||index==8){ Navigator.push(context, PopRoute(child: BottomInputDialog( height: 185, color: Colors.white, inputView: Column( children: [ Container( padding: EdgeInsets.only(top: 5,bottom: 10,left: 10), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text(index==1?'真实姓名':index==5?'邮箱地址':'公司名称',style: TextStyle(fontSize: 14,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),), Icon(Icons.close,size: 20,color: Color(0xFF9A9A9A),) ], ), ), Container( height: 50, width: MediaQuery.of(context).size.width-30, child: CupertinoTextField( placeholder: '请输入', style: TextStyle(fontSize: 15,color: Color(0xFF9A9A9A),decoration: TextDecoration.none,fontWeight: FontWeight.normal,), placeholderStyle: TextStyle(fontSize: 15,color: Color(0xFF9A9A9A),decoration: TextDecoration.none,fontWeight: FontWeight.normal), autofocus: true, decoration: BoxDecoration(), maxLines: 10, ), decoration: BoxDecoration( border: Border(bottom: BorderSide(color: Color(0xFFF5F6F8),width: 0.5)) ), margin: EdgeInsets.only(top: 10), ), Container( margin: EdgeInsets.all(15), height: 40, width: MediaQuery.of(context).size.width-40, alignment: Alignment.center, decoration: BoxDecoration( color: Color(0xFF007AFF), borderRadius: BorderRadius.all(Radius.circular(6)) ), child: Text('完成',style: TextStyle(fontSize: 17,color: Colors.white,fontWeight: FontWeight.bold,decoration: TextDecoration.none),), ) ], ), ))); }else{ } }, child: Container( height: 50, color: Colors.white, padding: EdgeInsets.only(left: 15,right: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('${array[index]['title']}',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),), index==0?Container( height: 40, width: 40, decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(20)), color: Colors.black12 ), ):index==6||index==7?Row( children: [ Text('${array[index]['content']}',style: TextStyle(fontSize: 16,color: Color(0xFF9A9A9A)),), Icon(Icons.keyboard_arrow_right,size: 20,color: Color(0xFF9A9A9A),) ], ):index==1||index==5||index==8?Text( '${array[index]['content']}', style: TextStyle(fontSize: 16,color: Color(0xFF9A9A9A)), ): DropdownButton( value: '${chooses[0]}', items: [ for(int i=0;i