slight changes
This commit is contained in:
@ -51,7 +51,7 @@ class DataSiswaView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'20 orang',
|
||||
'${model.jumlahSiswa} orang',
|
||||
style: regularTextStyle.copyWith(
|
||||
color: Colors.white,
|
||||
fontSize: 15,
|
||||
|
||||
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user