|
|
@ -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(), |
|
|
|
_initData(), |
|
|
|
warehouseListAPI(), |
|
|
|
warehouseListAPI(), |
|
|
|
typePetiListAPI(), |
|
|
|
typePetiListAPI(), |
|
|
@ -90,15 +98,14 @@ class _HomePageState extends State<HomePage> { |
|
|
|
datatablesCustomerList(), |
|
|
|
datatablesCustomerList(), |
|
|
|
datatablesWarehouseList(), |
|
|
|
datatablesWarehouseList(), |
|
|
|
initializeDateFormatting('id_ID', null), |
|
|
|
initializeDateFormatting('id_ID', null), |
|
|
|
]).then((_) { |
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
// Mengatur _isLoading ke false setelah semua tugas selesai |
|
|
|
// Mengatur _isLoading ke false setelah semua tugas selesai |
|
|
|
if (mounted) { |
|
|
|
if (mounted) { |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
_isLoading = false; |
|
|
|
_isLoading = false; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
_data = <AssetStatusModel>[]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@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, |
|
|
|
absorbing: _isFetchingData, |
|
|
|
child: Scaffold( |
|
|
|
child: Scaffold( |
|
|
|
backgroundColor: Colors.grey[200], |
|
|
|
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: [ |
|
|
|
children: [ |
|
|
|
cardMenuSync(), |
|
|
|
cardMenuSync(), |
|
|
|
SizedBox(height: 10), |
|
|
|
SizedBox(height: 10), |
|
|
@ -968,6 +997,8 @@ class _HomePageState extends State<HomePage> { |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|