Advertisement
Guest User

Scrolll TextField

a guest
Nov 15th, 2019
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 177.75 KB | None | 0 0
  1. import 'dart:io';
  2.  
  3. import 'package:flutter/material.dart';
  4. import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
  5. import 'package:flutter/services.dart';
  6. import 'package:intl/intl.dart';
  7. import 'package:path/path.dart' as Path;
  8. import 'package:image_picker/image_picker.dart';
  9. import 'package:dio/dio.dart';
  10. import 'package:sales/endpoint/api.dart';
  11. import 'package:sales/model/document_model.dart';
  12. import 'package:sales/model/jenis_model.dart';
  13. import 'package:sales/model/job_model.dart';
  14. import 'package:sales/model/kecamatan_model.dart';
  15. import 'package:sales/model/kelurahan_model.dart';
  16. import 'package:sales/model/kota_model.dart';
  17. import 'package:sales/model/perorangan_model.dart';
  18. import 'package:sales/model/provinsi_model.dart';
  19. import 'package:sales/model/result_model.dart';
  20. import 'package:sales/model/zipcode_model.dart';
  21. import 'package:sales/page/prospekme.dart';
  22. import 'package:sales/blocs/abuBloc.dart';
  23. import 'package:flutter_exif_rotation/flutter_exif_rotation.dart';
  24. import 'package:sales/static/raisedbutton.dart';
  25. import 'package:rflutter_alert/rflutter_alert.dart';
  26. import 'package:shared_preferences/shared_preferences.dart';
  27. import 'package:geocoder/geocoder.dart';
  28.  
  29. class Perorangan extends StatefulWidget {
  30. Perorangan({this.id, this.model, this.customer, this.type, this.negara});
  31. final String id;
  32. PeroranganModel model;
  33. final String type;
  34. final String customer, negara;
  35. @override
  36. _PeroranganState createState() => _PeroranganState();
  37. }
  38.  
  39. class _PeroranganState extends State<Perorangan> {
  40. bool loadingKirim = false;
  41. final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
  42. final _formKey = GlobalKey<FormState>();
  43. bool nameActive = false;
  44. bool hpActive = false;
  45. File _ktp;
  46. File _foto;
  47. List<Zipcode> _zipcodeList = [];
  48. SharedPreferences sharedPreferences;
  49. bool islogin = false;
  50. String email = "AAA";
  51. // 3275052108840013
  52. String user_id = "";
  53. bool sama = false;
  54. TextEditingController controllerTanggal = TextEditingController();
  55. TextEditingController controllerNama = TextEditingController();
  56. TextEditingController controllerPekerjaan = TextEditingController();
  57. TextEditingController controllerIbu = TextEditingController();
  58. TextEditingController controllerTempat = TextEditingController();
  59. TextEditingController controllerNIK = TextEditingController();
  60. TextEditingController controllerAlamat = TextEditingController();
  61. TextEditingController controllerRT = TextEditingController();
  62. TextEditingController controllerRW = TextEditingController();
  63. TextEditingController controllerAlamat2 = TextEditingController();
  64. TextEditingController controllerRT2 = TextEditingController();
  65. TextEditingController controllerRW2 = TextEditingController();
  66. TextEditingController controllerKodePos = TextEditingController();
  67. TextEditingController controllerKodePos2 = TextEditingController();
  68. TextEditingController controllerRumah = TextEditingController();
  69. TextEditingController controllerTelepon = TextEditingController();
  70. TextEditingController controllerHandphone = TextEditingController();
  71. TextEditingController controllerNamaKantor = TextEditingController();
  72. TextEditingController controllerAlamatKantor = TextEditingController();
  73. TextEditingController controllerJabatan = TextEditingController();
  74. TextEditingController controllerProvinsi = TextEditingController();
  75. TextEditingController controllerKota = TextEditingController();
  76. TextEditingController controllerKec = TextEditingController();
  77. TextEditingController controllerKel = TextEditingController();
  78. TextEditingController controllerProvinsi2 = TextEditingController();
  79. TextEditingController controllerKota2 = TextEditingController();
  80. TextEditingController controllerKec2 = TextEditingController();
  81. TextEditingController controllerKel2 = TextEditingController();
  82. TextEditingController controllerSearch = TextEditingController();
  83. TextEditingController controllerNote = TextEditingController();
  84. TextEditingController controllerNote2 = TextEditingController();
  85. TextEditingController controllerStatus = TextEditingController();
  86. TextEditingController controllerEmail = TextEditingController();
  87. TextEditingController controllerWarganegara = TextEditingController();
  88.  
  89. Jenis selectedJenis;
  90. List<Jenis> jenisx = <Jenis>[
  91. // const Jenis('silahkan', 'SIlahkan Pilih'),
  92. const Jenis('BRT', 'Buruh, Pembantu Rumah Tangga dan Tenaga Keamanan'),
  93. const Jenis('IRT', 'Ibu Rumah Tangga'),
  94. const Jenis('LAINNYA', 'Lain-Lain'),
  95. const Jenis('PDG', 'Pedagang'),
  96. const Jenis('PBK', 'Pegawai Bank'),
  97. const Jenis('PBI', 'Pegawai BI/BUMN/BUMD (termasuk pensiunan)'),
  98. const Jenis('PMC', 'Pegawai Money Changer'),
  99. const Jenis('PSWAS', 'Pegawai Swasta'),
  100. const Jenis('PLLP', 'Pejabat Lembaga Legislatif dan Pemerintah'),
  101. const Jenis('PM', 'Pelajar/Mahasiswa'),
  102. const Jenis('PDD', 'Pengajar dan Dosen'),
  103. const Jenis('PGJ', 'Pengrajin'),
  104. const Jenis('PPY', 'Pengurus & peg. yayasan/lembaga badan hukum lain'),
  105. const Jenis('PPARPOL', 'Pengurus Parpol'),
  106. const Jenis('PLSM', 'Pengurus/Peg. LSM/organisasi tdk badan hukum lain'),
  107. const Jenis('PW', 'Pengusaha/Wiraswasta'),
  108. const Jenis('PDN', 'Petani dan Nelayan'),
  109. const Jenis('PNS', 'PNS (termasuk pensiunan)'),
  110. const Jenis('PDK', 'Profesional dan Konsultan'),
  111. const Jenis('TNII', 'TNI/Polri (termasuk pensiunan)'),
  112. const Jenis('UPP', 'Ulama/Pendeta/Pimpinan oraganisasi & kelompok agama'),
  113. ];
  114.  
  115. var vkota = 0;
  116. var vprovinsi = 0;
  117. var vkec = 0;
  118. var vkel = 0;
  119. var vprovinsi2 = 0;
  120. var vkota2 = 0;
  121. var vkec2 = 0;
  122. var vkel2 = 0;
  123. var vjabatan = 0;
  124.  
  125. Result _result;
  126.  
  127. bool warna1 = false;
  128. bool warna2 = false;
  129. int multi = 0;
  130. bool _external = false;
  131. bool _check = false;
  132. bool _rejected = false;
  133. bool _deviasi = false;
  134. bool _kirims = false;
  135. String _nik = "";
  136. String _name = "";
  137. String _tempat = "";
  138. String _tanggal = "";
  139. String _jeniskelamin = "";
  140. String _kawin = "";
  141. String _pekerjaan = "";
  142. String _ibu = "";
  143. String _alamat = "";
  144. String _rt = "";
  145. String _rw = "";
  146. String _provinsi = "";
  147. String _kota = "";
  148. String _kec = "";
  149. String _kel = "";
  150. String _kodepos = "";
  151.  
  152. bool _nik2 = false;
  153. bool _name2 = false;
  154. bool _tempat2 = false;
  155. bool _tanggal2 = false;
  156. bool _jeniskelamin2 = false;
  157. bool _kawin2 = false;
  158. bool _pekerjaan2 = false;
  159. bool _ibu2 = false;
  160. bool _alamat2 = false;
  161. bool _rt2 = false;
  162. bool _rw2 = false;
  163. bool _provinsi2 = false;
  164. bool _kota2 = false;
  165. bool _kec2 = false;
  166. bool _kel2 = false;
  167. bool _kodepos2 = false;
  168.  
  169. bool _nik3 = false;
  170. bool _name3 = false;
  171. bool _tempat3 = false;
  172. bool _tanggal3 = false;
  173. bool _jeniskelamin3 = false;
  174. bool _kawin3 = false;
  175. bool _pekerjaan3 = false;
  176. bool _ibu3 = false;
  177. bool _alamat3 = false;
  178. bool _rt3 = false;
  179. bool _rw3 = false;
  180. bool _provinsi3 = false;
  181. bool _kota3 = false;
  182. bool _kec3 = false;
  183. bool _kel3 = false;
  184. bool _kodepos3 = false;
  185.  
  186. List<String> jenis = ["Laki-Laki", "Perempuan"];
  187. String _jenis = "Laki-Laki";
  188.  
  189. List<String> status = ["Menikah", "Lajang", "Janda/Duda"];
  190. String _status = "Menikah";
  191.  
  192. List<String> kerja = ["Karyawan", "Profesional", "Wiraswasta"];
  193. String _kerja = "Karyawan";
  194.  
  195. List<JobModel> _job = [];
  196. String selectedJob;
  197.  
  198. List<Provinsi> _region = [];
  199. String selectedRegion;
  200. String provinsi;
  201. String selectedRegion2;
  202.  
  203. List<Kota> _kotaSelec = [];
  204. String selectedKota;
  205.  
  206. List<Kota> _kotaSelec2 = [];
  207. String selectedKota2;
  208.  
  209. List<Kecamatan> _kecSelec = [];
  210. String selectedKec;
  211.  
  212. List<Kecamatan> _kecSelec2 = [];
  213. String selectedKec2;
  214.  
  215. List<Kelurahan> _kelSelec = [];
  216. String selectedKel;
  217.  
  218. List<Kelurahan> _kelSelec2 = [];
  219. String selectedKel2;
  220.  
  221. void pilihJenis(String value) {
  222. setState(() {
  223. _jenis = value;
  224. });
  225. }
  226.  
  227. void pilihStatus(String value) {
  228. setState(() {
  229. _status = value;
  230. });
  231. }
  232.  
  233. void pilihPekerjaan(String value) {
  234. setState(() {
  235. _kerja = value;
  236. });
  237. }
  238.  
  239. Future<String> _getJabatan() async {
  240. String url = new Api().url;
  241. // Response response;
  242. Response response;
  243. response = await Dio().get(url + "api/JobPosition/GetAll");
  244. final json = response.data;
  245.  
  246. setState(() {
  247. _job = (json).map<JobModel>((item) => JobModel.fromJson(item)).toList();
  248. });
  249.  
  250. if (widget.customer == "lama") {
  251. List<JobModel> _j = _job
  252. .where((i) => i.initialName.toString() == widget.model.jobPos)
  253. .toList();
  254. if (_j.length > 0) {
  255. setState(() {
  256. selectedJob = _j[0].descriptionName;
  257. });
  258. } else {
  259. setState(() {
  260. selectedJob = _job[0].descriptionName;
  261. });
  262. }
  263. } else {
  264. setState(() {
  265. selectedJob = _job[0].descriptionName;
  266. });
  267. }
  268.  
  269. return "Sucess";
  270. }
  271.  
  272. final formats = DateFormat("dd/MM/yyyy");
  273. // final formats = {
  274. // InputType.both: DateFormat("EEEE, MMMM d, yyyy 'at' h:mma"),
  275. // InputType.date: DateFormat('dd/MM/yyyy'),
  276. // InputType.time: DateFormat("HH:mm"),
  277. // };
  278.  
  279. // Changeable in demo
  280. // InputType inputType = InputType.date;
  281. bool editable = true;
  282. DateTime datex;
  283.  
  284. _samaDenganDiatas() async {
  285. setState(() {
  286. if (sama == true) {
  287. controllerAlamat2.text = controllerAlamat.text;
  288. controllerRT2.text = controllerRT.text;
  289. controllerRW2.text = controllerRW.text;
  290. if (selectedRegion != "") {
  291. selectedRegion2 = selectedRegion;
  292. vprovinsi2 = 1;
  293. }
  294. if (selectedKota != "") {
  295. _getKota(selectedRegion, "3");
  296. vkota2 = 1;
  297. }
  298. if (selectedKec != "") {
  299. _getKec(selectedKota, selectedRegion, "3");
  300. vkec2 = 1;
  301. }
  302. if (selectedKel != "") {
  303. _getKel(selectedKec, selectedKota, selectedRegion, "3");
  304. vkel2 = 1;
  305. }
  306. controllerKodePos2.text = controllerKodePos.text;
  307. } else {
  308. controllerAlamat2.text = "";
  309. controllerRT2.text = "";
  310. controllerRW2.text = "";
  311. controllerKodePos2.text = "";
  312. controllerProvinsi2.text = "";
  313. controllerKota2.text = "";
  314. controllerKec2.text = "";
  315. controllerKel2.text = "";
  316. print('engaaa ');
  317. }
  318. });
  319. }
  320.  
  321. _kirim() async {
  322. String url = new Api().url;
  323. var aps = "";
  324. if (widget.type == "1") {
  325. aps = "RBU";
  326. } else if (widget.type == "2") {
  327. aps = "NDF";
  328. }
  329. var aplikasi = aps;
  330. var nik = controllerNIK.text;
  331. var nama = controllerNama.text;
  332. var tempat = controllerTempat.text;
  333. var formatters = new DateFormat('yyyy-MM-dd');
  334. print(formatters);
  335. print(datex.toString());
  336. var lahir = formatters.format(datex);
  337.  
  338. var jeniskelamin = _jenis;
  339. var kawin = _status;
  340. var kerja = selectedJenis.name;
  341. var ibu = controllerIbu.text;
  342. var alamat = controllerAlamat.text;
  343. var alamat2 = controllerAlamat2.text;
  344. var rt1 = "";
  345. var rw1 = "";
  346. var rt2 = "";
  347. var rw2 = "";
  348.  
  349. if (controllerRT.text == "") {
  350. rt1 = "0";
  351. } else {
  352. rt1 = controllerRT.text;
  353. }
  354.  
  355. if (controllerRW.text == "") {
  356. rw1 = "0";
  357. } else {
  358. rw1 = controllerRW.text;
  359. }
  360.  
  361. if (controllerRT2.text == "") {
  362. rt2 = "0";
  363. } else {
  364. rt2 = controllerRT2.text;
  365. }
  366.  
  367. if (controllerRW2.text == "") {
  368. rw2 = "0";
  369. } else {
  370. rw2 = controllerRW2.text;
  371. }
  372.  
  373. // var rw1 = controllerRW.text;
  374. var pos1 = controllerKodePos.text;
  375. var pos2 = controllerKodePos2.text;
  376. var provinsi1 = _getP(selectedRegion);
  377. var provinsi2 = _getP(selectedRegion2);
  378.  
  379. List<Kota> _ko1 = _kotaSelec.where((i) => i.id == selectedKota).toList();
  380. List<Kota> _ko2 = _kotaSelec2.where((i) => i.id == selectedKota2).toList();
  381. List<Kecamatan> _ke1 = _kecSelec.where((i) => i.id == selectedKec).toList();
  382. List<Kecamatan> _ke2 =
  383. _kecSelec2.where((i) => i.id == selectedKec2).toList();
  384. List<Kelurahan> _kl1 = _kelSelec.where((i) => i.id == selectedKel).toList();
  385. List<Kelurahan> _kl2 =
  386. _kelSelec2.where((i) => i.id == selectedKel2).toList();
  387.  
  388. var kota1 = _ko1[0].name;
  389. var kota2 = _ko2[0].name;
  390. var kec1 = _ke1[0].name;
  391. var kec2 = _ke2[0].name;
  392. var kel1 = _kl1[0].name;
  393. var kel2 = _kl2[0].name;
  394. var jenispekerjaan = _kerja;
  395. var telephon = "";
  396. if (controllerTelepon.text == "") {
  397. telephon = controllerHandphone.text;
  398. } else {
  399. telephon = controllerTelepon.text;
  400. }
  401. var handphone = controllerHandphone.text;
  402.  
  403. var kantor = controllerNamaKantor.text;
  404. var alamatKantor = controllerAlamatKantor.text;
  405. var jabatan = controllerJabatan.text;
  406.  
  407. var now = new DateTime.now();
  408. var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
  409. var createddate = formatter.format(now);
  410. print("Created Date");
  411. var updatedate = formatter.format(now);
  412.  
  413. final query = "" + kel2 + ", " + kec2 + ", " + kota2 + "," + provinsi2;
  414. var addresses = await Geocoder.local.findAddressesFromQuery(query);
  415. List<Address> results = addresses;
  416. var lat = results.first.coordinates.latitude;
  417. var lng = results.first.coordinates.longitude;
  418. var customers = "";
  419. print(query);
  420. print(lat.toString() + "," + lng.toString());
  421. customers = widget.customer;
  422.  
  423. Response response;
  424. var dio = new Dio();
  425. try {
  426. response = await dio.post(
  427. url + "api/Prospek/Insert",
  428. data: {
  429. "PR_ID": "",
  430. "APPTYPEID": aplikasi,
  431. "PR_NAME": nama,
  432. "PR_BORNPLACE": tempat,
  433. "PR_BORNDATE": lahir,
  434. "PR_KTPNO": nik,
  435. "PR_HMADDR": alamat,
  436. "PR_HMPROPINSI": provinsi1,
  437. "PR_HMCITY": kota1,
  438. "PR_HMRT": rt1,
  439. "PR_HMRW": rw1,
  440. "PR_HMLURAH": kel1,
  441. "PR_HMCAMAT": kec1,
  442. "PR_HMZIPCODE": pos1,
  443. "PR_HMPHONE": telephon,
  444. "PR_HPNO": handphone,
  445. "LATITUDE": lat.toString(),
  446. "LONGITUDE": lng.toString(),
  447. "SURVEYOR_NAME": "-",
  448. "SURVEYOR_ID": "-",
  449. "ACTIVE": "true",
  450. "CREATE_BY": user_id,
  451. "CREATE_DATE": createddate,
  452. "UPDATE_BY": user_id,
  453. "UPDATE_DATE": updatedate,
  454. "STATUS": customers,
  455. "distance": "-",
  456. "PR_HM_ADD_DOMISILI": alamat2,
  457. "PR_HM_PROV_DOMISILI": provinsi2,
  458. "PR_HM_CITY_DOMISILI": kota2,
  459. "PR_HM_RT_DOMISILI": rt2,
  460. "PR_HM_RW_DOMISILI": rw2,
  461. "PR_HM_LURAH_DOMISILI": kel2,
  462. "PR_HM_CAMAT_DOMISILI": kec2,
  463. "PR_ZIPCODE_DOMISILI": pos2,
  464. "NAMA_IBU_KANDUNG": ibu,
  465. "JENIS_KELAMIN": jeniskelamin,
  466. "STATUS_KAWIN": kawin,
  467. "NAMA_PEKERJAAN": kerja,
  468. "JENIS_PEKERJAAN": jenispekerjaan,
  469. "NAMA_PERUSAHAAN": kantor,
  470. "JABATAN": jabatan,
  471. "ALAMAT_PERUSAHAAN": alamatKantor,
  472. "PHONE1": "-",
  473. "PHONE2": "-",
  474. "FAX": "-",
  475. "TYPE_PROSPEK": "P",
  476. "USER_BY": "CMO",
  477. "CMO_ID": user_id,
  478. "ID_FINDER": "",
  479. "PIC": "",
  480. "PHONE_PIC": "",
  481. "POSISI_JAB": selectedJob,
  482. "EMAIL": controllerEmail.text,
  483. "WARGANEGARA": controllerWarganegara.text
  484. },
  485. options:
  486. new Options(contentType: ContentType.parse("application/json")),
  487. );
  488. print(response.data.toString());
  489. var isSuccess = response.data["IsSuccess"];
  490. var jsonb = response.data["Data"];
  491. var prid = response.data["Data"]["PR_ID"];
  492. print(jsonb.toString());
  493. if (isSuccess == true) {
  494. List<DocumentModel> _newsList = [];
  495. Response res;
  496. res = await dio.get(url + "api/AppDokumen/GetByAP?APREGNO=" + prid);
  497. final jsonx = res.data;
  498. _newsList = (jsonx)
  499. .map<DocumentModel>((item) => DocumentModel.fromJson(item))
  500. .toList();
  501. var seq1 = _newsList.length + 1;
  502. var seq2 = _newsList.length + 2;
  503. if (_ktp != null) {
  504. _uploadKtp(prid, seq1);
  505. }
  506. if (_foto != null) {
  507. _uploadPhoto(prid, seq2);
  508. }
  509. setState(() {
  510. _result = Result.fromJson(jsonb);
  511.  
  512. _kirims = true;
  513. });
  514. print("prid " + prid);
  515. _saveToNotification(prid);
  516.  
  517. //MELAKUKAN UPDATE TRACK KE 1.0 YAITU PENGAJUAN AKAN TAMPIL DI APLIKASI MARKETING HEAD UNTUK DILAKUKAN REQUEST KOLEKTABILITAS
  518. _updateStatus("1.0");
  519. setState(() {
  520. loadingKirim = false;
  521. });
  522. Alert(
  523. context: context,
  524. type: AlertType.success,
  525. title: "Pengajuan Sukses",
  526. desc: "Silahkan tunggu konfimasi selanjutnya",
  527. buttons: [
  528. DialogButton(
  529. child: Text(
  530. "OK",
  531. style: TextStyle(color: Colors.white, fontSize: 20),
  532. ),
  533. onPressed: () {
  534. Navigator.of(context).pop();
  535. Navigator.of(context)
  536. .pushReplacement(new MaterialPageRoute(builder: (_) {
  537. return new ProspekMe(0);
  538. }));
  539. },
  540. width: 120,
  541. )
  542. ],
  543. ).show();
  544. } else {
  545. setState(() {
  546. loadingKirim = false;
  547. });
  548. Alert(
  549. context: context,
  550. type: AlertType.error,
  551. title: "Pengajuan Failed",
  552. desc: "Silahkan cek kembali inputan anda",
  553. buttons: [
  554. DialogButton(
  555. child: Text(
  556. "OK",
  557. style: TextStyle(color: Colors.white, fontSize: 20),
  558. ),
  559. onPressed: () => Navigator.pop(context),
  560. width: 120,
  561. )
  562. ],
  563. ).show();
  564. }
  565. } on DioError catch (e) {
  566. setState(() {
  567. loadingKirim = false;
  568. });
  569. if (e.response != null) {
  570. print(e.response.data);
  571. print(e.response.headers);
  572. print(e.response.request);
  573. } else {
  574. print(e.request);
  575. print(e.message);
  576. }
  577. }
  578. dio.interceptors.add(LogInterceptor(responseBody: false));
  579. }
  580.  
  581. _saveToNotification(prid) async {
  582. String url = new Api().url;
  583. Response responses;
  584. var id = prid.toString();
  585. var dio = new Dio();
  586. print("_saveToNotification " + prid);
  587. var a = {
  588. "AP_REGNO": prid.toString(),
  589. "CMO": 0,
  590. "CA": 0,
  591. "CO": 0,
  592. "MA": 0,
  593. "BH": 0,
  594. "MO": 0,
  595. "MH": 0,
  596. "BM4": 0,
  597. "BM3": 0,
  598. "BM2": 0,
  599. "BM1": 0,
  600. "AM": 0,
  601. "DirOps": 0,
  602. "DirUtama": 0,
  603. "DirKeuangan": 0,
  604. "DewanKomisaris": 0,
  605. "COC": 0
  606. };
  607. print('a ' + a.toString());
  608. try {
  609. responses = await dio.post(
  610. url + "api/NotificationBadge/Insert",
  611. data: {
  612. "AP_REGNO": id,
  613. "CMO": 0,
  614. "CA": 0,
  615. "CO": 0,
  616. "MA": 0,
  617. "BH": 0,
  618. "MO": 0,
  619. "MH": 0,
  620. "BM4": 0,
  621. "BM3": 0,
  622. "BM2": 0,
  623. "BM1": 0,
  624. "AM": 0,
  625. "DirOps": 0,
  626. "DirUtama": 0,
  627. "DirKeuangan": 0,
  628. "DewanKomisaris": 0,
  629. "COC": 0
  630. },
  631. options:
  632. new Options(contentType: ContentType.parse("application/json")),
  633. );
  634. print(responses.data.toString());
  635. var isSuccess = responses.data["IsSuccess"];
  636. var jsonb = responses.data["Data"];
  637. var prid = responses.data["Data"]["PR_ID"];
  638. print(jsonb.toString());
  639. } on DioError catch (e) {
  640. if (e.response != null) {
  641. print(e.response.data);
  642. print(e.response.headers);
  643. print(e.response.request);
  644. } else {
  645. print(e.request);
  646. print(e.message);
  647. }
  648. }
  649. }
  650.  
  651. _cek() async {
  652. String url = new Api().url;
  653. print('belum');
  654. try {
  655. print('masuk');
  656. Response res;
  657. res = await Dio().get(url +
  658. "api/CheckingSystem/VerificationDukcapil?KTP=" +
  659. _result.prKtpno);
  660.  
  661. var json = res.data;
  662. print("nik " + json.toString());
  663. if (json["content"][0]["NIK"] != null) {
  664. setState(() {
  665. _nik = json['content'][0]['NIK'];
  666. _name = json['content'][0]['NAMA_LGKP'];
  667. _tempat = json['content'][0]['TMPT_LHR'];
  668. _tanggal = _result.prBorndate;
  669. _jeniskelamin = json['content'][0]['JENIS_KLMIN'];
  670. _kawin = json['content'][0]['STATUS_KAWIN'];
  671. _pekerjaan = json['content'][0]['JENIS_PKRJN'];
  672. _ibu = json['content'][0]['NAMA_LGKP_IBU'];
  673. _alamat = json['content'][0]['ALAMAT'];
  674. _rt = json['content'][0]['NO_RT'];
  675. _rw = json['content'][0]['NO_RW'];
  676. _provinsi = json['content'][0]['PROP_NAME'];
  677. _kota = json['content'][0]['KAB_NAME'];
  678. _kec = json['content'][0]['KEC_NAME'];
  679. _kel = json['content'][0]['KEL_NAME'];
  680.  
  681. _nik2 = true;
  682. _name2 = true;
  683. _tempat2 = true;
  684. _tanggal2 = true;
  685. _jeniskelamin2 = true;
  686. _kawin2 = true;
  687. _pekerjaan2 = true;
  688. _ibu2 = true;
  689. _alamat2 = true;
  690. _rt2 = true;
  691. _rw2 = true;
  692. _provinsi2 = true;
  693. _kota2 = true;
  694. _kec2 = true;
  695. _kel2 = true;
  696.  
  697. _nik3 = true;
  698. _name3 = true;
  699. _tempat3 = true;
  700. _tanggal3 = true;
  701. _jeniskelamin3 = true;
  702. _kawin3 = true;
  703. _pekerjaan3 = true;
  704. _ibu3 = true;
  705. _alamat3 = true;
  706. _rt3 = true;
  707. _rw3 = true;
  708. _provinsi3 = true;
  709. _kota3 = true;
  710. _kec3 = true;
  711. _kel3 = true;
  712. _check = true;
  713. });
  714. } else {
  715. setState(() {
  716. _nik = "";
  717. _name = "";
  718. _tempat = "";
  719. _tanggal = "";
  720. _jeniskelamin = "";
  721. _kawin = "";
  722. _pekerjaan = "";
  723. _ibu = "";
  724. _alamat = "";
  725. _rt = "";
  726. _rw = "";
  727. _provinsi = "";
  728. _kota = "";
  729. _kec = "";
  730. _kel = "";
  731.  
  732. _nik2 = false;
  733. _name2 = false;
  734. _tempat2 = false;
  735. _tanggal2 = false;
  736. _jeniskelamin2 = false;
  737. _kawin2 = false;
  738. _pekerjaan2 = false;
  739. _ibu2 = false;
  740. _alamat2 = false;
  741. _rt2 = false;
  742. _rw2 = false;
  743. _provinsi2 = false;
  744. _kota2 = false;
  745. _kec2 = false;
  746. _kel2 = false;
  747.  
  748. _nik3 = false;
  749. _name3 = false;
  750. _tempat3 = false;
  751. _tanggal3 = false;
  752. _jeniskelamin3 = false;
  753. _kawin3 = false;
  754. _pekerjaan3 = false;
  755. _ibu3 = false;
  756. _alamat3 = false;
  757. _rt3 = false;
  758. _rw3 = false;
  759. _provinsi3 = false;
  760. _kota3 = false;
  761. _kec3 = false;
  762. _kel3 = false;
  763. _check = false;
  764. });
  765. }
  766. //UPDATE TRACK KE 3.1 YAITU PENGAJUAN SUDAH DILAKUKAN PENGECEKAN DUKCAPIL
  767. _updateStatus("3.1");
  768. } on DioError catch (e) {
  769. print("Error Cek Dukcapil");
  770. setState(() {
  771. _nik = "";
  772. _name = "";
  773. _tempat = "";
  774. _tanggal = "";
  775. _jeniskelamin = "";
  776. _kawin = "";
  777. _pekerjaan = "";
  778. _ibu = "";
  779. _alamat = "";
  780. _rt = "";
  781. _rw = "";
  782. _provinsi = "";
  783. _kota = "";
  784. _kec = "";
  785. _kel = "";
  786.  
  787. _nik2 = false;
  788. _name2 = false;
  789. _tempat2 = false;
  790. _tanggal2 = false;
  791. _jeniskelamin2 = false;
  792. _kawin2 = false;
  793. _pekerjaan2 = false;
  794. _ibu2 = false;
  795. _alamat2 = false;
  796. _rt2 = false;
  797. _rw2 = false;
  798. _provinsi2 = false;
  799. _kota2 = false;
  800. _kec2 = false;
  801. _kel2 = false;
  802.  
  803. _nik3 = false;
  804. _name3 = false;
  805. _tempat3 = false;
  806. _tanggal3 = false;
  807. _jeniskelamin3 = false;
  808. _kawin3 = false;
  809. _pekerjaan3 = false;
  810. _ibu3 = false;
  811. _alamat3 = false;
  812. _rt3 = false;
  813. _rw3 = false;
  814. _provinsi3 = false;
  815. _kota3 = false;
  816. _kec3 = false;
  817. _kel3 = false;
  818. _check = false;
  819. });
  820.  
  821. //UPDATE TRACK KE 3.1 YAITU PENGAJUAN SUDAH DILAKUKAN PENGECEKAN DUKCAPIL
  822. _updateStatus("3.1");
  823.  
  824. if (e.response != null) {
  825. print(e.response.data);
  826. print(e.response.headers);
  827. print(e.response.request);
  828. } else {
  829. print(e.request);
  830. print(e.message);
  831. }
  832. }
  833. }
  834.  
  835. _note() async {
  836. String url = new Api().url;
  837. Response response;
  838. Response res;
  839. Response rex;
  840. var dio = new Dio();
  841. var now = new DateTime.now();
  842. var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
  843. var createddate = formatter.format(now);
  844.  
  845. print("ini multi:" + multi.toString());
  846. try {
  847. if (multi == 1) {
  848. response = await dio.post(
  849. url + "api/AppNoted/Insert",
  850. data: {
  851. "ID": _result.prId,
  852. "NOTED": controllerNote.text,
  853. "CREATE_DATE": createddate,
  854. "CREATE_BY": bloc.appUserId,
  855. "TYPE_NOTE": "2"
  856. },
  857. options:
  858. new Options(contentType: ContentType.parse("application/json")),
  859. );
  860. if (response.data["IsSuccess"] == true) {
  861. _historycal(1);
  862. }
  863. } else if (multi == 2) {
  864. res =
  865. await Dio().get(url + "api/AppFlag/GetBy?AppRegno=" + _result.prId);
  866.  
  867. var currenttrcode = res.data['AP_CURRENTTRCODE'];
  868. var currenttrdate = res.data['AP_CURRENTTRDATE'];
  869. var nexttrby = res.data['AP_NEXTTRBY'];
  870. var lasttrcode = res.data['AP_LASTTRCODE'];
  871. var lasttrdate = res.data['AP_LASTTRDATE'];
  872. var lasttrby = res.data['AP_LASTTRBY'];
  873.  
  874. rex = await dio.put(
  875. url + "/api/AppFlag/Update",
  876. data: {
  877. "AP_REGNO": _result.prId,
  878. "AP_CURRENTTRCODE": currenttrcode,
  879. "AP_CURRENTTRDATE": currenttrdate,
  880. "AP_NEXTTRBY": nexttrby,
  881. "AP_LASTTRCODE": lasttrcode,
  882. "AP_LASTTRDATE": lasttrdate,
  883. "AP_LASTTRBY": lasttrby,
  884. "AP_REJECT": true,
  885. "AP_CANCEL": "",
  886. "AP_APPROVED": ""
  887. },
  888. options:
  889. new Options(contentType: ContentType.parse("application/json")),
  890. );
  891. if (rex.data["IsSuccess"] == true) {
  892. setState(() {
  893. _rejected = true;
  894. });
  895. }
  896. }
  897. } on DioError catch (e) {
  898. if (e.response != null) {
  899. print(e.response.data);
  900. print(e.response.headers);
  901. print(e.response.request);
  902. } else {
  903. print(e.request);
  904. print(e.message);
  905. }
  906. }
  907. dio.interceptors.add(LogInterceptor(responseBody: false));
  908. }
  909.  
  910. _historycal(int x) async {
  911. String url = new Api().url;
  912. Response res;
  913. res = await Dio().get(
  914. url + "api/CheckingSystem/GetNegativeCustomer?KTP=" + _result.prKtpno);
  915.  
  916. var json = res.data;
  917. print("Historycall" + json.toString());
  918. if (json['IsNegative'] == "false") {
  919. Alert(
  920. context: context,
  921. type: AlertType.info,
  922. title: "Historical Bagus",
  923. desc: "Historycal customer ini bagus",
  924. buttons: [
  925. DialogButton(
  926. child: Text(
  927. "OK",
  928. style: TextStyle(color: Colors.white, fontSize: 20),
  929. ),
  930. onPressed: () {
  931. Navigator.pop(context);
  932. _kesimpulan2();
  933. setState(() {
  934. _external = true;
  935. });
  936. },
  937. width: 120,
  938. )
  939. ],
  940. ).show();
  941. } else {
  942. Alert(
  943. context: context,
  944. type: AlertType.warning,
  945. title: "Historical Deviasi",
  946. desc: "Historycal customer ini tidak bagus / Deviasi",
  947. buttons: [
  948. DialogButton(
  949. child: Text(
  950. "OK",
  951. style: TextStyle(color: Colors.white, fontSize: 20),
  952. ),
  953. onPressed: () {
  954. Navigator.pop(context);
  955. _addDeviasi();
  956. _kesimpulan2();
  957. setState(() {
  958. _external = true;
  959. });
  960. },
  961. width: 120,
  962. )
  963. ],
  964. ).show();
  965. }
  966.  
  967. //UPDATE TRACK KE 3.2 YAITU PENGAJUAN SUDAH DILAKUKAN PENGECEKAN NEGATIF LIST
  968. _updateStatus("3.2");
  969. }
  970.  
  971. _addDeviasi() async {
  972. String url = new Api().url;
  973. var dio = new Dio();
  974. var now = new DateTime.now();
  975. var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
  976. var createddate = formatter.format(now);
  977. await dio.put(
  978. url + "/api/AppFlag/Update",
  979. data: {
  980. "ID": _result.prId,
  981. "DESCRIPTION": "Deviasi Historycal",
  982. "NOTED": "-",
  983. "CREATE_DATE": createddate,
  984. "CREATE_BY": bloc.appUserId
  985. },
  986. options: new Options(contentType: ContentType.parse("application/json")),
  987. );
  988. }
  989.  
  990. _updateStatus(String code) async {
  991. String url = new Api().url;
  992. var dio = new Dio();
  993. Response res;
  994.  
  995. res = await Dio().get(url + "api/AppFlag/GetBy?AppRegno=" + _result.prId);
  996. print(res.data.toString());
  997.  
  998. var currenttrdate = res.data['AP_CURRENTTRDATE'];
  999. var nexttrby = res.data['AP_NEXTTRBY'];
  1000. var lasttrcode = res.data['AP_LASTTRCODE'];
  1001. var lasttrdate = res.data['AP_LASTTRDATE'];
  1002. var lasttrby = res.data['AP_LASTTRBY'];
  1003.  
  1004. await dio.put(
  1005. url + "/api/AppFlag/Update",
  1006. data: {
  1007. "AP_REGNO": _result.prId,
  1008. "AP_CURRENTTRCODE": code,
  1009. "AP_CURRENTTRDATE": currenttrdate,
  1010. "AP_NEXTTRBY": nexttrby,
  1011. "AP_LASTTRCODE": lasttrcode,
  1012. "AP_LASTTRDATE": lasttrdate,
  1013. "AP_LASTTRBY": lasttrby,
  1014. "AP_REJECT": false,
  1015. "AP_CANCEL": false,
  1016. "AP_APPROVED": false
  1017. },
  1018. options: new Options(contentType: ContentType.parse("application/json")),
  1019. );
  1020. }
  1021.  
  1022. _note2() async {
  1023. String url = new Api().url;
  1024.  
  1025. var dio = new Dio();
  1026. var now = new DateTime.now();
  1027. var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
  1028. var createddate = formatter.format(now);
  1029. try {
  1030. await dio.post(
  1031. url + "api/AppNoted/Insert",
  1032. data: {
  1033. "ID": _result.prId,
  1034. "NOTED": controllerNote.text,
  1035. "CREATE_DATE": createddate,
  1036. "CREATE_BY": bloc.appUserId,
  1037. "TYPE_NOTE": "2"
  1038. },
  1039. options:
  1040. new Options(contentType: ContentType.parse("application/json")),
  1041. );
  1042. } on DioError catch (e) {
  1043. if (e.response != null) {
  1044. print(e.response.data);
  1045. print(e.response.headers);
  1046. print(e.response.request);
  1047. } else {
  1048. print(e.request);
  1049. print(e.message);
  1050. }
  1051. }
  1052. dio.interceptors.add(LogInterceptor(responseBody: false));
  1053. }
  1054.  
  1055. int _radioValue1 = 0;
  1056.  
  1057. void _handleRadioValueChange1(value) {
  1058. setState(() {
  1059. _radioValue1 = value;
  1060. });
  1061. Navigator.pop(context);
  1062. _checkExternal();
  1063. }
  1064.  
  1065. _checkExternal() async {
  1066. showDialog(
  1067. context: context,
  1068. builder: (BuildContext context) {
  1069. return AlertDialog(
  1070. title: new Text("Alamat Mana yg di survey dan siapa ?"),
  1071. content: SingleChildScrollView(
  1072. child: Container(
  1073. child: Column(
  1074. crossAxisAlignment: CrossAxisAlignment.center,
  1075. children: <Widget>[
  1076. new Radio(
  1077. value: 0,
  1078. groupValue: _radioValue1,
  1079. onChanged: _handleRadioValueChange1,
  1080. ),
  1081. new Text(
  1082. 'Alamat KTP',
  1083. style: new TextStyle(fontSize: 16.0),
  1084. ),
  1085. new Radio(
  1086. value: 1,
  1087. groupValue: _radioValue1,
  1088. onChanged: _handleRadioValueChange1,
  1089. ),
  1090. new Text(
  1091. 'Alamat Domisili',
  1092. style: new TextStyle(
  1093. fontSize: 16.0,
  1094. ),
  1095. ),
  1096. new Radio(
  1097. value: 2,
  1098. groupValue: _radioValue1,
  1099. onChanged: _handleRadioValueChange1,
  1100. ),
  1101. new Text(
  1102. 'Alamat Usaha',
  1103. style: new TextStyle(fontSize: 16.0),
  1104. ),
  1105. ],
  1106. ),
  1107. ),
  1108. ),
  1109. actions: <Widget>[
  1110. new FlatButton(
  1111. color: Colors.green,
  1112. child: new Text(
  1113. "Saya",
  1114. style: TextStyle(color: Colors.white),
  1115. ),
  1116. onPressed: () {
  1117. //UPDATE TRACK KE 4.0 YAITU PENGAJUAN DILAKUKAN SURVEY INTERNAL
  1118. _updateStatus("4.0");
  1119. Navigator.pop(context);
  1120. Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
  1121. return new ProspekMe(1);
  1122. }));
  1123. },
  1124. ),
  1125. // usually buttons at the bottom of the dialog
  1126. new FlatButton(
  1127. color: Colors.blue,
  1128. child: new Text(
  1129. "Surveyor External",
  1130. style: TextStyle(color: Colors.white),
  1131. ),
  1132. onPressed: () {
  1133. //UPDATE TRACK KE 4.1 YAITU PENGAJUAN DILAKUKAN SURVEY EKSTERNAL
  1134. _updateStatus("4.1");
  1135. Navigator.pop(context);
  1136. Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
  1137. return new ProspekMe(1);
  1138. }));
  1139. },
  1140. ),
  1141. ],
  1142. );
  1143. },
  1144. );
  1145. // Alert(
  1146. // context: context,
  1147. // type: AlertType.info,
  1148. // title: "Surveyor External",
  1149. // desc: "Apakah Akan di check Surveyor External ?",
  1150. // buttons: [
  1151. // DialogButton(
  1152. // child: Text(
  1153. // "Cancel",
  1154. // style: TextStyle(color: Colors.white, fontSize: 20),
  1155. // ),
  1156. // onPressed: () {
  1157. // _updateStatus("3.0");
  1158. // Navigator.pop(context);
  1159. // },
  1160. // width: 120,
  1161. // ),
  1162. // DialogButton(
  1163. // child: Text(
  1164. // "OK",
  1165. // style: TextStyle(color: Colors.white, fontSize: 20),
  1166. // ),
  1167. // onPressed: () {
  1168. // _updateStatus("3.0");
  1169. // Navigator.pop(context);
  1170. // Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
  1171. // return new ProspekMe(1);
  1172. // }));
  1173. // },
  1174. // width: 120,
  1175. // )
  1176. // ],
  1177. // ).show();
  1178. }
  1179.  
  1180. void _kesimpulan() async {
  1181. print("kesimpulan");
  1182. showDialog(
  1183. context: context,
  1184. builder: (BuildContext context) {
  1185. return AlertDialog(
  1186. title: new Text("Kesimpulan CMO"),
  1187. content: Container(
  1188. height: 180.0,
  1189. child: Column(
  1190. children: <Widget>[
  1191. new Row(
  1192. children: <Widget>[
  1193. Expanded(
  1194. flex: 5,
  1195. child: RaisedButton(
  1196. color: multi == 1
  1197. ? Color.fromRGBO(60, 158, 64, 1)
  1198. : Colors.white,
  1199. child: Text(
  1200. "Sesuai",
  1201. style: new TextStyle(
  1202. color: multi == 1
  1203. ? Colors.white
  1204. : Color.fromRGBO(102, 102, 102, 1),
  1205. fontSize: 15.0),
  1206. ),
  1207. onPressed: () {
  1208. print(multi);
  1209. setState(() {
  1210. if (multi == 0) {
  1211. warna1 = !warna1;
  1212. } else {
  1213. warna1 = !warna1;
  1214. if (warna2 == true) {
  1215. warna2 = false;
  1216. }
  1217. }
  1218. multi = 1;
  1219. });
  1220. Navigator.of(context).pop();
  1221. _kesimpulan();
  1222. },
  1223. ),
  1224. ),
  1225. Padding(
  1226. padding: EdgeInsets.only(left: 10.0),
  1227. ),
  1228. Expanded(
  1229. flex: 5,
  1230. child: RaisedButton(
  1231. color: multi == 2
  1232. ? Color.fromRGBO(60, 158, 64, 1)
  1233. : Colors.white,
  1234. child: Text(
  1235. "Tidak Sesuai",
  1236. style: new TextStyle(
  1237. color: multi == 2
  1238. ? Colors.white
  1239. : Color.fromRGBO(102, 102, 102, 1),
  1240. fontSize: 15.0),
  1241. ),
  1242. onPressed: () {
  1243. print(multi);
  1244. setState(() {
  1245. if (multi == 0) {
  1246. warna2 = !warna2;
  1247. } else {
  1248. warna2 = !warna2;
  1249. if (warna1 == true) {
  1250. warna1 = false;
  1251. }
  1252. }
  1253. multi = 2;
  1254. });
  1255. Navigator.of(context).pop();
  1256. _kesimpulan();
  1257. },
  1258. ),
  1259. ),
  1260. ],
  1261. ),
  1262. new TextField(
  1263. controller: controllerNote,
  1264. keyboardType: TextInputType.text,
  1265. maxLines: 4,
  1266. decoration: InputDecoration(
  1267. contentPadding: EdgeInsets.all(8.0),
  1268. border: OutlineInputBorder(),
  1269. hintText: "Kesimpulan CMO",
  1270. ),
  1271. )
  1272. ],
  1273. ),
  1274. ),
  1275. actions: <Widget>[
  1276. // usually buttons at the bottom of the dialog
  1277. new FlatButton(
  1278. color: Color.fromRGBO(7, 41, 102, 1),
  1279. child: new Text(
  1280. "Kirim",
  1281. style: TextStyle(color: Colors.white),
  1282. ),
  1283. onPressed: () {
  1284. _note();
  1285. Navigator.of(context).pop();
  1286. },
  1287. ),
  1288. ],
  1289. );
  1290. },
  1291. );
  1292. }
  1293.  
  1294. void _kesimpulan2() async {
  1295. print("kesimpulan");
  1296. showDialog(
  1297. context: context,
  1298. builder: (BuildContext context) {
  1299. return AlertDialog(
  1300. title: new Text("Kesimpulan CMO"),
  1301. content: Container(
  1302. height: 180.0,
  1303. child: Column(
  1304. children: <Widget>[
  1305. new TextField(
  1306. controller: controllerNote2,
  1307. keyboardType: TextInputType.text,
  1308. maxLines: 4,
  1309. decoration: InputDecoration(
  1310. contentPadding: EdgeInsets.all(8.0),
  1311. border: OutlineInputBorder(),
  1312. hintText: "Kesimpulan CMO",
  1313. ),
  1314. )
  1315. ],
  1316. ),
  1317. ),
  1318. actions: <Widget>[
  1319. // usually buttons at the bottom of the dialog
  1320. new FlatButton(
  1321. color: Color.fromRGBO(7, 41, 102, 1),
  1322. child: new Text(
  1323. "Kirim",
  1324. style: TextStyle(color: Colors.white),
  1325. ),
  1326. onPressed: () {
  1327. _note2();
  1328. Navigator.of(context).pop();
  1329. },
  1330. ),
  1331. ],
  1332. );
  1333. },
  1334. );
  1335. }
  1336.  
  1337. @override
  1338. void initState() {
  1339. super.initState();
  1340. if (mounted) {
  1341. _getJabatan();
  1342. }
  1343.  
  1344. if (widget.customer == "Lama" || widget.customer == "lama") {
  1345. setState(() {
  1346. controllerNIK.text = widget.id;
  1347. controllerNama.text = widget.model.fullName;
  1348. controllerTempat.text = widget.model.birthPlace;
  1349. var tgllahir = new DateFormat('yyyy-MM-dd')
  1350. .parse(widget.model.birthDate.split("T")[0]);
  1351. datex = tgllahir;
  1352. var formatter = new DateFormat('dd/MM/yyyy');
  1353. var tglhr = formatter.format(tgllahir);
  1354. controllerTanggal.text = tglhr.toString();
  1355. if (widget.model.gender == "M") {
  1356. _jenis = "Laki-Laki";
  1357. } else {
  1358. _jenis = "Perempuan";
  1359. }
  1360. controllerIbu.text = widget.model.surgateMotherName;
  1361. controllerJabatan.text = widget.model.companyJobTitle;
  1362. controllerNamaKantor.text = widget.model.companyName;
  1363. controllerAlamatKantor.text = widget.model.companyAddress;
  1364. controllerAlamat.text = widget.model.legalAddress;
  1365. controllerKodePos.text = widget.model.legalZipCode;
  1366. controllerRT.text = widget.model.legalRt;
  1367. controllerRW.text = widget.model.legalRw;
  1368. controllerAlamat2.text = widget.model.residenceAddress;
  1369. controllerKodePos2.text = widget.model.residenceZipCode;
  1370. controllerRT2.text = widget.model.residenceRt;
  1371. controllerRW2.text = widget.model.residenceRw;
  1372. controllerHandphone.text = widget.model.mobilePhone;
  1373. controllerWarganegara.text = widget.model.nationality;
  1374. controllerEmail.text = widget.model.eMail;
  1375. controllerStatus.text = "Lama";
  1376. controllerTelepon.text = widget.model.residenceAreaPhone1.toString() +
  1377. "" +
  1378. widget.model.residencePhone1.toString();
  1379.  
  1380. List<Jenis> j =
  1381. jenisx.where((i) => i.value == widget.model.jobTypeId).toList();
  1382. if (j.length > 0) {
  1383. selectedJenis = j[0];
  1384. }
  1385. _getProvinsi2();
  1386. });
  1387. } else {
  1388. _getDataUser(widget.id);
  1389. setState(() {
  1390. // controllerEmail.text = widget.model.;
  1391. controllerNIK.text = widget.id;
  1392. controllerStatus.text = "Baru";
  1393. controllerWarganegara.text = widget.negara;
  1394. });
  1395. }
  1396. (() async {
  1397. sharedPreferences = await SharedPreferences.getInstance();
  1398. setState(() {
  1399. islogin = sharedPreferences.getBool("isLogin");
  1400. print(islogin.toString());
  1401. user_id = sharedPreferences.getString('userid');
  1402. email = 'cmo';
  1403. });
  1404. await _getProvinsi();
  1405. })();
  1406. }
  1407.  
  1408. _getP(String val) {
  1409. List<Provinsi> _a = _region.where((i) => i.id == val).toList();
  1410. return _a[0].name;
  1411. }
  1412.  
  1413. Future<String> _getProvinsi() async {
  1414. String url = new Api().url;
  1415. // Response response;
  1416. Response response;
  1417. response = await Dio().get(url + "api/Provinsi/GetAll");
  1418. final json = response.data;
  1419.  
  1420. setState(() {
  1421. _region =
  1422. (json).map<Provinsi>((item) => Provinsi.fromJson(item)).toList();
  1423. // selectedRegion = _region[0].id;
  1424. // selectedRegion2 = _region[0].id;
  1425. });
  1426.  
  1427. return "Sucess";
  1428. }
  1429.  
  1430. Future<String> _getProvinsi2() async {
  1431. String url = new Api().url;
  1432. // Response response;
  1433. Response response;
  1434. response = await Dio().get(url + "api/Provinsi/GetAll");
  1435. final json = response.data;
  1436.  
  1437. setState(() {
  1438. _region =
  1439. (json).map<Provinsi>((item) => Provinsi.fromJson(item)).toList();
  1440. // selectedRegion = _region[0].id;
  1441. // selectedRegion2 = _region[0].id;
  1442. });
  1443. if (widget.model.legalPropinsi != null) {
  1444. List<Provinsi> _a = _region
  1445. .where((i) =>
  1446. i.name.toString() ==
  1447. widget.model.legalPropinsi.toString().toUpperCase())
  1448. .toList();
  1449. if (_a.length > 0) {
  1450. setState(() {
  1451. selectedRegion = _a[0].id;
  1452. vprovinsi = 1;
  1453. });
  1454. await _getKota2(_a[0].id, "1");
  1455. }
  1456. }
  1457. if (widget.model.residencePropinsi != null) {
  1458. List<Provinsi> _b = _region
  1459. .where((i) =>
  1460. i.name.toString() ==
  1461. widget.model.residencePropinsi.toString().toUpperCase())
  1462. .toList();
  1463. if (_b.length > 0) {
  1464. setState(() {
  1465. selectedRegion2 = _b[0].id;
  1466. vprovinsi2 = 1;
  1467. });
  1468. await _getKota2(_b[0].id, "2");
  1469. }
  1470. }
  1471. return "Sucess";
  1472. }
  1473.  
  1474. Future<String> _getKota(String id, String type) async {
  1475. String url = new Api().url;
  1476. // Response response;
  1477. Response response;
  1478. response = await Dio().get(url + "api/Kota/Select?PROVINSI_ID=" + id);
  1479. final json = response.data;
  1480.  
  1481. setState(() {
  1482. if (type == "1") {
  1483. _kotaSelec = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
  1484. // selectedKota = _kota[0].id;
  1485. } else if (type == "2") {
  1486. _kotaSelec2 = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
  1487. // selectedKota2 = _kota2[0].id;
  1488. } else {
  1489. _kotaSelec2 = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
  1490. selectedKota2 = selectedKota;
  1491. }
  1492. });
  1493.  
  1494. return "Sucess";
  1495. }
  1496.  
  1497. Future<String> _getKota2(String id, String type) async {
  1498. String url = new Api().url;
  1499. // Response response;
  1500. Response response;
  1501. response = await Dio().get(url + "api/Kota/Select?PROVINSI_ID=" + id);
  1502. final json = response.data;
  1503.  
  1504. if (type == "1") {
  1505. setState(() {
  1506. _kotaSelec = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
  1507. });
  1508. List<Kota> _a = _kotaSelec
  1509. .where((i) =>
  1510. i.name.toString() ==
  1511. widget.model.legalCity.toString().toUpperCase())
  1512. .toList();
  1513. if (_a.length > 0) {
  1514. print("KOTA");
  1515. setState(() {
  1516. selectedKota = _a[0].id;
  1517. vkota = 1;
  1518. });
  1519. await _getKec2(_a[0].id, id, "1");
  1520. }
  1521. } else if (type == "2") {
  1522. setState(() {
  1523. _kotaSelec2 = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
  1524. });
  1525. List<Kota> _a = _kotaSelec2
  1526. .where((i) =>
  1527. i.name.toString() ==
  1528. widget.model.residenceCity.toString().toUpperCase())
  1529. .toList();
  1530. if (_a.length > 0) {
  1531. print("KOTA");
  1532. setState(() {
  1533. selectedKota2 = _a[0].id;
  1534. vkota2 = 1;
  1535. });
  1536. await _getKec2(_a[0].id, id, "2");
  1537. }
  1538. }
  1539.  
  1540. return "Sucess";
  1541. }
  1542.  
  1543. Future<String> _getKec(String kota_id, String prov_id, String type) async {
  1544. String url = new Api().url;
  1545. Response response;
  1546. response = await Dio().get(url +
  1547. "api/Kecamatan/Select?PROVINSI_ID=" +
  1548. prov_id +
  1549. "&KOTA_ID=" +
  1550. kota_id);
  1551. final json = response.data;
  1552. setState(() {
  1553. if (type == "1") {
  1554. _kecSelec =
  1555. (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
  1556. // selectedKec = _kec[0].id;
  1557. } else if (type == "2") {
  1558. _kecSelec2 =
  1559. (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
  1560. // selectedKec2 = _kec2[0].id;
  1561. } else {
  1562. _kecSelec2 =
  1563. (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
  1564. selectedKec2 = selectedKec;
  1565. }
  1566. });
  1567.  
  1568. return "Sucess";
  1569. }
  1570.  
  1571. Future<String> _getKec2(String kota_id, String prov_id, String type) async {
  1572. String url = new Api().url;
  1573. Response response;
  1574. response = await Dio().get(url +
  1575. "api/Kecamatan/Select?PROVINSI_ID=" +
  1576. prov_id +
  1577. "&KOTA_ID=" +
  1578. kota_id);
  1579. final json = response.data;
  1580. setState(() {
  1581. if (type == "1") {
  1582. _kecSelec =
  1583. (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
  1584. // selectedKec = _kec[0].id;
  1585. } else if (type == "2") {
  1586. _kecSelec2 =
  1587. (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
  1588. // selectedKec2 = _kec2[0].id;
  1589. }
  1590. });
  1591.  
  1592. if (type == "1") {
  1593. print("CAMAT");
  1594. List<Kecamatan> _a = _kecSelec
  1595. .where((i) =>
  1596. i.name.toString().toUpperCase() ==
  1597. widget.model.legalKecamatan.toString().toUpperCase())
  1598. .toList();
  1599. if (_a.length > 0) {
  1600. setState(() {
  1601. selectedKec = _a[0].id;
  1602. vkec = 1;
  1603. });
  1604. await _getKel2(_a[0].id, kota_id, prov_id, "1");
  1605. }
  1606. } else if (type == "2") {
  1607. print("CAMAT");
  1608. List<Kecamatan> _a = _kecSelec2
  1609. .where((i) =>
  1610. i.name.toString().toUpperCase() ==
  1611. widget.model.residenceKecamatan.toString().toUpperCase())
  1612. .toList();
  1613. if (_a.length > 0) {
  1614. setState(() {
  1615. selectedKec2 = _a[0].id;
  1616. vkec2 = 1;
  1617. });
  1618. await _getKel2(_a[0].id, kota_id, prov_id, "2");
  1619. }
  1620. }
  1621.  
  1622. return "Sucess";
  1623. }
  1624.  
  1625. Future<String> _getKel(
  1626. String kec_id, String kota_id, String prov_id, String type) async {
  1627. String url = new Api().url;
  1628. Response response;
  1629. response = await Dio().get(url +
  1630. "api/Kelurahan/Select?PROVINSI_ID=" +
  1631. prov_id +
  1632. "&KOTA_ID=" +
  1633. kota_id +
  1634. "&KECAMATAN_ID=" +
  1635. kec_id);
  1636. final json = response.data;
  1637.  
  1638. setState(() {
  1639. if (type == "1") {
  1640. _kelSelec =
  1641. (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
  1642. // selectedKel = _kel[0].id;
  1643. } else if (type == "2") {
  1644. _kelSelec2 =
  1645. (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
  1646. // selectedKel2 = _kel2[0].id;
  1647. } else {
  1648. _kelSelec2 =
  1649. (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
  1650. selectedKel2 = selectedKel;
  1651. }
  1652. });
  1653.  
  1654. return "Sucess";
  1655. }
  1656.  
  1657. Future<String> _getKel2(
  1658. String kec_id, String kota_id, String prov_id, String type) async {
  1659. String url = new Api().url;
  1660. Response response;
  1661. response = await Dio().get(url +
  1662. "api/Kelurahan/Select?PROVINSI_ID=" +
  1663. prov_id +
  1664. "&KOTA_ID=" +
  1665. kota_id +
  1666. "&KECAMATAN_ID=" +
  1667. kec_id);
  1668. final json = response.data;
  1669.  
  1670. setState(() {
  1671. if (type == "1") {
  1672. _kelSelec =
  1673. (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
  1674. // controllerKodePos.text = _kel[0].kodepos;
  1675. // selectedKel = _kel[0].id;
  1676. } else if (type == "2") {
  1677. _kelSelec2 =
  1678. (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
  1679. // controllerKodePos2.text = _kel2[0].kodepos;
  1680. // selectedKel2 = _kel2[0].id;
  1681. }
  1682. });
  1683.  
  1684. if (type == "1") {
  1685. List<Kelurahan> _a = _kelSelec
  1686. .where((i) =>
  1687. i.name.toString().toUpperCase() ==
  1688. widget.model.legalKelurahan.toString().toUpperCase())
  1689. .toList();
  1690. if (_a.length > 0) {
  1691. setState(() {
  1692. selectedKel = _a[0].id;
  1693. vkel = 1;
  1694. });
  1695. }
  1696. } else if (type == "2") {
  1697. List<Kelurahan> _a = _kelSelec2
  1698. .where((i) =>
  1699. i.name.toString().toUpperCase() ==
  1700. widget.model.residenceKelurahan.toString().toUpperCase())
  1701. .toList();
  1702. if (_a.length > 0) {
  1703. setState(() {
  1704. selectedKel2 = _a[0].id;
  1705. vkel2 = 1;
  1706. });
  1707. }
  1708. }
  1709.  
  1710. return "Sucess";
  1711. }
  1712.  
  1713. Future<String> _getKelId(String kel_id, String kec_id, String kota_id,
  1714. String prov_id, String type) async {
  1715. String url = new Api().url;
  1716. Response response;
  1717. response = await Dio().get(url +
  1718. "api/Kelurahan/GetByDistrictID?PROVINSI_ID=" +
  1719. prov_id +
  1720. "&KOTA_ID=" +
  1721. kota_id +
  1722. "&KECAMATAN_ID=" +
  1723. kec_id +
  1724. "&KELURAHAN_ID=" +
  1725. kel_id);
  1726. final json = response.data;
  1727. Kelurahan _kel4 = Kelurahan.fromJson(json);
  1728. setState(() {
  1729. if (type == "1") {
  1730. controllerKodePos.text = _kel4.kodepos;
  1731. } else {
  1732. controllerKodePos2.text = _kel4.kodepos;
  1733. }
  1734. });
  1735.  
  1736. return "Sucess";
  1737. }
  1738.  
  1739. _getDataUser(id) async {
  1740. String url = new Api().url;
  1741. var dio = new Dio();
  1742. Response res;
  1743. res =
  1744. await dio.get(url + "api/Customer/GetByIDNumber?ID=" + id + "&Type=P");
  1745. var json = res.data;
  1746. if (json["USERID"] != 0) {
  1747. setState(() {
  1748. controllerNama.text = json["FULLNAME"];
  1749. controllerHandphone.text = json["NO_HP"];
  1750. controllerEmail.text = json["EMAIL"];
  1751. controllerTelepon.text = json["NO_HP"];
  1752. });
  1753. } else {
  1754. setState(() {
  1755. nameActive = true;
  1756. hpActive = true;
  1757. });
  1758. }
  1759. }
  1760.  
  1761. Widget _iconCheck(bool i, bool x) {
  1762. if (x != false) {
  1763. return Icon(
  1764. i == true ? Icons.check : Icons.close,
  1765. color: i == true ? Colors.green : Colors.red,
  1766. );
  1767. } else {
  1768. return Container();
  1769. }
  1770. }
  1771.  
  1772. Widget _checkRejected() {
  1773. if (_rejected == true) {
  1774. return FlatButton(
  1775. onPressed: () {},
  1776. color: Colors.red,
  1777. child: Text(
  1778. "Rejected",
  1779. style: TextStyle(color: Colors.red),
  1780. ),
  1781. );
  1782. } else {
  1783. if (_deviasi == true) {
  1784. return FlatButton(
  1785. onPressed: () {},
  1786. color: Colors.red,
  1787. child: Text(
  1788. "Deviasi",
  1789. style: TextStyle(color: Colors.red),
  1790. ),
  1791. );
  1792. } else {
  1793. return Container();
  1794. }
  1795. }
  1796. }
  1797.  
  1798. Future openCamera(type) async {
  1799. // Navigator.of(context).pop();
  1800. var image = await ImagePicker.pickImage(
  1801. source: ImageSource.camera, maxHeight: 816, maxWidth: 816, imageQuality: 100);
  1802. if (image != null) {
  1803. image = await FlutterExifRotation.rotateImage(path: image.path);
  1804. if (type == "ktp") {
  1805. setState(() {
  1806. _ktp = image;
  1807. });
  1808. } else {
  1809. setState(() {
  1810. _foto = image;
  1811. });
  1812. }
  1813. print("Foto" + image.toString());
  1814. }
  1815. }
  1816.  
  1817. Future openGallery(type) async {
  1818. Navigator.of(context).pop();
  1819. var image = await ImagePicker.pickImage(source: ImageSource.gallery, maxHeight: 816, maxWidth: 816, imageQuality: 100);
  1820.  
  1821. if (type == "ktp") {
  1822. setState(() {
  1823. _ktp = image;
  1824. });
  1825. } else {
  1826. setState(() {
  1827. _foto = image;
  1828. });
  1829. }
  1830. print("Foto" + image.toString());
  1831. }
  1832.  
  1833. Future<void> _optionsDialogBox(type) {
  1834. return showDialog(
  1835. context: context,
  1836. builder: (BuildContext context) {
  1837. return AlertDialog(
  1838. content: new SingleChildScrollView(
  1839. child: new ListBody(
  1840. children: <Widget>[
  1841. GestureDetector(
  1842. child: new Text('Take a picture'),
  1843. onTap: () {
  1844. openCamera(type);
  1845. },
  1846. ),
  1847. Padding(
  1848. padding: EdgeInsets.all(8.0),
  1849. ),
  1850. GestureDetector(
  1851. child: new Text('Select from gallery'),
  1852. onTap: () {
  1853. openGallery(type);
  1854. },
  1855. ),
  1856. ],
  1857. ),
  1858. ),
  1859. );
  1860. });
  1861. }
  1862.  
  1863. _uploadKtp(prid, seq) async {
  1864. var now = new DateTime.now();
  1865. var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
  1866. var createddate = formatter.format(now);
  1867.  
  1868. String url = new Api().url;
  1869. Dio dio = new Dio();
  1870.  
  1871. FormData formdata = new FormData.from({
  1872. "file": new UploadFileInfo(_ktp, Path.basename(_ktp.path)),
  1873. "AP_REGNO": prid,
  1874. "SEQ": seq,
  1875. "DOC_CODE": "1",
  1876. "DOC_ORIGINAL": "True",
  1877. "DOCSTA_CODE": "Dokument Belum Diterima",
  1878. "DOC_RECVDATE": createddate,
  1879. "DOC_EXPDATE": createddate,
  1880. "DOC_NO": "KTP/2019",
  1881. "DOC_NOTARY": "KTP/2019"
  1882. });
  1883. try {
  1884. dio
  1885. .post(url + "api/AppDokumen/Insert",
  1886. data: formdata,
  1887. options: Options(
  1888. contentType: ContentType.parse("multipart/form-data"),
  1889. method: 'POST',
  1890. responseType: ResponseType.json // or ResponseType.JSON
  1891. ))
  1892. .then((response) => print(response));
  1893. } on DioError catch (e) {
  1894. if (e.response != null) {
  1895. print(e.response.data);
  1896. print(e.response.headers);
  1897. print(e.response.request);
  1898. } else {
  1899. print(e.request);
  1900. print(e.message);
  1901. }
  1902. }
  1903. }
  1904.  
  1905. _uploadPhoto(prid, seq) async {
  1906. var now = new DateTime.now();
  1907. var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
  1908. var createddate = formatter.format(now);
  1909.  
  1910. String url = new Api().url;
  1911. Dio dio = new Dio();
  1912.  
  1913. FormData formdata = new FormData.from({
  1914. "file": new UploadFileInfo(_foto, Path.basename(_foto.path)),
  1915. "AP_REGNO": prid,
  1916. "SEQ": seq,
  1917. "DOC_CODE": "7",
  1918. "DOC_ORIGINAL": "True",
  1919. "DOCSTA_CODE": "Dokument Belum Diterima",
  1920. "DOC_RECVDATE": createddate,
  1921. "DOC_EXPDATE": createddate,
  1922. "DOC_NO": "Photo/2019",
  1923. "DOC_NOTARY": "Photo/2019"
  1924. });
  1925. try {
  1926. dio
  1927. .post(url + "api/AppDokumen/Insert",
  1928. data: formdata,
  1929. options: Options(
  1930. contentType: ContentType.parse("multipart/form-data"),
  1931. method: 'POST',
  1932. responseType: ResponseType.json // or ResponseType.JSON
  1933. ))
  1934. .then((response) => print(response));
  1935. } on DioError catch (e) {
  1936. if (e.response != null) {
  1937. print(e.response.data);
  1938. print(e.response.headers);
  1939. print(e.response.request);
  1940. } else {
  1941. print(e.request);
  1942. print(e.message);
  1943. }
  1944. }
  1945. }
  1946.  
  1947. Widget _hasilID() {
  1948. if (_ktp != null) {
  1949. return new Container(
  1950. decoration: BoxDecoration(
  1951. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  1952. border: new Border.all(
  1953. width: 1,
  1954. color: Color.fromRGBO(83, 108, 121, 1),
  1955. )),
  1956. child: Column(children: <Widget>[
  1957. new Container(
  1958. width: MediaQuery.of(context).size.width,
  1959. padding: EdgeInsets.all(5.0),
  1960. color: Color.fromRGBO(83, 108, 121, 1),
  1961. child: Text("Hasil Foto ID",
  1962. style: new TextStyle(fontSize: 14.0, color: Colors.white)),
  1963. ),
  1964. Padding(
  1965. padding: EdgeInsets.all(10.0),
  1966. child: Container(
  1967. width: MediaQuery.of(context).size.width,
  1968. child: Column(
  1969. children: <Widget>[Image.file(File(_ktp.path))],
  1970. ),
  1971. ),
  1972. )
  1973. ]));
  1974. } else {
  1975. return Container();
  1976. }
  1977. }
  1978.  
  1979. Widget _hasilWajah() {
  1980. if (_foto != null) {
  1981. return new Container(
  1982. decoration: BoxDecoration(
  1983. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  1984. border: new Border.all(
  1985. width: 1,
  1986. color: Color.fromRGBO(83, 108, 121, 1),
  1987. )),
  1988. child: Column(children: <Widget>[
  1989. new Container(
  1990. width: MediaQuery.of(context).size.width,
  1991. padding: EdgeInsets.all(5.0),
  1992. color: Color.fromRGBO(83, 108, 121, 1),
  1993. child: Text("Hasil Foto Wajah",
  1994. style: new TextStyle(fontSize: 14.0, color: Colors.white)),
  1995. ),
  1996. Padding(
  1997. padding: EdgeInsets.all(10.0),
  1998. child: Container(
  1999. width: MediaQuery.of(context).size.width,
  2000. child: Column(
  2001. children: <Widget>[Image.file(File(_foto.path))],
  2002. ),
  2003. ),
  2004. )
  2005. ]));
  2006. } else {
  2007. return Container();
  2008. }
  2009. }
  2010.  
  2011. _jp() {
  2012. return FormField<Jenis>(
  2013. validator: (user) {
  2014. print(user);
  2015. if (user == null && selectedJenis == null) {
  2016. // return "Pekerjaan Belum Dipilih";
  2017. }
  2018. },
  2019. builder: (
  2020. FormFieldState<Jenis> state,
  2021. ) {
  2022. return Column(
  2023. crossAxisAlignment: CrossAxisAlignment.start,
  2024. children: <Widget>[
  2025. Container(
  2026. width: MediaQuery.of(context).size.width,
  2027. child: DropdownButtonHideUnderline(
  2028. child: Container(
  2029. height: 40.0,
  2030. decoration: ShapeDecoration(
  2031. shape: RoundedRectangleBorder(
  2032. side: BorderSide(width: 1.0, style: BorderStyle.solid),
  2033. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  2034. ),
  2035. ),
  2036. child: ButtonTheme(
  2037. alignedDropdown: true,
  2038. child: new DropdownButton<Jenis>(
  2039. hint: new Text(
  2040. "Pekerjaan",
  2041. style: TextStyle(fontSize: 13.0),
  2042. ),
  2043. value: selectedJenis,
  2044. onChanged: (Jenis newValue) {
  2045. state.didChange(newValue);
  2046.  
  2047. setState(() {
  2048. selectedJenis = newValue;
  2049. });
  2050. },
  2051. items: jenisx.map((Jenis user) {
  2052. return new DropdownMenuItem<Jenis>(
  2053. value: user,
  2054. child: SizedBox(
  2055. width: 135.0,
  2056. child: new Text(user.name,
  2057. maxLines: 4,
  2058. style: new TextStyle(
  2059. color: Colors.black, fontSize: 10.0)),
  2060. ),
  2061. );
  2062. }).toList(),
  2063. ),
  2064. ),
  2065. ),
  2066. ),
  2067. ),
  2068. SizedBox(height: 5.0),
  2069. Text(
  2070. state.hasError ? state.errorText : '',
  2071. style:
  2072. TextStyle(color: Colors.redAccent.shade700, fontSize: 12.0),
  2073. ),
  2074. ],
  2075. );
  2076. },
  2077. );
  2078. }
  2079.  
  2080. @override
  2081. Widget build(BuildContext context) {
  2082. return Scaffold(
  2083. key: _scaffoldKey,
  2084. appBar: AppBar(
  2085. title: Text("Pengajuan Perorangan",
  2086. style: new TextStyle(
  2087. color: Colors.black,
  2088. fontFamily: "Poppins",
  2089. )),
  2090. backgroundColor: Colors.white,
  2091. centerTitle: true,
  2092. leading: BackButton(color: Colors.black),
  2093. elevation: 0.0,
  2094. ),
  2095. body: SingleChildScrollView(
  2096. child: Form(
  2097. key: _formKey,
  2098. child: Container(
  2099. width: MediaQuery.of(context).size.width,
  2100. padding: EdgeInsets.all(10.0),
  2101. child: Column(
  2102. children: <Widget>[
  2103. Container(
  2104. width: MediaQuery.of(context).size.width,
  2105. padding: EdgeInsets.all(10.0),
  2106. decoration: BoxDecoration(
  2107. color: Color.fromRGBO(60, 158, 64, 1),
  2108. borderRadius: BorderRadius.all(Radius.circular(5.0))),
  2109. child: Row(
  2110. children: <Widget>[
  2111. Text(
  2112. "Pemohon Perorangan",
  2113. style: TextStyle(color: Colors.white, fontSize: 15.0),
  2114. ),
  2115. _checkRejected()
  2116. ],
  2117. ),
  2118. ),
  2119. Padding(
  2120. padding: EdgeInsets.only(top: 10.0),
  2121. ),
  2122. new Container(
  2123. decoration: BoxDecoration(
  2124. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  2125. border: new Border.all(
  2126. width: 1,
  2127. color: Color.fromRGBO(83, 108, 121, 1),
  2128. )),
  2129. child: Column(
  2130. children: <Widget>[
  2131. new Container(
  2132. width: MediaQuery.of(context).size.width,
  2133. padding: EdgeInsets.all(5.0),
  2134. color: Color.fromRGBO(83, 108, 121, 1),
  2135. child: Text("SESUAI KTP (WNI) / PASPOR (WNA)",
  2136. style: new TextStyle(
  2137. fontSize: 14.0, color: Colors.white)),
  2138. ),
  2139. Padding(
  2140. padding: EdgeInsets.all(10.0),
  2141. child: Column(
  2142. children: <Widget>[
  2143. new Row(
  2144. children: <Widget>[
  2145. Expanded(
  2146. flex: 10,
  2147. child: new Column(
  2148. crossAxisAlignment:
  2149. CrossAxisAlignment.start,
  2150. children: <Widget>[
  2151. Row(
  2152. children: <Widget>[
  2153. new Text("No. KTP / No. Paspor",
  2154. textAlign: TextAlign.left),
  2155. _iconCheck(_nik2, _nik3)
  2156. ],
  2157. ),
  2158. new TextField(
  2159. enabled: false,
  2160. controller: controllerNIK,
  2161. keyboardType: TextInputType.text,
  2162. decoration: InputDecoration(
  2163. contentPadding: EdgeInsets.all(8.0),
  2164. border: OutlineInputBorder(),
  2165. hintText: "NIK",
  2166. ),
  2167. ),
  2168. Text(
  2169. _nik == "" ? "" : _nik,
  2170. style: TextStyle(color: Colors.green),
  2171. )
  2172. ],
  2173. ),
  2174. ),
  2175. ],
  2176. ),
  2177. new Row(
  2178. children: <Widget>[
  2179. Expanded(
  2180. flex: 10,
  2181. child: new Column(
  2182. crossAxisAlignment:
  2183. CrossAxisAlignment.start,
  2184. children: <Widget>[
  2185. Row(
  2186. children: <Widget>[
  2187. new Text("Nama Lengkap",
  2188. textAlign: TextAlign.left),
  2189. _iconCheck(_name2, _name3)
  2190. ],
  2191. ),
  2192. new TextFormField(
  2193. validator: (value) {
  2194. if (value.isEmpty) {
  2195. return '';
  2196. }
  2197. },
  2198. enabled: nameActive,
  2199. controller: controllerNama,
  2200. keyboardType: TextInputType.text,
  2201. inputFormatters: [
  2202. BlacklistingTextInputFormatter(
  2203. new RegExp(
  2204. r'[-]|[,]|[.]|[/]|[!]|[@]|[$]|[#]|[%]|[&]|[*]|[(]|[)]|[-]|[_]|[+]|[=]|[~]|[`]|[{]|[}]|[[]]|[]]|[|]|["]|[:]|[;]|[>]|[<]|[?]'))
  2205. ],
  2206. decoration: InputDecoration(
  2207. contentPadding: EdgeInsets.all(8.0),
  2208. border: OutlineInputBorder(),
  2209. hintText: "Nama Lengkap",
  2210. ),
  2211. ),
  2212. Text(
  2213. _name == "" ? "" : _name,
  2214. style: TextStyle(color: Colors.green),
  2215. )
  2216. ],
  2217. ),
  2218. ),
  2219. ],
  2220. ),
  2221. new Row(
  2222. children: <Widget>[
  2223. Expanded(
  2224. flex: 5,
  2225. child: new Column(
  2226. crossAxisAlignment:
  2227. CrossAxisAlignment.start,
  2228. children: <Widget>[
  2229. Row(
  2230. children: <Widget>[
  2231. new Text("Tempat Lahir",
  2232. textAlign: TextAlign.left),
  2233. _iconCheck(_tempat2, _tempat3)
  2234. ],
  2235. ),
  2236. new TextFormField(
  2237. validator: (value) {
  2238. if (value.isEmpty) {
  2239. return '';
  2240. }
  2241. },
  2242. controller: controllerTempat,
  2243. keyboardType: TextInputType.text,
  2244. decoration: InputDecoration(
  2245. contentPadding: EdgeInsets.only(
  2246. left: 8.0,
  2247. top: 15.0,
  2248. bottom: 15.0),
  2249. border: OutlineInputBorder(),
  2250. hintText: "Tempat Lahir",
  2251. ),
  2252. ),
  2253. Text(
  2254. _tempat == "" ? "" : _tempat,
  2255. style: TextStyle(color: Colors.green),
  2256. )
  2257. ],
  2258. ),
  2259. ),
  2260. new Padding(
  2261. padding: EdgeInsets.only(left: 5.0),
  2262. ),
  2263. Expanded(
  2264. flex: 5,
  2265. child: new Column(
  2266. crossAxisAlignment:
  2267. CrossAxisAlignment.start,
  2268. children: <Widget>[
  2269. Row(
  2270. children: <Widget>[
  2271. new Text("Tanggal Lahir",
  2272. textAlign: TextAlign.left),
  2273. _iconCheck(_tanggal2, _tanggal3)
  2274. ],
  2275. ),
  2276. DateTimeField(
  2277. format: formats,
  2278. controller: controllerTanggal,
  2279. validator: (dateTime) {
  2280. if (dateTime == null) {
  2281. return '';
  2282. }
  2283. print(dateTime);
  2284. },
  2285. decoration: InputDecoration(
  2286. contentPadding: EdgeInsets.only(
  2287. left: 8.0,
  2288. top: 15.0,
  2289. bottom: 15.0),
  2290. border: OutlineInputBorder(),
  2291. labelText: 'Tanggal Lahir',
  2292. hasFloatingPlaceholder: false),
  2293. onChanged: (dt) =>
  2294. setState(() => datex = dt),
  2295. onShowPicker:
  2296. (context, currentValue) {
  2297. return showDatePicker(
  2298. context: context,
  2299. firstDate: DateTime(1900),
  2300. initialDate: currentValue ??
  2301. DateTime.now(),
  2302. lastDate: DateTime(2100));
  2303. },
  2304. ),
  2305. // DateTimePickerFormField(
  2306. // validator: (value) {
  2307. // if (value == null) {
  2308. // return '';
  2309. // }
  2310. // },
  2311. // controller: controllerTanggal,
  2312. // inputType: inputType,
  2313. // format: formats[inputType],
  2314. // editable: editable,
  2315. // decoration: InputDecoration(
  2316. // contentPadding:
  2317. // EdgeInsets.all(8.0),
  2318. // border: OutlineInputBorder(),
  2319. // labelText: 'Tanggal Lahir',
  2320. // hasFloatingPlaceholder: false),
  2321. // onChanged: (dt) =>
  2322. // setState(() => datex = dt),
  2323. // ),
  2324. Text(
  2325. _tanggal == "" ? "" : _tanggal,
  2326. style: TextStyle(color: Colors.green),
  2327. )
  2328. ],
  2329. ),
  2330. ),
  2331. ],
  2332. ),
  2333. new Row(
  2334. children: <Widget>[
  2335. Expanded(
  2336. flex: 5,
  2337. child: new Column(
  2338. crossAxisAlignment:
  2339. CrossAxisAlignment.start,
  2340. children: <Widget>[
  2341. Row(
  2342. children: <Widget>[
  2343. new Text("Jenis Kelamin",
  2344. textAlign: TextAlign.left),
  2345. _iconCheck(
  2346. _jeniskelamin2, _jeniskelamin3)
  2347. ],
  2348. ),
  2349. Container(
  2350. width:
  2351. MediaQuery.of(context).size.width,
  2352. child: DropdownButtonHideUnderline(
  2353. child: Container(
  2354. height: 40.0,
  2355. decoration: ShapeDecoration(
  2356. shape: RoundedRectangleBorder(
  2357. side: BorderSide(
  2358. width: 1.0,
  2359. style: BorderStyle.solid),
  2360. borderRadius:
  2361. BorderRadius.all(
  2362. Radius.circular(5.0)),
  2363. ),
  2364. ),
  2365. child: ButtonTheme(
  2366. alignedDropdown: true,
  2367. child: new DropdownButton(
  2368. onChanged: (String value) {
  2369. pilihJenis(value);
  2370. },
  2371. value: _jenis,
  2372. items:
  2373. jenis.map((String value) {
  2374. return new DropdownMenuItem(
  2375. value: value,
  2376. child: new Text(value),
  2377. );
  2378. }).toList(),
  2379. ),
  2380. ),
  2381. ),
  2382. ),
  2383. ),
  2384. Text(
  2385. _jeniskelamin == ""
  2386. ? ""
  2387. : _jeniskelamin,
  2388. style: TextStyle(color: Colors.green),
  2389. )
  2390. ],
  2391. ),
  2392. ),
  2393. Padding(
  2394. padding: EdgeInsets.only(left: 10.0),
  2395. ),
  2396. Expanded(
  2397. flex: 5,
  2398. child: new Column(
  2399. crossAxisAlignment:
  2400. CrossAxisAlignment.start,
  2401. children: <Widget>[
  2402. Row(
  2403. children: <Widget>[
  2404. new Text("Status Kawin",
  2405. textAlign: TextAlign.left),
  2406. _iconCheck(_kawin2, _kawin3)
  2407. ],
  2408. ),
  2409. Container(
  2410. width:
  2411. MediaQuery.of(context).size.width,
  2412. child: DropdownButtonHideUnderline(
  2413. child: Container(
  2414. height: 40.0,
  2415. decoration: ShapeDecoration(
  2416. shape: RoundedRectangleBorder(
  2417. side: BorderSide(
  2418. width: 1.0,
  2419. style: BorderStyle.solid),
  2420. borderRadius:
  2421. BorderRadius.all(
  2422. Radius.circular(5.0)),
  2423. ),
  2424. ),
  2425. child: ButtonTheme(
  2426. alignedDropdown: true,
  2427. child: new DropdownButton(
  2428. onChanged: (String value) {
  2429. pilihStatus(value);
  2430. },
  2431. value: _status,
  2432. items: status
  2433. .map((String value) {
  2434. return new DropdownMenuItem(
  2435. value: value,
  2436. child: SizedBox(
  2437. width: 100.0,
  2438. child: new Text(value,
  2439. maxLines: 4,
  2440. style: new TextStyle(
  2441. color: Colors
  2442. .black,
  2443. fontSize:
  2444. 15.0)),
  2445. ),
  2446. );
  2447. }).toList(),
  2448. ),
  2449. ),
  2450. ),
  2451. ),
  2452. ),
  2453. Text(
  2454. _kawin == "" ? "" : _kawin,
  2455. style: TextStyle(color: Colors.green),
  2456. )
  2457. ],
  2458. ),
  2459. ),
  2460. ],
  2461. ),
  2462. new Row(
  2463. children: <Widget>[
  2464. Expanded(
  2465. flex: 5,
  2466. child: new Column(
  2467. crossAxisAlignment:
  2468. CrossAxisAlignment.start,
  2469. children: <Widget>[
  2470. Row(
  2471. children: <Widget>[
  2472. new Text("Pekerjaan",
  2473. textAlign: TextAlign.left),
  2474. _iconCheck(_pekerjaan2, _pekerjaan3)
  2475. ],
  2476. ),
  2477. _jp(),
  2478. ],
  2479. ),
  2480. ),
  2481. new Padding(
  2482. padding: EdgeInsets.only(left: 5.0),
  2483. ),
  2484. Expanded(
  2485. flex: 5,
  2486. child: new Column(
  2487. crossAxisAlignment:
  2488. CrossAxisAlignment.start,
  2489. children: <Widget>[
  2490. Row(
  2491. children: <Widget>[
  2492. new Text("Nama Ibu Kandung",
  2493. textAlign: TextAlign.left),
  2494. _iconCheck(_ibu2, _ibu3)
  2495. ],
  2496. ),
  2497. new TextFormField(
  2498. validator: (value) {
  2499. if (value.isEmpty) {
  2500. return '';
  2501. }
  2502. },
  2503. controller: controllerIbu,
  2504. keyboardType: TextInputType.text,
  2505. decoration: InputDecoration(
  2506. contentPadding: EdgeInsets.all(8.0),
  2507. border: OutlineInputBorder(),
  2508. hintText: "Nama Ibu Kandung",
  2509. ),
  2510. ),
  2511. Text(
  2512. _ibu == "" ? "" : _ibu,
  2513. style: TextStyle(color: Colors.green),
  2514. )
  2515. ],
  2516. ),
  2517. ),
  2518. ],
  2519. ),
  2520. Container(
  2521. width: MediaQuery.of(context).size.width,
  2522. child: new Column(
  2523. crossAxisAlignment: CrossAxisAlignment.start,
  2524. children: <Widget>[
  2525. Row(
  2526. children: <Widget>[
  2527. new Text("Alamat",
  2528. textAlign: TextAlign.left),
  2529. _iconCheck(_alamat2, _alamat3)
  2530. ],
  2531. ),
  2532. new TextFormField(
  2533. validator: (value) {
  2534. if (value.isEmpty) {
  2535. return '';
  2536. }
  2537. },
  2538. controller: controllerAlamat,
  2539. keyboardType: TextInputType.text,
  2540. maxLines: 4,
  2541. decoration: InputDecoration(
  2542. contentPadding: EdgeInsets.all(8.0),
  2543. border: OutlineInputBorder(),
  2544. hintText: "Alamat",
  2545. ),
  2546. ),
  2547. Text(
  2548. _alamat == "" ? "" : _alamat,
  2549. style: TextStyle(color: Colors.green),
  2550. )
  2551. ],
  2552. ),
  2553. ),
  2554. new Row(
  2555. children: <Widget>[
  2556. Expanded(
  2557. flex: 5,
  2558. child: new Column(
  2559. crossAxisAlignment:
  2560. CrossAxisAlignment.start,
  2561. children: <Widget>[
  2562. Row(
  2563. children: <Widget>[
  2564. new Text("RT",
  2565. textAlign: TextAlign.left),
  2566. _iconCheck(_rt2, _rt3)
  2567. ],
  2568. ),
  2569. new TextField(
  2570. controller: controllerRT,
  2571. keyboardType: TextInputType.number,
  2572. decoration: InputDecoration(
  2573. contentPadding: EdgeInsets.all(8.0),
  2574. border: OutlineInputBorder(),
  2575. hintText: "RT",
  2576. ),
  2577. ),
  2578. Text(
  2579. _rt == "" ? "" : _rt,
  2580. style: TextStyle(color: Colors.green),
  2581. )
  2582. ],
  2583. ),
  2584. ),
  2585. new Padding(
  2586. padding: EdgeInsets.only(left: 5.0),
  2587. ),
  2588. Expanded(
  2589. flex: 5,
  2590. child: new Column(
  2591. crossAxisAlignment:
  2592. CrossAxisAlignment.start,
  2593. children: <Widget>[
  2594. Row(
  2595. children: <Widget>[
  2596. new Text("RW",
  2597. textAlign: TextAlign.left),
  2598. _iconCheck(_rw2, _rw3)
  2599. ],
  2600. ),
  2601. new TextField(
  2602. controller: controllerRW,
  2603. keyboardType: TextInputType.number,
  2604. decoration: InputDecoration(
  2605. contentPadding: EdgeInsets.all(8.0),
  2606. border: OutlineInputBorder(),
  2607. hintText: "RW",
  2608. ),
  2609. ),
  2610. Text(
  2611. _rw == "" ? "" : _rw,
  2612. style: TextStyle(color: Colors.green),
  2613. )
  2614. ],
  2615. ),
  2616. ),
  2617. ],
  2618. ),
  2619. new Column(
  2620. crossAxisAlignment: CrossAxisAlignment.start,
  2621. children: <Widget>[
  2622. Row(
  2623. children: <Widget>[
  2624. new Text("Provinsi*",
  2625. textAlign: TextAlign.left),
  2626. _iconCheck(_provinsi2, _provinsi3)
  2627. ],
  2628. ),
  2629. Container(
  2630. width: MediaQuery.of(context).size.width,
  2631. child: DropdownButtonHideUnderline(
  2632. child: Container(
  2633. height: 40.0,
  2634. decoration: ShapeDecoration(
  2635. shape: RoundedRectangleBorder(
  2636. side: BorderSide(
  2637. color: vprovinsi == 0 ||
  2638. vprovinsi == 1
  2639. ? Colors.black
  2640. : Colors.red,
  2641. width: 1.0,
  2642. style: BorderStyle.solid),
  2643. borderRadius: BorderRadius.all(
  2644. Radius.circular(5.0)),
  2645. ),
  2646. ),
  2647. child: ButtonTheme(
  2648. alignedDropdown: true,
  2649. child: new DropdownButton<String>(
  2650. hint: new Text("Pilih Provinsi"),
  2651. value: selectedRegion,
  2652. isDense: true,
  2653. onChanged: (String newValue) {
  2654. setState(() {
  2655. selectedRegion = newValue;
  2656. vprovinsi = 1;
  2657. });
  2658. _getKota(newValue, "1");
  2659. },
  2660. items: _region.map((Provinsi map) {
  2661. return new DropdownMenuItem<
  2662. String>(
  2663. value: map.id,
  2664. child: new Text(map.name,
  2665. style: new TextStyle(
  2666. color: Colors.black,
  2667. fontSize: 13.0)),
  2668. );
  2669. }).toList(),
  2670. ),
  2671. ),
  2672. ),
  2673. ),
  2674. ),
  2675. Text(
  2676. _provinsi == "" ? "" : _provinsi,
  2677. style: TextStyle(color: Colors.green),
  2678. ),
  2679. Text(
  2680. vprovinsi == 0 || vprovinsi == 1
  2681. ? ""
  2682. : "",
  2683. style: TextStyle(color: Colors.red)),
  2684. ],
  2685. ),
  2686. new Column(
  2687. crossAxisAlignment: CrossAxisAlignment.start,
  2688. children: <Widget>[
  2689. Row(
  2690. children: <Widget>[
  2691. new Text("Kota / Kabupaten*",
  2692. textAlign: TextAlign.left),
  2693. _iconCheck(_kota2, _kota3)
  2694. ],
  2695. ),
  2696. Container(
  2697. width: MediaQuery.of(context).size.width,
  2698. child: DropdownButtonHideUnderline(
  2699. child: Container(
  2700. height: 40.0,
  2701. decoration: ShapeDecoration(
  2702. shape: RoundedRectangleBorder(
  2703. side: BorderSide(
  2704. color: vkota == 0 || vkota == 1
  2705. ? Colors.black
  2706. : Colors.red,
  2707. width: 1.0,
  2708. style: BorderStyle.solid),
  2709. borderRadius: BorderRadius.all(
  2710. Radius.circular(5.0)),
  2711. ),
  2712. ),
  2713. child: ButtonTheme(
  2714. alignedDropdown: true,
  2715. child: new DropdownButton<String>(
  2716. hint: new Text("Pilih Kota/Kab"),
  2717. value: selectedKota,
  2718. isDense: true,
  2719. onChanged: (String newValue) {
  2720. setState(() {
  2721. selectedKota = newValue;
  2722. vkota = 1;
  2723. });
  2724. _getKec(newValue, selectedRegion,
  2725. "1");
  2726. },
  2727. items: _kotaSelec.map((Kota map) {
  2728. return new DropdownMenuItem<
  2729. String>(
  2730. value: map.id,
  2731. child: new Text(map.name,
  2732. style: new TextStyle(
  2733. color: Colors.black,
  2734. fontSize: 13.0)),
  2735. );
  2736. }).toList(),
  2737. ),
  2738. ),
  2739. ),
  2740. ),
  2741. ),
  2742. Text(
  2743. _kota == "" ? "" : _kota,
  2744. style: TextStyle(color: Colors.green),
  2745. ),
  2746. Text(vkota == 0 || vkota == 1 ? "" : "",
  2747. style: TextStyle(color: Colors.red)),
  2748. ],
  2749. ),
  2750. new Column(
  2751. crossAxisAlignment: CrossAxisAlignment.start,
  2752. children: <Widget>[
  2753. Row(
  2754. children: <Widget>[
  2755. new Text("Kecamatan*",
  2756. textAlign: TextAlign.left),
  2757. _iconCheck(_kec2, _kec3)
  2758. ],
  2759. ),
  2760. Container(
  2761. width: MediaQuery.of(context).size.width,
  2762. child: DropdownButtonHideUnderline(
  2763. child: Container(
  2764. height: 40.0,
  2765. decoration: ShapeDecoration(
  2766. shape: RoundedRectangleBorder(
  2767. side: BorderSide(
  2768. color: vkec == 0 || vkec == 1
  2769. ? Colors.black
  2770. : Colors.red,
  2771. width: 1.0,
  2772. style: BorderStyle.solid),
  2773. borderRadius: BorderRadius.all(
  2774. Radius.circular(5.0)),
  2775. ),
  2776. ),
  2777. child: ButtonTheme(
  2778. alignedDropdown: true,
  2779. child: new DropdownButton<String>(
  2780. hint: SizedBox(
  2781. width: 150.0,
  2782. child: new Text(
  2783. "Pilih Kecamatan")),
  2784. value: selectedKec,
  2785. isDense: true,
  2786. onChanged: (String newValue) {
  2787. setState(() {
  2788. selectedKec = newValue;
  2789. vkec = 1;
  2790. });
  2791. _getKel(newValue, selectedKota,
  2792. selectedRegion, "1");
  2793. },
  2794. items:
  2795. _kecSelec.map((Kecamatan map) {
  2796. return new DropdownMenuItem<
  2797. String>(
  2798. value: map.id,
  2799. child: new Text(map.name,
  2800. style: new TextStyle(
  2801. color: Colors.black,
  2802. fontSize: 13.0)),
  2803. );
  2804. }).toList(),
  2805. ),
  2806. ),
  2807. ),
  2808. ),
  2809. ),
  2810. Text(
  2811. _kec == "" ? "" : _kec,
  2812. style: TextStyle(color: Colors.green),
  2813. ),
  2814. Text(vkec == 0 || vkec == 1 ? "" : "",
  2815. style: TextStyle(color: Colors.red)),
  2816. ],
  2817. ),
  2818. new Column(
  2819. crossAxisAlignment: CrossAxisAlignment.start,
  2820. children: <Widget>[
  2821. Row(
  2822. children: <Widget>[
  2823. new Text("Kelurahan",
  2824. textAlign: TextAlign.left),
  2825. _iconCheck(_kel2, _kel3)
  2826. ],
  2827. ),
  2828. Container(
  2829. width: MediaQuery.of(context).size.width,
  2830. child: DropdownButtonHideUnderline(
  2831. child: Container(
  2832. height: 40.0,
  2833. decoration: ShapeDecoration(
  2834. shape: RoundedRectangleBorder(
  2835. side: BorderSide(
  2836. color: vkel == 0 || vkel == 1
  2837. ? Colors.black
  2838. : Colors.red,
  2839. width: 1.0,
  2840. style: BorderStyle.solid),
  2841. borderRadius: BorderRadius.all(
  2842. Radius.circular(5.0)),
  2843. ),
  2844. ),
  2845. child: ButtonTheme(
  2846. alignedDropdown: true,
  2847. child: new DropdownButton<String>(
  2848. hint: SizedBox(
  2849. width: 150.0,
  2850. child: new Text(
  2851. "Pilih Kelurahan")),
  2852. value: selectedKel,
  2853. isDense: true,
  2854. onChanged: (String newValue) {
  2855. _getKelId(
  2856. newValue,
  2857. selectedKec,
  2858. selectedKota,
  2859. selectedRegion,
  2860. "1");
  2861. setState(() {
  2862. selectedKel = newValue;
  2863. vkel = 1;
  2864. });
  2865. },
  2866. items:
  2867. _kelSelec.map((Kelurahan map) {
  2868. return new DropdownMenuItem<
  2869. String>(
  2870. value: map.id,
  2871. child: new Text(map.name,
  2872. style: new TextStyle(
  2873. color: Colors.black,
  2874. fontSize: 13.0)),
  2875. );
  2876. }).toList(),
  2877. ),
  2878. ),
  2879. ),
  2880. ),
  2881. ),
  2882. Text(
  2883. _kel == "" ? "" : _kel,
  2884. style: TextStyle(color: Colors.green),
  2885. ),
  2886. Text(vkel == 0 || vkel == 1 ? "" : "",
  2887. style: TextStyle(color: Colors.red)),
  2888. ],
  2889. ),
  2890. new Row(
  2891. children: <Widget>[
  2892. Expanded(
  2893. flex: 5,
  2894. child: new Column(
  2895. crossAxisAlignment:
  2896. CrossAxisAlignment.start,
  2897. children: <Widget>[
  2898. Row(
  2899. children: <Widget>[
  2900. new Text("Kode Pos*",
  2901. textAlign: TextAlign.left),
  2902. _iconCheck(_kodepos2, _kodepos3)
  2903. ],
  2904. ),
  2905. new TextFormField(
  2906. validator: (value) {
  2907. if (value.isEmpty) {
  2908. return '';
  2909. }
  2910. },
  2911. controller: controllerKodePos,
  2912. keyboardType: TextInputType.number,
  2913. decoration: InputDecoration(
  2914. contentPadding: EdgeInsets.all(8.0),
  2915. border: OutlineInputBorder(),
  2916. hintText: "Kode Pos",
  2917. ),
  2918. ),
  2919. Text(
  2920. _kodepos == "" ? "" : _kodepos,
  2921. style: TextStyle(color: Colors.green),
  2922. )
  2923. ],
  2924. ),
  2925. ),
  2926. ],
  2927. ),
  2928. // new Row(
  2929. // children: <Widget>[
  2930. // Expanded(
  2931. // flex: 5,
  2932. // child: new Column(
  2933. // crossAxisAlignment:
  2934. // CrossAxisAlignment.start,
  2935. // children: <Widget>[
  2936. // Row(
  2937. // children: <Widget>[
  2938. // new Text("Kode Pos",
  2939. // textAlign: TextAlign.left),
  2940. // _iconCheck(_kodepos2, _kodepos3)
  2941. // ],
  2942. // ),
  2943. // InkWell(
  2944. // onTap: () {
  2945. // FocusScope.of(context)
  2946. // .requestFocus(new FocusNode());
  2947. // showModalBottomSheet<void>(
  2948. // context: context,
  2949. // builder: (context) {
  2950. // return _searchZipcode(1);
  2951. // });
  2952. // },
  2953. // child: IgnorePointer(
  2954. // child: new TextFormField(
  2955. // validator: (value) {
  2956. // if (value.isEmpty) {
  2957. // return '';
  2958. // }
  2959. // },
  2960. // controller: controllerKodePos,
  2961. // keyboardType: TextInputType.text,
  2962. // inputFormatters: [
  2963. // LengthLimitingTextInputFormatter(
  2964. // 5),
  2965. // WhitelistingTextInputFormatter
  2966. // .digitsOnly,
  2967. // ],
  2968. // decoration: InputDecoration(
  2969. // contentPadding: EdgeInsets.only(
  2970. // left: 8.0,
  2971. // top: 15.0,
  2972. // bottom: 15.0),
  2973. // border: OutlineInputBorder(),
  2974. // hintText: "Kode Pos",
  2975. // ),
  2976. // ),
  2977. // ),
  2978. // ),
  2979. // Text(
  2980. // _kodepos == "" ? "" : _kodepos,
  2981. // style: TextStyle(color: Colors.green),
  2982. // )
  2983. // ],
  2984. // ),
  2985. // ),
  2986. // ],
  2987. // ),
  2988. // new Row(
  2989. // children: <Widget>[
  2990. // Expanded(
  2991. // flex: 10,
  2992. // child: new Column(
  2993. // crossAxisAlignment:
  2994. // CrossAxisAlignment.start,
  2995. // children: <Widget>[
  2996. // Row(
  2997. // children: <Widget>[
  2998. // new Text("Provinsi",
  2999. // textAlign: TextAlign.left),
  3000. // _iconCheck(_provinsi2, _provinsi3)
  3001. // ],
  3002. // ),
  3003. // new TextField(
  3004. // enabled: false,
  3005. // controller: controllerProvinsi,
  3006. // keyboardType: TextInputType.text,
  3007. // decoration: InputDecoration(
  3008. // contentPadding: EdgeInsets.only(
  3009. // left: 8.0,
  3010. // top: 15.0,
  3011. // bottom: 15.0),
  3012. // border: OutlineInputBorder(),
  3013. // hintText: "Provinsi",
  3014. // ),
  3015. // ),
  3016. // Text(
  3017. // _provinsi == "" ? "" : _provinsi,
  3018. // style: TextStyle(color: Colors.green),
  3019. // )
  3020. // ],
  3021. // ),
  3022. // ),
  3023. // ],
  3024. // ),
  3025. // new Row(
  3026. // children: <Widget>[
  3027. // Expanded(
  3028. // flex: 10,
  3029. // child: new Column(
  3030. // crossAxisAlignment:
  3031. // CrossAxisAlignment.start,
  3032. // children: <Widget>[
  3033. // Row(
  3034. // children: <Widget>[
  3035. // new Text("Kota / Kabupaten",
  3036. // textAlign: TextAlign.left),
  3037. // _iconCheck(_kota2, _kota3)
  3038. // ],
  3039. // ),
  3040. // new TextField(
  3041. // enabled: false,
  3042. // controller: controllerKota,
  3043. // keyboardType: TextInputType.text,
  3044. // decoration: InputDecoration(
  3045. // contentPadding: EdgeInsets.only(
  3046. // left: 8.0,
  3047. // top: 15.0,
  3048. // bottom: 15.0),
  3049. // border: OutlineInputBorder(),
  3050. // hintText: "Kota / Kabupaten",
  3051. // ),
  3052. // ),
  3053. // Text(
  3054. // _kota == "" ? "" : _kota,
  3055. // style: TextStyle(color: Colors.green),
  3056. // )
  3057. // ],
  3058. // ),
  3059. // ),
  3060. // ],
  3061. // ),
  3062. // new Row(
  3063. // children: <Widget>[
  3064. // Expanded(
  3065. // flex: 10,
  3066. // child: new Column(
  3067. // crossAxisAlignment:
  3068. // CrossAxisAlignment.start,
  3069. // children: <Widget>[
  3070. // Row(
  3071. // children: <Widget>[
  3072. // new Text("Kecamatan",
  3073. // textAlign: TextAlign.left),
  3074. // _iconCheck(_kec2, _kec3)
  3075. // ],
  3076. // ),
  3077. // new TextField(
  3078. // enabled: false,
  3079. // controller: controllerKec,
  3080. // keyboardType: TextInputType.text,
  3081. // decoration: InputDecoration(
  3082. // contentPadding: EdgeInsets.only(
  3083. // left: 8.0,
  3084. // top: 15.0,
  3085. // bottom: 15.0),
  3086. // border: OutlineInputBorder(),
  3087. // hintText: "Kecamatan",
  3088. // ),
  3089. // ),
  3090. // Text(
  3091. // _kec == "" ? "" : _kec,
  3092. // style: TextStyle(color: Colors.green),
  3093. // )
  3094. // ],
  3095. // ),
  3096. // ),
  3097. // ],
  3098. // ),
  3099. // new Row(
  3100. // children: <Widget>[
  3101. // Expanded(
  3102. // flex: 10,
  3103. // child: new Column(
  3104. // crossAxisAlignment:
  3105. // CrossAxisAlignment.start,
  3106. // children: <Widget>[
  3107. // Row(
  3108. // children: <Widget>[
  3109. // new Text("Kelurahan",
  3110. // textAlign: TextAlign.left),
  3111. // _iconCheck(_kel2, _kel3)
  3112. // ],
  3113. // ),
  3114. // new TextField(
  3115. // enabled: false,
  3116. // controller: controllerKel,
  3117. // keyboardType: TextInputType.text,
  3118. // decoration: InputDecoration(
  3119. // contentPadding: EdgeInsets.only(
  3120. // left: 8.0,
  3121. // top: 15.0,
  3122. // bottom: 15.0),
  3123. // border: OutlineInputBorder(),
  3124. // hintText: "Kelurahan",
  3125. // ),
  3126. // ),
  3127. // Text(
  3128. // _kel == "" ? "" : _kel,
  3129. // style: TextStyle(color: Colors.green),
  3130. // )
  3131. // ],
  3132. // ),
  3133. // ),
  3134. // ],
  3135. // ),
  3136. ],
  3137. ),
  3138. )
  3139. ],
  3140. ),
  3141. ),
  3142. Padding(
  3143. padding: EdgeInsets.only(
  3144. top: 10.0,
  3145. )),
  3146. new Container(
  3147. decoration: BoxDecoration(
  3148. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  3149. border: new Border.all(
  3150. width: 1,
  3151. color: Color.fromRGBO(83, 108, 121, 1),
  3152. )),
  3153. child: Column(
  3154. children: <Widget>[
  3155. new Container(
  3156. width: MediaQuery.of(context).size.width,
  3157. padding: EdgeInsets.all(5.0),
  3158. color: Color.fromRGBO(83, 108, 121, 1),
  3159. child: Row(
  3160. children: <Widget>[
  3161. Expanded(
  3162. flex: 4,
  3163. child: Text("SESUAI DOMISILI",
  3164. style: new TextStyle(
  3165. fontSize: 14.0, color: Colors.white)),
  3166. ),
  3167. Expanded(
  3168. flex: 6,
  3169. child: InkWell(
  3170. onTap: () {
  3171. setState(() {
  3172. controllerAlamat2.text =
  3173. controllerAlamat.text;
  3174. controllerRT2.text = controllerRT.text;
  3175. controllerRW2.text = controllerRW.text;
  3176. if (selectedRegion != "") {
  3177. selectedRegion2 = selectedRegion;
  3178. vprovinsi2 = 1;
  3179. }
  3180. if (selectedKota != "") {
  3181. _getKota(selectedRegion, "3");
  3182. vkota2 = 1;
  3183. }
  3184. if (selectedKec != "") {
  3185. _getKec(selectedKota, selectedRegion,
  3186. "3");
  3187. vkec2 = 1;
  3188. }
  3189. if (selectedKel != "") {
  3190. _getKel(selectedKec, selectedKota,
  3191. selectedRegion, "3");
  3192. vkel2 = 1;
  3193. }
  3194. controllerKodePos2.text =
  3195. controllerKodePos.text;
  3196. });
  3197. },
  3198. child: Row(
  3199. children: <Widget>[
  3200. Expanded(
  3201. flex: 8,
  3202. child: Text("Sama Dengan Di Atas",
  3203. style: new TextStyle(
  3204. fontSize: 14.0,
  3205. color: Colors.white)),
  3206. ),
  3207. Expanded(
  3208. flex: 2,
  3209. child: Column(
  3210. mainAxisAlignment:
  3211. MainAxisAlignment.center,
  3212. children: <Widget>[
  3213. // Text("Mon"),
  3214. Checkbox(
  3215. value: sama,
  3216. onChanged: (bool value) {
  3217. setState(() {
  3218. sama = value;
  3219. });
  3220. _samaDenganDiatas();
  3221. },
  3222. ),
  3223. ],
  3224. ),
  3225. ),
  3226. ],
  3227. )),
  3228. )
  3229. ],
  3230. ),
  3231. ),
  3232. Padding(
  3233. padding: EdgeInsets.all(10.0),
  3234. child: Column(
  3235. children: <Widget>[
  3236. Container(
  3237. width: MediaQuery.of(context).size.width,
  3238. child: new Column(
  3239. crossAxisAlignment: CrossAxisAlignment.start,
  3240. children: <Widget>[
  3241. new Text("Alamat",
  3242. textAlign: TextAlign.left),
  3243. new TextFormField(
  3244. validator: (value) {
  3245. if (value.isEmpty) {
  3246. return '';
  3247. }
  3248. },
  3249. controller: controllerAlamat2,
  3250. keyboardType: TextInputType.text,
  3251. maxLines: 4,
  3252. decoration: InputDecoration(
  3253. contentPadding: EdgeInsets.all(8.0),
  3254. border: OutlineInputBorder(),
  3255. hintText: "Alamat",
  3256. ),
  3257. )
  3258. ],
  3259. ),
  3260. ),
  3261. new Row(
  3262. children: <Widget>[
  3263. Expanded(
  3264. flex: 5,
  3265. child: new Column(
  3266. crossAxisAlignment:
  3267. CrossAxisAlignment.start,
  3268. children: <Widget>[
  3269. new Text("RT",
  3270. textAlign: TextAlign.left),
  3271. new TextField(
  3272. controller: controllerRT2,
  3273. keyboardType: TextInputType.number,
  3274. decoration: InputDecoration(
  3275. contentPadding: EdgeInsets.all(8.0),
  3276. border: OutlineInputBorder(),
  3277. hintText: "RT",
  3278. ),
  3279. )
  3280. ],
  3281. ),
  3282. ),
  3283. new Padding(
  3284. padding: EdgeInsets.only(left: 5.0),
  3285. ),
  3286. Expanded(
  3287. flex: 5,
  3288. child: new Column(
  3289. crossAxisAlignment:
  3290. CrossAxisAlignment.start,
  3291. children: <Widget>[
  3292. new Text("RW",
  3293. textAlign: TextAlign.left),
  3294. new TextField(
  3295. controller: controllerRW2,
  3296. keyboardType: TextInputType.number,
  3297. decoration: InputDecoration(
  3298. contentPadding: EdgeInsets.all(8.0),
  3299. border: OutlineInputBorder(),
  3300. hintText: "RW",
  3301. ),
  3302. )
  3303. ],
  3304. ),
  3305. ),
  3306. ],
  3307. ),
  3308. new Column(
  3309. crossAxisAlignment: CrossAxisAlignment.start,
  3310. children: <Widget>[
  3311. new Text("Provinsi*",
  3312. textAlign: TextAlign.left),
  3313. Container(
  3314. width: MediaQuery.of(context).size.width,
  3315. child: DropdownButtonHideUnderline(
  3316. child: Container(
  3317. height: 40.0,
  3318. decoration: ShapeDecoration(
  3319. shape: RoundedRectangleBorder(
  3320. side: BorderSide(
  3321. color: vprovinsi2 == 0 ||
  3322. vprovinsi2 == 1
  3323. ? Colors.black
  3324. : Colors.red,
  3325. width: 1.0,
  3326. style: BorderStyle.solid),
  3327. borderRadius: BorderRadius.all(
  3328. Radius.circular(5.0)),
  3329. ),
  3330. ),
  3331. child: ButtonTheme(
  3332. alignedDropdown: true,
  3333. child: new DropdownButton<String>(
  3334. hint: new Text("Pilih Provinsi"),
  3335. value: selectedRegion2,
  3336. isDense: true,
  3337. onChanged: (String newValue) {
  3338. setState(() {
  3339. selectedRegion2 = newValue;
  3340. vprovinsi2 = 1;
  3341. });
  3342. _getKota(newValue, "2");
  3343. },
  3344. items: _region.map((Provinsi map) {
  3345. return new DropdownMenuItem<
  3346. String>(
  3347. value: map.id,
  3348. child: new Text(map.name,
  3349. style: new TextStyle(
  3350. color: Colors.black,
  3351. fontSize: 13.0)),
  3352. );
  3353. }).toList(),
  3354. ),
  3355. ),
  3356. ),
  3357. ),
  3358. ),
  3359. Text(
  3360. vprovinsi2 == 0 || vprovinsi2 == 1
  3361. ? ""
  3362. : "",
  3363. style: TextStyle(color: Colors.red)),
  3364. ],
  3365. ),
  3366. new Column(
  3367. crossAxisAlignment: CrossAxisAlignment.start,
  3368. children: <Widget>[
  3369. new Text("Kota / Kabupaten*",
  3370. textAlign: TextAlign.left),
  3371. Container(
  3372. width: MediaQuery.of(context).size.width,
  3373. child: DropdownButtonHideUnderline(
  3374. child: Container(
  3375. height: 40.0,
  3376. decoration: ShapeDecoration(
  3377. shape: RoundedRectangleBorder(
  3378. side: BorderSide(
  3379. color:
  3380. vkota2 == 0 || vkota2 == 1
  3381. ? Colors.black
  3382. : Colors.red,
  3383. width: 1.0,
  3384. style: BorderStyle.solid),
  3385. borderRadius: BorderRadius.all(
  3386. Radius.circular(5.0)),
  3387. ),
  3388. ),
  3389. child: ButtonTheme(
  3390. alignedDropdown: true,
  3391. child: new DropdownButton<String>(
  3392. hint: new Text("Pilih Kota/Kab"),
  3393. value: selectedKota2,
  3394. isDense: true,
  3395. onChanged: (String newValue) {
  3396. setState(() {
  3397. selectedKota2 = newValue;
  3398. vkota2 = 1;
  3399. });
  3400. _getKec(newValue, selectedRegion2,
  3401. "2");
  3402. },
  3403. items: _kotaSelec2.map((Kota map) {
  3404. return new DropdownMenuItem<
  3405. String>(
  3406. value: map.id,
  3407. child: new Text(map.name,
  3408. style: new TextStyle(
  3409. color: Colors.black,
  3410. fontSize: 13.0)),
  3411. );
  3412. }).toList(),
  3413. ),
  3414. ),
  3415. ),
  3416. ),
  3417. ),
  3418. Text(vkota2 == 0 || vkota2 == 1 ? "" : "",
  3419. style: TextStyle(color: Colors.red)),
  3420. ],
  3421. ),
  3422. new Column(
  3423. crossAxisAlignment: CrossAxisAlignment.start,
  3424. children: <Widget>[
  3425. new Text("Kecamatan*",
  3426. textAlign: TextAlign.left),
  3427. Container(
  3428. width: MediaQuery.of(context).size.width,
  3429. child: DropdownButtonHideUnderline(
  3430. child: Container(
  3431. height: 40.0,
  3432. decoration: ShapeDecoration(
  3433. shape: RoundedRectangleBorder(
  3434. side: BorderSide(
  3435. color: vkec2 == 0 || vkec2 == 1
  3436. ? Colors.black
  3437. : Colors.red,
  3438. width: 1.0,
  3439. style: BorderStyle.solid),
  3440. borderRadius: BorderRadius.all(
  3441. Radius.circular(5.0)),
  3442. ),
  3443. ),
  3444. child: ButtonTheme(
  3445. alignedDropdown: true,
  3446. child: new DropdownButton<String>(
  3447. hint: SizedBox(
  3448. width: 150.0,
  3449. child: new Text(
  3450. "Pilih Kecamatan")),
  3451. value: selectedKec2,
  3452. isDense: true,
  3453. onChanged: (String newValue) {
  3454. setState(() {
  3455. selectedKec2 = newValue;
  3456. vkec2 = 1;
  3457. });
  3458. _getKel(newValue, selectedKota2,
  3459. selectedRegion2, "2");
  3460. },
  3461. items:
  3462. _kecSelec2.map((Kecamatan map) {
  3463. return new DropdownMenuItem<
  3464. String>(
  3465. value: map.id,
  3466. child: new Text(map.name,
  3467. style: new TextStyle(
  3468. color: Colors.black,
  3469. fontSize: 13.0)),
  3470. );
  3471. }).toList(),
  3472. ),
  3473. ),
  3474. ),
  3475. ),
  3476. ),
  3477. Text(vkec2 == 0 || vkec2 == 1 ? "" : "",
  3478. style: TextStyle(color: Colors.red)),
  3479. ],
  3480. ),
  3481. new Column(
  3482. crossAxisAlignment: CrossAxisAlignment.start,
  3483. children: <Widget>[
  3484. new Text("Kelurahan*",
  3485. textAlign: TextAlign.left),
  3486. Container(
  3487. width: MediaQuery.of(context).size.width,
  3488. child: DropdownButtonHideUnderline(
  3489. child: Container(
  3490. height: 40.0,
  3491. decoration: ShapeDecoration(
  3492. shape: RoundedRectangleBorder(
  3493. side: BorderSide(
  3494. color: vkel2 == 0 || vkel2 == 1
  3495. ? Colors.black
  3496. : Colors.red,
  3497. width: 1.0,
  3498. style: BorderStyle.solid),
  3499. borderRadius: BorderRadius.all(
  3500. Radius.circular(5.0)),
  3501. ),
  3502. ),
  3503. child: ButtonTheme(
  3504. alignedDropdown: true,
  3505. child: new DropdownButton<String>(
  3506. hint: SizedBox(
  3507. width: 150.0,
  3508. child: new Text(
  3509. "Pilih Kelurahan")),
  3510. value: selectedKel2,
  3511. isDense: true,
  3512. onChanged: (String newValue) {
  3513. _getKelId(
  3514. newValue,
  3515. selectedKec2,
  3516. selectedKota2,
  3517. selectedRegion2,
  3518. "2");
  3519. setState(() {
  3520. selectedKel2 = newValue;
  3521. vkel2 = 1;
  3522. });
  3523. },
  3524. items:
  3525. _kelSelec2.map((Kelurahan map) {
  3526. return new DropdownMenuItem<
  3527. String>(
  3528. value: map.id,
  3529. child: new Text(map.name,
  3530. style: new TextStyle(
  3531. color: Colors.black,
  3532. fontSize: 13.0)),
  3533. );
  3534. }).toList(),
  3535. ),
  3536. ),
  3537. ),
  3538. ),
  3539. ),
  3540. Text(vkel2 == 0 || vkel2 == 1 ? "" : "",
  3541. style: TextStyle(color: Colors.red)),
  3542. ],
  3543. ),
  3544. new Row(
  3545. children: <Widget>[
  3546. Expanded(
  3547. flex: 5,
  3548. child: new Column(
  3549. crossAxisAlignment:
  3550. CrossAxisAlignment.start,
  3551. children: <Widget>[
  3552. new Text("Kode Pos*",
  3553. textAlign: TextAlign.left),
  3554. new TextFormField(
  3555. validator: (value) {
  3556. if (value.isEmpty) {
  3557. return '';
  3558. }
  3559. },
  3560. controller: controllerKodePos2,
  3561. maxLength: 5,
  3562. keyboardType: TextInputType.number,
  3563. decoration: InputDecoration(
  3564. contentPadding: EdgeInsets.all(8.0),
  3565. border: OutlineInputBorder(),
  3566. hintText: "Kode Pos",
  3567. ),
  3568. )
  3569. ],
  3570. ),
  3571. ),
  3572. ],
  3573. ),
  3574. // new Row(
  3575. // children: <Widget>[
  3576. // Expanded(
  3577. // flex: 5,
  3578. // child: new Column(
  3579. // crossAxisAlignment:
  3580. // CrossAxisAlignment.start,
  3581. // children: <Widget>[
  3582. // new Text("Kode Pos",
  3583. // textAlign: TextAlign.left),
  3584. // new TextField(
  3585. // controller: controllerKodePos2,
  3586. // keyboardType: TextInputType.text,
  3587. // inputFormatters: [
  3588. // LengthLimitingTextInputFormatter(5),
  3589. // WhitelistingTextInputFormatter
  3590. // .digitsOnly,
  3591. // ],
  3592. // decoration: InputDecoration(
  3593. // contentPadding: EdgeInsets.only(
  3594. // left: 8.0,
  3595. // top: 15.0,
  3596. // bottom: 15.0),
  3597. // border: OutlineInputBorder(),
  3598. // hintText: "Kode Pos",
  3599. // ),
  3600. // onTap: () {
  3601. // FocusScope.of(context)
  3602. // .requestFocus(new FocusNode());
  3603. // showModalBottomSheet<void>(
  3604. // context: context,
  3605. // builder: (context) {
  3606. // return _searchZipcode(2);
  3607. // });
  3608. // },
  3609. // )
  3610. // ],
  3611. // ),
  3612. // ),
  3613. // ],
  3614. // ),
  3615. // new Row(
  3616. // children: <Widget>[
  3617. // Expanded(
  3618. // flex: 10,
  3619. // child: new Column(
  3620. // crossAxisAlignment:
  3621. // CrossAxisAlignment.start,
  3622. // children: <Widget>[
  3623. // new Text("Provinsi",
  3624. // textAlign: TextAlign.left),
  3625. // new TextField(
  3626. // enabled: false,
  3627. // controller: controllerProvinsi2,
  3628. // keyboardType: TextInputType.text,
  3629. // decoration: InputDecoration(
  3630. // contentPadding: EdgeInsets.only(
  3631. // left: 8.0,
  3632. // top: 15.0,
  3633. // bottom: 15.0),
  3634. // border: OutlineInputBorder(),
  3635. // hintText: "Provinsi",
  3636. // ),
  3637. // )
  3638. // ],
  3639. // ),
  3640. // ),
  3641. // ],
  3642. // ),
  3643. // new Row(
  3644. // children: <Widget>[
  3645. // Expanded(
  3646. // flex: 10,
  3647. // child: new Column(
  3648. // crossAxisAlignment:
  3649. // CrossAxisAlignment.start,
  3650. // children: <Widget>[
  3651. // new Text("Kota / Kabupaten",
  3652. // textAlign: TextAlign.left),
  3653. // new TextField(
  3654. // enabled: false,
  3655. // controller: controllerKota2,
  3656. // keyboardType: TextInputType.text,
  3657. // decoration: InputDecoration(
  3658. // contentPadding: EdgeInsets.only(
  3659. // left: 8.0,
  3660. // top: 15.0,
  3661. // bottom: 15.0),
  3662. // border: OutlineInputBorder(),
  3663. // hintText: "Kota / Kabupaten",
  3664. // ),
  3665. // )
  3666. // ],
  3667. // ),
  3668. // ),
  3669. // ],
  3670. // ),
  3671. // new Row(
  3672. // children: <Widget>[
  3673. // Expanded(
  3674. // flex: 10,
  3675. // child: new Column(
  3676. // crossAxisAlignment:
  3677. // CrossAxisAlignment.start,
  3678. // children: <Widget>[
  3679. // new Text("Kecamatan",
  3680. // textAlign: TextAlign.left),
  3681. // new TextField(
  3682. // enabled: false,
  3683. // controller: controllerKec2,
  3684. // keyboardType: TextInputType.text,
  3685. // decoration: InputDecoration(
  3686. // contentPadding: EdgeInsets.only(
  3687. // left: 8.0,
  3688. // top: 15.0,
  3689. // bottom: 15.0),
  3690. // border: OutlineInputBorder(),
  3691. // hintText: "Kecamatan",
  3692. // ),
  3693. // )
  3694. // ],
  3695. // ),
  3696. // ),
  3697. // ],
  3698. // ),
  3699. // new Row(
  3700. // children: <Widget>[
  3701. // Expanded(
  3702. // flex: 10,
  3703. // child: new Column(
  3704. // crossAxisAlignment:
  3705. // CrossAxisAlignment.start,
  3706. // children: <Widget>[
  3707. // new Text("Kelurahan",
  3708. // textAlign: TextAlign.left),
  3709. // new TextField(
  3710. // enabled: false,
  3711. // controller: controllerKel2,
  3712. // keyboardType: TextInputType.text,
  3713. // decoration: InputDecoration(
  3714. // contentPadding: EdgeInsets.only(
  3715. // left: 8.0,
  3716. // top: 15.0,
  3717. // bottom: 15.0),
  3718. // border: OutlineInputBorder(),
  3719. // hintText: "Kelurahan",
  3720. // ),
  3721. // )
  3722. // ],
  3723. // ),
  3724. // ),
  3725. // ],
  3726. // ),
  3727. ],
  3728. ),
  3729. )
  3730. ],
  3731. ),
  3732. ),
  3733. new Row(
  3734. children: <Widget>[
  3735. Expanded(
  3736. flex: 5,
  3737. child: new Column(
  3738. crossAxisAlignment: CrossAxisAlignment.start,
  3739. children: <Widget>[
  3740. new Text("Jenis Pekerjaan",
  3741. textAlign: TextAlign.left),
  3742. Container(
  3743. width: MediaQuery.of(context).size.width,
  3744. child: DropdownButtonHideUnderline(
  3745. child: Container(
  3746. height: 50.0,
  3747. decoration: ShapeDecoration(
  3748. shape: RoundedRectangleBorder(
  3749. side: BorderSide(
  3750. width: 1.0, style: BorderStyle.solid),
  3751. borderRadius: BorderRadius.all(
  3752. Radius.circular(5.0)),
  3753. ),
  3754. ),
  3755. child: ButtonTheme(
  3756. alignedDropdown: true,
  3757. child: new DropdownButton(
  3758. onChanged: (String value) {
  3759. pilihPekerjaan(value);
  3760. },
  3761. value: _kerja,
  3762. items: kerja.map((String value) {
  3763. return new DropdownMenuItem(
  3764. value: value,
  3765. child: new Text(value),
  3766. );
  3767. }).toList(),
  3768. ),
  3769. ),
  3770. ),
  3771. ),
  3772. ),
  3773. ],
  3774. ),
  3775. ),
  3776. new Padding(
  3777. padding: EdgeInsets.only(left: 5.0),
  3778. ),
  3779. Expanded(
  3780. flex: 5,
  3781. child: new Column(
  3782. crossAxisAlignment: CrossAxisAlignment.start,
  3783. children: <Widget>[
  3784. new Text("Status", textAlign: TextAlign.left),
  3785. new TextField(
  3786. enabled: false,
  3787. controller: controllerStatus,
  3788. keyboardType: TextInputType.text,
  3789. inputFormatters: [
  3790. LengthLimitingTextInputFormatter(13),
  3791. WhitelistingTextInputFormatter.digitsOnly,
  3792. ],
  3793. decoration: InputDecoration(
  3794. contentPadding: EdgeInsets.only(
  3795. left: 8.0, top: 15.0, bottom: 15.0),
  3796. border: OutlineInputBorder(),
  3797. hintText: "Status",
  3798. ),
  3799. )
  3800. ],
  3801. ),
  3802. ),
  3803. ],
  3804. ),
  3805. new Row(
  3806. children: <Widget>[
  3807. Expanded(
  3808. flex: 5,
  3809. child: new Column(
  3810. crossAxisAlignment: CrossAxisAlignment.start,
  3811. children: <Widget>[
  3812. new Text("Telepon", textAlign: TextAlign.left),
  3813. new TextField(
  3814. controller: controllerTelepon,
  3815. keyboardType: TextInputType.number,
  3816. inputFormatters: [
  3817. LengthLimitingTextInputFormatter(18),
  3818. WhitelistingTextInputFormatter.digitsOnly,
  3819. ],
  3820. decoration: InputDecoration(
  3821. contentPadding: EdgeInsets.only(
  3822. left: 8.0, top: 15.0, bottom: 15.0),
  3823. border: OutlineInputBorder(),
  3824. hintText: "Telepon",
  3825. ),
  3826. )
  3827. ],
  3828. ),
  3829. ),
  3830. new Padding(
  3831. padding: EdgeInsets.only(left: 5.0),
  3832. ),
  3833. Expanded(
  3834. flex: 5,
  3835. child: new Column(
  3836. crossAxisAlignment: CrossAxisAlignment.start,
  3837. children: <Widget>[
  3838. new Text("No Handphone", textAlign: TextAlign.left),
  3839. new TextFormField(
  3840. validator: (value) {
  3841. if (value.isEmpty) {
  3842. return '';
  3843. }
  3844. },
  3845. enabled: hpActive,
  3846. controller: controllerHandphone,
  3847. inputFormatters: [
  3848. LengthLimitingTextInputFormatter(13),
  3849. WhitelistingTextInputFormatter.digitsOnly,
  3850. ],
  3851. keyboardType: TextInputType.number,
  3852. decoration: InputDecoration(
  3853. contentPadding: EdgeInsets.only(
  3854. left: 8.0, top: 15.0, bottom: 15.0),
  3855. border: OutlineInputBorder(),
  3856. hintText: "No Handphone",
  3857. ),
  3858. )
  3859. ],
  3860. ),
  3861. ),
  3862. ],
  3863. ),
  3864. new Row(
  3865. children: <Widget>[
  3866. Expanded(
  3867. flex: 10,
  3868. child: new Column(
  3869. crossAxisAlignment: CrossAxisAlignment.start,
  3870. children: <Widget>[
  3871. new Text("Email", textAlign: TextAlign.left),
  3872. new TextFormField(
  3873. validator: (value) {
  3874. if (value.isEmpty) {
  3875. return '';
  3876. }
  3877. },
  3878. enabled: hpActive,
  3879. controller: controllerEmail,
  3880. keyboardType: TextInputType.text,
  3881. decoration: InputDecoration(
  3882. contentPadding: EdgeInsets.only(
  3883. left: 8.0, top: 15.0, bottom: 15.0),
  3884. border: OutlineInputBorder(),
  3885. hintText: "Email",
  3886. ),
  3887. )
  3888. ],
  3889. ),
  3890. ),
  3891. ],
  3892. ),
  3893. new Column(
  3894. crossAxisAlignment: CrossAxisAlignment.start,
  3895. children: <Widget>[
  3896. new Text("Kewarganegaraan", textAlign: TextAlign.left),
  3897. new TextField(
  3898. enabled: false,
  3899. controller: controllerWarganegara,
  3900. keyboardType: TextInputType.number,
  3901. inputFormatters: [
  3902. LengthLimitingTextInputFormatter(13),
  3903. WhitelistingTextInputFormatter.digitsOnly,
  3904. ],
  3905. decoration: InputDecoration(
  3906. contentPadding: EdgeInsets.all(8.0),
  3907. border: OutlineInputBorder(),
  3908. hintText: "Kewarganegaraan",
  3909. ),
  3910. )
  3911. ],
  3912. ),
  3913. _jenisPekerjaan(),
  3914. Padding(
  3915. padding: EdgeInsets.only(top: 20.0),
  3916. ),
  3917. new Container(
  3918. decoration: BoxDecoration(
  3919. borderRadius: BorderRadius.all(Radius.circular(5.0)),
  3920. border: new Border.all(
  3921. width: 1,
  3922. color: Color.fromRGBO(83, 108, 121, 1),
  3923. )),
  3924. child: Column(children: <Widget>[
  3925. new Container(
  3926. width: MediaQuery.of(context).size.width,
  3927. padding: EdgeInsets.all(5.0),
  3928. color: Color.fromRGBO(83, 108, 121, 1),
  3929. child: Text(
  3930. "Foto KTP (WNI)/Paspor (WNA) serta Foto Wajah (Wajib)",
  3931. style: new TextStyle(
  3932. fontSize: 14.0, color: Colors.white)),
  3933. ),
  3934. Padding(
  3935. padding: EdgeInsets.only(
  3936. left: 10.0, top: 10.0, right: 10.0, bottom: 10.0),
  3937. child: Container(
  3938. width: MediaQuery.of(context).size.width,
  3939. child: Column(
  3940. children: <Widget>[
  3941. new Row(
  3942. children: <Widget>[
  3943. Expanded(
  3944. flex: 5,
  3945. child: new Column(
  3946. crossAxisAlignment:
  3947. CrossAxisAlignment.center,
  3948. children: <Widget>[
  3949. // new Text("Photo KTP",
  3950. // textAlign: TextAlign.left),
  3951. FlatButton(
  3952. color: Colors.blue,
  3953. onPressed: () {
  3954. openCamera("ktp");
  3955. },
  3956. child: Text(
  3957. "ID",
  3958. style: TextStyle(
  3959. color: Colors.white),
  3960. ),
  3961. ),
  3962.  
  3963. Center(
  3964. child: _ktp == null
  3965. ? Text('No image selected')
  3966. : Text("fotoid.jpg"),
  3967. )
  3968. ],
  3969. ),
  3970. ),
  3971. new Padding(
  3972. padding: EdgeInsets.only(left: 30.0),
  3973. ),
  3974. Expanded(
  3975. flex: 5,
  3976. child: new Column(
  3977. crossAxisAlignment:
  3978. CrossAxisAlignment.center,
  3979. children: <Widget>[
  3980. // new Text("Photo Wajah",
  3981. // textAlign: TextAlign.left),
  3982. FlatButton(
  3983. color: Colors.blue,
  3984. onPressed: () {
  3985. openCamera("foto");
  3986. },
  3987. child: Text(
  3988. "Wajah",
  3989. style: TextStyle(
  3990. color: Colors.white),
  3991. ),
  3992. ),
  3993. Center(
  3994. child: _foto == null
  3995. ? Text('No image selected')
  3996. : Text("fotowajah.jpg"))
  3997. ],
  3998. ),
  3999. ),
  4000. ],
  4001. ),
  4002. ],
  4003. ),
  4004. ),
  4005. )
  4006. ])),
  4007. Padding(
  4008. padding: EdgeInsets.only(top: 20.0),
  4009. ),
  4010. _hasilID(),
  4011. Padding(
  4012. padding: EdgeInsets.only(top: 10.0),
  4013. ),
  4014. _hasilWajah(),
  4015. Padding(
  4016. padding: EdgeInsets.only(top: 10.0),
  4017. ),
  4018. _button()
  4019. ],
  4020. ),
  4021. ),
  4022. ),
  4023. ));
  4024. }
  4025.  
  4026. Widget _button() {
  4027. if (loadingKirim == false) {
  4028. if (_rejected == false) {
  4029. if (_kirims == false) {
  4030. return RaisedGradientButton(
  4031. child: Text(
  4032. 'Kirim',
  4033. style: TextStyle(color: Colors.white),
  4034. ),
  4035. gradient: LinearGradient(
  4036. colors: <Color>[
  4037. Color.fromRGBO(42, 153, 158, 1),
  4038. Color.fromRGBO(27, 104, 210, 1)
  4039. ],
  4040. ),
  4041. onPressed: () {
  4042. bool isValid = _formKey.currentState.validate();
  4043. if (_ktp == null) {
  4044. _scaffoldKey.currentState.showSnackBar(SnackBar(
  4045. backgroundColor: Colors.red,
  4046. content: Text('Foto ID Wajib Ada')));
  4047. isValid = false;
  4048. }
  4049.  
  4050. if (_foto == null) {
  4051. _scaffoldKey.currentState.showSnackBar(SnackBar(
  4052. backgroundColor: Colors.red,
  4053. content: Text('Foto Selfie Wajib Ada')));
  4054. isValid = false;
  4055. }
  4056. if (vprovinsi == 0) {
  4057. setState(() {
  4058. vprovinsi = 2;
  4059. });
  4060. isValid = false;
  4061. }
  4062.  
  4063. if (vprovinsi2 == 0) {
  4064. setState(() {
  4065. vprovinsi2 = 2;
  4066. });
  4067. isValid = false;
  4068. }
  4069.  
  4070. if (vkota == 0) {
  4071. setState(() {
  4072. vkota = 2;
  4073. });
  4074. isValid = false;
  4075. }
  4076. if (vkec == 0) {
  4077. setState(() {
  4078. vkec = 2;
  4079. });
  4080. isValid = false;
  4081. }
  4082. if (vkel == 0) {
  4083. setState(() {
  4084. vkel = 2;
  4085. });
  4086. isValid = false;
  4087. }
  4088.  
  4089. if (vkota2 == 0) {
  4090. setState(() {
  4091. vkota2 = 2;
  4092. });
  4093. isValid = false;
  4094. }
  4095. if (vkec2 == 0) {
  4096. setState(() {
  4097. vkec2 = 2;
  4098. });
  4099. isValid = false;
  4100. }
  4101. if (vkel2 == 0) {
  4102. setState(() {
  4103. vkel2 = 2;
  4104. });
  4105. isValid = false;
  4106. }
  4107. if (isValid) {
  4108. setState(() {
  4109. loadingKirim = true;
  4110. });
  4111. _kirim();
  4112. } else {
  4113. _scaffoldKey.currentState.showSnackBar(SnackBar(
  4114. backgroundColor: Colors.red,
  4115. content: Text('Semua Kotak Isian Wajib Diisi')));
  4116. }
  4117. });
  4118. } else {
  4119. return Container();
  4120. // if (_check == false) {
  4121. // return RaisedGradientButton(
  4122. // child: Text(
  4123. // 'Cek',
  4124. // style: TextStyle(color: Colors.white),
  4125. // ),
  4126. // gradient: LinearGradient(
  4127. // colors: <Color>[
  4128. // Color.fromRGBO(42, 153, 158, 1),
  4129. // Color.fromRGBO(27, 104, 210, 1)
  4130. // ],
  4131. // ),
  4132. // onPressed: () {
  4133. // _cek();
  4134. // });
  4135. // } else {
  4136. // if (_external == false) {
  4137. // return RaisedGradientButton(
  4138. // child: Text(
  4139. // 'Kesimpulan',
  4140. // style: TextStyle(color: Colors.white),
  4141. // ),
  4142. // gradient: LinearGradient(
  4143. // colors: <Color>[
  4144. // Color.fromRGBO(42, 153, 158, 1),
  4145. // Color.fromRGBO(27, 104, 210, 1)
  4146. // ],
  4147. // ),
  4148. // onPressed: () {
  4149. // _kesimpulan();
  4150. // });
  4151. // } else {
  4152. // return RaisedGradientButton(
  4153. // child: Text(
  4154. // 'Survey External',
  4155. // style: TextStyle(color: Colors.white),
  4156. // ),
  4157. // gradient: LinearGradient(
  4158. // colors: <Color>[
  4159. // Color.fromRGBO(42, 153, 158, 1),
  4160. // Color.fromRGBO(27, 104, 210, 1)
  4161. // ],
  4162. // ),
  4163. // onPressed: () {
  4164. // _checkExternal();
  4165. // // _kesimpulan();
  4166. // });
  4167. // }
  4168. // }
  4169. }
  4170. } else {
  4171. return Container();
  4172. }
  4173. } else {
  4174. return CircularProgressIndicator();
  4175. }
  4176. }
  4177.  
  4178. Future<Null> getZipcode(String code) async {
  4179. _zipcodeList.clear();
  4180. final url = new Api().url;
  4181. Response response;
  4182. response =
  4183. await Dio().get(url + "api/Kelurahan/GetByZipCode?ZipCode=" + code);
  4184.  
  4185. final json = response.data;
  4186.  
  4187. if (response.statusCode == 200) {
  4188. setState(() {
  4189. _zipcodeList =
  4190. (json).map<Zipcode>((item) => Zipcode.fromJson(item)).toList();
  4191. });
  4192. } else {
  4193. throw Exception('Failed to load');
  4194. }
  4195. }
  4196.  
  4197.  
  4198.  
  4199. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement