master_become.dart 63 KB

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