Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'dart:io';
- import 'package:flutter/material.dart';
- import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
- import 'package:flutter/services.dart';
- import 'package:intl/intl.dart';
- import 'package:path/path.dart' as Path;
- import 'package:image_picker/image_picker.dart';
- import 'package:dio/dio.dart';
- import 'package:sales/endpoint/api.dart';
- import 'package:sales/model/document_model.dart';
- import 'package:sales/model/jenis_model.dart';
- import 'package:sales/model/job_model.dart';
- import 'package:sales/model/kecamatan_model.dart';
- import 'package:sales/model/kelurahan_model.dart';
- import 'package:sales/model/kota_model.dart';
- import 'package:sales/model/perorangan_model.dart';
- import 'package:sales/model/provinsi_model.dart';
- import 'package:sales/model/result_model.dart';
- import 'package:sales/model/zipcode_model.dart';
- import 'package:sales/page/prospekme.dart';
- import 'package:sales/blocs/abuBloc.dart';
- import 'package:flutter_exif_rotation/flutter_exif_rotation.dart';
- import 'package:sales/static/raisedbutton.dart';
- import 'package:rflutter_alert/rflutter_alert.dart';
- import 'package:shared_preferences/shared_preferences.dart';
- import 'package:geocoder/geocoder.dart';
- class Perorangan extends StatefulWidget {
- Perorangan({this.id, this.model, this.customer, this.type, this.negara});
- final String id;
- PeroranganModel model;
- final String type;
- final String customer, negara;
- @override
- _PeroranganState createState() => _PeroranganState();
- }
- class _PeroranganState extends State<Perorangan> {
- bool loadingKirim = false;
- final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
- final _formKey = GlobalKey<FormState>();
- bool nameActive = false;
- bool hpActive = false;
- File _ktp;
- File _foto;
- List<Zipcode> _zipcodeList = [];
- SharedPreferences sharedPreferences;
- bool islogin = false;
- String email = "AAA";
- // 3275052108840013
- String user_id = "";
- bool sama = false;
- TextEditingController controllerTanggal = TextEditingController();
- TextEditingController controllerNama = TextEditingController();
- TextEditingController controllerPekerjaan = TextEditingController();
- TextEditingController controllerIbu = TextEditingController();
- TextEditingController controllerTempat = TextEditingController();
- TextEditingController controllerNIK = TextEditingController();
- TextEditingController controllerAlamat = TextEditingController();
- TextEditingController controllerRT = TextEditingController();
- TextEditingController controllerRW = TextEditingController();
- TextEditingController controllerAlamat2 = TextEditingController();
- TextEditingController controllerRT2 = TextEditingController();
- TextEditingController controllerRW2 = TextEditingController();
- TextEditingController controllerKodePos = TextEditingController();
- TextEditingController controllerKodePos2 = TextEditingController();
- TextEditingController controllerRumah = TextEditingController();
- TextEditingController controllerTelepon = TextEditingController();
- TextEditingController controllerHandphone = TextEditingController();
- TextEditingController controllerNamaKantor = TextEditingController();
- TextEditingController controllerAlamatKantor = TextEditingController();
- TextEditingController controllerJabatan = TextEditingController();
- TextEditingController controllerProvinsi = TextEditingController();
- TextEditingController controllerKota = TextEditingController();
- TextEditingController controllerKec = TextEditingController();
- TextEditingController controllerKel = TextEditingController();
- TextEditingController controllerProvinsi2 = TextEditingController();
- TextEditingController controllerKota2 = TextEditingController();
- TextEditingController controllerKec2 = TextEditingController();
- TextEditingController controllerKel2 = TextEditingController();
- TextEditingController controllerSearch = TextEditingController();
- TextEditingController controllerNote = TextEditingController();
- TextEditingController controllerNote2 = TextEditingController();
- TextEditingController controllerStatus = TextEditingController();
- TextEditingController controllerEmail = TextEditingController();
- TextEditingController controllerWarganegara = TextEditingController();
- Jenis selectedJenis;
- List<Jenis> jenisx = <Jenis>[
- // const Jenis('silahkan', 'SIlahkan Pilih'),
- const Jenis('BRT', 'Buruh, Pembantu Rumah Tangga dan Tenaga Keamanan'),
- const Jenis('IRT', 'Ibu Rumah Tangga'),
- const Jenis('LAINNYA', 'Lain-Lain'),
- const Jenis('PDG', 'Pedagang'),
- const Jenis('PBK', 'Pegawai Bank'),
- const Jenis('PBI', 'Pegawai BI/BUMN/BUMD (termasuk pensiunan)'),
- const Jenis('PMC', 'Pegawai Money Changer'),
- const Jenis('PSWAS', 'Pegawai Swasta'),
- const Jenis('PLLP', 'Pejabat Lembaga Legislatif dan Pemerintah'),
- const Jenis('PM', 'Pelajar/Mahasiswa'),
- const Jenis('PDD', 'Pengajar dan Dosen'),
- const Jenis('PGJ', 'Pengrajin'),
- const Jenis('PPY', 'Pengurus & peg. yayasan/lembaga badan hukum lain'),
- const Jenis('PPARPOL', 'Pengurus Parpol'),
- const Jenis('PLSM', 'Pengurus/Peg. LSM/organisasi tdk badan hukum lain'),
- const Jenis('PW', 'Pengusaha/Wiraswasta'),
- const Jenis('PDN', 'Petani dan Nelayan'),
- const Jenis('PNS', 'PNS (termasuk pensiunan)'),
- const Jenis('PDK', 'Profesional dan Konsultan'),
- const Jenis('TNII', 'TNI/Polri (termasuk pensiunan)'),
- const Jenis('UPP', 'Ulama/Pendeta/Pimpinan oraganisasi & kelompok agama'),
- ];
- var vkota = 0;
- var vprovinsi = 0;
- var vkec = 0;
- var vkel = 0;
- var vprovinsi2 = 0;
- var vkota2 = 0;
- var vkec2 = 0;
- var vkel2 = 0;
- var vjabatan = 0;
- Result _result;
- bool warna1 = false;
- bool warna2 = false;
- int multi = 0;
- bool _external = false;
- bool _check = false;
- bool _rejected = false;
- bool _deviasi = false;
- bool _kirims = false;
- String _nik = "";
- String _name = "";
- String _tempat = "";
- String _tanggal = "";
- String _jeniskelamin = "";
- String _kawin = "";
- String _pekerjaan = "";
- String _ibu = "";
- String _alamat = "";
- String _rt = "";
- String _rw = "";
- String _provinsi = "";
- String _kota = "";
- String _kec = "";
- String _kel = "";
- String _kodepos = "";
- bool _nik2 = false;
- bool _name2 = false;
- bool _tempat2 = false;
- bool _tanggal2 = false;
- bool _jeniskelamin2 = false;
- bool _kawin2 = false;
- bool _pekerjaan2 = false;
- bool _ibu2 = false;
- bool _alamat2 = false;
- bool _rt2 = false;
- bool _rw2 = false;
- bool _provinsi2 = false;
- bool _kota2 = false;
- bool _kec2 = false;
- bool _kel2 = false;
- bool _kodepos2 = false;
- bool _nik3 = false;
- bool _name3 = false;
- bool _tempat3 = false;
- bool _tanggal3 = false;
- bool _jeniskelamin3 = false;
- bool _kawin3 = false;
- bool _pekerjaan3 = false;
- bool _ibu3 = false;
- bool _alamat3 = false;
- bool _rt3 = false;
- bool _rw3 = false;
- bool _provinsi3 = false;
- bool _kota3 = false;
- bool _kec3 = false;
- bool _kel3 = false;
- bool _kodepos3 = false;
- List<String> jenis = ["Laki-Laki", "Perempuan"];
- String _jenis = "Laki-Laki";
- List<String> status = ["Menikah", "Lajang", "Janda/Duda"];
- String _status = "Menikah";
- List<String> kerja = ["Karyawan", "Profesional", "Wiraswasta"];
- String _kerja = "Karyawan";
- List<JobModel> _job = [];
- String selectedJob;
- List<Provinsi> _region = [];
- String selectedRegion;
- String provinsi;
- String selectedRegion2;
- List<Kota> _kotaSelec = [];
- String selectedKota;
- List<Kota> _kotaSelec2 = [];
- String selectedKota2;
- List<Kecamatan> _kecSelec = [];
- String selectedKec;
- List<Kecamatan> _kecSelec2 = [];
- String selectedKec2;
- List<Kelurahan> _kelSelec = [];
- String selectedKel;
- List<Kelurahan> _kelSelec2 = [];
- String selectedKel2;
- void pilihJenis(String value) {
- setState(() {
- _jenis = value;
- });
- }
- void pilihStatus(String value) {
- setState(() {
- _status = value;
- });
- }
- void pilihPekerjaan(String value) {
- setState(() {
- _kerja = value;
- });
- }
- Future<String> _getJabatan() async {
- String url = new Api().url;
- // Response response;
- Response response;
- response = await Dio().get(url + "api/JobPosition/GetAll");
- final json = response.data;
- setState(() {
- _job = (json).map<JobModel>((item) => JobModel.fromJson(item)).toList();
- });
- if (widget.customer == "lama") {
- List<JobModel> _j = _job
- .where((i) => i.initialName.toString() == widget.model.jobPos)
- .toList();
- if (_j.length > 0) {
- setState(() {
- selectedJob = _j[0].descriptionName;
- });
- } else {
- setState(() {
- selectedJob = _job[0].descriptionName;
- });
- }
- } else {
- setState(() {
- selectedJob = _job[0].descriptionName;
- });
- }
- return "Sucess";
- }
- final formats = DateFormat("dd/MM/yyyy");
- // final formats = {
- // InputType.both: DateFormat("EEEE, MMMM d, yyyy 'at' h:mma"),
- // InputType.date: DateFormat('dd/MM/yyyy'),
- // InputType.time: DateFormat("HH:mm"),
- // };
- // Changeable in demo
- // InputType inputType = InputType.date;
- bool editable = true;
- DateTime datex;
- _samaDenganDiatas() async {
- setState(() {
- if (sama == true) {
- controllerAlamat2.text = controllerAlamat.text;
- controllerRT2.text = controllerRT.text;
- controllerRW2.text = controllerRW.text;
- if (selectedRegion != "") {
- selectedRegion2 = selectedRegion;
- vprovinsi2 = 1;
- }
- if (selectedKota != "") {
- _getKota(selectedRegion, "3");
- vkota2 = 1;
- }
- if (selectedKec != "") {
- _getKec(selectedKota, selectedRegion, "3");
- vkec2 = 1;
- }
- if (selectedKel != "") {
- _getKel(selectedKec, selectedKota, selectedRegion, "3");
- vkel2 = 1;
- }
- controllerKodePos2.text = controllerKodePos.text;
- } else {
- controllerAlamat2.text = "";
- controllerRT2.text = "";
- controllerRW2.text = "";
- controllerKodePos2.text = "";
- controllerProvinsi2.text = "";
- controllerKota2.text = "";
- controllerKec2.text = "";
- controllerKel2.text = "";
- print('engaaa ');
- }
- });
- }
- _kirim() async {
- String url = new Api().url;
- var aps = "";
- if (widget.type == "1") {
- aps = "RBU";
- } else if (widget.type == "2") {
- aps = "NDF";
- }
- var aplikasi = aps;
- var nik = controllerNIK.text;
- var nama = controllerNama.text;
- var tempat = controllerTempat.text;
- var formatters = new DateFormat('yyyy-MM-dd');
- print(formatters);
- print(datex.toString());
- var lahir = formatters.format(datex);
- var jeniskelamin = _jenis;
- var kawin = _status;
- var kerja = selectedJenis.name;
- var ibu = controllerIbu.text;
- var alamat = controllerAlamat.text;
- var alamat2 = controllerAlamat2.text;
- var rt1 = "";
- var rw1 = "";
- var rt2 = "";
- var rw2 = "";
- if (controllerRT.text == "") {
- rt1 = "0";
- } else {
- rt1 = controllerRT.text;
- }
- if (controllerRW.text == "") {
- rw1 = "0";
- } else {
- rw1 = controllerRW.text;
- }
- if (controllerRT2.text == "") {
- rt2 = "0";
- } else {
- rt2 = controllerRT2.text;
- }
- if (controllerRW2.text == "") {
- rw2 = "0";
- } else {
- rw2 = controllerRW2.text;
- }
- // var rw1 = controllerRW.text;
- var pos1 = controllerKodePos.text;
- var pos2 = controllerKodePos2.text;
- var provinsi1 = _getP(selectedRegion);
- var provinsi2 = _getP(selectedRegion2);
- List<Kota> _ko1 = _kotaSelec.where((i) => i.id == selectedKota).toList();
- List<Kota> _ko2 = _kotaSelec2.where((i) => i.id == selectedKota2).toList();
- List<Kecamatan> _ke1 = _kecSelec.where((i) => i.id == selectedKec).toList();
- List<Kecamatan> _ke2 =
- _kecSelec2.where((i) => i.id == selectedKec2).toList();
- List<Kelurahan> _kl1 = _kelSelec.where((i) => i.id == selectedKel).toList();
- List<Kelurahan> _kl2 =
- _kelSelec2.where((i) => i.id == selectedKel2).toList();
- var kota1 = _ko1[0].name;
- var kota2 = _ko2[0].name;
- var kec1 = _ke1[0].name;
- var kec2 = _ke2[0].name;
- var kel1 = _kl1[0].name;
- var kel2 = _kl2[0].name;
- var jenispekerjaan = _kerja;
- var telephon = "";
- if (controllerTelepon.text == "") {
- telephon = controllerHandphone.text;
- } else {
- telephon = controllerTelepon.text;
- }
- var handphone = controllerHandphone.text;
- var kantor = controllerNamaKantor.text;
- var alamatKantor = controllerAlamatKantor.text;
- var jabatan = controllerJabatan.text;
- var now = new DateTime.now();
- var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
- var createddate = formatter.format(now);
- print("Created Date");
- var updatedate = formatter.format(now);
- final query = "" + kel2 + ", " + kec2 + ", " + kota2 + "," + provinsi2;
- var addresses = await Geocoder.local.findAddressesFromQuery(query);
- List<Address> results = addresses;
- var lat = results.first.coordinates.latitude;
- var lng = results.first.coordinates.longitude;
- var customers = "";
- print(query);
- print(lat.toString() + "," + lng.toString());
- customers = widget.customer;
- Response response;
- var dio = new Dio();
- try {
- response = await dio.post(
- url + "api/Prospek/Insert",
- data: {
- "PR_ID": "",
- "APPTYPEID": aplikasi,
- "PR_NAME": nama,
- "PR_BORNPLACE": tempat,
- "PR_BORNDATE": lahir,
- "PR_KTPNO": nik,
- "PR_HMADDR": alamat,
- "PR_HMPROPINSI": provinsi1,
- "PR_HMCITY": kota1,
- "PR_HMRT": rt1,
- "PR_HMRW": rw1,
- "PR_HMLURAH": kel1,
- "PR_HMCAMAT": kec1,
- "PR_HMZIPCODE": pos1,
- "PR_HMPHONE": telephon,
- "PR_HPNO": handphone,
- "LATITUDE": lat.toString(),
- "LONGITUDE": lng.toString(),
- "SURVEYOR_NAME": "-",
- "SURVEYOR_ID": "-",
- "ACTIVE": "true",
- "CREATE_BY": user_id,
- "CREATE_DATE": createddate,
- "UPDATE_BY": user_id,
- "UPDATE_DATE": updatedate,
- "STATUS": customers,
- "distance": "-",
- "PR_HM_ADD_DOMISILI": alamat2,
- "PR_HM_PROV_DOMISILI": provinsi2,
- "PR_HM_CITY_DOMISILI": kota2,
- "PR_HM_RT_DOMISILI": rt2,
- "PR_HM_RW_DOMISILI": rw2,
- "PR_HM_LURAH_DOMISILI": kel2,
- "PR_HM_CAMAT_DOMISILI": kec2,
- "PR_ZIPCODE_DOMISILI": pos2,
- "NAMA_IBU_KANDUNG": ibu,
- "JENIS_KELAMIN": jeniskelamin,
- "STATUS_KAWIN": kawin,
- "NAMA_PEKERJAAN": kerja,
- "JENIS_PEKERJAAN": jenispekerjaan,
- "NAMA_PERUSAHAAN": kantor,
- "JABATAN": jabatan,
- "ALAMAT_PERUSAHAAN": alamatKantor,
- "PHONE1": "-",
- "PHONE2": "-",
- "FAX": "-",
- "TYPE_PROSPEK": "P",
- "USER_BY": "CMO",
- "CMO_ID": user_id,
- "ID_FINDER": "",
- "PIC": "",
- "PHONE_PIC": "",
- "POSISI_JAB": selectedJob,
- "EMAIL": controllerEmail.text,
- "WARGANEGARA": controllerWarganegara.text
- },
- options:
- new Options(contentType: ContentType.parse("application/json")),
- );
- print(response.data.toString());
- var isSuccess = response.data["IsSuccess"];
- var jsonb = response.data["Data"];
- var prid = response.data["Data"]["PR_ID"];
- print(jsonb.toString());
- if (isSuccess == true) {
- List<DocumentModel> _newsList = [];
- Response res;
- res = await dio.get(url + "api/AppDokumen/GetByAP?APREGNO=" + prid);
- final jsonx = res.data;
- _newsList = (jsonx)
- .map<DocumentModel>((item) => DocumentModel.fromJson(item))
- .toList();
- var seq1 = _newsList.length + 1;
- var seq2 = _newsList.length + 2;
- if (_ktp != null) {
- _uploadKtp(prid, seq1);
- }
- if (_foto != null) {
- _uploadPhoto(prid, seq2);
- }
- setState(() {
- _result = Result.fromJson(jsonb);
- _kirims = true;
- });
- print("prid " + prid);
- _saveToNotification(prid);
- //MELAKUKAN UPDATE TRACK KE 1.0 YAITU PENGAJUAN AKAN TAMPIL DI APLIKASI MARKETING HEAD UNTUK DILAKUKAN REQUEST KOLEKTABILITAS
- _updateStatus("1.0");
- setState(() {
- loadingKirim = false;
- });
- Alert(
- context: context,
- type: AlertType.success,
- title: "Pengajuan Sukses",
- desc: "Silahkan tunggu konfimasi selanjutnya",
- buttons: [
- DialogButton(
- child: Text(
- "OK",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- onPressed: () {
- Navigator.of(context).pop();
- Navigator.of(context)
- .pushReplacement(new MaterialPageRoute(builder: (_) {
- return new ProspekMe(0);
- }));
- },
- width: 120,
- )
- ],
- ).show();
- } else {
- setState(() {
- loadingKirim = false;
- });
- Alert(
- context: context,
- type: AlertType.error,
- title: "Pengajuan Failed",
- desc: "Silahkan cek kembali inputan anda",
- buttons: [
- DialogButton(
- child: Text(
- "OK",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- onPressed: () => Navigator.pop(context),
- width: 120,
- )
- ],
- ).show();
- }
- } on DioError catch (e) {
- setState(() {
- loadingKirim = false;
- });
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- dio.interceptors.add(LogInterceptor(responseBody: false));
- }
- _saveToNotification(prid) async {
- String url = new Api().url;
- Response responses;
- var id = prid.toString();
- var dio = new Dio();
- print("_saveToNotification " + prid);
- var a = {
- "AP_REGNO": prid.toString(),
- "CMO": 0,
- "CA": 0,
- "CO": 0,
- "MA": 0,
- "BH": 0,
- "MO": 0,
- "MH": 0,
- "BM4": 0,
- "BM3": 0,
- "BM2": 0,
- "BM1": 0,
- "AM": 0,
- "DirOps": 0,
- "DirUtama": 0,
- "DirKeuangan": 0,
- "DewanKomisaris": 0,
- "COC": 0
- };
- print('a ' + a.toString());
- try {
- responses = await dio.post(
- url + "api/NotificationBadge/Insert",
- data: {
- "AP_REGNO": id,
- "CMO": 0,
- "CA": 0,
- "CO": 0,
- "MA": 0,
- "BH": 0,
- "MO": 0,
- "MH": 0,
- "BM4": 0,
- "BM3": 0,
- "BM2": 0,
- "BM1": 0,
- "AM": 0,
- "DirOps": 0,
- "DirUtama": 0,
- "DirKeuangan": 0,
- "DewanKomisaris": 0,
- "COC": 0
- },
- options:
- new Options(contentType: ContentType.parse("application/json")),
- );
- print(responses.data.toString());
- var isSuccess = responses.data["IsSuccess"];
- var jsonb = responses.data["Data"];
- var prid = responses.data["Data"]["PR_ID"];
- print(jsonb.toString());
- } on DioError catch (e) {
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- _cek() async {
- String url = new Api().url;
- print('belum');
- try {
- print('masuk');
- Response res;
- res = await Dio().get(url +
- "api/CheckingSystem/VerificationDukcapil?KTP=" +
- _result.prKtpno);
- var json = res.data;
- print("nik " + json.toString());
- if (json["content"][0]["NIK"] != null) {
- setState(() {
- _nik = json['content'][0]['NIK'];
- _name = json['content'][0]['NAMA_LGKP'];
- _tempat = json['content'][0]['TMPT_LHR'];
- _tanggal = _result.prBorndate;
- _jeniskelamin = json['content'][0]['JENIS_KLMIN'];
- _kawin = json['content'][0]['STATUS_KAWIN'];
- _pekerjaan = json['content'][0]['JENIS_PKRJN'];
- _ibu = json['content'][0]['NAMA_LGKP_IBU'];
- _alamat = json['content'][0]['ALAMAT'];
- _rt = json['content'][0]['NO_RT'];
- _rw = json['content'][0]['NO_RW'];
- _provinsi = json['content'][0]['PROP_NAME'];
- _kota = json['content'][0]['KAB_NAME'];
- _kec = json['content'][0]['KEC_NAME'];
- _kel = json['content'][0]['KEL_NAME'];
- _nik2 = true;
- _name2 = true;
- _tempat2 = true;
- _tanggal2 = true;
- _jeniskelamin2 = true;
- _kawin2 = true;
- _pekerjaan2 = true;
- _ibu2 = true;
- _alamat2 = true;
- _rt2 = true;
- _rw2 = true;
- _provinsi2 = true;
- _kota2 = true;
- _kec2 = true;
- _kel2 = true;
- _nik3 = true;
- _name3 = true;
- _tempat3 = true;
- _tanggal3 = true;
- _jeniskelamin3 = true;
- _kawin3 = true;
- _pekerjaan3 = true;
- _ibu3 = true;
- _alamat3 = true;
- _rt3 = true;
- _rw3 = true;
- _provinsi3 = true;
- _kota3 = true;
- _kec3 = true;
- _kel3 = true;
- _check = true;
- });
- } else {
- setState(() {
- _nik = "";
- _name = "";
- _tempat = "";
- _tanggal = "";
- _jeniskelamin = "";
- _kawin = "";
- _pekerjaan = "";
- _ibu = "";
- _alamat = "";
- _rt = "";
- _rw = "";
- _provinsi = "";
- _kota = "";
- _kec = "";
- _kel = "";
- _nik2 = false;
- _name2 = false;
- _tempat2 = false;
- _tanggal2 = false;
- _jeniskelamin2 = false;
- _kawin2 = false;
- _pekerjaan2 = false;
- _ibu2 = false;
- _alamat2 = false;
- _rt2 = false;
- _rw2 = false;
- _provinsi2 = false;
- _kota2 = false;
- _kec2 = false;
- _kel2 = false;
- _nik3 = false;
- _name3 = false;
- _tempat3 = false;
- _tanggal3 = false;
- _jeniskelamin3 = false;
- _kawin3 = false;
- _pekerjaan3 = false;
- _ibu3 = false;
- _alamat3 = false;
- _rt3 = false;
- _rw3 = false;
- _provinsi3 = false;
- _kota3 = false;
- _kec3 = false;
- _kel3 = false;
- _check = false;
- });
- }
- //UPDATE TRACK KE 3.1 YAITU PENGAJUAN SUDAH DILAKUKAN PENGECEKAN DUKCAPIL
- _updateStatus("3.1");
- } on DioError catch (e) {
- print("Error Cek Dukcapil");
- setState(() {
- _nik = "";
- _name = "";
- _tempat = "";
- _tanggal = "";
- _jeniskelamin = "";
- _kawin = "";
- _pekerjaan = "";
- _ibu = "";
- _alamat = "";
- _rt = "";
- _rw = "";
- _provinsi = "";
- _kota = "";
- _kec = "";
- _kel = "";
- _nik2 = false;
- _name2 = false;
- _tempat2 = false;
- _tanggal2 = false;
- _jeniskelamin2 = false;
- _kawin2 = false;
- _pekerjaan2 = false;
- _ibu2 = false;
- _alamat2 = false;
- _rt2 = false;
- _rw2 = false;
- _provinsi2 = false;
- _kota2 = false;
- _kec2 = false;
- _kel2 = false;
- _nik3 = false;
- _name3 = false;
- _tempat3 = false;
- _tanggal3 = false;
- _jeniskelamin3 = false;
- _kawin3 = false;
- _pekerjaan3 = false;
- _ibu3 = false;
- _alamat3 = false;
- _rt3 = false;
- _rw3 = false;
- _provinsi3 = false;
- _kota3 = false;
- _kec3 = false;
- _kel3 = false;
- _check = false;
- });
- //UPDATE TRACK KE 3.1 YAITU PENGAJUAN SUDAH DILAKUKAN PENGECEKAN DUKCAPIL
- _updateStatus("3.1");
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- _note() async {
- String url = new Api().url;
- Response response;
- Response res;
- Response rex;
- var dio = new Dio();
- var now = new DateTime.now();
- var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
- var createddate = formatter.format(now);
- print("ini multi:" + multi.toString());
- try {
- if (multi == 1) {
- response = await dio.post(
- url + "api/AppNoted/Insert",
- data: {
- "ID": _result.prId,
- "NOTED": controllerNote.text,
- "CREATE_DATE": createddate,
- "CREATE_BY": bloc.appUserId,
- "TYPE_NOTE": "2"
- },
- options:
- new Options(contentType: ContentType.parse("application/json")),
- );
- if (response.data["IsSuccess"] == true) {
- _historycal(1);
- }
- } else if (multi == 2) {
- res =
- await Dio().get(url + "api/AppFlag/GetBy?AppRegno=" + _result.prId);
- var currenttrcode = res.data['AP_CURRENTTRCODE'];
- var currenttrdate = res.data['AP_CURRENTTRDATE'];
- var nexttrby = res.data['AP_NEXTTRBY'];
- var lasttrcode = res.data['AP_LASTTRCODE'];
- var lasttrdate = res.data['AP_LASTTRDATE'];
- var lasttrby = res.data['AP_LASTTRBY'];
- rex = await dio.put(
- url + "/api/AppFlag/Update",
- data: {
- "AP_REGNO": _result.prId,
- "AP_CURRENTTRCODE": currenttrcode,
- "AP_CURRENTTRDATE": currenttrdate,
- "AP_NEXTTRBY": nexttrby,
- "AP_LASTTRCODE": lasttrcode,
- "AP_LASTTRDATE": lasttrdate,
- "AP_LASTTRBY": lasttrby,
- "AP_REJECT": true,
- "AP_CANCEL": "",
- "AP_APPROVED": ""
- },
- options:
- new Options(contentType: ContentType.parse("application/json")),
- );
- if (rex.data["IsSuccess"] == true) {
- setState(() {
- _rejected = true;
- });
- }
- }
- } on DioError catch (e) {
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- dio.interceptors.add(LogInterceptor(responseBody: false));
- }
- _historycal(int x) async {
- String url = new Api().url;
- Response res;
- res = await Dio().get(
- url + "api/CheckingSystem/GetNegativeCustomer?KTP=" + _result.prKtpno);
- var json = res.data;
- print("Historycall" + json.toString());
- if (json['IsNegative'] == "false") {
- Alert(
- context: context,
- type: AlertType.info,
- title: "Historical Bagus",
- desc: "Historycal customer ini bagus",
- buttons: [
- DialogButton(
- child: Text(
- "OK",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- onPressed: () {
- Navigator.pop(context);
- _kesimpulan2();
- setState(() {
- _external = true;
- });
- },
- width: 120,
- )
- ],
- ).show();
- } else {
- Alert(
- context: context,
- type: AlertType.warning,
- title: "Historical Deviasi",
- desc: "Historycal customer ini tidak bagus / Deviasi",
- buttons: [
- DialogButton(
- child: Text(
- "OK",
- style: TextStyle(color: Colors.white, fontSize: 20),
- ),
- onPressed: () {
- Navigator.pop(context);
- _addDeviasi();
- _kesimpulan2();
- setState(() {
- _external = true;
- });
- },
- width: 120,
- )
- ],
- ).show();
- }
- //UPDATE TRACK KE 3.2 YAITU PENGAJUAN SUDAH DILAKUKAN PENGECEKAN NEGATIF LIST
- _updateStatus("3.2");
- }
- _addDeviasi() async {
- String url = new Api().url;
- var dio = new Dio();
- var now = new DateTime.now();
- var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
- var createddate = formatter.format(now);
- await dio.put(
- url + "/api/AppFlag/Update",
- data: {
- "ID": _result.prId,
- "DESCRIPTION": "Deviasi Historycal",
- "NOTED": "-",
- "CREATE_DATE": createddate,
- "CREATE_BY": bloc.appUserId
- },
- options: new Options(contentType: ContentType.parse("application/json")),
- );
- }
- _updateStatus(String code) async {
- String url = new Api().url;
- var dio = new Dio();
- Response res;
- res = await Dio().get(url + "api/AppFlag/GetBy?AppRegno=" + _result.prId);
- print(res.data.toString());
- var currenttrdate = res.data['AP_CURRENTTRDATE'];
- var nexttrby = res.data['AP_NEXTTRBY'];
- var lasttrcode = res.data['AP_LASTTRCODE'];
- var lasttrdate = res.data['AP_LASTTRDATE'];
- var lasttrby = res.data['AP_LASTTRBY'];
- await dio.put(
- url + "/api/AppFlag/Update",
- data: {
- "AP_REGNO": _result.prId,
- "AP_CURRENTTRCODE": code,
- "AP_CURRENTTRDATE": currenttrdate,
- "AP_NEXTTRBY": nexttrby,
- "AP_LASTTRCODE": lasttrcode,
- "AP_LASTTRDATE": lasttrdate,
- "AP_LASTTRBY": lasttrby,
- "AP_REJECT": false,
- "AP_CANCEL": false,
- "AP_APPROVED": false
- },
- options: new Options(contentType: ContentType.parse("application/json")),
- );
- }
- _note2() async {
- String url = new Api().url;
- var dio = new Dio();
- var now = new DateTime.now();
- var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
- var createddate = formatter.format(now);
- try {
- await dio.post(
- url + "api/AppNoted/Insert",
- data: {
- "ID": _result.prId,
- "NOTED": controllerNote.text,
- "CREATE_DATE": createddate,
- "CREATE_BY": bloc.appUserId,
- "TYPE_NOTE": "2"
- },
- options:
- new Options(contentType: ContentType.parse("application/json")),
- );
- } on DioError catch (e) {
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- dio.interceptors.add(LogInterceptor(responseBody: false));
- }
- int _radioValue1 = 0;
- void _handleRadioValueChange1(value) {
- setState(() {
- _radioValue1 = value;
- });
- Navigator.pop(context);
- _checkExternal();
- }
- _checkExternal() async {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- title: new Text("Alamat Mana yg di survey dan siapa ?"),
- content: SingleChildScrollView(
- child: Container(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- new Radio(
- value: 0,
- groupValue: _radioValue1,
- onChanged: _handleRadioValueChange1,
- ),
- new Text(
- 'Alamat KTP',
- style: new TextStyle(fontSize: 16.0),
- ),
- new Radio(
- value: 1,
- groupValue: _radioValue1,
- onChanged: _handleRadioValueChange1,
- ),
- new Text(
- 'Alamat Domisili',
- style: new TextStyle(
- fontSize: 16.0,
- ),
- ),
- new Radio(
- value: 2,
- groupValue: _radioValue1,
- onChanged: _handleRadioValueChange1,
- ),
- new Text(
- 'Alamat Usaha',
- style: new TextStyle(fontSize: 16.0),
- ),
- ],
- ),
- ),
- ),
- actions: <Widget>[
- new FlatButton(
- color: Colors.green,
- child: new Text(
- "Saya",
- style: TextStyle(color: Colors.white),
- ),
- onPressed: () {
- //UPDATE TRACK KE 4.0 YAITU PENGAJUAN DILAKUKAN SURVEY INTERNAL
- _updateStatus("4.0");
- Navigator.pop(context);
- Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
- return new ProspekMe(1);
- }));
- },
- ),
- // usually buttons at the bottom of the dialog
- new FlatButton(
- color: Colors.blue,
- child: new Text(
- "Surveyor External",
- style: TextStyle(color: Colors.white),
- ),
- onPressed: () {
- //UPDATE TRACK KE 4.1 YAITU PENGAJUAN DILAKUKAN SURVEY EKSTERNAL
- _updateStatus("4.1");
- Navigator.pop(context);
- Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
- return new ProspekMe(1);
- }));
- },
- ),
- ],
- );
- },
- );
- // Alert(
- // context: context,
- // type: AlertType.info,
- // title: "Surveyor External",
- // desc: "Apakah Akan di check Surveyor External ?",
- // buttons: [
- // DialogButton(
- // child: Text(
- // "Cancel",
- // style: TextStyle(color: Colors.white, fontSize: 20),
- // ),
- // onPressed: () {
- // _updateStatus("3.0");
- // Navigator.pop(context);
- // },
- // width: 120,
- // ),
- // DialogButton(
- // child: Text(
- // "OK",
- // style: TextStyle(color: Colors.white, fontSize: 20),
- // ),
- // onPressed: () {
- // _updateStatus("3.0");
- // Navigator.pop(context);
- // Navigator.of(context).push(new MaterialPageRoute(builder: (_) {
- // return new ProspekMe(1);
- // }));
- // },
- // width: 120,
- // )
- // ],
- // ).show();
- }
- void _kesimpulan() async {
- print("kesimpulan");
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- title: new Text("Kesimpulan CMO"),
- content: Container(
- height: 180.0,
- child: Column(
- children: <Widget>[
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: RaisedButton(
- color: multi == 1
- ? Color.fromRGBO(60, 158, 64, 1)
- : Colors.white,
- child: Text(
- "Sesuai",
- style: new TextStyle(
- color: multi == 1
- ? Colors.white
- : Color.fromRGBO(102, 102, 102, 1),
- fontSize: 15.0),
- ),
- onPressed: () {
- print(multi);
- setState(() {
- if (multi == 0) {
- warna1 = !warna1;
- } else {
- warna1 = !warna1;
- if (warna2 == true) {
- warna2 = false;
- }
- }
- multi = 1;
- });
- Navigator.of(context).pop();
- _kesimpulan();
- },
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 10.0),
- ),
- Expanded(
- flex: 5,
- child: RaisedButton(
- color: multi == 2
- ? Color.fromRGBO(60, 158, 64, 1)
- : Colors.white,
- child: Text(
- "Tidak Sesuai",
- style: new TextStyle(
- color: multi == 2
- ? Colors.white
- : Color.fromRGBO(102, 102, 102, 1),
- fontSize: 15.0),
- ),
- onPressed: () {
- print(multi);
- setState(() {
- if (multi == 0) {
- warna2 = !warna2;
- } else {
- warna2 = !warna2;
- if (warna1 == true) {
- warna1 = false;
- }
- }
- multi = 2;
- });
- Navigator.of(context).pop();
- _kesimpulan();
- },
- ),
- ),
- ],
- ),
- new TextField(
- controller: controllerNote,
- keyboardType: TextInputType.text,
- maxLines: 4,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Kesimpulan CMO",
- ),
- )
- ],
- ),
- ),
- actions: <Widget>[
- // usually buttons at the bottom of the dialog
- new FlatButton(
- color: Color.fromRGBO(7, 41, 102, 1),
- child: new Text(
- "Kirim",
- style: TextStyle(color: Colors.white),
- ),
- onPressed: () {
- _note();
- Navigator.of(context).pop();
- },
- ),
- ],
- );
- },
- );
- }
- void _kesimpulan2() async {
- print("kesimpulan");
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- title: new Text("Kesimpulan CMO"),
- content: Container(
- height: 180.0,
- child: Column(
- children: <Widget>[
- new TextField(
- controller: controllerNote2,
- keyboardType: TextInputType.text,
- maxLines: 4,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Kesimpulan CMO",
- ),
- )
- ],
- ),
- ),
- actions: <Widget>[
- // usually buttons at the bottom of the dialog
- new FlatButton(
- color: Color.fromRGBO(7, 41, 102, 1),
- child: new Text(
- "Kirim",
- style: TextStyle(color: Colors.white),
- ),
- onPressed: () {
- _note2();
- Navigator.of(context).pop();
- },
- ),
- ],
- );
- },
- );
- }
- @override
- void initState() {
- super.initState();
- if (mounted) {
- _getJabatan();
- }
- if (widget.customer == "Lama" || widget.customer == "lama") {
- setState(() {
- controllerNIK.text = widget.id;
- controllerNama.text = widget.model.fullName;
- controllerTempat.text = widget.model.birthPlace;
- var tgllahir = new DateFormat('yyyy-MM-dd')
- .parse(widget.model.birthDate.split("T")[0]);
- datex = tgllahir;
- var formatter = new DateFormat('dd/MM/yyyy');
- var tglhr = formatter.format(tgllahir);
- controllerTanggal.text = tglhr.toString();
- if (widget.model.gender == "M") {
- _jenis = "Laki-Laki";
- } else {
- _jenis = "Perempuan";
- }
- controllerIbu.text = widget.model.surgateMotherName;
- controllerJabatan.text = widget.model.companyJobTitle;
- controllerNamaKantor.text = widget.model.companyName;
- controllerAlamatKantor.text = widget.model.companyAddress;
- controllerAlamat.text = widget.model.legalAddress;
- controllerKodePos.text = widget.model.legalZipCode;
- controllerRT.text = widget.model.legalRt;
- controllerRW.text = widget.model.legalRw;
- controllerAlamat2.text = widget.model.residenceAddress;
- controllerKodePos2.text = widget.model.residenceZipCode;
- controllerRT2.text = widget.model.residenceRt;
- controllerRW2.text = widget.model.residenceRw;
- controllerHandphone.text = widget.model.mobilePhone;
- controllerWarganegara.text = widget.model.nationality;
- controllerEmail.text = widget.model.eMail;
- controllerStatus.text = "Lama";
- controllerTelepon.text = widget.model.residenceAreaPhone1.toString() +
- "" +
- widget.model.residencePhone1.toString();
- List<Jenis> j =
- jenisx.where((i) => i.value == widget.model.jobTypeId).toList();
- if (j.length > 0) {
- selectedJenis = j[0];
- }
- _getProvinsi2();
- });
- } else {
- _getDataUser(widget.id);
- setState(() {
- // controllerEmail.text = widget.model.;
- controllerNIK.text = widget.id;
- controllerStatus.text = "Baru";
- controllerWarganegara.text = widget.negara;
- });
- }
- (() async {
- sharedPreferences = await SharedPreferences.getInstance();
- setState(() {
- islogin = sharedPreferences.getBool("isLogin");
- print(islogin.toString());
- user_id = sharedPreferences.getString('userid');
- email = 'cmo';
- });
- await _getProvinsi();
- })();
- }
- _getP(String val) {
- List<Provinsi> _a = _region.where((i) => i.id == val).toList();
- return _a[0].name;
- }
- Future<String> _getProvinsi() async {
- String url = new Api().url;
- // Response response;
- Response response;
- response = await Dio().get(url + "api/Provinsi/GetAll");
- final json = response.data;
- setState(() {
- _region =
- (json).map<Provinsi>((item) => Provinsi.fromJson(item)).toList();
- // selectedRegion = _region[0].id;
- // selectedRegion2 = _region[0].id;
- });
- return "Sucess";
- }
- Future<String> _getProvinsi2() async {
- String url = new Api().url;
- // Response response;
- Response response;
- response = await Dio().get(url + "api/Provinsi/GetAll");
- final json = response.data;
- setState(() {
- _region =
- (json).map<Provinsi>((item) => Provinsi.fromJson(item)).toList();
- // selectedRegion = _region[0].id;
- // selectedRegion2 = _region[0].id;
- });
- if (widget.model.legalPropinsi != null) {
- List<Provinsi> _a = _region
- .where((i) =>
- i.name.toString() ==
- widget.model.legalPropinsi.toString().toUpperCase())
- .toList();
- if (_a.length > 0) {
- setState(() {
- selectedRegion = _a[0].id;
- vprovinsi = 1;
- });
- await _getKota2(_a[0].id, "1");
- }
- }
- if (widget.model.residencePropinsi != null) {
- List<Provinsi> _b = _region
- .where((i) =>
- i.name.toString() ==
- widget.model.residencePropinsi.toString().toUpperCase())
- .toList();
- if (_b.length > 0) {
- setState(() {
- selectedRegion2 = _b[0].id;
- vprovinsi2 = 1;
- });
- await _getKota2(_b[0].id, "2");
- }
- }
- return "Sucess";
- }
- Future<String> _getKota(String id, String type) async {
- String url = new Api().url;
- // Response response;
- Response response;
- response = await Dio().get(url + "api/Kota/Select?PROVINSI_ID=" + id);
- final json = response.data;
- setState(() {
- if (type == "1") {
- _kotaSelec = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
- // selectedKota = _kota[0].id;
- } else if (type == "2") {
- _kotaSelec2 = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
- // selectedKota2 = _kota2[0].id;
- } else {
- _kotaSelec2 = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
- selectedKota2 = selectedKota;
- }
- });
- return "Sucess";
- }
- Future<String> _getKota2(String id, String type) async {
- String url = new Api().url;
- // Response response;
- Response response;
- response = await Dio().get(url + "api/Kota/Select?PROVINSI_ID=" + id);
- final json = response.data;
- if (type == "1") {
- setState(() {
- _kotaSelec = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
- });
- List<Kota> _a = _kotaSelec
- .where((i) =>
- i.name.toString() ==
- widget.model.legalCity.toString().toUpperCase())
- .toList();
- if (_a.length > 0) {
- print("KOTA");
- setState(() {
- selectedKota = _a[0].id;
- vkota = 1;
- });
- await _getKec2(_a[0].id, id, "1");
- }
- } else if (type == "2") {
- setState(() {
- _kotaSelec2 = (json).map<Kota>((item) => Kota.fromJson(item)).toList();
- });
- List<Kota> _a = _kotaSelec2
- .where((i) =>
- i.name.toString() ==
- widget.model.residenceCity.toString().toUpperCase())
- .toList();
- if (_a.length > 0) {
- print("KOTA");
- setState(() {
- selectedKota2 = _a[0].id;
- vkota2 = 1;
- });
- await _getKec2(_a[0].id, id, "2");
- }
- }
- return "Sucess";
- }
- Future<String> _getKec(String kota_id, String prov_id, String type) async {
- String url = new Api().url;
- Response response;
- response = await Dio().get(url +
- "api/Kecamatan/Select?PROVINSI_ID=" +
- prov_id +
- "&KOTA_ID=" +
- kota_id);
- final json = response.data;
- setState(() {
- if (type == "1") {
- _kecSelec =
- (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
- // selectedKec = _kec[0].id;
- } else if (type == "2") {
- _kecSelec2 =
- (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
- // selectedKec2 = _kec2[0].id;
- } else {
- _kecSelec2 =
- (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
- selectedKec2 = selectedKec;
- }
- });
- return "Sucess";
- }
- Future<String> _getKec2(String kota_id, String prov_id, String type) async {
- String url = new Api().url;
- Response response;
- response = await Dio().get(url +
- "api/Kecamatan/Select?PROVINSI_ID=" +
- prov_id +
- "&KOTA_ID=" +
- kota_id);
- final json = response.data;
- setState(() {
- if (type == "1") {
- _kecSelec =
- (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
- // selectedKec = _kec[0].id;
- } else if (type == "2") {
- _kecSelec2 =
- (json).map<Kecamatan>((item) => Kecamatan.fromJson(item)).toList();
- // selectedKec2 = _kec2[0].id;
- }
- });
- if (type == "1") {
- print("CAMAT");
- List<Kecamatan> _a = _kecSelec
- .where((i) =>
- i.name.toString().toUpperCase() ==
- widget.model.legalKecamatan.toString().toUpperCase())
- .toList();
- if (_a.length > 0) {
- setState(() {
- selectedKec = _a[0].id;
- vkec = 1;
- });
- await _getKel2(_a[0].id, kota_id, prov_id, "1");
- }
- } else if (type == "2") {
- print("CAMAT");
- List<Kecamatan> _a = _kecSelec2
- .where((i) =>
- i.name.toString().toUpperCase() ==
- widget.model.residenceKecamatan.toString().toUpperCase())
- .toList();
- if (_a.length > 0) {
- setState(() {
- selectedKec2 = _a[0].id;
- vkec2 = 1;
- });
- await _getKel2(_a[0].id, kota_id, prov_id, "2");
- }
- }
- return "Sucess";
- }
- Future<String> _getKel(
- String kec_id, String kota_id, String prov_id, String type) async {
- String url = new Api().url;
- Response response;
- response = await Dio().get(url +
- "api/Kelurahan/Select?PROVINSI_ID=" +
- prov_id +
- "&KOTA_ID=" +
- kota_id +
- "&KECAMATAN_ID=" +
- kec_id);
- final json = response.data;
- setState(() {
- if (type == "1") {
- _kelSelec =
- (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
- // selectedKel = _kel[0].id;
- } else if (type == "2") {
- _kelSelec2 =
- (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
- // selectedKel2 = _kel2[0].id;
- } else {
- _kelSelec2 =
- (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
- selectedKel2 = selectedKel;
- }
- });
- return "Sucess";
- }
- Future<String> _getKel2(
- String kec_id, String kota_id, String prov_id, String type) async {
- String url = new Api().url;
- Response response;
- response = await Dio().get(url +
- "api/Kelurahan/Select?PROVINSI_ID=" +
- prov_id +
- "&KOTA_ID=" +
- kota_id +
- "&KECAMATAN_ID=" +
- kec_id);
- final json = response.data;
- setState(() {
- if (type == "1") {
- _kelSelec =
- (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
- // controllerKodePos.text = _kel[0].kodepos;
- // selectedKel = _kel[0].id;
- } else if (type == "2") {
- _kelSelec2 =
- (json).map<Kelurahan>((item) => Kelurahan.fromJson(item)).toList();
- // controllerKodePos2.text = _kel2[0].kodepos;
- // selectedKel2 = _kel2[0].id;
- }
- });
- if (type == "1") {
- List<Kelurahan> _a = _kelSelec
- .where((i) =>
- i.name.toString().toUpperCase() ==
- widget.model.legalKelurahan.toString().toUpperCase())
- .toList();
- if (_a.length > 0) {
- setState(() {
- selectedKel = _a[0].id;
- vkel = 1;
- });
- }
- } else if (type == "2") {
- List<Kelurahan> _a = _kelSelec2
- .where((i) =>
- i.name.toString().toUpperCase() ==
- widget.model.residenceKelurahan.toString().toUpperCase())
- .toList();
- if (_a.length > 0) {
- setState(() {
- selectedKel2 = _a[0].id;
- vkel2 = 1;
- });
- }
- }
- return "Sucess";
- }
- Future<String> _getKelId(String kel_id, String kec_id, String kota_id,
- String prov_id, String type) async {
- String url = new Api().url;
- Response response;
- response = await Dio().get(url +
- "api/Kelurahan/GetByDistrictID?PROVINSI_ID=" +
- prov_id +
- "&KOTA_ID=" +
- kota_id +
- "&KECAMATAN_ID=" +
- kec_id +
- "&KELURAHAN_ID=" +
- kel_id);
- final json = response.data;
- Kelurahan _kel4 = Kelurahan.fromJson(json);
- setState(() {
- if (type == "1") {
- controllerKodePos.text = _kel4.kodepos;
- } else {
- controllerKodePos2.text = _kel4.kodepos;
- }
- });
- return "Sucess";
- }
- _getDataUser(id) async {
- String url = new Api().url;
- var dio = new Dio();
- Response res;
- res =
- await dio.get(url + "api/Customer/GetByIDNumber?ID=" + id + "&Type=P");
- var json = res.data;
- if (json["USERID"] != 0) {
- setState(() {
- controllerNama.text = json["FULLNAME"];
- controllerHandphone.text = json["NO_HP"];
- controllerEmail.text = json["EMAIL"];
- controllerTelepon.text = json["NO_HP"];
- });
- } else {
- setState(() {
- nameActive = true;
- hpActive = true;
- });
- }
- }
- Widget _iconCheck(bool i, bool x) {
- if (x != false) {
- return Icon(
- i == true ? Icons.check : Icons.close,
- color: i == true ? Colors.green : Colors.red,
- );
- } else {
- return Container();
- }
- }
- Widget _checkRejected() {
- if (_rejected == true) {
- return FlatButton(
- onPressed: () {},
- color: Colors.red,
- child: Text(
- "Rejected",
- style: TextStyle(color: Colors.red),
- ),
- );
- } else {
- if (_deviasi == true) {
- return FlatButton(
- onPressed: () {},
- color: Colors.red,
- child: Text(
- "Deviasi",
- style: TextStyle(color: Colors.red),
- ),
- );
- } else {
- return Container();
- }
- }
- }
- Future openCamera(type) async {
- // Navigator.of(context).pop();
- var image = await ImagePicker.pickImage(
- source: ImageSource.camera, maxHeight: 816, maxWidth: 816, imageQuality: 100);
- if (image != null) {
- image = await FlutterExifRotation.rotateImage(path: image.path);
- if (type == "ktp") {
- setState(() {
- _ktp = image;
- });
- } else {
- setState(() {
- _foto = image;
- });
- }
- print("Foto" + image.toString());
- }
- }
- Future openGallery(type) async {
- Navigator.of(context).pop();
- var image = await ImagePicker.pickImage(source: ImageSource.gallery, maxHeight: 816, maxWidth: 816, imageQuality: 100);
- if (type == "ktp") {
- setState(() {
- _ktp = image;
- });
- } else {
- setState(() {
- _foto = image;
- });
- }
- print("Foto" + image.toString());
- }
- Future<void> _optionsDialogBox(type) {
- return showDialog(
- context: context,
- builder: (BuildContext context) {
- return AlertDialog(
- content: new SingleChildScrollView(
- child: new ListBody(
- children: <Widget>[
- GestureDetector(
- child: new Text('Take a picture'),
- onTap: () {
- openCamera(type);
- },
- ),
- Padding(
- padding: EdgeInsets.all(8.0),
- ),
- GestureDetector(
- child: new Text('Select from gallery'),
- onTap: () {
- openGallery(type);
- },
- ),
- ],
- ),
- ),
- );
- });
- }
- _uploadKtp(prid, seq) async {
- var now = new DateTime.now();
- var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
- var createddate = formatter.format(now);
- String url = new Api().url;
- Dio dio = new Dio();
- FormData formdata = new FormData.from({
- "file": new UploadFileInfo(_ktp, Path.basename(_ktp.path)),
- "AP_REGNO": prid,
- "SEQ": seq,
- "DOC_CODE": "1",
- "DOC_ORIGINAL": "True",
- "DOCSTA_CODE": "Dokument Belum Diterima",
- "DOC_RECVDATE": createddate,
- "DOC_EXPDATE": createddate,
- "DOC_NO": "KTP/2019",
- "DOC_NOTARY": "KTP/2019"
- });
- try {
- dio
- .post(url + "api/AppDokumen/Insert",
- data: formdata,
- options: Options(
- contentType: ContentType.parse("multipart/form-data"),
- method: 'POST',
- responseType: ResponseType.json // or ResponseType.JSON
- ))
- .then((response) => print(response));
- } on DioError catch (e) {
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- _uploadPhoto(prid, seq) async {
- var now = new DateTime.now();
- var formatter = new DateFormat('yyyy-MM-dd HH:mm:ss');
- var createddate = formatter.format(now);
- String url = new Api().url;
- Dio dio = new Dio();
- FormData formdata = new FormData.from({
- "file": new UploadFileInfo(_foto, Path.basename(_foto.path)),
- "AP_REGNO": prid,
- "SEQ": seq,
- "DOC_CODE": "7",
- "DOC_ORIGINAL": "True",
- "DOCSTA_CODE": "Dokument Belum Diterima",
- "DOC_RECVDATE": createddate,
- "DOC_EXPDATE": createddate,
- "DOC_NO": "Photo/2019",
- "DOC_NOTARY": "Photo/2019"
- });
- try {
- dio
- .post(url + "api/AppDokumen/Insert",
- data: formdata,
- options: Options(
- contentType: ContentType.parse("multipart/form-data"),
- method: 'POST',
- responseType: ResponseType.json // or ResponseType.JSON
- ))
- .then((response) => print(response));
- } on DioError catch (e) {
- if (e.response != null) {
- print(e.response.data);
- print(e.response.headers);
- print(e.response.request);
- } else {
- print(e.request);
- print(e.message);
- }
- }
- }
- Widget _hasilID() {
- if (_ktp != null) {
- return new Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5.0)),
- border: new Border.all(
- width: 1,
- color: Color.fromRGBO(83, 108, 121, 1),
- )),
- child: Column(children: <Widget>[
- new Container(
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(5.0),
- color: Color.fromRGBO(83, 108, 121, 1),
- child: Text("Hasil Foto ID",
- style: new TextStyle(fontSize: 14.0, color: Colors.white)),
- ),
- Padding(
- padding: EdgeInsets.all(10.0),
- child: Container(
- width: MediaQuery.of(context).size.width,
- child: Column(
- children: <Widget>[Image.file(File(_ktp.path))],
- ),
- ),
- )
- ]));
- } else {
- return Container();
- }
- }
- Widget _hasilWajah() {
- if (_foto != null) {
- return new Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5.0)),
- border: new Border.all(
- width: 1,
- color: Color.fromRGBO(83, 108, 121, 1),
- )),
- child: Column(children: <Widget>[
- new Container(
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(5.0),
- color: Color.fromRGBO(83, 108, 121, 1),
- child: Text("Hasil Foto Wajah",
- style: new TextStyle(fontSize: 14.0, color: Colors.white)),
- ),
- Padding(
- padding: EdgeInsets.all(10.0),
- child: Container(
- width: MediaQuery.of(context).size.width,
- child: Column(
- children: <Widget>[Image.file(File(_foto.path))],
- ),
- ),
- )
- ]));
- } else {
- return Container();
- }
- }
- _jp() {
- return FormField<Jenis>(
- validator: (user) {
- print(user);
- if (user == null && selectedJenis == null) {
- // return "Pekerjaan Belum Dipilih";
- }
- },
- builder: (
- FormFieldState<Jenis> state,
- ) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(width: 1.0, style: BorderStyle.solid),
- borderRadius: BorderRadius.all(Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<Jenis>(
- hint: new Text(
- "Pekerjaan",
- style: TextStyle(fontSize: 13.0),
- ),
- value: selectedJenis,
- onChanged: (Jenis newValue) {
- state.didChange(newValue);
- setState(() {
- selectedJenis = newValue;
- });
- },
- items: jenisx.map((Jenis user) {
- return new DropdownMenuItem<Jenis>(
- value: user,
- child: SizedBox(
- width: 135.0,
- child: new Text(user.name,
- maxLines: 4,
- style: new TextStyle(
- color: Colors.black, fontSize: 10.0)),
- ),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- SizedBox(height: 5.0),
- Text(
- state.hasError ? state.errorText : '',
- style:
- TextStyle(color: Colors.redAccent.shade700, fontSize: 12.0),
- ),
- ],
- );
- },
- );
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- key: _scaffoldKey,
- appBar: AppBar(
- title: Text("Pengajuan Perorangan",
- style: new TextStyle(
- color: Colors.black,
- fontFamily: "Poppins",
- )),
- backgroundColor: Colors.white,
- centerTitle: true,
- leading: BackButton(color: Colors.black),
- elevation: 0.0,
- ),
- body: SingleChildScrollView(
- child: Form(
- key: _formKey,
- child: Container(
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(10.0),
- child: Column(
- children: <Widget>[
- Container(
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(10.0),
- decoration: BoxDecoration(
- color: Color.fromRGBO(60, 158, 64, 1),
- borderRadius: BorderRadius.all(Radius.circular(5.0))),
- child: Row(
- children: <Widget>[
- Text(
- "Pemohon Perorangan",
- style: TextStyle(color: Colors.white, fontSize: 15.0),
- ),
- _checkRejected()
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(top: 10.0),
- ),
- new Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5.0)),
- border: new Border.all(
- width: 1,
- color: Color.fromRGBO(83, 108, 121, 1),
- )),
- child: Column(
- children: <Widget>[
- new Container(
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(5.0),
- color: Color.fromRGBO(83, 108, 121, 1),
- child: Text("SESUAI KTP (WNI) / PASPOR (WNA)",
- style: new TextStyle(
- fontSize: 14.0, color: Colors.white)),
- ),
- Padding(
- padding: EdgeInsets.all(10.0),
- child: Column(
- children: <Widget>[
- new Row(
- children: <Widget>[
- Expanded(
- flex: 10,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("No. KTP / No. Paspor",
- textAlign: TextAlign.left),
- _iconCheck(_nik2, _nik3)
- ],
- ),
- new TextField(
- enabled: false,
- controller: controllerNIK,
- keyboardType: TextInputType.text,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "NIK",
- ),
- ),
- Text(
- _nik == "" ? "" : _nik,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- ],
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 10,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Nama Lengkap",
- textAlign: TextAlign.left),
- _iconCheck(_name2, _name3)
- ],
- ),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- enabled: nameActive,
- controller: controllerNama,
- keyboardType: TextInputType.text,
- inputFormatters: [
- BlacklistingTextInputFormatter(
- new RegExp(
- r'[-]|[,]|[.]|[/]|[!]|[@]|[$]|[#]|[%]|[&]|[*]|[(]|[)]|[-]|[_]|[+]|[=]|[~]|[`]|[{]|[}]|[[]]|[]]|[|]|["]|[:]|[;]|[>]|[<]|[?]'))
- ],
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Nama Lengkap",
- ),
- ),
- Text(
- _name == "" ? "" : _name,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- ],
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Tempat Lahir",
- textAlign: TextAlign.left),
- _iconCheck(_tempat2, _tempat3)
- ],
- ),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- controller: controllerTempat,
- keyboardType: TextInputType.text,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.only(
- left: 8.0,
- top: 15.0,
- bottom: 15.0),
- border: OutlineInputBorder(),
- hintText: "Tempat Lahir",
- ),
- ),
- Text(
- _tempat == "" ? "" : _tempat,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- new Padding(
- padding: EdgeInsets.only(left: 5.0),
- ),
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Tanggal Lahir",
- textAlign: TextAlign.left),
- _iconCheck(_tanggal2, _tanggal3)
- ],
- ),
- DateTimeField(
- format: formats,
- controller: controllerTanggal,
- validator: (dateTime) {
- if (dateTime == null) {
- return '';
- }
- print(dateTime);
- },
- decoration: InputDecoration(
- contentPadding: EdgeInsets.only(
- left: 8.0,
- top: 15.0,
- bottom: 15.0),
- border: OutlineInputBorder(),
- labelText: 'Tanggal Lahir',
- hasFloatingPlaceholder: false),
- onChanged: (dt) =>
- setState(() => datex = dt),
- onShowPicker:
- (context, currentValue) {
- return showDatePicker(
- context: context,
- firstDate: DateTime(1900),
- initialDate: currentValue ??
- DateTime.now(),
- lastDate: DateTime(2100));
- },
- ),
- // DateTimePickerFormField(
- // validator: (value) {
- // if (value == null) {
- // return '';
- // }
- // },
- // controller: controllerTanggal,
- // inputType: inputType,
- // format: formats[inputType],
- // editable: editable,
- // decoration: InputDecoration(
- // contentPadding:
- // EdgeInsets.all(8.0),
- // border: OutlineInputBorder(),
- // labelText: 'Tanggal Lahir',
- // hasFloatingPlaceholder: false),
- // onChanged: (dt) =>
- // setState(() => datex = dt),
- // ),
- Text(
- _tanggal == "" ? "" : _tanggal,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- ],
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Jenis Kelamin",
- textAlign: TextAlign.left),
- _iconCheck(
- _jeniskelamin2, _jeniskelamin3)
- ],
- ),
- Container(
- width:
- MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius:
- BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton(
- onChanged: (String value) {
- pilihJenis(value);
- },
- value: _jenis,
- items:
- jenis.map((String value) {
- return new DropdownMenuItem(
- value: value,
- child: new Text(value),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(
- _jeniskelamin == ""
- ? ""
- : _jeniskelamin,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 10.0),
- ),
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Status Kawin",
- textAlign: TextAlign.left),
- _iconCheck(_kawin2, _kawin3)
- ],
- ),
- Container(
- width:
- MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius:
- BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton(
- onChanged: (String value) {
- pilihStatus(value);
- },
- value: _status,
- items: status
- .map((String value) {
- return new DropdownMenuItem(
- value: value,
- child: SizedBox(
- width: 100.0,
- child: new Text(value,
- maxLines: 4,
- style: new TextStyle(
- color: Colors
- .black,
- fontSize:
- 15.0)),
- ),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(
- _kawin == "" ? "" : _kawin,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- ],
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Pekerjaan",
- textAlign: TextAlign.left),
- _iconCheck(_pekerjaan2, _pekerjaan3)
- ],
- ),
- _jp(),
- ],
- ),
- ),
- new Padding(
- padding: EdgeInsets.only(left: 5.0),
- ),
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Nama Ibu Kandung",
- textAlign: TextAlign.left),
- _iconCheck(_ibu2, _ibu3)
- ],
- ),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- controller: controllerIbu,
- keyboardType: TextInputType.text,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Nama Ibu Kandung",
- ),
- ),
- Text(
- _ibu == "" ? "" : _ibu,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- ],
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- child: new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Alamat",
- textAlign: TextAlign.left),
- _iconCheck(_alamat2, _alamat3)
- ],
- ),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- controller: controllerAlamat,
- keyboardType: TextInputType.text,
- maxLines: 4,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Alamat",
- ),
- ),
- Text(
- _alamat == "" ? "" : _alamat,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("RT",
- textAlign: TextAlign.left),
- _iconCheck(_rt2, _rt3)
- ],
- ),
- new TextField(
- controller: controllerRT,
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "RT",
- ),
- ),
- Text(
- _rt == "" ? "" : _rt,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- new Padding(
- padding: EdgeInsets.only(left: 5.0),
- ),
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("RW",
- textAlign: TextAlign.left),
- _iconCheck(_rw2, _rw3)
- ],
- ),
- new TextField(
- controller: controllerRW,
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "RW",
- ),
- ),
- Text(
- _rw == "" ? "" : _rw,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Provinsi*",
- textAlign: TextAlign.left),
- _iconCheck(_provinsi2, _provinsi3)
- ],
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- color: vprovinsi == 0 ||
- vprovinsi == 1
- ? Colors.black
- : Colors.red,
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<String>(
- hint: new Text("Pilih Provinsi"),
- value: selectedRegion,
- isDense: true,
- onChanged: (String newValue) {
- setState(() {
- selectedRegion = newValue;
- vprovinsi = 1;
- });
- _getKota(newValue, "1");
- },
- items: _region.map((Provinsi map) {
- return new DropdownMenuItem<
- String>(
- value: map.id,
- child: new Text(map.name,
- style: new TextStyle(
- color: Colors.black,
- fontSize: 13.0)),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(
- _provinsi == "" ? "" : _provinsi,
- style: TextStyle(color: Colors.green),
- ),
- Text(
- vprovinsi == 0 || vprovinsi == 1
- ? ""
- : "",
- style: TextStyle(color: Colors.red)),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Kota / Kabupaten*",
- textAlign: TextAlign.left),
- _iconCheck(_kota2, _kota3)
- ],
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- color: vkota == 0 || vkota == 1
- ? Colors.black
- : Colors.red,
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<String>(
- hint: new Text("Pilih Kota/Kab"),
- value: selectedKota,
- isDense: true,
- onChanged: (String newValue) {
- setState(() {
- selectedKota = newValue;
- vkota = 1;
- });
- _getKec(newValue, selectedRegion,
- "1");
- },
- items: _kotaSelec.map((Kota map) {
- return new DropdownMenuItem<
- String>(
- value: map.id,
- child: new Text(map.name,
- style: new TextStyle(
- color: Colors.black,
- fontSize: 13.0)),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(
- _kota == "" ? "" : _kota,
- style: TextStyle(color: Colors.green),
- ),
- Text(vkota == 0 || vkota == 1 ? "" : "",
- style: TextStyle(color: Colors.red)),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Kecamatan*",
- textAlign: TextAlign.left),
- _iconCheck(_kec2, _kec3)
- ],
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- color: vkec == 0 || vkec == 1
- ? Colors.black
- : Colors.red,
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<String>(
- hint: SizedBox(
- width: 150.0,
- child: new Text(
- "Pilih Kecamatan")),
- value: selectedKec,
- isDense: true,
- onChanged: (String newValue) {
- setState(() {
- selectedKec = newValue;
- vkec = 1;
- });
- _getKel(newValue, selectedKota,
- selectedRegion, "1");
- },
- items:
- _kecSelec.map((Kecamatan map) {
- return new DropdownMenuItem<
- String>(
- value: map.id,
- child: new Text(map.name,
- style: new TextStyle(
- color: Colors.black,
- fontSize: 13.0)),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(
- _kec == "" ? "" : _kec,
- style: TextStyle(color: Colors.green),
- ),
- Text(vkec == 0 || vkec == 1 ? "" : "",
- style: TextStyle(color: Colors.red)),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Kelurahan",
- textAlign: TextAlign.left),
- _iconCheck(_kel2, _kel3)
- ],
- ),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- color: vkel == 0 || vkel == 1
- ? Colors.black
- : Colors.red,
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<String>(
- hint: SizedBox(
- width: 150.0,
- child: new Text(
- "Pilih Kelurahan")),
- value: selectedKel,
- isDense: true,
- onChanged: (String newValue) {
- _getKelId(
- newValue,
- selectedKec,
- selectedKota,
- selectedRegion,
- "1");
- setState(() {
- selectedKel = newValue;
- vkel = 1;
- });
- },
- items:
- _kelSelec.map((Kelurahan map) {
- return new DropdownMenuItem<
- String>(
- value: map.id,
- child: new Text(map.name,
- style: new TextStyle(
- color: Colors.black,
- fontSize: 13.0)),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(
- _kel == "" ? "" : _kel,
- style: TextStyle(color: Colors.green),
- ),
- Text(vkel == 0 || vkel == 1 ? "" : "",
- style: TextStyle(color: Colors.red)),
- ],
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- children: <Widget>[
- new Text("Kode Pos*",
- textAlign: TextAlign.left),
- _iconCheck(_kodepos2, _kodepos3)
- ],
- ),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- controller: controllerKodePos,
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Kode Pos",
- ),
- ),
- Text(
- _kodepos == "" ? "" : _kodepos,
- style: TextStyle(color: Colors.green),
- )
- ],
- ),
- ),
- ],
- ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 5,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // new Text("Kode Pos",
- // textAlign: TextAlign.left),
- // _iconCheck(_kodepos2, _kodepos3)
- // ],
- // ),
- // InkWell(
- // onTap: () {
- // FocusScope.of(context)
- // .requestFocus(new FocusNode());
- // showModalBottomSheet<void>(
- // context: context,
- // builder: (context) {
- // return _searchZipcode(1);
- // });
- // },
- // child: IgnorePointer(
- // child: new TextFormField(
- // validator: (value) {
- // if (value.isEmpty) {
- // return '';
- // }
- // },
- // controller: controllerKodePos,
- // keyboardType: TextInputType.text,
- // inputFormatters: [
- // LengthLimitingTextInputFormatter(
- // 5),
- // WhitelistingTextInputFormatter
- // .digitsOnly,
- // ],
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Kode Pos",
- // ),
- // ),
- // ),
- // ),
- // Text(
- // _kodepos == "" ? "" : _kodepos,
- // style: TextStyle(color: Colors.green),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 10,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // new Text("Provinsi",
- // textAlign: TextAlign.left),
- // _iconCheck(_provinsi2, _provinsi3)
- // ],
- // ),
- // new TextField(
- // enabled: false,
- // controller: controllerProvinsi,
- // keyboardType: TextInputType.text,
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Provinsi",
- // ),
- // ),
- // Text(
- // _provinsi == "" ? "" : _provinsi,
- // style: TextStyle(color: Colors.green),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 10,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // new Text("Kota / Kabupaten",
- // textAlign: TextAlign.left),
- // _iconCheck(_kota2, _kota3)
- // ],
- // ),
- // new TextField(
- // enabled: false,
- // controller: controllerKota,
- // keyboardType: TextInputType.text,
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Kota / Kabupaten",
- // ),
- // ),
- // Text(
- // _kota == "" ? "" : _kota,
- // style: TextStyle(color: Colors.green),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 10,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // new Text("Kecamatan",
- // textAlign: TextAlign.left),
- // _iconCheck(_kec2, _kec3)
- // ],
- // ),
- // new TextField(
- // enabled: false,
- // controller: controllerKec,
- // keyboardType: TextInputType.text,
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Kecamatan",
- // ),
- // ),
- // Text(
- // _kec == "" ? "" : _kec,
- // style: TextStyle(color: Colors.green),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 10,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // Row(
- // children: <Widget>[
- // new Text("Kelurahan",
- // textAlign: TextAlign.left),
- // _iconCheck(_kel2, _kel3)
- // ],
- // ),
- // new TextField(
- // enabled: false,
- // controller: controllerKel,
- // keyboardType: TextInputType.text,
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Kelurahan",
- // ),
- // ),
- // Text(
- // _kel == "" ? "" : _kel,
- // style: TextStyle(color: Colors.green),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- ],
- ),
- )
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.only(
- top: 10.0,
- )),
- new Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5.0)),
- border: new Border.all(
- width: 1,
- color: Color.fromRGBO(83, 108, 121, 1),
- )),
- child: Column(
- children: <Widget>[
- new Container(
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(5.0),
- color: Color.fromRGBO(83, 108, 121, 1),
- child: Row(
- children: <Widget>[
- Expanded(
- flex: 4,
- child: Text("SESUAI DOMISILI",
- style: new TextStyle(
- fontSize: 14.0, color: Colors.white)),
- ),
- Expanded(
- flex: 6,
- child: InkWell(
- onTap: () {
- setState(() {
- controllerAlamat2.text =
- controllerAlamat.text;
- controllerRT2.text = controllerRT.text;
- controllerRW2.text = controllerRW.text;
- if (selectedRegion != "") {
- selectedRegion2 = selectedRegion;
- vprovinsi2 = 1;
- }
- if (selectedKota != "") {
- _getKota(selectedRegion, "3");
- vkota2 = 1;
- }
- if (selectedKec != "") {
- _getKec(selectedKota, selectedRegion,
- "3");
- vkec2 = 1;
- }
- if (selectedKel != "") {
- _getKel(selectedKec, selectedKota,
- selectedRegion, "3");
- vkel2 = 1;
- }
- controllerKodePos2.text =
- controllerKodePos.text;
- });
- },
- child: Row(
- children: <Widget>[
- Expanded(
- flex: 8,
- child: Text("Sama Dengan Di Atas",
- style: new TextStyle(
- fontSize: 14.0,
- color: Colors.white)),
- ),
- Expanded(
- flex: 2,
- child: Column(
- mainAxisAlignment:
- MainAxisAlignment.center,
- children: <Widget>[
- // Text("Mon"),
- Checkbox(
- value: sama,
- onChanged: (bool value) {
- setState(() {
- sama = value;
- });
- _samaDenganDiatas();
- },
- ),
- ],
- ),
- ),
- ],
- )),
- )
- ],
- ),
- ),
- Padding(
- padding: EdgeInsets.all(10.0),
- child: Column(
- children: <Widget>[
- Container(
- width: MediaQuery.of(context).size.width,
- child: new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Alamat",
- textAlign: TextAlign.left),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- controller: controllerAlamat2,
- keyboardType: TextInputType.text,
- maxLines: 4,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Alamat",
- ),
- )
- ],
- ),
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- new Text("RT",
- textAlign: TextAlign.left),
- new TextField(
- controller: controllerRT2,
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "RT",
- ),
- )
- ],
- ),
- ),
- new Padding(
- padding: EdgeInsets.only(left: 5.0),
- ),
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- new Text("RW",
- textAlign: TextAlign.left),
- new TextField(
- controller: controllerRW2,
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "RW",
- ),
- )
- ],
- ),
- ),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Provinsi*",
- textAlign: TextAlign.left),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- color: vprovinsi2 == 0 ||
- vprovinsi2 == 1
- ? Colors.black
- : Colors.red,
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<String>(
- hint: new Text("Pilih Provinsi"),
- value: selectedRegion2,
- isDense: true,
- onChanged: (String newValue) {
- setState(() {
- selectedRegion2 = newValue;
- vprovinsi2 = 1;
- });
- _getKota(newValue, "2");
- },
- items: _region.map((Provinsi map) {
- return new DropdownMenuItem<
- String>(
- value: map.id,
- child: new Text(map.name,
- style: new TextStyle(
- color: Colors.black,
- fontSize: 13.0)),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(
- vprovinsi2 == 0 || vprovinsi2 == 1
- ? ""
- : "",
- style: TextStyle(color: Colors.red)),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Kota / Kabupaten*",
- textAlign: TextAlign.left),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- color:
- vkota2 == 0 || vkota2 == 1
- ? Colors.black
- : Colors.red,
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<String>(
- hint: new Text("Pilih Kota/Kab"),
- value: selectedKota2,
- isDense: true,
- onChanged: (String newValue) {
- setState(() {
- selectedKota2 = newValue;
- vkota2 = 1;
- });
- _getKec(newValue, selectedRegion2,
- "2");
- },
- items: _kotaSelec2.map((Kota map) {
- return new DropdownMenuItem<
- String>(
- value: map.id,
- child: new Text(map.name,
- style: new TextStyle(
- color: Colors.black,
- fontSize: 13.0)),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(vkota2 == 0 || vkota2 == 1 ? "" : "",
- style: TextStyle(color: Colors.red)),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Kecamatan*",
- textAlign: TextAlign.left),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- color: vkec2 == 0 || vkec2 == 1
- ? Colors.black
- : Colors.red,
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<String>(
- hint: SizedBox(
- width: 150.0,
- child: new Text(
- "Pilih Kecamatan")),
- value: selectedKec2,
- isDense: true,
- onChanged: (String newValue) {
- setState(() {
- selectedKec2 = newValue;
- vkec2 = 1;
- });
- _getKel(newValue, selectedKota2,
- selectedRegion2, "2");
- },
- items:
- _kecSelec2.map((Kecamatan map) {
- return new DropdownMenuItem<
- String>(
- value: map.id,
- child: new Text(map.name,
- style: new TextStyle(
- color: Colors.black,
- fontSize: 13.0)),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(vkec2 == 0 || vkec2 == 1 ? "" : "",
- style: TextStyle(color: Colors.red)),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Kelurahan*",
- textAlign: TextAlign.left),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 40.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- color: vkel2 == 0 || vkel2 == 1
- ? Colors.black
- : Colors.red,
- width: 1.0,
- style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton<String>(
- hint: SizedBox(
- width: 150.0,
- child: new Text(
- "Pilih Kelurahan")),
- value: selectedKel2,
- isDense: true,
- onChanged: (String newValue) {
- _getKelId(
- newValue,
- selectedKec2,
- selectedKota2,
- selectedRegion2,
- "2");
- setState(() {
- selectedKel2 = newValue;
- vkel2 = 1;
- });
- },
- items:
- _kelSelec2.map((Kelurahan map) {
- return new DropdownMenuItem<
- String>(
- value: map.id,
- child: new Text(map.name,
- style: new TextStyle(
- color: Colors.black,
- fontSize: 13.0)),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- Text(vkel2 == 0 || vkel2 == 1 ? "" : "",
- style: TextStyle(color: Colors.red)),
- ],
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Kode Pos*",
- textAlign: TextAlign.left),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- controller: controllerKodePos2,
- maxLength: 5,
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Kode Pos",
- ),
- )
- ],
- ),
- ),
- ],
- ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 5,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // new Text("Kode Pos",
- // textAlign: TextAlign.left),
- // new TextField(
- // controller: controllerKodePos2,
- // keyboardType: TextInputType.text,
- // inputFormatters: [
- // LengthLimitingTextInputFormatter(5),
- // WhitelistingTextInputFormatter
- // .digitsOnly,
- // ],
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Kode Pos",
- // ),
- // onTap: () {
- // FocusScope.of(context)
- // .requestFocus(new FocusNode());
- // showModalBottomSheet<void>(
- // context: context,
- // builder: (context) {
- // return _searchZipcode(2);
- // });
- // },
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 10,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // new Text("Provinsi",
- // textAlign: TextAlign.left),
- // new TextField(
- // enabled: false,
- // controller: controllerProvinsi2,
- // keyboardType: TextInputType.text,
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Provinsi",
- // ),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 10,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // new Text("Kota / Kabupaten",
- // textAlign: TextAlign.left),
- // new TextField(
- // enabled: false,
- // controller: controllerKota2,
- // keyboardType: TextInputType.text,
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Kota / Kabupaten",
- // ),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 10,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // new Text("Kecamatan",
- // textAlign: TextAlign.left),
- // new TextField(
- // enabled: false,
- // controller: controllerKec2,
- // keyboardType: TextInputType.text,
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Kecamatan",
- // ),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- // new Row(
- // children: <Widget>[
- // Expanded(
- // flex: 10,
- // child: new Column(
- // crossAxisAlignment:
- // CrossAxisAlignment.start,
- // children: <Widget>[
- // new Text("Kelurahan",
- // textAlign: TextAlign.left),
- // new TextField(
- // enabled: false,
- // controller: controllerKel2,
- // keyboardType: TextInputType.text,
- // decoration: InputDecoration(
- // contentPadding: EdgeInsets.only(
- // left: 8.0,
- // top: 15.0,
- // bottom: 15.0),
- // border: OutlineInputBorder(),
- // hintText: "Kelurahan",
- // ),
- // )
- // ],
- // ),
- // ),
- // ],
- // ),
- ],
- ),
- )
- ],
- ),
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Jenis Pekerjaan",
- textAlign: TextAlign.left),
- Container(
- width: MediaQuery.of(context).size.width,
- child: DropdownButtonHideUnderline(
- child: Container(
- height: 50.0,
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(
- width: 1.0, style: BorderStyle.solid),
- borderRadius: BorderRadius.all(
- Radius.circular(5.0)),
- ),
- ),
- child: ButtonTheme(
- alignedDropdown: true,
- child: new DropdownButton(
- onChanged: (String value) {
- pilihPekerjaan(value);
- },
- value: _kerja,
- items: kerja.map((String value) {
- return new DropdownMenuItem(
- value: value,
- child: new Text(value),
- );
- }).toList(),
- ),
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- new Padding(
- padding: EdgeInsets.only(left: 5.0),
- ),
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Status", textAlign: TextAlign.left),
- new TextField(
- enabled: false,
- controller: controllerStatus,
- keyboardType: TextInputType.text,
- inputFormatters: [
- LengthLimitingTextInputFormatter(13),
- WhitelistingTextInputFormatter.digitsOnly,
- ],
- decoration: InputDecoration(
- contentPadding: EdgeInsets.only(
- left: 8.0, top: 15.0, bottom: 15.0),
- border: OutlineInputBorder(),
- hintText: "Status",
- ),
- )
- ],
- ),
- ),
- ],
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Telepon", textAlign: TextAlign.left),
- new TextField(
- controller: controllerTelepon,
- keyboardType: TextInputType.number,
- inputFormatters: [
- LengthLimitingTextInputFormatter(18),
- WhitelistingTextInputFormatter.digitsOnly,
- ],
- decoration: InputDecoration(
- contentPadding: EdgeInsets.only(
- left: 8.0, top: 15.0, bottom: 15.0),
- border: OutlineInputBorder(),
- hintText: "Telepon",
- ),
- )
- ],
- ),
- ),
- new Padding(
- padding: EdgeInsets.only(left: 5.0),
- ),
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("No Handphone", textAlign: TextAlign.left),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- enabled: hpActive,
- controller: controllerHandphone,
- inputFormatters: [
- LengthLimitingTextInputFormatter(13),
- WhitelistingTextInputFormatter.digitsOnly,
- ],
- keyboardType: TextInputType.number,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.only(
- left: 8.0, top: 15.0, bottom: 15.0),
- border: OutlineInputBorder(),
- hintText: "No Handphone",
- ),
- )
- ],
- ),
- ),
- ],
- ),
- new Row(
- children: <Widget>[
- Expanded(
- flex: 10,
- child: new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Email", textAlign: TextAlign.left),
- new TextFormField(
- validator: (value) {
- if (value.isEmpty) {
- return '';
- }
- },
- enabled: hpActive,
- controller: controllerEmail,
- keyboardType: TextInputType.text,
- decoration: InputDecoration(
- contentPadding: EdgeInsets.only(
- left: 8.0, top: 15.0, bottom: 15.0),
- border: OutlineInputBorder(),
- hintText: "Email",
- ),
- )
- ],
- ),
- ),
- ],
- ),
- new Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- new Text("Kewarganegaraan", textAlign: TextAlign.left),
- new TextField(
- enabled: false,
- controller: controllerWarganegara,
- keyboardType: TextInputType.number,
- inputFormatters: [
- LengthLimitingTextInputFormatter(13),
- WhitelistingTextInputFormatter.digitsOnly,
- ],
- decoration: InputDecoration(
- contentPadding: EdgeInsets.all(8.0),
- border: OutlineInputBorder(),
- hintText: "Kewarganegaraan",
- ),
- )
- ],
- ),
- _jenisPekerjaan(),
- Padding(
- padding: EdgeInsets.only(top: 20.0),
- ),
- new Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(5.0)),
- border: new Border.all(
- width: 1,
- color: Color.fromRGBO(83, 108, 121, 1),
- )),
- child: Column(children: <Widget>[
- new Container(
- width: MediaQuery.of(context).size.width,
- padding: EdgeInsets.all(5.0),
- color: Color.fromRGBO(83, 108, 121, 1),
- child: Text(
- "Foto KTP (WNI)/Paspor (WNA) serta Foto Wajah (Wajib)",
- style: new TextStyle(
- fontSize: 14.0, color: Colors.white)),
- ),
- Padding(
- padding: EdgeInsets.only(
- left: 10.0, top: 10.0, right: 10.0, bottom: 10.0),
- child: Container(
- width: MediaQuery.of(context).size.width,
- child: Column(
- children: <Widget>[
- new Row(
- children: <Widget>[
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- children: <Widget>[
- // new Text("Photo KTP",
- // textAlign: TextAlign.left),
- FlatButton(
- color: Colors.blue,
- onPressed: () {
- openCamera("ktp");
- },
- child: Text(
- "ID",
- style: TextStyle(
- color: Colors.white),
- ),
- ),
- Center(
- child: _ktp == null
- ? Text('No image selected')
- : Text("fotoid.jpg"),
- )
- ],
- ),
- ),
- new Padding(
- padding: EdgeInsets.only(left: 30.0),
- ),
- Expanded(
- flex: 5,
- child: new Column(
- crossAxisAlignment:
- CrossAxisAlignment.center,
- children: <Widget>[
- // new Text("Photo Wajah",
- // textAlign: TextAlign.left),
- FlatButton(
- color: Colors.blue,
- onPressed: () {
- openCamera("foto");
- },
- child: Text(
- "Wajah",
- style: TextStyle(
- color: Colors.white),
- ),
- ),
- Center(
- child: _foto == null
- ? Text('No image selected')
- : Text("fotowajah.jpg"))
- ],
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- )
- ])),
- Padding(
- padding: EdgeInsets.only(top: 20.0),
- ),
- _hasilID(),
- Padding(
- padding: EdgeInsets.only(top: 10.0),
- ),
- _hasilWajah(),
- Padding(
- padding: EdgeInsets.only(top: 10.0),
- ),
- _button()
- ],
- ),
- ),
- ),
- ));
- }
- Widget _button() {
- if (loadingKirim == false) {
- if (_rejected == false) {
- if (_kirims == false) {
- return RaisedGradientButton(
- child: Text(
- 'Kirim',
- style: TextStyle(color: Colors.white),
- ),
- gradient: LinearGradient(
- colors: <Color>[
- Color.fromRGBO(42, 153, 158, 1),
- Color.fromRGBO(27, 104, 210, 1)
- ],
- ),
- onPressed: () {
- bool isValid = _formKey.currentState.validate();
- if (_ktp == null) {
- _scaffoldKey.currentState.showSnackBar(SnackBar(
- backgroundColor: Colors.red,
- content: Text('Foto ID Wajib Ada')));
- isValid = false;
- }
- if (_foto == null) {
- _scaffoldKey.currentState.showSnackBar(SnackBar(
- backgroundColor: Colors.red,
- content: Text('Foto Selfie Wajib Ada')));
- isValid = false;
- }
- if (vprovinsi == 0) {
- setState(() {
- vprovinsi = 2;
- });
- isValid = false;
- }
- if (vprovinsi2 == 0) {
- setState(() {
- vprovinsi2 = 2;
- });
- isValid = false;
- }
- if (vkota == 0) {
- setState(() {
- vkota = 2;
- });
- isValid = false;
- }
- if (vkec == 0) {
- setState(() {
- vkec = 2;
- });
- isValid = false;
- }
- if (vkel == 0) {
- setState(() {
- vkel = 2;
- });
- isValid = false;
- }
- if (vkota2 == 0) {
- setState(() {
- vkota2 = 2;
- });
- isValid = false;
- }
- if (vkec2 == 0) {
- setState(() {
- vkec2 = 2;
- });
- isValid = false;
- }
- if (vkel2 == 0) {
- setState(() {
- vkel2 = 2;
- });
- isValid = false;
- }
- if (isValid) {
- setState(() {
- loadingKirim = true;
- });
- _kirim();
- } else {
- _scaffoldKey.currentState.showSnackBar(SnackBar(
- backgroundColor: Colors.red,
- content: Text('Semua Kotak Isian Wajib Diisi')));
- }
- });
- } else {
- return Container();
- // if (_check == false) {
- // return RaisedGradientButton(
- // child: Text(
- // 'Cek',
- // style: TextStyle(color: Colors.white),
- // ),
- // gradient: LinearGradient(
- // colors: <Color>[
- // Color.fromRGBO(42, 153, 158, 1),
- // Color.fromRGBO(27, 104, 210, 1)
- // ],
- // ),
- // onPressed: () {
- // _cek();
- // });
- // } else {
- // if (_external == false) {
- // return RaisedGradientButton(
- // child: Text(
- // 'Kesimpulan',
- // style: TextStyle(color: Colors.white),
- // ),
- // gradient: LinearGradient(
- // colors: <Color>[
- // Color.fromRGBO(42, 153, 158, 1),
- // Color.fromRGBO(27, 104, 210, 1)
- // ],
- // ),
- // onPressed: () {
- // _kesimpulan();
- // });
- // } else {
- // return RaisedGradientButton(
- // child: Text(
- // 'Survey External',
- // style: TextStyle(color: Colors.white),
- // ),
- // gradient: LinearGradient(
- // colors: <Color>[
- // Color.fromRGBO(42, 153, 158, 1),
- // Color.fromRGBO(27, 104, 210, 1)
- // ],
- // ),
- // onPressed: () {
- // _checkExternal();
- // // _kesimpulan();
- // });
- // }
- // }
- }
- } else {
- return Container();
- }
- } else {
- return CircularProgressIndicator();
- }
- }
- Future<Null> getZipcode(String code) async {
- _zipcodeList.clear();
- final url = new Api().url;
- Response response;
- response =
- await Dio().get(url + "api/Kelurahan/GetByZipCode?ZipCode=" + code);
- final json = response.data;
- if (response.statusCode == 200) {
- setState(() {
- _zipcodeList =
- (json).map<Zipcode>((item) => Zipcode.fromJson(item)).toList();
- });
- } else {
- throw Exception('Failed to load');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement