12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496 |
- import 'package:flustars/flustars.dart' as flustars;
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/foundation.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:flutter_spinkit/flutter_spinkit.dart';
- import 'package:image_picker/image_picker.dart';
- import 'package:keyboard_actions/keyboard_actions.dart';
- import 'package:liftmanager/common/common.dart';
- import 'package:liftmanager/internal/bbs/bbs_router.dart';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/fast_notification.dart';
- import 'package:liftmanager/utils/number_text_input_formatter.dart';
- import 'package:liftmanager/utils/theme_utils.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/widgets/bbs_content.dart';
- import 'package:liftmanager/widgets/click_item.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:umeng_common_sdk/umeng_common_sdk.dart';
- class MasterBecome extends StatefulWidget {
- @override
- State<StatefulWidget> createState() {
- return MasterBecomeState();
- }
- }
- class MasterBecomeState extends State<MasterBecome> {
- ScrollController _scrollController = new ScrollController();
- TextEditingController _nameController = new TextEditingController();
- TextEditingController _idNumberController = new TextEditingController();
- TextEditingController _mobileController = new TextEditingController();
- TextEditingController _professionalController = new TextEditingController();
- TextEditingController _workDateController = new TextEditingController();
- TextEditingController _companyController = new TextEditingController();
- TextEditingController _jobController = new TextEditingController();
- TextEditingController _residentPlaceController = new TextEditingController();
- TextEditingController _workExperienceController = new TextEditingController();
- TextEditingController _projectExperienceController =
- new TextEditingController();
- TextEditingController _proficiencyBrandController =
- new TextEditingController();
- TextEditingController _goodElectricalController = new TextEditingController();
- TextEditingController _goodMechanicalController = new TextEditingController();
- String defaultValue = "请选择";
- String ids;
- List<String> idsList = [];
- List<String> defaultValueList = [];
- // 焦点控制
- FocusNode _focusNode1 = new FocusNode();
- GlobalKey _formKey = new GlobalKey<FormState>();
- int sexChiose = -1;
- String sexChioseString = "";
- String ageChiose = "";
- int learnChiose = -1;
- String learnChioseString = "";
- String addressName = "";
- List<String> sexListChiose = [];
- List<dynamic> sexList = [
- {"value": 1, "label": "男"},
- {"value": 2, "label": "女"}
- ];
- List<String> ageListChiose = [];
- List<String> learnListChiose = [];
- List<dynamic> learnList = [
- {"value": 1, "label": "小学"},
- {"value": 2, "label": "初中"},
- {"value": 3, "label": "中专"},
- {"value": 4, "label": "高中"},
- {"value": 5, "label": "大专"},
- {"value": 6, "label": "本科"},
- {"value": 7, "label": "硕士研究生"},
- {"value": 8, "label": "博士研究生"},
- ];
- String avatarPath = '';
- String cardPicture = '';
- String degreeCertificate = '';
- String skillsCertificate = '';
- String otherCertificates = '';
- dynamic detailObj;
- bool _protocol = false;
- bool sortBool = true;
- void submit(type) {
- if (!_protocol) {
- toasts("请勾选用户协议!");
- return;
- }
- if (avatarPath == null || avatarPath.isEmpty) {
- toasts("请上传头像!");
- return;
- } else if (sexChiose == -1) {
- toasts("请选择性别!");
- return;
- } else if (ageChiose.isEmpty) {
- toasts("请选择年龄!");
- return;
- } else if (learnChiose == -1) {
- toasts("请选择学历!");
- return;
- } else if (cardPicture.isEmpty) {
- toasts("请上传身份证人像面!");
- return;
- } else if (skillsCertificate.isEmpty) {
- toasts("请上传专业技能证书人像面!");
- return;
- }
- if (addressName == null || addressName == "") {
- toasts("请选择常驻工作地!");
- return;
- }
- if (_goodElectricalController.text.length > 20) {
- toasts("擅长电气最大不超过20字符!");
- return;
- }
- if (_goodMechanicalController.text.length > 20) {
- toasts("擅长机械最大不超过20字符!");
- return;
- }
- RegExp exp = RegExp(r'^1[34578]\d{9}$');
- RegExp expSfz = RegExp(r"\d{17}[\d|x]|\d{15}");
- if (!expSfz.hasMatch(_idNumberController.text)) {
- toasts("请输入正确的身份证号");
- return;
- }
- if (!exp.hasMatch(_mobileController.text)) {
- toasts("请输入正确的手机号");
- return;
- }
- if (idsList.length <= 0) {
- toasts("请选择品牌");
- return;
- }
- if (type == "add") {
- NewApiService().applyExperts({
- "age": ageChiose,
- "photo": avatarPath,
- "cardPicture": cardPicture,
- // "checkFlag": 0,
- "company": _companyController.text,
- "degreeCertificate": degreeCertificate,
- "eduLevel": learnChiose,
- "gender": sexChiose,
- "goodElectrical": _goodElectricalController.text,
- "goodMechanical": _goodMechanicalController.text,
- "idNumber": _idNumberController.text,
- "job": _jobController.text,
- "mobile": _mobileController.text,
- "name": _nameController.text,
- "otherCertificates": otherCertificates,
- "professional": _professionalController.text,
- "proficiencyBrand": ids,
- "proficiencyBrandName": defaultValue,
- "projectExperience": _projectExperienceController.text,
- "residentPlace": addressName,
- "skillsCertificate": skillsCertificate,
- "userId": int.parse(flustars.SpUtil.getString(Constant.userId)),
- "workDate": _workDateController.text,
- "workExperience": _workExperienceController.text
- }, onSuccess: (res) {
- toasts("申请成功,请等待审核");
- Navigator.pop(context);
- }, onError: (code, msg) {
- toasts(msg);
- });
- } else {
- NewApiService().updateBecomeMaster({
- "id": detailObj.id,
- "photo": avatarPath,
- "age": ageChiose,
- "cardPicture": cardPicture,
- // "checkFlag": 0,
- "company": _companyController.text,
- "degreeCertificate": degreeCertificate,
- "eduLevel": learnChiose,
- "gender": sexChiose,
- "goodElectrical": _goodElectricalController.text,
- "goodMechanical": _goodMechanicalController.text,
- "idNumber": _idNumberController.text,
- "job": _jobController.text,
- "mobile": _mobileController.text,
- "name": _nameController.text,
- "otherCertificates": otherCertificates,
- "professional": _professionalController.text,
- "proficiencyBrand": ids,
- "proficiencyBrandName": defaultValue,
- "projectExperience": _projectExperienceController.text,
- "residentPlace": addressName,
- "skillsCertificate": skillsCertificate,
- "userId": int.parse(flustars.SpUtil.getString(Constant.userId)),
- "workDate": _workDateController.text,
- "workExperience": _workExperienceController.text
- }, onSuccess: (res) {
- toasts("修改申请成功,请等待审核");
- Navigator.pop(context);
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- }
- @override
- void dispose() {
- UmengCommonSdk.onPageEnd("申请为专家");
- super.dispose();
- }
- @override
- initState() {
- UmengCommonSdk.onPageStart("申请为专家");
- getDetail();
- for (var i = 10; i < 100; i++) {
- ageListChiose.add(i.toString());
- }
- for (var i = 0; i < sexList.length; i++) {
- sexListChiose.add(sexList[i]['label']);
- }
- for (var i = 0; i < learnList.length; i++) {
- learnListChiose.add(learnList[i]['label']);
- }
- getBrandList();
- super.initState();
- FastNotification.addListener("set_address_master", (setAddressMaster) {
- setState(() {
- addressName = setAddressMaster;
- print(addressName);
- print(222222224);
- });
- });
- }
- bool _hasData = false;
- Future getDetail() async {
- await NewApiService().getBecomeMasterDetail(onSuccess: (res) {
- if (res != null) {
- detailObj = res;
- ageChiose = detailObj.age.toString();
- sexChiose = detailObj.gender;
- learnChiose = detailObj.eduLevel;
- if (sexChiose == 1) {
- sexChioseString = "男";
- } else if (sexChiose == 2) {
- sexChioseString = "女";
- }
- learnList.forEach((element) {
- if (learnChiose == element["value"]) {
- print(learnChiose);
- print(element["value"]);
- print(123456);
- learnChioseString = element["label"];
- }
- });
- cardPicture = detailObj.cardPicture;
- _companyController.text = detailObj.company;
- degreeCertificate = detailObj.degreeCertificate;
- avatarPath = detailObj.photo;
- _goodElectricalController.text = detailObj.goodElectrical;
- _goodMechanicalController.text = detailObj.goodMechanical;
- _idNumberController.text = detailObj.idNumber;
- _jobController.text = detailObj.job;
- _mobileController.text = detailObj.mobile;
- _nameController.text = detailObj.name;
- otherCertificates = detailObj.otherCertificates;
- _professionalController.text = detailObj.professional;
- ids = detailObj.proficiencyBrand;
- defaultValue = detailObj.proficiencyBrandName;
- _projectExperienceController.text = detailObj.projectExperience;
- addressName = detailObj.residentPlace;
- skillsCertificate = detailObj.skillsCertificate;
- _workDateController.text = detailObj.workDate.toString();
- _workExperienceController.text = detailObj.workExperience;
- idsList = ids.split(",");
- defaultValueList = defaultValue.split(",");
- setState(() {});
- } else {
- avatarPath = flustars.SpUtil.getString("avatarUrl");
- _nameController.text = flustars.SpUtil.getString("name");
- _mobileController.text = flustars.SpUtil.getString(Constant.phone);
- }
- _hasData = true;
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- List<dynamic> brandList;
- Future getBrandList() async {
- await NewApiService().getBrandListNoPage(onSuccess: (res) {
- if (res != null) {
- brandList = res;
- setState(() {});
- }
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- void selectPicker() {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return SimpleDialog(
- title: Text("修改头像"),
- children: ["拍照", '从手机相册选择'].map((String value) {
- return SimpleDialogOption(
- child: Text(
- value,
- style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
- ),
- onPressed: () {
- _getImage(value == '拍照' ? 1 : 0);
- Navigator.of(context).pop();
- },
- );
- }).toList(),
- );
- },
- );
- }
- void _getImage(int key) async {
- try {
- var _imageFile = await ImagePicker.pickImage(
- source: key == 1 ? ImageSource.camera : ImageSource.gallery,
- maxWidth: 800,
- imageQuality: 95,
- );
- if (_imageFile != null) {
- upLoadFileOnce(_imageFile.path);
- }
- } catch (e) {
- toasts("没有权限,无法打开相册!");
- }
- }
- getCheckFlag(type) {
- String str;
- if (type == 2) {
- str = "待审核";
- } else if (type == 0) {
- str = "驳回";
- } else if (type == 1) {
- str = "审核通过";
- }
- return "($str)";
- }
- void upLoadFileOnce(String path) {
- showLoading(context, "正在上传...");
- NewApiService().upload(path, onSuccess: (res) {
- dismissLoading(context);
- setState(() {
- avatarPath = res.pathUrl;
- setState(() {});
- });
- }, onError: (code, msg) {
- dismissLoading(context);
- toasts(msg);
- });
- }
- // 查看专家协议
- void openProtocol() {}
- FocusNode blankNode = FocusNode();
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- double height = MediaQuery.of(context).size.height;
- // 监听FocusNode
- _focusNode1.addListener(() {
- // _focusNode1.hasFocus 是否聚焦
- print(_focusNode1.hasFocus);
- });
- return Scaffold(
- resizeToAvoidBottomPadding: false, //不让键盘弹上去
- appBar: MyAppBar(
- centerTitle: "申请为专家",
- ),
- body: _hasData
- ? GestureDetector(
- onTap: () {
- // 点击空白页面关闭键盘
- FocusScope.of(context).requestFocus(blankNode);
- },
- child: Stack(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(80)),
- child: ListView(
- children: <Widget>[
- Form(
- key: _formKey, //设置globalKey,用于后面获取FormState
- // autovalidate: true, //开启自动校验
- child: Column(
- children: <Widget>[
- ClickItem(
- title: "上传照片",
- hasPicRight: "${avatarPath ?? ""}",
- onTap: () {
- selectPicker();
- // NavigatorUtils.push(context, BbsRouter.videoDetail);
- },
- ),
- // Stack(
- // children: <Widget>[
- // Container(
- // width: width,
- // height: 180,
- // child: avatarPath.isEmpty
- // ? LoadAssetImage(
- // "wode/apply_expert_cover",
- // format: "jpg",
- // fit: BoxFit.fill,
- // width: ScreenUtil().setWidth(width),
- // height: ScreenUtil().setWidth(180),
- // )
- // : LoadNetworkImage(
- // avatarPath,
- // fit: BoxFit.fill,
- // width: ScreenUtil().setWidth(width),
- // height: ScreenUtil().setWidth(180),
- // ),
- // ),
- // Positioned(
- // left: width / 2 - 30,
- // top: 180 / 2 - 40,
- // width: 60,
- // height: 60,
- // child: GestureDetector(
- // onTap: () {
- // selectPicker();
- // },
- // child: LoadAssetImage(
- // "wode/apply_expert_avatar",
- // fit: BoxFit.fill,
- // width: ScreenUtil().setWidth(60),
- // height: ScreenUtil().setWidth(60),
- // ),
- // ),
- // ),
- // Positioned(
- // left:
- // width / 2 - ScreenUtil().setHeight(60),
- // top: ScreenUtil().setHeight(180) / 2 +
- // ScreenUtil().setHeight(30),
- // width: ScreenUtil().setHeight(120),
- // height: ScreenUtil().setHeight(30),
- // child: GestureDetector(
- // onTap: () {
- // selectPicker();
- // },
- // child: Text(
- // "上传照片",
- // textAlign: TextAlign.center,
- // style: TextStyle(
- // color: Color(0xffffffff),
- // fontSize: ScreenUtil().setSp(18),
- // ),
- // ),
- // ),
- // ),
- // ],
- // ),
- Container(
- height: ScreenUtil().setHeight(45),
- padding: EdgeInsets.only(
- // left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- ),
- alignment: Alignment.centerLeft,
- decoration: BoxDecoration(
- color: ThemeUtils.getDialogTextFieldColor(
- context),
- ),
- child: Row(
- children: <Widget>[
- Container(
- height: 13,
- width: 2,
- color: Colours.blue_app_main),
- SizedBox(
- width: 13,
- ),
- Text(
- "基本信息",
- style: TextStyle(
- fontSize: ScreenUtil().setSp(15),
- fontWeight: FontWeight.bold,
- ),
- ),
- Text(
- detailObj?.checkFlag == null
- ? ""
- : getCheckFlag(detailObj.checkFlag),
- style: TextStyle(
- fontSize: ScreenUtil().setSp(15),
- fontWeight: FontWeight.bold,
- color: Color(0xFFff0000),
- ),
- )
- ],
- ),
- ),
- TextFieldItem(
- title: "姓名",
- isMust: true,
- content: "",
- controller: _nameController,
- hintText: "请输入您的姓名",
- validator: (val) {
- return val.trim().length > 0 ? null : "请输入姓名";
- },
- ),
- ChiosePicker(
- range: sexListChiose,
- label: "性别",
- isMust: true,
- value: sexChioseString,
- onConfirm: (value, index) {
- sexChiose = sexList[index]['value'];
- if (sexChiose == 1) {
- sexChioseString = "男";
- } else if (sexChiose == 2) {
- sexChioseString = "女";
- }
- },
- ),
- ChiosePicker(
- range: ageListChiose,
- label: "年龄",
- isMust: true,
- value: ageChiose,
- onConfirm: (value, index) {
- ageChiose = value;
- },
- ),
- TextFieldItem(
- title: "身份证号",
- isMust: true,
- content: "",
- controller: _idNumberController,
- hintText: "请输入您的身份证号",
- validator: (val) {
- return val.trim().length > 0
- ? null
- : "请输入身份证号";
- },
- ),
- TextFieldItem(
- title: "联系电话",
- isMust: true,
- content: "",
- controller: _mobileController,
- hintText: "请输入您的联系电话",
- validator: (val) {
- return val.trim().length > 0
- ? null
- : "请输入联系电话";
- },
- ),
- ChiosePicker(
- range: learnListChiose,
- label: "学历",
- isMust: true,
- value: learnChioseString,
- onConfirm: (value, index) {
- learnChiose = learnList[index]['value'];
- learnChioseString = value;
- },
- ),
- TextFieldItem(
- title: "专业",
- isMust: true,
- content: "",
- controller: _professionalController,
- hintText: "请输入您的专业",
- validator: (val) {
- return val.trim().length > 0
- ? null
- : "请输入您的专业";
- },
- ),
- TextFieldItem(
- title: "从业时长",
- isMust: true,
- content: "",
- keyboardType: TextInputType.number,
- controller: _workDateController,
- hintText: "请输入您的从业时长",
- validator: (val) {
- return val.trim().length > 0
- ? null
- : "请输入您的从业时长";
- },
- ),
- TextFieldItem(
- title: "所在公司",
- content: "",
- controller: _companyController,
- hintText: "请输入您的所在公司",
- ),
- TextFieldItem(
- title: "现任岗位",
- content: "",
- controller: _jobController,
- hintText: "请输入您的现任岗位",
- ),
- // TextFieldItem(
- // title: "常驻工作地",
- // content: "",
- // controller: _residentPlaceController,
- // hintText: "常驻工作地",
- // onChanged: (res) {
- // // setState(() {});
- // },
- // ),
- InkWell(
- onTap: () {
- NavigatorUtils.push(context,
- "${BbsRouter.mapChoicePoint}?type=2");
- },
- child: Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(10),
- bottom: ScreenUtil().setWidth(10)),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 0.5, color: Colours.line),
- ),
- ),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- children: <Widget>[
- Text(
- "常驻工作地",
- style: TextStyle(
- color: Color(0xff222222),
- // fontSize:ScreenUtil().setSp(14)
- ),
- textAlign: TextAlign.start,
- ),
- Text(
- "*",
- style: TextStyle(
- color: Color(0xffff0000),
- // fontSize:ScreenUtil().setSp(14)
- ),
- textAlign: TextAlign.start,
- ),
- ],
- ),
- Expanded(
- child: Text(
- addressName != null &&
- addressName != ""
- ? addressName.split(",")[0]
- : "请选择",
- style: TextStyle(
- color: Color(0xff999999),
- // fontSize:ScreenUtil().setSp(14)
- ),
- textAlign: TextAlign.end,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- )
- ]),
- ),
- ),
- Container(
- height: ScreenUtil().setHeight(45),
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- ),
- alignment: Alignment.centerLeft,
- decoration: BoxDecoration(
- color: ThemeUtils.getDialogTextFieldColor(
- context),
- ),
- child: Text(
- "工作经历",
- style: TextStyle(
- fontSize: ScreenUtil().setSp(15),
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(5),
- bottom: ScreenUtil().setWidth(5),
- ),
- child: Text(
- "工作经历",
- style: TextStyle(
- color: Color(0xff222222),
- // fontSize:ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.left,
- ),
- ),
- ],
- ),
- Container(
- height: 100,
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- bottom: ScreenUtil().setWidth(20),
- ),
- child: TextFormField(
- // autofocus: true,
- maxLength: 50,
- cursorColor: Color(0xffcccccc),
- controller: _workExperienceController,
- maxLines: 5,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(0),
- hintText: '请输入工作时间+岗位+工作内容',
- hintStyle: TextStyle(
- color: Color(0xffcccccc),
- // fontSize: ScreenUtil().setSp(14)
- ),
- focusedBorder: InputBorder.none,
- border: InputBorder.none,
- // filled: true, // 背景色
- // fillColor: Colors.cyan.withAlpha(35),
- // icon: Icon(Icons.person)
- ),
- ),
- ),
- SizedBox(
- height: 6,
- child: Container(
- color: ThemeUtils.getDialogTextFieldColor(
- context)),
- ),
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(5),
- bottom: ScreenUtil().setWidth(5)),
- child: Text(
- "项目经历",
- style: TextStyle(
- color: Color(0xff222222),
- // fontSize:ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.left,
- ),
- ),
- ],
- ),
- Container(
- height: 100,
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- bottom: ScreenUtil().setWidth(20)),
- child: TextFormField(
- // autofocus: true,
- maxLength: 50,
- cursorColor: Color(0xffcccccc),
- controller: _projectExperienceController,
- maxLines: 5,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(0),
- hintText: '请输入项目时间+项目名称+主要职责',
- hintStyle: TextStyle(
- color: Color(0xffcccccc),
- ),
- focusedBorder: InputBorder.none,
- border: InputBorder.none,
- ),
- ),
- ),
- Container(
- height: ScreenUtil().setHeight(45),
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- ),
- alignment: Alignment.centerLeft,
- decoration: BoxDecoration(
- color: ThemeUtils.getDialogTextFieldColor(
- context),
- ),
- child: Text(
- "技术特点",
- style: TextStyle(
- fontSize: ScreenUtil().setSp(15),
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- // TextFieldItem(
- // title: "擅长品牌",
- // isMust: true,
- // content: "",
- // controller: _proficiencyBrandController,
- // hintText: "请输入电梯品牌",
- // validator: (val) {
- // return val.trim().length > 0 ? null : "请输入擅长品牌";
- // },
- // ),
- ClickItem(
- title: "擅长品牌",
- content: defaultValue,
- isMust: true,
- onTap: () {
- setState(() {
- sortBool = false;
- });
- },
- ),
- TextFieldItem(
- title: "擅长电气",
- isMust: true,
- content: "",
- controller: _goodElectricalController,
- hintText: "请输入电气类别",
- validator: (val) {
- return val.trim().length > 0
- ? null
- : "请输入擅长电气";
- },
- ),
- TextFieldItem(
- title: "擅长机械",
- isMust: true,
- content: "",
- controller: _goodMechanicalController,
- hintText: "请输入机械类别",
- validator: (val) {
- return val.trim().length > 0
- ? null
- : "请输入擅长机械";
- },
- ),
- Container(
- height: ScreenUtil().setHeight(45),
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- ),
- alignment: Alignment.centerLeft,
- decoration: BoxDecoration(
- color: ThemeUtils.getDialogTextFieldColor(
- context),
- ),
- child: Text(
- "上传证照",
- style: TextStyle(
- fontSize: ScreenUtil().setSp(15),
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- IdPhoto(
- title: "身份证上传",
- desc: "上传身份证人像面",
- cover: "apply_idcard",
- isMust: true,
- uploadFile: cardPicture,
- change: (value) {
- cardPicture = value;
- }),
- IdPhoto(
- title: "学历学位证书上传",
- desc: "上传学位学历证书人面像",
- cover: "apply_education",
- uploadFile: degreeCertificate,
- change: (value) {
- degreeCertificate = value;
- }),
- IdPhoto(
- title: "专业技能证书上传",
- desc: "上传专业技能证书人像面",
- cover: "apply_profession",
- uploadFile: skillsCertificate,
- isMust: true,
- change: (value) {
- skillsCertificate = value;
- }),
- IdPhoto(
- title: "其他证书上传",
- desc: "其他荣誉、培训证书等",
- cover: "apply_other",
- uploadFile: otherCertificates,
- change: (value) {
- otherCertificates = value;
- }),
- Container(
- height: ScreenUtil().setHeight(45),
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- ),
- alignment: Alignment.centerLeft,
- decoration: BoxDecoration(
- color: ThemeUtils.getDialogTextFieldColor(
- context),
- ),
- child: Row(
- children: <Widget>[
- Checkbox(
- value: _protocol,
- activeColor: Colors.red, //选中时的颜色
- onChanged: (value) {
- setState(() {
- _protocol = value;
- });
- print(_protocol);
- },
- ),
- GestureDetector(
- onTap: () {
- NavigatorUtils.push(context,
- "${WodeRouter.xieyiList}");
- },
- child: Row(
- children: <Widget>[
- Text("同意《"),
- Text(
- "专家协议",
- style: TextStyle(
- color: Color(0xFF0287FF),
- ),
- // textAlign:TextAlign.start,
- ),
- Text("》")
- ],
- )),
- ],
- ),
- ),
- SizedBox(
- height: 6,
- child: Container(
- color: ThemeUtils.getDialogTextFieldColor(
- context)),
- ),
- ],
- ),
- )
- ],
- ),
- ),
- Positioned(
- bottom: 0,
- left: 0,
- child: Container(
- width: width,
- padding: EdgeInsets.only(
- top: ScreenUtil().setWidth(15),
- bottom: ScreenUtil().setWidth(15),
- left: ScreenUtil().setWidth(25),
- right: ScreenUtil().setWidth(25),
- ),
- color: ThemeUtils.getDialogTextFieldColor(context),
- child: ((detailObj == null) ||
- (detailObj != null && detailObj.checkFlag == 0))
- ? Container(
- height: ScreenUtil().setWidth(44),
- decoration: BoxDecoration(
- color: Colours.blue_app_main,
- borderRadius: BorderRadius.circular(
- ScreenUtil().setWidth(22)),
- // gradient: const LinearGradient(
- // colors: [Color(0xFF00D9FF), Color(0xFF0287FF)],
- // ),
- ),
- child: FlatButton(
- // padding: EdgeInsets.all(15.0),
- child: Text("提交"),
- textColor: Colors.white,
- onPressed: () {
- if ((_formKey.currentState as FormState)
- .validate()) {
- if (detailObj == null) {
- submit("add");
- } else {
- submit("edit");
- }
- }
- },
- ),
- )
- : Container(
- height: ScreenUtil().setWidth(44),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(
- ScreenUtil().setWidth(22)),
- color: Color(0xffcccccc)),
- child: FlatButton(
- // padding: EdgeInsets.all(15.0),
- child: Text("提交"),
- textColor: Colors.white,
- onPressed: () {
- toasts("审核中,请勿重复提交!");
- },
- ),
- ),
- ),
- ),
- !sortBool
- ? Positioned(
- top: 0,
- left: 0,
- child: GestureDetector(
- onTap: () {
- setState(() {
- sortBool = true;
- if (ids != null && ids != "") {
- defaultValueList = defaultValue.split(",");
- idsList = ids.split(",");
- } else {
- defaultValueList = [];
- idsList = [];
- }
- });
- },
- child: Container(
- width: width,
- height: height,
- color: Color.fromRGBO(0, 0, 0, 0.5)),
- ),
- )
- : Container(child: null),
- !sortBool
- ? Positioned(
- top: 0,
- right: 0,
- child: Container(
- width: width / 4 * 3,
- height: height,
- color: Colors.white,
- padding: EdgeInsets.only(
- top: ScreenUtil().setWidth(45)),
- child: ListView(
- children: <Widget>[
- brandList != null && brandList != []
- ? Container(
- child: Wrap(
- alignment: WrapAlignment.start,
- crossAxisAlignment:
- WrapCrossAlignment.center,
- children: brandList
- .asMap()
- .keys
- .map((index) {
- return InkWell(
- onTap: () {
- print("666");
- setState(() {
- if (idsList.contains(
- brandList[index]
- .id
- .toString())) {
- defaultValueList.remove(
- brandList[index].name);
- idsList.remove(
- brandList[index]
- .id
- .toString());
- } else {
- if (idsList.length >= 3) {
- toasts("最多只能选择3个品牌");
- } else {
- defaultValueList.add(
- brandList[index]
- .name);
- idsList.add(
- brandList[index]
- .id
- .toString());
- }
- }
- print(idsList);
- });
- },
- child: Container(
- width: width / 4 - 12,
- padding: EdgeInsets.only(
- bottom: ScreenUtil()
- .setWidth(10),
- top: ScreenUtil()
- .setWidth(10)),
- margin: EdgeInsets.only(
- left: 5,
- right: 5,
- bottom: 5,
- top: 5),
- decoration: BoxDecoration(
- // border: Border(
- // bottom: BorderSide(width: 0.5, color: Colours.line),
- // ),
- color: Color(0xfff5f5f5)),
- child: Text(
- brandList[index].name ?? "",
- style: TextStyle(
- color: idsList.contains(
- brandList[index]
- .id
- .toString())
- ? Color(0xffff0000)
- : Color(0xff666666),
- fontSize: ScreenUtil()
- .setSp(15)),
- textAlign: TextAlign.center,
- ),
- ),
- );
- }).toList(),
- ))
- : loadCircle()
- ],
- )))
- : Container(child: null),
- !sortBool
- ? Positioned(
- top: 0,
- right: 0,
- child: Container(
- width: width / 4 * 3,
- padding: EdgeInsets.only(
- left: 10, top: 10, bottom: 10, right: 10),
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- "品牌",
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(16)),
- textAlign: TextAlign.start,
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- sortBool = true;
- String str = "";
- String strD = "";
- idsList.forEach((item) {
- str += (item.toString() + ",");
- });
- ids = str.substring(0, str.length - 1);
- defaultValueList.forEach((item) {
- strD += (item.toString() + ",");
- });
- defaultValue =
- strD.substring(0, strD.length - 1);
- print(defaultValue);
- print(ids);
- });
- },
- child: Text(
- "确定",
- style: TextStyle(
- color: Color(0xFF0287FF),
- fontSize: ScreenUtil().setSp(16)),
- textAlign: TextAlign.start,
- ),
- )
- ],
- )),
- )
- : Container(child: null),
- ],
- ),
- )
- : Center(
- child: Text("正在加载..."),
- ),
- );
- }
- Widget loadCircle() {
- return Container(
- padding: EdgeInsets.only(top: 10, bottom: 10),
- color: ThemeUtils.getTabsBg(context),
- child: Center(
- child: SpinKitFadingCircle(
- color: Colors.blueAccent,
- size: 30.0,
- ),
- ),
- );
- }
- }
- class IdPhoto extends StatefulWidget {
- IdPhoto({
- Key key,
- this.title,
- this.desc,
- this.uploadFile = "",
- this.cover,
- this.isMust: false,
- this.change,
- }) : super(key: key);
- final String title;
- final String desc;
- String uploadFile;
- final String cover;
- final bool isMust;
- final Function(String) change;
- @override
- _IdPhotoState createState() => _IdPhotoState();
- }
- class _IdPhotoState extends State<IdPhoto> {
- @override
- initState() {
- super.initState();
- }
- void selectPicker() {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return SimpleDialog(
- title: Text(widget.title ?? "图片上传"),
- children: ["拍照", '从手机相册选择'].map((String value) {
- return SimpleDialogOption(
- child: Text(
- value,
- style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
- ),
- onPressed: () {
- _getImage(value == '拍照' ? 1 : 0);
- Navigator.of(context).pop();
- },
- );
- }).toList(),
- );
- },
- );
- }
- void _getImage(int key) async {
- try {
- var _imageFile = await ImagePicker.pickImage(
- source: key == 1 ? ImageSource.camera : ImageSource.gallery,
- maxWidth: 800,
- imageQuality: 95,
- );
- if (_imageFile != null) {
- upLoadFileOnce(_imageFile.path);
- // setState(() {});
- }
- } catch (e) {
- toasts("没有权限,无法打开相册!");
- }
- }
- void upLoadFileOnce(String path) {
- showLoading(context, "正在上传...");
- NewApiService().upload(path, onSuccess: (res) {
- dismissLoading(context);
- setState(() {
- widget.uploadFile = res.pathUrl;
- widget.change != null ? widget.change(res.pathUrl) : null;
- setState(() {});
- });
- }, onError: (code, msg) {
- dismissLoading(context);
- toasts(msg);
- });
- }
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return Container(
- child: Container(
- // height: ScreenUtil().setWidth(200),
- padding: EdgeInsets.only(
- top: ScreenUtil().setWidth(30),
- right: ScreenUtil().setWidth(10),
- bottom: ScreenUtil().setWidth(30),
- left: ScreenUtil().setWidth(10),
- ),
- decoration: BoxDecoration(
- border: Border(
- bottom: Divider.createBorderSide(context, width: 0.6),
- ),
- ),
- child: Row(
- children: <Widget>[
- Offstage(
- offstage: !widget.isMust,
- child: Text(
- "*",
- style: TextStyle(color: Colors.red),
- ),
- ),
- Container(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- child: Text(
- widget.title,
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(16),
- ),
- ),
- ),
- Container(
- child: Text(
- widget.desc,
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Color(0xFF999999),
- ),
- ),
- ),
- ],
- ),
- ),
- Expanded(
- flex: 1,
- child: Container(),
- ),
- GestureDetector(
- onTap: () {
- selectPicker();
- },
- child: widget.uploadFile.isEmpty
- ? LoadAssetImage(
- "wode/" + widget.cover,
- fit: BoxFit.fill,
- width: ScreenUtil().setWidth(140),
- height: ScreenUtil().setWidth(89),
- )
- : LoadNetworkImage(
- widget.uploadFile,
- fit: BoxFit.fill,
- width: ScreenUtil().setWidth(140),
- height: ScreenUtil().setWidth(89),
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
- /// 封装输入框
- class TextFieldItem extends StatelessWidget {
- const TextFieldItem({
- Key key,
- this.controller,
- @required this.title,
- this.keyboardType: TextInputType.text,
- this.hintText: "",
- this.isMust: false,
- this.content: "",
- this.maxLength,
- this.focusNode,
- this.onChanged,
- this.config,
- this.validator,
- }) : super(key: key);
- final TextEditingController controller;
- final String title;
- final String hintText;
- final bool isMust;
- final String content;
- final TextInputType keyboardType;
- final int maxLength;
- final FocusNode focusNode;
- final Function onChanged;
- final KeyboardActionsConfig config;
- final FormFieldValidator<String> validator;
- @override
- Widget build(BuildContext context) {
- if (config != null && defaultTargetPlatform == TargetPlatform.iOS) {
- // 因Android平台输入法兼容问题,所以只配置IOS平台
- FormKeyboardActions.setKeyboardActions(context, config);
- }
- if (content.length > 0) {
- controller.text = content;
- }
- return Container(
- // height: 50.0,
- margin: const EdgeInsets.only(left: 16.0),
- width: double.infinity,
- decoration: BoxDecoration(
- border: Border(
- bottom: Divider.createBorderSide(context, width: 0.6),
- )),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Padding(
- padding: const EdgeInsets.only(top: 15),
- child: Text(title),
- ),
- Offstage(
- offstage: !this.isMust,
- child: Container(
- padding: EdgeInsets.only(top: 18),
- child: Text(
- "*",
- style: TextStyle(color: Colors.red),
- ),
- )),
- Expanded(
- flex: 1,
- child: TextFormField(
- textAlign: TextAlign.right,
- onChanged: onChanged,
- maxLength: maxLength,
- focusNode: focusNode,
- keyboardType: keyboardType,
- inputFormatters: _getInputFormatters(),
- controller: controller,
- //style: TextStyles.textDark14,
- decoration: InputDecoration(
- hintText: hintText,
- hintStyle: TextStyle(color: Colours.text_gray_c),
- border: InputBorder.none, //去掉下划线
- //hintStyle: TextStyles.textGrayC14
- ),
- validator: validator,
- ),
- ),
- Gaps.hGap16
- ],
- ),
- );
- }
- _getInputFormatters() {
- if (keyboardType == TextInputType.numberWithOptions(decimal: true)) {
- return [UsNumberTextInputFormatter()];
- }
- if (keyboardType == TextInputType.number ||
- keyboardType == TextInputType.phone) {
- return [WhitelistingTextInputFormatter.digitsOnly];
- }
- return null;
- }
- }
|