|
|
|
@ -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>[]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@ -895,7 +902,12 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return AbsorbPointer( |
|
|
|
|
return WillPopScope( |
|
|
|
|
onWillPop: () async { |
|
|
|
|
// Mencegah kembali ke halaman sebelumnya |
|
|
|
|
return false; |
|
|
|
|
}, |
|
|
|
|
child: AbsorbPointer( |
|
|
|
|
absorbing: _isFetchingData, |
|
|
|
|
child: Scaffold( |
|
|
|
|
backgroundColor: Colors.grey[200], |
|
|
|
@ -928,7 +940,24 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
body: ListView( |
|
|
|
|
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: [ |
|
|
|
|
cardMenuSync(), |
|
|
|
|
SizedBox(height: 10), |
|
|
|
@ -968,6 +997,8 @@ class _HomePageState extends State<HomePage> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|