Fakultas Ilmu Komputer UI

Commit 77fd5041 authored by Manuel Yoseph Ray's avatar Manuel Yoseph Ray
Browse files

[REFACTOR] menghapus conflict dengan staging

parents 543cee6c 11f5a872
Pipeline #77273 passed with stages
in 8 minutes and 29 seconds
......@@ -668,7 +668,7 @@
"languageVersion": "2.7"
}
],
"generated": "2021-05-16T21:29:14.154041Z",
"generated": "2021-05-16T23:44:49.072828Z",
"generator": "pub",
"generatorVersion": "2.12.0"
}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-05-17 04:53:59.510562","version":"2.0.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"android":[{"name":"flutter_keyboard_visibility","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility-5.0.0\\\\","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-2.0.1\\\\","dependencies":[]},{"name":"flutter_secure_storage","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_secure_storage-3.3.5\\\\","dependencies":[]},{"name":"image_picker","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker-0.7.4\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-2.0.1\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.0\\\\","dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.0.0\\\\","dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.0.0\\\\","dependencies":[]}],"web":[{"name":"flutter_keyboard_visibility_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_keyboard_visibility_web-2.0.0\\\\","dependencies":[]},{"name":"image_picker_for_web","path":"C:\\\\src\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\image_picker_for_web-2.0.0\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_keyboard_visibility","dependencies":["flutter_keyboard_visibility_web"]},{"name":"flutter_keyboard_visibility_web","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_secure_storage","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle","image_picker_for_web"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos","path_provider_linux","path_provider_windows"]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2021-05-17 06:49:39.992025","version":"2.0.1"}
\ No newline at end of file
......@@ -4,7 +4,7 @@ stages:
- linter
- test_coverage
- sonar
- build_android
# - build_android
before_script:
- flutter pub get
......@@ -64,16 +64,16 @@ SonarScanner:
- staging
build_android:
stage: build_android
before_script:
- flutter packages get
- flutter clean
script:
- flutter build apk
artifacts:
paths:
- build/app/outputs/apk/release/app-release.apk
only:
- master
- staging
# build_android:
# stage: build_android
# before_script:
# - flutter packages get
# - flutter clean
# script:
# - flutter build apk
# artifacts:
# paths:
# - build/app/outputs/apk/release/app-release.apk
# only:
# - master
# - staging
......@@ -3,7 +3,7 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2021-05-17 04:29:14.128046.
# Generated by pub on 2021-05-17 06:44:49.048785.
_fe_analyzer_shared:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-14.0.0/lib/
analyzer:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-0.41.2/lib/
args:file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.0.0/lib/
......
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/ferdisungkar/flutter
FLUTTER_APPLICATION_PATH=/Users/ferdisungkar/Desktop/Files/Universitas-Indonesia/Semester-6/PPL/Project/ppl2021-d-slhape
FLUTTER_TARGET=/Users/ferdisungkar/Desktop/Files/Universitas-Indonesia/Semester-6/PPL/Project/ppl2021-d-slhape/lib/main.dart
FLUTTER_ROOT=C:\src\flutter
FLUTTER_APPLICATION_PATH=C:\Users\Manuel Yoseph Ray\Desktop\Semester 6\PPL\Project\test\register\ppl2021-d-slhape
FLUTTER_TARGET=lib\main.dart
FLUTTER_BUILD_DIR=build
SYMROOT=${SOURCE_ROOT}/../build/ios
SYMROOT=${SOURCE_ROOT}/../build\ios
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
DART_DEFINES=flutter.inspector.structuredErrors%3Dtrue
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TRACK_WIDGET_CREATION=false
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=/Users/ferdisungkar/Desktop/Files/Universitas-Indonesia/Semester-6/PPL/Project/ppl2021-d-slhape/.dart_tool/package_config.json
PACKAGE_CONFIG=.packages
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/ferdisungkar/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/ferdisungkar/Desktop/Files/Universitas-Indonesia/Semester-6/PPL/Project/ppl2021-d-slhape"
export "FLUTTER_TARGET=/Users/ferdisungkar/Desktop/Files/Universitas-Indonesia/Semester-6/PPL/Project/ppl2021-d-slhape/lib/main.dart"
export "FLUTTER_ROOT=C:\src\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\Manuel Yoseph Ray\Desktop\Semester 6\PPL\Project\test\register\ppl2021-d-slhape"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "SYMROOT=${SOURCE_ROOT}/../build\ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=flutter.inspector.structuredErrors%3Dtrue"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TRACK_WIDGET_CREATION=false"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=/Users/ferdisungkar/Desktop/Files/Universitas-Indonesia/Semester-6/PPL/Project/ppl2021-d-slhape/.dart_tool/package_config.json"
export "PACKAGE_CONFIG=.packages"
import 'dart:convert';
import 'dart:io';
import 'package:fundex_app/storage/storage.dart';
import 'package:http/http.dart' show Client;
......@@ -84,4 +85,270 @@ class Api {
print("Unknown");
}
}
Future patchMember(String name, int addressId, String phone) async {
var apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/member)');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.patch(apiURL,
headers: <String, String>{
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode({
'name': name,
'address_id': addressId,
'phone': phone
}));
if (apiResult.statusCode == 200) {
print('Patch member berhasil');
print(apiResult.statusCode);
print(apiResult.body);
return 'Simpan Berhasil!';
} else {
print('Patch member ' + apiResult.statusCode.toString());
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan..');
}
}
Future<String> gender(String gen) async {
var apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/member-attribute)');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.post(apiURL,
headers: <String, String>{
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode({
'attribute_name': 'gender',
'attribute_value': '$gen'
}));
if (apiResult.statusCode == 200) {
print('gender berhasil');
print(apiResult.statusCode);
print(apiResult.body);
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var idMemberAttributeGender = jsonData['id'];
await secureStorage.writeSecureData('idMemberAttributeGender', idMemberAttributeGender);
print(await secureStorage.readSecureData('idMemberAttributeGender'));
return 'Simpan Berhasil!';
} else {
print('gender ' + apiResult.statusCode.toString());
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan..');
}
}
Future birthdate(DateTime date) async {
var apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/member-attribute)');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.post(apiURL,
headers: <String, String>{
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode({
'attribute_name': 'birthdate',
'attribute_value': date
}));
if (apiResult.statusCode == 200) {
print('birthdate berhasil');
print(apiResult.statusCode);
print(apiResult.body);
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var idMemberAttributeBirthdate = jsonData['id'];
await secureStorage.writeSecureData('idMemberAttributeBirthdate', idMemberAttributeBirthdate);
print(await secureStorage.readSecureData('idMemberAttributeBirthdate'));
return 'Simpan Berhasil!';
} else {
print('birthdate ' + apiResult.statusCode.toString());
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan..');
}
}
Future birthplace(String nameCity) async {
var apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/member-attribute)');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.post(apiURL,
headers: <String, String>{
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode({
'attribute_name': 'birthplace',
'attribute_value': nameCity
}));
if (apiResult.statusCode == 200) {
print('birthplace berhasil');
print(apiResult.statusCode);
print(apiResult.body);
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var idMemberAttributeBirthplace = jsonData['id'];
await secureStorage.writeSecureData('idMemberAttributeBirthplace', idMemberAttributeBirthplace);
print(await secureStorage.readSecureData('idMemberAttributeBirthplace'));
return 'Simpan Berhasil!';
} else {
print('birthplace ' + apiResult.statusCode.toString());
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan..');
}
}
Future getMember() async {
final apiURL = Uri.parse('https://canary.fundex.id/api/v1.1/member');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
print(await secureStorage.readSecureData('accessToken'));
print(apiResult.reasonPhrase);
print(apiResult.request);
print("get member: " + (apiResult.statusCode).toString());
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
var jsonMember = (jsonData as Map<String, dynamic>)['member'];
return jsonMember;
} else {
throw Exception('Get Failed');
}
}
Future getRefCity() async {
final apiURL = Uri.parse('https://canary.fundex.id/api/v1.1/ref-cities?offset=&limit=');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
print(await secureStorage.readSecureData('accessToken'));
print(apiResult.reasonPhrase);
print(apiResult.request);
print("get ref cities: " + (apiResult.statusCode).toString());
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
List<dynamic> refCities = jsonData['ref_cities'];
final List<String> city = <String>[];
for (var i = 0; i < refCities.length; i++) {
city.add(refCities[i]['name']);
}
return city;
} else {
throw Exception('Get Failed');
}
}
Future getRefState() async {
final apiURL = Uri.parse('https://canary.fundex.id/api/v1.1/ref-states?offset=&limit=');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
print(await secureStorage.readSecureData('accessToken'));
print(apiResult.reasonPhrase);
print(apiResult.request);
print("get ref state: " + (apiResult.statusCode).toString());
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
List<dynamic> refCities = jsonData['ref_states'];
final List<String> state = <String>[];
for (var i = 0; i < refCities.length; i++) {
state.add(refCities[i]['name']);
}
return state;
} else {
throw Exception('Get Failed');
}
}
Future getRefDistrict() async {
final apiURL = Uri.parse('https://canary.fundex.id/api/v1.1/ref-districts?offset=&limit=');
var token = await secureStorage.readSecureData('accessToken');
var headers = {
'Content-type': 'application/json',
HttpHeaders.authorizationHeader: 'Bearer $token',
};
var apiResult = await client.get(apiURL, headers: headers);
print(await secureStorage.readSecureData('accessToken'));
print(apiResult.reasonPhrase);
print(apiResult.request);
print("get ref state: " + (apiResult.statusCode).toString());
if (apiResult.statusCode == 200) {
var jsonObject = json.decode(apiResult.body);
var jsonData = (jsonObject as Map<String, dynamic>)['data'];
List<dynamic> refCities = jsonData['ref_districts'];
final List<String> distr = <String>[];
for (var i = 0; i < refCities.length; i++) {
distr.add(refCities[i]['name']);
}
return distr;
} else {
throw Exception('Get Failed');
}
}
Future postAddress(
String address,
String district,
String city,
String province,
String zipCode
) async {
var apiURL = Uri.parse(
'https://canary.fundex.id/api/v1.1/address)');
var token = await secureStorage.readSecureData('accessToken');
final apiResult = await client.post(apiURL,
headers: <String, String>{
HttpHeaders.authorizationHeader: 'Bearer $token',
},
body: jsonEncode(<String, String>{
"address": address,
"district": district,
"city": city,
"province": province,
"country": "Indonesia",
"zip_code": zipCode
}));
if (apiResult.statusCode == 200) {
// var jsonObject = json.decode(apiResult.body);
// var data = (jsonObject as Map<String, dynamic>)['data'];
// var name = data['name'];
// Map<String, dynamic> map = {'name': name};
print('Patch member berhasil');
print(apiResult.statusCode);
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
return 'Simpan Berhasil!';
} else {
print(apiResult.statusCode);
print(apiResult.reasonPhrase);
print(apiResult.request);
print(apiResult.body);
throw Exception('Gagal menyimpan..');
}
}
}
import 'package:flutter/material.dart';
const primary = Color(0xFF12284B);
const secondary = Color(0xFF0091C9);
const white = Color(0xFFFFFFFF);
const black1 = Color(0xFF000000);
const gray4 = Color(0xFFBDBDBD);
\ No newline at end of file
// To parse this JSON data, do
//
// final user = userFromJson(jsonString);
import 'dart:convert';
User userFromJson(String str) => User.fromJson(json.decode(str));
String userToJson(User data) => json.encode(data.toJson());
class User {
User({
this.email,
this.password,
this.role,
this.isCompany,
});
String email;
String password;
String role;
bool isCompany;
factory User.fromJson(Map<String, dynamic> json) => User(
email: json["email"],
password: json["password"],
role: json["role"],
isCompany: json["is_company"],
);
Map<String, dynamic> toJson() => {
"email": email,
"password": password,
"role": role,
"is_company": isCompany,
};
}
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:fundex_app/api/api.dart';
import 'package:fundex_app/assets/colors.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:fundex_app/pages/kyc/biodata_body.dart';
......@@ -82,7 +83,75 @@ class _AlamatBodyState extends State<AlamatBody> {
final TextEditingController _typeAheadControllerPro = TextEditingController();
final TextEditingController _typeAheadControllerKab = TextEditingController();
final TextEditingController _typeAheadControllerKec = TextEditingController();
final TextEditingController _typeAheadControllerKel = TextEditingController();
List<String> city;
List<String> states;
List<String> distr;
void initState(){
super.initState();
init();
}
Future init() async {
final List<String> listCity = await Api().getRefCity();
final List<String> listStates = await Api().getRefState();
final List<String> listDistr = await Api().getRefDistrict();
city = listCity;
distr= listDistr;
states = listStates;
setState(() {
this.distr= distr;
this.states = states;
this.city = city;
});
}
List<String> getSuggestionsCity(String query) {
List<String> matches = [];
matches.addAll(city);
matches.retainWhere((s) => s.toLowerCase().contains(query.toLowerCase()));
return matches;
}
List<String> getSuggestionsStates(String query) {
List<String> matches = [];
matches.addAll(states);
matches.retainWhere((s) => s.toLowerCase().contains(query.toLowerCase()));
return matches;
}
List<String> getSuggestionsDistr(String query) {
List<String> matches = [];
matches.addAll(distr);
matches.retainWhere((s) => s.toLowerCase().contains(query.toLowerCase()));
return matches;
}
List<String> getSuggestionsCityTambahan(String query) {
List<String> matches = [];
matches.addAll(city);
matches.retainWhere((s) => s.toLowerCase().contains(query.toLowerCase()));
return matches;
}
List<String> getSuggestionsStatesTambahan(String query) {
List<String> matches = [];
matches.addAll(states);
matches.retainWhere((s) => s.toLowerCase().contains(query.toLowerCase()));
return matches;
}
List<String> getSuggestionsDistrTambahan(String query) {
List<String> matches = [];
matches.addAll(distr);
matches.retainWhere((s) => s.toLowerCase().contains(query.toLowerCase()));
return matches;
}
@override
Widget build(BuildContext context) {
......@@ -354,8 +423,7 @@ class _AlamatBodyState extends State<AlamatBody> {
controller: this._typeAheadControllerPro,
decoration: formInputDecoration()),
suggestionsCallback: (pattern) {
return namaProvinsi
.getSuggestionsPro(pattern);
return getSuggestionsStates(pattern);
},
itemBuilder: (context, suggestion) {
return ListTile(
......@@ -393,8 +461,7 @@ class _AlamatBodyState extends State<AlamatBody> {
controller: this._typeAheadControllerKab,
decoration: formInputDecoration()),
suggestionsCallback: (pattern) {
return namaKabupaten
.getSuggestionsKab(pattern);
return getSuggestionsCity(pattern);
},
itemBuilder: (context, suggestion) {
return ListTile(
......@@ -433,8 +500,7 @@ class _AlamatBodyState extends State<AlamatBody> {
controller: this._typeAheadControllerKec,
decoration: formInputDecoration()),
suggestionsCallback: (pattern) {
return namaKecamatan
.getSuggestionsKec(pattern);
return getSuggestionsDistr(pattern);
},
itemBuilder: (context, suggestion) {
return ListTile(
......@@ -467,32 +533,13 @@ class _AlamatBodyState extends State<AlamatBody> {
Container(
width: 343,
child: TypeAheadFormField(
key: Key('typeaheadKelurahan'),
textFieldConfiguration: TextFieldConfiguration(
controller: this._typeAheadControllerKel,
decoration: formInputDecoration()),
suggestionsCallback: (pattern) {
return namaKelurahan
.getSuggestionsKel(pattern);
},
itemBuilder: (context, suggestion) {
return ListTile(
title: Text(suggestion),
);
},
transitionBuilder:
(context, suggestionsBox, controller) {
return suggestionsBox;
},
onSuggestionSelected: (suggestion) {
this._typeAheadControllerKel.text =
suggestion;
},
// ignore: missing_return
child: TextFormField(
keyboardType: TextInputType.text,
decoration: formInputDecoration(),
validator: ValidasiKelurahan.validate,
onSaved: (value) =>
this._pilihKelurahan = value,
onSaved: (String pilihKelurahan) {
_pilihKelurahan = pilihKelurahan;
},
),
),
......@@ -576,9 +623,6 @@ class _AlamatBodyState extends State<AlamatBody> {
MaterialPageRoute(builder: (context) {
return BiodataBody();
}));
// _formkey.currentState.save();
// print(_noKTP);
// print(_noPWP);
},
child: Text(
"Sebelumnya",
......@@ -606,7 +650,14 @@ class _AlamatBodyState extends State<AlamatBody> {
onPressed: () {