master_become.dart 54 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/net/api_service.dart';
  3. import 'package:liftmanager/utils/toast.dart';
  4. import 'package:liftmanager/widgets/app_bar.dart';
  5. import 'package:liftmanager/widgets/load_image.dart';
  6. import 'package:liftmanager/widgets/selected_image.dart';
  7. import 'dart:io';
  8. import 'package:liftmanager/widgets/bbs_content.dart';
  9. import 'package:flutter_screenutil/flutter_screenutil.dart';
  10. import 'package:image_picker/image_picker.dart';
  11. import 'package:keyboard_actions/keyboard_actions.dart';
  12. import 'package:liftmanager/res/resources.dart';
  13. import 'package:liftmanager/utils/number_text_input_formatter.dart';
  14. import 'package:flutter/foundation.dart';
  15. import 'package:flutter/services.dart';
  16. import 'package:liftmanager/common/common.dart';
  17. import 'package:flustars/flustars.dart' as flustars;
  18. import 'package:flutter/cupertino.dart';
  19. import 'package:liftmanager/routers/fluro_navigator.dart';
  20. import 'package:liftmanager/internal/wode/wode_router.dart';
  21. import 'package:liftmanager/widgets/click_item.dart';
  22. import 'package:liftmanager/internal/bbs/bbs_router.dart';
  23. import 'package:flutter_spinkit/flutter_spinkit.dart';
  24. import 'package:liftmanager/utils/fast_notification.dart';
  25. import 'package:liftmanager/utils/theme_utils.dart';
  26. class MasterBecome extends StatefulWidget {
  27. @override
  28. State<StatefulWidget> createState() {
  29. return MasterBecomeState();
  30. }
  31. }
  32. class MasterBecomeState extends State<MasterBecome> {
  33. ScrollController _scrollController = new ScrollController();
  34. TextEditingController _nameController = new TextEditingController();
  35. TextEditingController _idNumberController = new TextEditingController();
  36. TextEditingController _mobileController = new TextEditingController();
  37. TextEditingController _professionalController = new TextEditingController();
  38. TextEditingController _workDateController = new TextEditingController();
  39. TextEditingController _companyController = new TextEditingController();
  40. TextEditingController _jobController = new TextEditingController();
  41. TextEditingController _residentPlaceController = new TextEditingController();
  42. TextEditingController _workExperienceController = new TextEditingController();
  43. TextEditingController _projectExperienceController =
  44. new TextEditingController();
  45. TextEditingController _proficiencyBrandController =
  46. new TextEditingController();
  47. TextEditingController _goodElectricalController = new TextEditingController();
  48. TextEditingController _goodMechanicalController = new TextEditingController();
  49. String defaultValue = "请选择";
  50. String ids;
  51. List<String>idsList = [];
  52. List<String>defaultValueList = [];
  53. // 焦点控制
  54. FocusNode _focusNode1 = new FocusNode();
  55. GlobalKey _formKey = new GlobalKey<FormState>();
  56. int sexChiose = -1;
  57. String sexChioseString = "";
  58. String ageChiose = "";
  59. int learnChiose = -1;
  60. String learnChioseString = "";
  61. String addressName = "";
  62. List<String> sexListChiose = [];
  63. List<dynamic> sexList = [
  64. {"value": 1, "label": "男"},
  65. {"value": 2, "label": "女"}
  66. ];
  67. List<String> ageListChiose = [];
  68. List<String> learnListChiose = [];
  69. List<dynamic> learnList = [
  70. {"value": 1, "label": "小学"},
  71. {"value": 2, "label": "初中"},
  72. {"value": 3, "label": "中专"},
  73. {"value": 4, "label": "高中"},
  74. {"value": 5, "label": "大专"},
  75. {"value": 6, "label": "本科"},
  76. {"value": 7, "label": "硕士研究生"},
  77. {"value": 8, "label": "博士研究生"},
  78. ];
  79. String avatarPath = '';
  80. String cardPicture = '';
  81. String degreeCertificate = '';
  82. String skillsCertificate = '';
  83. String otherCertificates = '';
  84. dynamic detailObj;
  85. bool _protocol = false;
  86. bool sortBool = true;
  87. void submit(type) {
  88. if (!_protocol) {
  89. toasts("请勾选用户协议!");
  90. return;
  91. }
  92. if (avatarPath.isEmpty) {
  93. toasts("请上传头像!");
  94. return;
  95. } else if (sexChiose == -1) {
  96. toasts("请选择性别!");
  97. return;
  98. } else if (ageChiose.isEmpty) {
  99. toasts("请选择年龄!");
  100. return;
  101. } else if (learnChiose == -1) {
  102. toasts("请选择学历!");
  103. return;
  104. } else if (cardPicture.isEmpty) {
  105. toasts("请上传身份证人像面!");
  106. return;
  107. } else if (skillsCertificate.isEmpty) {
  108. toasts("请上传专业技能证书人像面!");
  109. return;
  110. }
  111. if(addressName == null || addressName == ""){
  112. toasts("请选择常驻工作地!");
  113. return;
  114. }
  115. if(_goodElectricalController.text.length>20){
  116. toasts("擅长电气最大不超过20字符!");
  117. return;
  118. }
  119. if(_goodMechanicalController.text.length>20){
  120. toasts("擅长机械最大不超过20字符!");
  121. return;
  122. }
  123. RegExp exp = RegExp(r'^1[34578]\d{9}$');
  124. RegExp expSfz = RegExp(r"\d{17}[\d|x]|\d{15}");
  125. if(!expSfz.hasMatch(_idNumberController.text)){
  126. toasts("请输入正确的身份证号");
  127. return;
  128. }
  129. if(!exp.hasMatch(_mobileController.text)){
  130. toasts("请输入正确的手机号");
  131. return;
  132. }
  133. if(idsList.length<=0){
  134. toasts("请选择品牌");
  135. return;
  136. }
  137. if(type == "add"){
  138. NewApiService().applyExperts({
  139. "age": ageChiose,
  140. "photo": avatarPath,
  141. "cardPicture": cardPicture,
  142. // "checkFlag": 0,
  143. "company": _companyController.text,
  144. "degreeCertificate": degreeCertificate,
  145. "eduLevel": learnChiose,
  146. "gender": sexChiose,
  147. "goodElectrical": _goodElectricalController.text,
  148. "goodMechanical": _goodMechanicalController.text,
  149. "idNumber": _idNumberController.text,
  150. "job": _jobController.text,
  151. "mobile": _mobileController.text,
  152. "name": _nameController.text,
  153. "otherCertificates": otherCertificates,
  154. "professional": _professionalController.text,
  155. "proficiencyBrand":ids,
  156. "proficiencyBrandName":defaultValue,
  157. "projectExperience": _projectExperienceController.text,
  158. "residentPlace": addressName,
  159. "skillsCertificate": skillsCertificate,
  160. "userId": int.parse(flustars.SpUtil.getString(Constant.userId)),
  161. "workDate": _workDateController.text,
  162. "workExperience": _workExperienceController.text
  163. }, onSuccess: (res) {
  164. toasts("申请成功,请等待审核");
  165. Navigator.pop(context);
  166. }, onError: (code, msg) {
  167. toasts(msg);
  168. });
  169. }else {
  170. NewApiService().updateBecomeMaster({
  171. "id": detailObj.id,
  172. "photo": avatarPath,
  173. "age": ageChiose,
  174. "cardPicture": cardPicture,
  175. // "checkFlag": 0,
  176. "company": _companyController.text,
  177. "degreeCertificate": degreeCertificate,
  178. "eduLevel": learnChiose,
  179. "gender": sexChiose,
  180. "goodElectrical": _goodElectricalController.text,
  181. "goodMechanical": _goodMechanicalController.text,
  182. "idNumber": _idNumberController.text,
  183. "job": _jobController.text,
  184. "mobile": _mobileController.text,
  185. "name": _nameController.text,
  186. "otherCertificates": otherCertificates,
  187. "professional": _professionalController.text,
  188. "proficiencyBrand":ids,
  189. "proficiencyBrandName":defaultValue,
  190. "projectExperience": _projectExperienceController.text,
  191. "residentPlace": addressName,
  192. "skillsCertificate": skillsCertificate,
  193. "userId": int.parse(flustars.SpUtil.getString(Constant.userId)),
  194. "workDate": _workDateController.text,
  195. "workExperience": _workExperienceController.text
  196. }, onSuccess: (res) {
  197. toasts("修改申请成功,请等待审核");
  198. Navigator.pop(context);
  199. }, onError: (code, msg) {
  200. toasts(msg);
  201. });
  202. }
  203. }
  204. @override
  205. initState() {
  206. getDetail();
  207. for (var i = 10; i < 100; i++) {
  208. ageListChiose.add(i.toString());
  209. }
  210. for (var i = 0; i < sexList.length; i++) {
  211. sexListChiose.add(sexList[i]['label']);
  212. }
  213. for (var i = 0; i < learnList.length; i++) {
  214. learnListChiose.add(learnList[i]['label']);
  215. }
  216. getBrandList();
  217. super.initState();
  218. FastNotification.addListener("set_address_master", (setAddressMaster) {
  219. setState(() {
  220. addressName = setAddressMaster;
  221. print(addressName);
  222. print(222222224);
  223. });
  224. });
  225. }
  226. bool _hasData = false;
  227. Future getDetail() async {
  228. await NewApiService().getBecomeMasterDetail(
  229. onSuccess: (res) {
  230. if (res != null) {
  231. detailObj = res;
  232. ageChiose = detailObj.age.toString();
  233. sexChiose = detailObj.gender;
  234. learnChiose = detailObj.eduLevel;
  235. if(sexChiose == 1){
  236. sexChioseString = "男";
  237. }else if (sexChiose == 2){
  238. sexChioseString = "女";
  239. }
  240. learnList.forEach((element) {
  241. if(learnChiose == element["value"]){
  242. print(learnChiose);
  243. print(element["value"]);
  244. print(123456);
  245. learnChioseString = element["label"];
  246. }
  247. });
  248. cardPicture = detailObj.cardPicture;
  249. _companyController.text = detailObj.company;
  250. degreeCertificate = detailObj.degreeCertificate;
  251. avatarPath = detailObj.photo;
  252. _goodElectricalController.text = detailObj.goodElectrical;
  253. _goodMechanicalController.text = detailObj.goodMechanical;
  254. _idNumberController.text = detailObj.idNumber;
  255. _jobController.text = detailObj.job;
  256. _mobileController.text = detailObj.mobile;
  257. _nameController.text = detailObj.name;
  258. otherCertificates = detailObj.otherCertificates;
  259. _professionalController.text = detailObj.professional;
  260. ids = detailObj.proficiencyBrand;
  261. defaultValue = detailObj.proficiencyBrandName;
  262. _projectExperienceController.text = detailObj.projectExperience;
  263. addressName = detailObj.residentPlace;
  264. skillsCertificate = detailObj.skillsCertificate;
  265. _workDateController.text = detailObj.workDate.toString();
  266. _workExperienceController.text = detailObj.workExperience;
  267. idsList = ids.split(",");
  268. defaultValueList = defaultValue.split(",");
  269. setState(() {});
  270. }else {
  271. avatarPath = flustars.SpUtil.getString("avatarUrl");
  272. _nameController.text = flustars.SpUtil.getString("name");
  273. _mobileController.text = flustars.SpUtil.getString(Constant.phone);
  274. }
  275. _hasData = true;
  276. }, onError: (code, msg) {
  277. toasts(msg);
  278. });
  279. }
  280. List<dynamic> brandList;
  281. Future getBrandList() async {
  282. await NewApiService().getBrandListNoPage(
  283. onSuccess: (res) {
  284. if (res != null) {
  285. brandList = res;
  286. setState(() {});
  287. }
  288. }, onError: (code, msg) {
  289. toasts(msg);
  290. });
  291. }
  292. void selectPicker() {
  293. showDialog(
  294. context: context,
  295. builder: (BuildContext context) {
  296. return SimpleDialog(
  297. title: Text("修改头像"),
  298. children: ["拍照", '从手机相册选择'].map((String value) {
  299. return SimpleDialogOption(
  300. child: Text(
  301. value,
  302. style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
  303. ),
  304. onPressed: () {
  305. _getImage(value == '拍照' ? 1 : 0);
  306. Navigator.of(context).pop();
  307. },
  308. );
  309. }).toList(),
  310. );
  311. },
  312. );
  313. }
  314. void _getImage(int key) async {
  315. try {
  316. var _imageFile = await ImagePicker.pickImage(
  317. source: key == 1 ? ImageSource.camera : ImageSource.gallery,
  318. maxWidth: 800,
  319. imageQuality: 95,
  320. );
  321. if (_imageFile != null) {
  322. upLoadFileOnce(_imageFile.path);
  323. }
  324. } catch (e) {
  325. toasts("没有权限,无法打开相册!");
  326. }
  327. }
  328. getCheckFlag(type){
  329. String str;
  330. if(type == 2){
  331. str = "待审核";
  332. }else if(type == 0) {
  333. str = "驳回";
  334. }else if (type == 1){
  335. str = "审核通过";
  336. }
  337. return "($str)";
  338. }
  339. void upLoadFileOnce(String path) {
  340. showLoading(context, "正在上传...");
  341. NewApiService().upload(path, onSuccess: (res) {
  342. dismissLoading(context);
  343. setState(() {
  344. avatarPath = res.pathUrl;
  345. setState(() {});
  346. });
  347. }, onError: (code, msg) {
  348. dismissLoading(context);
  349. toasts(msg);
  350. });
  351. }
  352. // 查看专家协议
  353. void openProtocol() {
  354. }
  355. FocusNode blankNode = FocusNode();
  356. @override
  357. Widget build(BuildContext context) {
  358. double width = MediaQuery.of(context).size.width;
  359. double height = MediaQuery.of(context).size.height;
  360. // 监听FocusNode
  361. _focusNode1.addListener(() {
  362. // _focusNode1.hasFocus 是否聚焦
  363. print(_focusNode1.hasFocus);
  364. });
  365. return Scaffold(
  366. resizeToAvoidBottomPadding: false, //不让键盘弹上去
  367. appBar: MyAppBar(
  368. centerTitle: "申请为专家",
  369. ),
  370. body: _hasData? GestureDetector(
  371. onTap: () {
  372. // 点击空白页面关闭键盘
  373. FocusScope.of(context).requestFocus(blankNode);
  374. },
  375. child: Stack(
  376. children: <Widget>[
  377. Container(
  378. padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(80)),
  379. child: ListView(
  380. children: <Widget>[
  381. Form(
  382. key: _formKey, //设置globalKey,用于后面获取FormState
  383. // autovalidate: true, //开启自动校验
  384. child: Column(
  385. children: <Widget>[
  386. Stack(
  387. children: <Widget>[
  388. Container(
  389. width: width,
  390. height: 180,
  391. child: avatarPath.isEmpty
  392. ? LoadAssetImage(
  393. "wode/apply_expert_cover",
  394. format: "jpg",
  395. fit: BoxFit.fill,
  396. width: ScreenUtil().setWidth(width),
  397. height: ScreenUtil().setWidth(180),
  398. )
  399. : LoadNetworkImage(
  400. avatarPath,
  401. fit: BoxFit.fill,
  402. width: ScreenUtil().setWidth(width),
  403. height: ScreenUtil().setWidth(180),
  404. ),
  405. ),
  406. Positioned(
  407. left: width / 2 - 30,
  408. top: 180 / 2 - 40,
  409. width: 60,
  410. height: 60,
  411. child: GestureDetector(
  412. onTap: () {
  413. selectPicker();
  414. },
  415. child: LoadAssetImage(
  416. "wode/apply_expert_avatar",
  417. fit: BoxFit.fill,
  418. width: ScreenUtil().setWidth(60),
  419. height: ScreenUtil().setWidth(60),
  420. ),
  421. ),
  422. ),
  423. Positioned(
  424. left: width / 2 - ScreenUtil().setHeight(60),
  425. top: ScreenUtil().setHeight(180) / 2 + ScreenUtil().setHeight(30),
  426. width: ScreenUtil().setHeight(120),
  427. height: ScreenUtil().setHeight(30),
  428. child: GestureDetector(
  429. onTap: () {
  430. selectPicker();
  431. },
  432. child: Text(
  433. "上传照片",
  434. textAlign: TextAlign.center,
  435. style: TextStyle(
  436. color: Color(0xffffffff),
  437. fontSize: ScreenUtil().setSp(18),
  438. ),
  439. ),
  440. ),
  441. ),
  442. ],
  443. ),
  444. Container(
  445. height: ScreenUtil().setHeight(45),
  446. padding: EdgeInsets.only(
  447. left: ScreenUtil().setWidth(15),
  448. right: ScreenUtil().setWidth(15),
  449. ),
  450. alignment: Alignment.centerLeft,
  451. decoration: BoxDecoration(
  452. color: ThemeUtils.getDialogTextFieldColor(context),
  453. ),
  454. child: Row(
  455. children: <Widget>[
  456. Text(
  457. "基本信息",
  458. style: TextStyle(
  459. fontSize: ScreenUtil().setSp(15),
  460. fontWeight: FontWeight.bold,
  461. ),
  462. ),
  463. Text(
  464. detailObj?.checkFlag == null?"":getCheckFlag(detailObj.checkFlag),
  465. style: TextStyle(
  466. fontSize: ScreenUtil().setSp(15),
  467. fontWeight: FontWeight.bold,
  468. color: Color(0xFFff0000),
  469. ),
  470. )
  471. ],
  472. ),
  473. ),
  474. TextFieldItem(
  475. title: "姓名",
  476. isMust: true,
  477. content: "",
  478. controller: _nameController,
  479. hintText: "请输入您的姓名",
  480. validator: (val) {
  481. return val.trim().length > 0 ? null : "请输入姓名";
  482. },
  483. ),
  484. ChiosePicker(
  485. range: sexListChiose,
  486. label: "性别",
  487. isMust: true,
  488. value: sexChioseString,
  489. onConfirm: (value, index) {
  490. sexChiose = sexList[index]['value'];
  491. },
  492. ),
  493. ChiosePicker(
  494. range: ageListChiose,
  495. label: "年龄",
  496. isMust: true,
  497. value: ageChiose,
  498. onConfirm: (value, index) {
  499. ageChiose = value;
  500. },
  501. ),
  502. TextFieldItem(
  503. title: "身份证号",
  504. isMust: true,
  505. content: "",
  506. controller: _idNumberController,
  507. hintText: "请输入您的身份证号",
  508. validator: (val) {
  509. return val.trim().length > 0 ? null : "请输入身份证号";
  510. },
  511. ),
  512. TextFieldItem(
  513. title: "联系电话",
  514. isMust: true,
  515. content: "",
  516. controller: _mobileController,
  517. hintText: "请输入您的联系电话",
  518. validator: (val) {
  519. return val.trim().length > 0 ? null : "请输入联系电话";
  520. },
  521. ),
  522. ChiosePicker(
  523. range: learnListChiose,
  524. label: "学历",
  525. isMust: true,
  526. value: learnChioseString,
  527. onConfirm: (value, index) {
  528. learnChiose = learnList[index]['value'];
  529. },
  530. ),
  531. TextFieldItem(
  532. title: "专业",
  533. isMust: true,
  534. content: "",
  535. controller: _professionalController,
  536. hintText: "请输入您的专业",
  537. validator: (val) {
  538. return val.trim().length > 0 ? null : "请输入您的专业";
  539. },
  540. ),
  541. TextFieldItem(
  542. title: "从业时长",
  543. isMust: true,
  544. content: "",
  545. keyboardType: TextInputType.number,
  546. controller: _workDateController,
  547. hintText: "请输入您的从业时长",
  548. validator: (val) {
  549. return val.trim().length > 0 ? null : "请输入您的从业时长";
  550. },
  551. ),
  552. TextFieldItem(
  553. title: "所在公司",
  554. content: "",
  555. controller: _companyController,
  556. hintText: "请输入您的所在公司",
  557. ),
  558. TextFieldItem(
  559. title: "现任岗位",
  560. content: "",
  561. controller: _jobController,
  562. hintText: "请输入您的现任岗位",
  563. ),
  564. // TextFieldItem(
  565. // title: "常驻工作地",
  566. // content: "",
  567. // controller: _residentPlaceController,
  568. // hintText: "常驻工作地",
  569. // onChanged: (res) {
  570. // // setState(() {});
  571. // },
  572. // ),
  573. InkWell(
  574. onTap: () {
  575. NavigatorUtils.push(
  576. context, "${BbsRouter.mapChoicePoint}?type=2");
  577. },
  578. child: Container(
  579. padding: EdgeInsets.only(
  580. left: ScreenUtil().setWidth(15),
  581. right: ScreenUtil().setWidth(15),
  582. top: ScreenUtil().setWidth(10),
  583. bottom: ScreenUtil().setWidth(10)),
  584. decoration: BoxDecoration(
  585. border: Border(
  586. bottom:
  587. BorderSide(width: 0.5, color: Colours.line),
  588. ),
  589. ),
  590. child: Row(
  591. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  592. children: <Widget>[
  593. Row(
  594. children: <Widget>[
  595. Text(
  596. "常驻工作地",
  597. style: TextStyle(
  598. color: Color(0xff222222),
  599. // fontSize:ScreenUtil().setSp(14)
  600. ),
  601. textAlign: TextAlign.start,
  602. ),
  603. Text(
  604. "*",
  605. style: TextStyle(
  606. color: Color(0xffff0000),
  607. // fontSize:ScreenUtil().setSp(14)
  608. ),
  609. textAlign: TextAlign.start,
  610. ),
  611. ],
  612. ),
  613. Expanded(
  614. child: Text(
  615. addressName != null && addressName != ""
  616. ? addressName.split(",")[0]
  617. : "请选择",
  618. style: TextStyle(
  619. color: Color(0xff999999),
  620. // fontSize:ScreenUtil().setSp(14)
  621. ),
  622. textAlign: TextAlign.end,
  623. maxLines: 1,
  624. overflow: TextOverflow.ellipsis,
  625. ),
  626. )
  627. ]),
  628. ),
  629. ),
  630. Container(
  631. height: ScreenUtil().setHeight(45),
  632. padding: EdgeInsets.only(
  633. left: ScreenUtil().setWidth(15),
  634. right: ScreenUtil().setWidth(15),
  635. ),
  636. alignment: Alignment.centerLeft,
  637. decoration: BoxDecoration(
  638. color: ThemeUtils.getDialogTextFieldColor(context),
  639. ),
  640. child: Text(
  641. "工作经历",
  642. style: TextStyle(
  643. fontSize: ScreenUtil().setSp(15),
  644. fontWeight: FontWeight.bold,
  645. ),
  646. ),
  647. ),
  648. Row(
  649. crossAxisAlignment: CrossAxisAlignment.start,
  650. mainAxisAlignment: MainAxisAlignment.start,
  651. children: <Widget>[
  652. Container(
  653. padding: EdgeInsets.only(
  654. left: ScreenUtil().setWidth(15),
  655. top: ScreenUtil().setWidth(5),
  656. bottom: ScreenUtil().setWidth(5),
  657. ),
  658. child: Text(
  659. "工作经历",
  660. style: TextStyle(
  661. color: Color(0xff222222),
  662. // fontSize:ScreenUtil().setSp(14),
  663. ),
  664. textAlign: TextAlign.left,
  665. ),
  666. ),
  667. ],
  668. ),
  669. Container(
  670. height: 100,
  671. padding: EdgeInsets.only(
  672. left: ScreenUtil().setWidth(15),
  673. right: ScreenUtil().setWidth(15),
  674. bottom: ScreenUtil().setWidth(20),
  675. ),
  676. child: TextFormField(
  677. // autofocus: true,
  678. maxLength: 50,
  679. cursorColor: Color(0xffcccccc),
  680. controller: _workExperienceController,
  681. maxLines: 5,
  682. decoration: InputDecoration(
  683. contentPadding: EdgeInsets.all(0),
  684. hintText: '请输入工作时间+岗位+工作内容',
  685. hintStyle: TextStyle(
  686. color: Color(0xffcccccc),
  687. // fontSize: ScreenUtil().setSp(14)
  688. ),
  689. focusedBorder: InputBorder.none,
  690. border: InputBorder.none,
  691. // filled: true, // 背景色
  692. // fillColor: Colors.cyan.withAlpha(35),
  693. // icon: Icon(Icons.person)
  694. ),
  695. ),
  696. ),
  697. SizedBox(
  698. height: 6,
  699. child: Container(color: ThemeUtils.getDialogTextFieldColor(context)),
  700. ),
  701. Row(
  702. crossAxisAlignment: CrossAxisAlignment.start,
  703. mainAxisAlignment: MainAxisAlignment.start,
  704. children: <Widget>[
  705. Container(
  706. padding: EdgeInsets.only(
  707. left: ScreenUtil().setWidth(15),
  708. top: ScreenUtil().setWidth(5),
  709. bottom: ScreenUtil().setWidth(5)),
  710. child: Text(
  711. "项目经历",
  712. style: TextStyle(
  713. color: Color(0xff222222),
  714. // fontSize:ScreenUtil().setSp(14),
  715. ),
  716. textAlign: TextAlign.left,
  717. ),
  718. ),
  719. ],
  720. ),
  721. Container(
  722. height: 100,
  723. padding: EdgeInsets.only(
  724. left: ScreenUtil().setWidth(15),
  725. right: ScreenUtil().setWidth(15),
  726. bottom: ScreenUtil().setWidth(20)),
  727. child: TextFormField(
  728. // autofocus: true,
  729. maxLength: 50,
  730. cursorColor: Color(0xffcccccc),
  731. controller: _projectExperienceController,
  732. maxLines: 5,
  733. decoration: InputDecoration(
  734. contentPadding: EdgeInsets.all(0),
  735. hintText: '请输入项目时间+项目名称+主要职责',
  736. hintStyle: TextStyle(
  737. color: Color(0xffcccccc),
  738. ),
  739. focusedBorder: InputBorder.none,
  740. border: InputBorder.none,
  741. ),
  742. ),
  743. ),
  744. Container(
  745. height: ScreenUtil().setHeight(45),
  746. padding: EdgeInsets.only(
  747. left: ScreenUtil().setWidth(15),
  748. right: ScreenUtil().setWidth(15),
  749. ),
  750. alignment: Alignment.centerLeft,
  751. decoration: BoxDecoration(
  752. color: ThemeUtils.getDialogTextFieldColor(context),
  753. ),
  754. child: Text(
  755. "技术特点",
  756. style: TextStyle(
  757. fontSize: ScreenUtil().setSp(15),
  758. fontWeight: FontWeight.bold,
  759. ),
  760. ),
  761. ),
  762. // TextFieldItem(
  763. // title: "擅长品牌",
  764. // isMust: true,
  765. // content: "",
  766. // controller: _proficiencyBrandController,
  767. // hintText: "请输入电梯品牌",
  768. // validator: (val) {
  769. // return val.trim().length > 0 ? null : "请输入擅长品牌";
  770. // },
  771. // ),
  772. ClickItem(
  773. title: "擅长品牌",
  774. content: defaultValue,
  775. isMust:true,
  776. onTap: () {
  777. setState(() {
  778. sortBool = false;
  779. });
  780. },
  781. ),
  782. TextFieldItem(
  783. title: "擅长电气",
  784. isMust: true,
  785. content: "",
  786. controller: _goodElectricalController,
  787. hintText: "请输入电气类别",
  788. validator: (val) {
  789. return val.trim().length > 0 ? null : "请输入擅长电气";
  790. },
  791. ),
  792. TextFieldItem(
  793. title: "擅长机械",
  794. isMust: true,
  795. content: "",
  796. controller: _goodMechanicalController,
  797. hintText: "请输入机械类别",
  798. validator: (val) {
  799. return val.trim().length > 0 ? null : "请输入擅长机械";
  800. },
  801. ),
  802. Container(
  803. height: ScreenUtil().setHeight(45),
  804. padding: EdgeInsets.only(
  805. left: ScreenUtil().setWidth(15),
  806. right: ScreenUtil().setWidth(15),
  807. ),
  808. alignment: Alignment.centerLeft,
  809. decoration: BoxDecoration(
  810. color: ThemeUtils.getDialogTextFieldColor(context),
  811. ),
  812. child: Text(
  813. "上传证照",
  814. style: TextStyle(
  815. fontSize: ScreenUtil().setSp(15),
  816. fontWeight: FontWeight.bold,
  817. ),
  818. ),
  819. ),
  820. IdPhoto(
  821. title: "身份证上传",
  822. desc: "上传身份证人像面",
  823. cover: "apply_idcard",
  824. isMust: true,
  825. uploadFile:cardPicture,
  826. change: (value) {
  827. cardPicture = value;
  828. }),
  829. IdPhoto(
  830. title: "学历学位证书上传",
  831. desc: "上传学位学历证书人面像",
  832. cover: "apply_education",
  833. uploadFile:degreeCertificate,
  834. change: (value) {
  835. degreeCertificate = value;
  836. }),
  837. IdPhoto(
  838. title: "专业技能证书上传",
  839. desc: "上传专业技能证书人像面",
  840. cover: "apply_profession",
  841. uploadFile:skillsCertificate,
  842. isMust: true,
  843. change: (value) {
  844. skillsCertificate = value;
  845. }),
  846. IdPhoto(
  847. title: "其他证书上传",
  848. desc: "其他荣誉、培训证书等",
  849. cover: "apply_other",
  850. uploadFile:otherCertificates,
  851. change: (value) {
  852. otherCertificates = value;
  853. }),
  854. Container(
  855. height: ScreenUtil().setHeight(45),
  856. padding: EdgeInsets.only(
  857. left: ScreenUtil().setWidth(15),
  858. right: ScreenUtil().setWidth(15),
  859. ),
  860. alignment: Alignment.centerLeft,
  861. decoration: BoxDecoration(
  862. color: ThemeUtils.getDialogTextFieldColor(context),
  863. ),
  864. child: Row(
  865. children: <Widget>[
  866. Checkbox(
  867. value: _protocol,
  868. activeColor: Colors.red, //选中时的颜色
  869. onChanged: (value) {
  870. setState(() {
  871. _protocol = value;
  872. });
  873. print(_protocol);
  874. },
  875. ),
  876. GestureDetector(
  877. onTap: () {
  878. NavigatorUtils.push(
  879. context, "${WodeRouter.xieyiList}");
  880. },
  881. child: Row(
  882. children: <Widget>[
  883. Text("同意《"),
  884. Text(
  885. "专家协议",
  886. style: TextStyle(
  887. color:Color(0xFF0287FF),
  888. ),
  889. // textAlign:TextAlign.start,
  890. ),
  891. Text("》")
  892. ],
  893. )
  894. ),
  895. ],
  896. ),
  897. ),
  898. SizedBox(
  899. height: 6,
  900. child: Container(color: ThemeUtils.getDialogTextFieldColor(context)),
  901. ),
  902. ],
  903. ),
  904. )
  905. ],
  906. ),
  907. ),
  908. Positioned(
  909. bottom: 0,
  910. left: 0,
  911. child: Container(
  912. width: width,
  913. padding: EdgeInsets.only(
  914. top: ScreenUtil().setWidth(15),
  915. bottom: ScreenUtil().setWidth(15),
  916. left: ScreenUtil().setWidth(25),
  917. right: ScreenUtil().setWidth(25),
  918. ),
  919. color: ThemeUtils.getDialogTextFieldColor(context),
  920. child: ((detailObj == null) || (detailObj != null&&detailObj.checkFlag == 0))? Container(
  921. height: ScreenUtil().setWidth(44),
  922. decoration: BoxDecoration(
  923. borderRadius:
  924. BorderRadius.circular(ScreenUtil().setWidth(22)),
  925. gradient: const LinearGradient(
  926. colors: [Color(0xFF00D9FF), Color(0xFF0287FF)],
  927. ),
  928. ),
  929. child: FlatButton(
  930. // padding: EdgeInsets.all(15.0),
  931. child: Text("提交"),
  932. textColor: Colors.white,
  933. onPressed: () {
  934. if ((_formKey.currentState as FormState).validate()) {
  935. if(detailObj == null){
  936. submit("add");
  937. }else {
  938. submit("edit");
  939. }
  940. }
  941. },
  942. ),
  943. ):Container(
  944. height: ScreenUtil().setWidth(44),
  945. decoration: BoxDecoration(
  946. borderRadius:
  947. BorderRadius.circular(ScreenUtil().setWidth(22)),
  948. color:Color(0xffcccccc)
  949. ),
  950. child: FlatButton(
  951. // padding: EdgeInsets.all(15.0),
  952. child: Text("提交"),
  953. textColor: Colors.white,
  954. onPressed: () {
  955. toasts("审核中,请勿重复提交!");
  956. },
  957. ),
  958. ),
  959. ),
  960. ),
  961. !sortBool
  962. ? Positioned(
  963. top: 0,
  964. left: 0,
  965. child: GestureDetector(
  966. onTap: () {
  967. setState(() {
  968. sortBool = true;
  969. if(ids!=null&&ids!=""){
  970. defaultValueList = defaultValue.split(",");
  971. idsList = ids.split(",");
  972. }else {
  973. defaultValueList = [];
  974. idsList = [];
  975. }
  976. });
  977. },
  978. child: Container(
  979. width: width,
  980. height: height,
  981. color: Color.fromRGBO(0, 0, 0, 0.5)),
  982. ),
  983. )
  984. : Container(child: null),
  985. !sortBool?
  986. Positioned(
  987. top:0,
  988. right:0,
  989. child:Container(
  990. width: width/4*3,
  991. height:height,
  992. color: Colors.white,
  993. padding: EdgeInsets.only(top:ScreenUtil().setWidth(45)),
  994. child:ListView(
  995. children:<Widget>[
  996. brandList!=null&&brandList!=[]?Container(
  997. child: Wrap(
  998. alignment: WrapAlignment.start,
  999. crossAxisAlignment: WrapCrossAlignment.center,
  1000. children: brandList.asMap().keys.map((index){
  1001. return InkWell(
  1002. onTap: (){
  1003. print("666");
  1004. setState(() {
  1005. if(idsList.contains(brandList[index].id.toString())){
  1006. defaultValueList.remove(brandList[index].name);
  1007. idsList.remove(brandList[index].id.toString());
  1008. }else {
  1009. if(idsList.length>=3){
  1010. toasts("最多只能选择3个品牌");
  1011. }else {
  1012. defaultValueList.add(brandList[index].name);
  1013. idsList.add(brandList[index].id.toString());
  1014. }
  1015. }
  1016. print(idsList);
  1017. });
  1018. },
  1019. child: Container(
  1020. width: width/4-12,
  1021. padding: EdgeInsets.only(bottom:ScreenUtil().setWidth(10),top:ScreenUtil().setWidth(10)),
  1022. margin: EdgeInsets.only(left:5,right:5,bottom:5,top:5),
  1023. decoration: BoxDecoration(
  1024. // border: Border(
  1025. // bottom: BorderSide(width: 0.5, color: Colours.line),
  1026. // ),
  1027. color: Color(0xfff5f5f5)
  1028. ),
  1029. child:Text(
  1030. brandList[index].name??"",
  1031. style: TextStyle(
  1032. color:idsList.contains(brandList[index].id.toString())?Color(0xffff0000):Color(0xff666666),
  1033. fontSize:ScreenUtil().setSp(15)
  1034. ),
  1035. textAlign:TextAlign.center,
  1036. ),
  1037. ),
  1038. );
  1039. }).toList(),
  1040. )
  1041. ):loadCircle()
  1042. ],
  1043. )
  1044. )
  1045. ):
  1046. Container(
  1047. child:null
  1048. ),
  1049. !sortBool?
  1050. Positioned(
  1051. top:0,
  1052. right:0,
  1053. child:
  1054. Container(
  1055. width: width/4*3,
  1056. padding: EdgeInsets.only(left:10,top:10,bottom:10,right:10),
  1057. child:Row(
  1058. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1059. children: <Widget>[
  1060. Text(
  1061. "品牌",
  1062. style: TextStyle(
  1063. color:Color(0xff666666),
  1064. fontSize:ScreenUtil().setSp(16)
  1065. ),
  1066. textAlign:TextAlign.start,
  1067. ),
  1068. GestureDetector(
  1069. onTap: (){
  1070. setState(() {
  1071. sortBool = true;
  1072. String str = "";
  1073. String strD = "";
  1074. idsList.forEach((item){
  1075. str += (item.toString() + ",");
  1076. });
  1077. ids = str.substring(0, str.length-1);
  1078. defaultValueList.forEach((item){
  1079. strD += (item.toString() + ",");
  1080. });
  1081. defaultValue = strD.substring(0, strD.length-1);
  1082. print(defaultValue);
  1083. print(ids);
  1084. });
  1085. },
  1086. child: Text(
  1087. "确定",
  1088. style: TextStyle(
  1089. color:Color(0xFF0287FF),
  1090. fontSize:ScreenUtil().setSp(16)
  1091. ),
  1092. textAlign:TextAlign.start,
  1093. ),
  1094. )
  1095. ],
  1096. )
  1097. ),
  1098. ):
  1099. Container(
  1100. child:null
  1101. ),
  1102. ],
  1103. ),
  1104. ):Center(
  1105. child: Text("正在加载..."),
  1106. ),
  1107. );
  1108. }
  1109. Widget loadCircle() {
  1110. return Container(
  1111. padding: EdgeInsets.only(top: 10, bottom: 10),
  1112. color: ThemeUtils.getTabsBg(context),
  1113. child: Center(
  1114. child: SpinKitFadingCircle(
  1115. color: Colors.blueAccent,
  1116. size: 30.0,
  1117. ),
  1118. ),
  1119. );
  1120. }
  1121. }
  1122. class IdPhoto extends StatefulWidget {
  1123. IdPhoto({
  1124. Key key,
  1125. this.title,
  1126. this.desc,
  1127. this.uploadFile = "",
  1128. this.cover,
  1129. this.isMust: false,
  1130. this.change,
  1131. }) : super(key: key);
  1132. final String title;
  1133. final String desc;
  1134. String uploadFile;
  1135. final String cover;
  1136. final bool isMust;
  1137. final Function(String) change;
  1138. @override
  1139. _IdPhotoState createState() => _IdPhotoState();
  1140. }
  1141. class _IdPhotoState extends State<IdPhoto> {
  1142. @override
  1143. initState() {
  1144. super.initState();
  1145. }
  1146. void selectPicker() {
  1147. showDialog(
  1148. context: context,
  1149. builder: (BuildContext context) {
  1150. return SimpleDialog(
  1151. title: Text(widget.title ?? "图片上传"),
  1152. children: ["拍照", '从手机相册选择'].map((String value) {
  1153. return SimpleDialogOption(
  1154. child: Text(
  1155. value,
  1156. style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
  1157. ),
  1158. onPressed: () {
  1159. _getImage(value == '拍照' ? 1 : 0);
  1160. Navigator.of(context).pop();
  1161. },
  1162. );
  1163. }).toList(),
  1164. );
  1165. },
  1166. );
  1167. }
  1168. void _getImage(int key) async {
  1169. try {
  1170. var _imageFile = await ImagePicker.pickImage(
  1171. source: key == 1 ? ImageSource.camera : ImageSource.gallery,
  1172. maxWidth: 800,
  1173. imageQuality: 95,
  1174. );
  1175. if (_imageFile != null) {
  1176. upLoadFileOnce(_imageFile.path);
  1177. // setState(() {});
  1178. }
  1179. } catch (e) {
  1180. toasts("没有权限,无法打开相册!");
  1181. }
  1182. }
  1183. void upLoadFileOnce(String path) {
  1184. showLoading(context, "正在上传...");
  1185. NewApiService().upload(path, onSuccess: (res) {
  1186. dismissLoading(context);
  1187. setState(() {
  1188. widget.uploadFile = res.pathUrl;
  1189. widget.change != null ? widget.change(res.pathUrl) : null;
  1190. setState(() {});
  1191. });
  1192. }, onError: (code, msg) {
  1193. dismissLoading(context);
  1194. toasts(msg);
  1195. });
  1196. }
  1197. @override
  1198. Widget build(BuildContext context) {
  1199. double width = MediaQuery.of(context).size.width;
  1200. return Container(
  1201. child: Container(
  1202. // height: ScreenUtil().setWidth(200),
  1203. padding: EdgeInsets.only(
  1204. top: ScreenUtil().setWidth(30),
  1205. right: ScreenUtil().setWidth(10),
  1206. bottom: ScreenUtil().setWidth(30),
  1207. left: ScreenUtil().setWidth(10),
  1208. ),
  1209. decoration: BoxDecoration(
  1210. border: Border(
  1211. bottom: Divider.createBorderSide(context, width: 0.6),
  1212. ),
  1213. ),
  1214. child: Row(
  1215. children: <Widget>[
  1216. Offstage(
  1217. offstage: !widget.isMust,
  1218. child: Text(
  1219. "*",
  1220. style: TextStyle(color: Colors.red),
  1221. ),
  1222. ),
  1223. Container(
  1224. child: Column(
  1225. mainAxisAlignment: MainAxisAlignment.center,
  1226. crossAxisAlignment: CrossAxisAlignment.start,
  1227. children: <Widget>[
  1228. Container(
  1229. child: Text(
  1230. widget.title,
  1231. textAlign: TextAlign.left,
  1232. style: TextStyle(
  1233. fontSize: ScreenUtil().setSp(16),
  1234. ),
  1235. ),
  1236. ),
  1237. Container(
  1238. child: Text(
  1239. widget.desc,
  1240. textAlign: TextAlign.left,
  1241. style: TextStyle(
  1242. fontSize: ScreenUtil().setSp(14),
  1243. color: Color(0xFF999999),
  1244. ),
  1245. ),
  1246. ),
  1247. ],
  1248. ),
  1249. ),
  1250. Expanded(
  1251. flex: 1,
  1252. child: Container(),
  1253. ),
  1254. GestureDetector(
  1255. onTap: () {
  1256. selectPicker();
  1257. },
  1258. child: widget.uploadFile.isEmpty
  1259. ? LoadAssetImage(
  1260. "wode/" + widget.cover,
  1261. fit: BoxFit.fill,
  1262. width: ScreenUtil().setWidth(140),
  1263. height: ScreenUtil().setWidth(89),
  1264. )
  1265. : LoadNetworkImage(
  1266. widget.uploadFile,
  1267. fit: BoxFit.fill,
  1268. width: ScreenUtil().setWidth(140),
  1269. height: ScreenUtil().setWidth(89),
  1270. ),
  1271. ),
  1272. ],
  1273. ),
  1274. ),
  1275. );
  1276. }
  1277. }
  1278. /// 封装输入框
  1279. class TextFieldItem extends StatelessWidget {
  1280. const TextFieldItem({
  1281. Key key,
  1282. this.controller,
  1283. @required this.title,
  1284. this.keyboardType: TextInputType.text,
  1285. this.hintText: "",
  1286. this.isMust: false,
  1287. this.content: "",
  1288. this.maxLength,
  1289. this.focusNode,
  1290. this.onChanged,
  1291. this.config,
  1292. this.validator,
  1293. }) : super(key: key);
  1294. final TextEditingController controller;
  1295. final String title;
  1296. final String hintText;
  1297. final bool isMust;
  1298. final String content;
  1299. final TextInputType keyboardType;
  1300. final int maxLength;
  1301. final FocusNode focusNode;
  1302. final Function onChanged;
  1303. final KeyboardActionsConfig config;
  1304. final FormFieldValidator<String> validator;
  1305. @override
  1306. Widget build(BuildContext context) {
  1307. if (config != null && defaultTargetPlatform == TargetPlatform.iOS) {
  1308. // 因Android平台输入法兼容问题,所以只配置IOS平台
  1309. FormKeyboardActions.setKeyboardActions(context, config);
  1310. }
  1311. if (content.length > 0) {
  1312. controller.text = content;
  1313. }
  1314. return Container(
  1315. // height: 50.0,
  1316. margin: const EdgeInsets.only(left: 16.0),
  1317. width: double.infinity,
  1318. decoration: BoxDecoration(
  1319. border: Border(
  1320. bottom: Divider.createBorderSide(context, width: 0.6),
  1321. )),
  1322. child: Row(
  1323. crossAxisAlignment: CrossAxisAlignment.start,
  1324. children: <Widget>[
  1325. Padding(
  1326. padding: const EdgeInsets.only(top:15),
  1327. child: Text(title),
  1328. ),
  1329. Offstage(
  1330. offstage: !this.isMust,
  1331. child: Container(
  1332. padding: EdgeInsets.only(top:18),
  1333. child: Text(
  1334. "*",
  1335. style: TextStyle(color: Colors.red),
  1336. ),
  1337. )
  1338. ),
  1339. Expanded(
  1340. flex: 1,
  1341. child: TextFormField(
  1342. textAlign: TextAlign.right,
  1343. onChanged: onChanged,
  1344. maxLength: maxLength,
  1345. focusNode: focusNode,
  1346. keyboardType: keyboardType,
  1347. inputFormatters: _getInputFormatters(),
  1348. controller: controller,
  1349. //style: TextStyles.textDark14,
  1350. decoration: InputDecoration(
  1351. hintText: hintText,
  1352. hintStyle: TextStyle(color: Colours.text_gray_c),
  1353. border: InputBorder.none, //去掉下划线
  1354. //hintStyle: TextStyles.textGrayC14
  1355. ),
  1356. validator: validator,
  1357. ),
  1358. ),
  1359. Gaps.hGap16
  1360. ],
  1361. ),
  1362. );
  1363. }
  1364. _getInputFormatters() {
  1365. if (keyboardType == TextInputType.numberWithOptions(decimal: true)) {
  1366. return [UsNumberTextInputFormatter()];
  1367. }
  1368. if (keyboardType == TextInputType.number ||
  1369. keyboardType == TextInputType.phone) {
  1370. return [WhitelistingTextInputFormatter.digitsOnly];
  1371. }
  1372. return null;
  1373. }
  1374. }