Commit d31b1ca6 authored by Dio Maulana's avatar Dio Maulana

perbaharui dialog home

parent b1f93059
......@@ -146,6 +146,14 @@ class Api {
return ApiResponse(error: true, msg: Strings.cantConnectToServer);
} else {
if (jsonObject['status'] == "ok") {
// simpan NIK user
List<String> listAbsentUser = getListAbsentUser();
int indexList =
listAbsentUser.indexWhere((element) => element == nik);
if (indexList == -1) {
listAbsentUser.add(nik);
setListAbsentUser(listAbsentUser);
}
return ApiResponse(
error: false,
msg: Strings.succesGetData,
......@@ -184,6 +192,14 @@ class Api {
return ApiResponse(error: true, msg: Strings.cantConnectToServer);
} else {
if (jsonObject['status'] == "ok") {
// simpan NIK user
List<String> listAbsentUser = getListAbsentUser();
int indexList =
listAbsentUser.indexWhere((element) => element == nik);
if (indexList == -1) {
listAbsentUser.add(nik);
setListAbsentUser(listAbsentUser);
}
return ApiResponse(
error: false,
msg: Strings.succesGetData,
......
......@@ -2,6 +2,7 @@ import 'package:excelso_attendance/main.dart';
const String _latitude = 'laU';
const String _longitude = 'loU';
const String _listAbsent = 'listAbsent';
String? getLatitude() {
return prefs.getString(_latitude);
......@@ -20,3 +21,11 @@ Future<String> setLongitude(String value) async {
prefs.setString(_longitude, value);
return value;
}
Future<void> setListAbsentUser(List<String> value) async {
prefs.setStringList(_listAbsent, value);
}
List<String> getListAbsentUser() {
return prefs.getStringList(_listAbsent) ?? [];
}
This diff is collapsed.
......@@ -145,6 +145,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.5"
dropdown_button2:
dependency: "direct main"
description:
name: dropdown_button2
sha256: "374f2390161bf782b4896f0b1b24cbb2b5daaa1cfb11047c3307461dcdf44e07"
url: "https://pub.dev"
source: hosted
version: "2.1.3"
fake_async:
dependency: transitive
description:
......
......@@ -32,6 +32,7 @@ dependencies:
autocomplete_textfield: ^2.0.1
camera: ^0.10.5+2
cupertino_icons: ^1.0.2
dropdown_button2: ^2.1.3
flutter:
sdk: flutter
flutter_easyloading: ^3.0.5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment