YSUserInfo.dart 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:ysairplane/base/YSBase.dart';
  4. import 'package:ysairplane/tools/YSTools.dart';
  5. import 'package:image_picker/image_picker.dart';
  6. class YSUserInfo extends StatefulWidget {
  7. @override
  8. _YSUserInfoState createState() => _YSUserInfoState();
  9. }
  10. class _YSUserInfoState extends State<YSUserInfo> {
  11. ImagePicker _picker = ImagePicker();
  12. List array = [{'title':'头像','content':''},{'title':'真实姓名','content':'请输入真实姓名'},{'title':'性别','content':'请选择性别'},{'title':'地区','content':'请选择地区'},{'title':'登录手机','content':'199 9999 0000'},
  13. {'title':'邮箱地址','content':'请输入邮箱地址'},{'title':'绑定微信','content':''},{'title':'绑定支付宝','content':''},{'title':'公司名称','content':'请输入公司名称'},{'title':'公司职务','content':'请选择职务'},
  14. {'title':'公司行业','content':'请选择行业'},{'title':'网址','content':'请输入网址'},{'title':'所在地区','content':'请输入所在地区'}];
  15. List chooses = ['选择1','选择2','选择3'];
  16. @override
  17. Widget build(BuildContext context) {
  18. return YSBase(
  19. ystitle: '个人资料',
  20. yschild: Container(
  21. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44,
  22. width: MediaQuery.of(context).size.width,
  23. color: Color(0xFFF5F6F8),
  24. child: ListView.separated(
  25. itemBuilder: (context,index){
  26. return GestureDetector(
  27. onTap: (){
  28. if(index==0){
  29. showCupertinoModalPopup(
  30. context: context,
  31. builder: (context) {
  32. return CupertinoActionSheet(
  33. actions: <Widget>[
  34. CupertinoActionSheetAction(
  35. child: Text('拍摄照片'),
  36. onPressed: () {
  37. Navigator.pop(context);
  38. _picker.getImage(source: ImageSource.camera,imageQuality: 50).then((value) => {
  39. });
  40. },
  41. ),
  42. CupertinoActionSheetAction(
  43. child: Text('选择图片'),
  44. onPressed: () {
  45. Navigator.pop(context);
  46. _picker.getImage(source: ImageSource.gallery,imageQuality: 50).then((value) => {
  47. });
  48. },
  49. ),
  50. ],
  51. cancelButton: CupertinoActionSheetAction(
  52. child: Text('取消'),
  53. onPressed: () {
  54. Navigator.pop(context);
  55. },
  56. ),
  57. );
  58. }
  59. );
  60. }else if(index==6||index==7){
  61. }else if(index==1||index==5||index==8){
  62. Navigator.push(context, PopRoute(child: BottomInputDialog(
  63. height: 185,
  64. color: Colors.white,
  65. inputView: Column(
  66. children: [
  67. Container(
  68. padding: EdgeInsets.only(top: 5,bottom: 10,left: 10),
  69. child: Row(
  70. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  71. children: [
  72. Text(index==1?'真实姓名':index==5?'邮箱地址':'公司名称',style: TextStyle(fontSize: 14,color: Color(0xFF000000),decoration: TextDecoration.none,fontWeight: FontWeight.bold),),
  73. Icon(Icons.close,size: 20,color: Color(0xFF9A9A9A),)
  74. ],
  75. ),
  76. ),
  77. Container(
  78. height: 50,
  79. width: MediaQuery.of(context).size.width-30,
  80. child: CupertinoTextField(
  81. placeholder: '请输入',
  82. style: TextStyle(fontSize: 15,color: Color(0xFF9A9A9A),decoration: TextDecoration.none,fontWeight: FontWeight.normal,),
  83. placeholderStyle: TextStyle(fontSize: 15,color: Color(0xFF9A9A9A),decoration: TextDecoration.none,fontWeight: FontWeight.normal),
  84. autofocus: true,
  85. decoration: BoxDecoration(),
  86. maxLines: 10,
  87. ),
  88. decoration: BoxDecoration(
  89. border: Border(bottom: BorderSide(color: Color(0xFFF5F6F8),width: 0.5))
  90. ),
  91. margin: EdgeInsets.only(top: 10),
  92. ),
  93. Container(
  94. margin: EdgeInsets.all(15),
  95. height: 40,
  96. width: MediaQuery.of(context).size.width-40,
  97. alignment: Alignment.center,
  98. decoration: BoxDecoration(
  99. color: Color(0xFF007AFF),
  100. borderRadius: BorderRadius.all(Radius.circular(6))
  101. ),
  102. child: Text('完成',style: TextStyle(fontSize: 17,color: Colors.white,fontWeight: FontWeight.bold,decoration: TextDecoration.none),),
  103. )
  104. ],
  105. ),
  106. )));
  107. }else{
  108. }
  109. },
  110. child: Container(
  111. height: 50,
  112. color: Colors.white,
  113. padding: EdgeInsets.only(left: 15,right: 15),
  114. child: Row(
  115. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  116. children: [
  117. Text('${array[index]['title']}',style: TextStyle(fontSize: 16,color: Color(0xFF000000)),),
  118. index==0?Container(
  119. height: 40,
  120. width: 40,
  121. decoration: BoxDecoration(
  122. borderRadius: BorderRadius.all(Radius.circular(20)),
  123. color: Colors.black12
  124. ),
  125. ):index==6||index==7?Row(
  126. children: [
  127. Text('${array[index]['content']}',style: TextStyle(fontSize: 16,color: Color(0xFF9A9A9A)),),
  128. Icon(Icons.keyboard_arrow_right,size: 20,color: Color(0xFF9A9A9A),)
  129. ],
  130. ):index==1||index==5||index==8?Text(
  131. '${array[index]['content']}',
  132. style: TextStyle(fontSize: 16,color: Color(0xFF9A9A9A)),
  133. ): DropdownButton(
  134. value: '${chooses[0]}',
  135. items: [
  136. for(int i=0;i<chooses.length;i++)DropdownMenuItem(child: Text('${chooses[i]}'),value: '${chooses[i]}',),
  137. ],
  138. onChanged: (value){
  139. },
  140. underline: Container(),
  141. icon: Icon(Icons.keyboard_arrow_down,size: 20,color: Color(0xFF999999),),
  142. style: TextStyle(fontSize: 15,color: Color(0xFF999999)),
  143. )
  144. ],
  145. ),
  146. ),
  147. );
  148. },
  149. separatorBuilder: (context,index){
  150. return Container(
  151. color: Color(0xFFF5F6F8),
  152. height: index==3||index==7?10:0.5,
  153. );
  154. },
  155. itemCount: array.length,
  156. padding: EdgeInsets.only(top: 10,bottom: 30),
  157. ),
  158. ),
  159. );
  160. }
  161. }