master_become.dart 64 KB

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