slight changes

This commit is contained in:
kicap
2023-11-13 18:33:06 +08:00
parent 667aae745b
commit 41ecbc0065
10 changed files with 139 additions and 52 deletions

View File

@ -51,7 +51,7 @@ class DataSiswaView extends StatelessWidget {
),
),
Text(
'20 orang',
'${model.jumlahSiswa} orang',
style: regularTextStyle.copyWith(
color: Colors.white,
fontSize: 15,

View File

@ -17,15 +17,33 @@ class DataSiswaViewModel extends CustomBaseViewModel {
List<SiswaModel> siswaModelList = [];
int jumlahSiswa = 0;
String? role;
Future<void> init() async {
await getData();
await getJumlahSiswa();
prefs.then((SharedPreferences prefs) {
role = prefs.getString('role');
});
}
getJumlahSiswa() async {
setBusy(true);
easyLoading.showLoading();
try {
var response = await _httpService.get('jumlah_siswa');
log.i(response.data['data']);
jumlahSiswa = int.parse(response.data['data']['jumlah']);
} catch (e) {
log.e(e);
} finally {
setBusy(false);
easyLoading.dismissLoading();
}
}
getData() async {
setBusy(true);
easyLoading.showLoading();