|
|
|
@ -78,7 +78,15 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Future.wait([ |
|
|
|
|
// Memanggil _refreshPage untuk menginisialisasi dan memuat data |
|
|
|
|
_refreshPage(); |
|
|
|
|
|
|
|
|
|
_data = <AssetStatusModel>[]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Future<void> _refreshPage() async { |
|
|
|
|
// Menggunakan Future.wait untuk menunggu hasil dari semua tugas selesai |
|
|
|
|
await Future.wait([ |
|
|
|
|
_initData(), |
|
|
|
|
warehouseListAPI(), |
|
|
|
|
typePetiListAPI(), |
|
|
|
@ -90,15 +98,14 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
datatablesCustomerList(), |
|
|
|
|
datatablesWarehouseList(), |
|
|
|
|
initializeDateFormatting('id_ID', null), |
|
|
|
|
]).then((_) { |
|
|
|
|
// Mengatur _isLoading ke false setelah semua tugas selesai |
|
|
|
|
if (mounted) { |
|
|
|
|
setState(() { |
|
|
|
|
_isLoading = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
_data = <AssetStatusModel>[]; |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
// Mengatur _isLoading ke false setelah semua tugas selesai |
|
|
|
|
if (mounted) { |
|
|
|
|
setState(() { |
|
|
|
|
_isLoading = false; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@ -895,77 +902,101 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return AbsorbPointer( |
|
|
|
|
absorbing: _isFetchingData, |
|
|
|
|
child: Scaffold( |
|
|
|
|
backgroundColor: Colors.grey[200], |
|
|
|
|
appBar: AppBar( |
|
|
|
|
elevation: 0, |
|
|
|
|
automaticallyImplyLeading: false, |
|
|
|
|
backgroundColor: Colors.indigo[700], |
|
|
|
|
centerTitle: true, |
|
|
|
|
title: Row( |
|
|
|
|
children: [ |
|
|
|
|
SizedBox(width: 10), |
|
|
|
|
Expanded( |
|
|
|
|
child: Center( |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
'SIOPAS-ISTW', |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
'${user.fullname}', |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
body: ListView( |
|
|
|
|
children: [ |
|
|
|
|
cardMenuSync(), |
|
|
|
|
SizedBox(height: 10), |
|
|
|
|
Container( |
|
|
|
|
padding: EdgeInsets.all(10), |
|
|
|
|
child: Text( |
|
|
|
|
'Menu Aplikasi', |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 18, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
return WillPopScope( |
|
|
|
|
onWillPop: () async { |
|
|
|
|
// Mencegah kembali ke halaman sebelumnya |
|
|
|
|
return false; |
|
|
|
|
}, |
|
|
|
|
child: AbsorbPointer( |
|
|
|
|
absorbing: _isFetchingData, |
|
|
|
|
child: Scaffold( |
|
|
|
|
backgroundColor: Colors.grey[200], |
|
|
|
|
appBar: AppBar( |
|
|
|
|
elevation: 0, |
|
|
|
|
automaticallyImplyLeading: false, |
|
|
|
|
backgroundColor: Colors.indigo[700], |
|
|
|
|
centerTitle: true, |
|
|
|
|
title: Row( |
|
|
|
|
children: [ |
|
|
|
|
SizedBox(width: 10), |
|
|
|
|
Expanded( |
|
|
|
|
child: cardMenuPeminjaman(), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: cardMenuPengembalian(), |
|
|
|
|
child: Center( |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
'SIOPAS-ISTW', |
|
|
|
|
textAlign: TextAlign.center, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
'${user.fullname}', |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox(height: 10), // Add some space between rows |
|
|
|
|
Row( |
|
|
|
|
), |
|
|
|
|
body: RefreshIndicator( |
|
|
|
|
color: Colors.white, |
|
|
|
|
backgroundColor: Colors.indigo[700], |
|
|
|
|
onRefresh: () async { |
|
|
|
|
// Tampilkan Shimmer loading selama proses refresh |
|
|
|
|
setState(() { |
|
|
|
|
_isLoading = true; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// Selesaikan proses refresh |
|
|
|
|
await _refreshPage(); |
|
|
|
|
|
|
|
|
|
// Sembunyikan Shimmer loading setelah selesai |
|
|
|
|
setState(() { |
|
|
|
|
_isLoading = false; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: ListView( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: cardMenuTransfer(), |
|
|
|
|
cardMenuSync(), |
|
|
|
|
SizedBox(height: 10), |
|
|
|
|
Container( |
|
|
|
|
padding: EdgeInsets.all(10), |
|
|
|
|
child: Text( |
|
|
|
|
'Menu Aplikasi', |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 18, |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container(), |
|
|
|
|
// child: cardMenuPengembalian(), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: cardMenuPeminjaman(), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: cardMenuPengembalian(), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox(height: 10), // Add some space between rows |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: cardMenuTransfer(), |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: Container(), |
|
|
|
|
// child: cardMenuPengembalian(), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|