Browse Source

perbaikan bug list peti, penambahan refresh page home

master
unknown 9 months ago
parent
commit
9bd0b1a505
  1. 173
      lib/pages/home/home_page.dart
  2. 92
      lib/pages/peminjaman_barang/create-finish.dart
  3. 92
      lib/pages/pengembalian_barang/edit-finish.dart
  4. 92
      lib/pages/transfer_peti/edit-finish.dart
  5. 46
      lib/pages/transfer_peti/index.dart

173
lib/pages/home/home_page.dart

@ -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(),
),
],
),
],
),
],
),
),
),
);

92
lib/pages/peminjaman_barang/create-finish.dart

@ -414,58 +414,56 @@ class _CreateFinishPeminjamanState extends State<CreateFinishPeminjaman> {
color: Colors.grey[100],
),
padding: EdgeInsets.all(8),
child: Expanded(
child: ListView.builder(
itemCount: widget.temporaryDataList.length,
itemBuilder: (context, index) {
int? petiId =
widget.temporaryDataList[index].peti_id;
PetiAssetModel? petiSqfliteApi =
_valpeti?.firstWhereOrNull(
(peti) => peti.id == petiId,
);
return ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
100, // Set your desired height here
),
child: Card(
elevation: 1,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Colors.grey.withOpacity(0.5),
width: 1,
),
child: ListView.builder(
itemCount: widget.temporaryDataList.length,
itemBuilder: (context, index) {
int? petiId =
widget.temporaryDataList[index].peti_id;
PetiAssetModel? petiSqfliteApi =
_valpeti?.firstWhereOrNull(
(peti) => peti.id == petiId,
);
return ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
100, // Set your desired height here
),
child: Card(
elevation: 1,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Colors.grey.withOpacity(0.5),
width: 1,
),
margin: EdgeInsets.symmetric(vertical: 4),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Row(
children: [
Text(
'${index + 1}.',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
SizedBox(width: 16),
Text(
' ${petiSqfliteApi?.fix_lot ?? ''}',
style: TextStyle(fontSize: 13),
),
margin: EdgeInsets.symmetric(vertical: 4),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Row(
children: [
Text(
'${index + 1}.',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
// Tambahkan properti lainnya sesuai kebutuhan
],
),
),
SizedBox(width: 16),
Text(
' ${petiSqfliteApi?.fix_lot ?? ''}',
style: TextStyle(fontSize: 13),
),
// Tambahkan properti lainnya sesuai kebutuhan
],
),
),
),
);
},
),
),
);
},
),
),
SizedBox(height: 16),

92
lib/pages/pengembalian_barang/edit-finish.dart

@ -397,58 +397,56 @@ class _EditFinishPengembalianState extends State<EditFinishPengembalian> {
color: Colors.grey[100],
),
padding: EdgeInsets.all(8),
child: Expanded(
child: ListView.builder(
itemCount: widget.temporaryDataList.length,
itemBuilder: (context, index) {
int? petiId =
widget.temporaryDataList[index].peti_id;
PetiAssetModel? petiSqfliteApi =
_valpeti?.firstWhereOrNull(
(peti) => peti.id == petiId,
);
return ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
100, // Set your desired height here
),
child: Card(
elevation: 1,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Colors.grey.withOpacity(0.5),
width: 1,
),
child: ListView.builder(
itemCount: widget.temporaryDataList.length,
itemBuilder: (context, index) {
int? petiId =
widget.temporaryDataList[index].peti_id;
PetiAssetModel? petiSqfliteApi =
_valpeti?.firstWhereOrNull(
(peti) => peti.id == petiId,
);
return ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
100, // Set your desired height here
),
child: Card(
elevation: 1,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Colors.grey.withOpacity(0.5),
width: 1,
),
margin: EdgeInsets.symmetric(vertical: 4),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Row(
children: [
Text(
'${index + 1}.',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
SizedBox(width: 16),
Text(
' ${petiSqfliteApi?.fix_lot ?? ''}',
style: TextStyle(fontSize: 13),
),
margin: EdgeInsets.symmetric(vertical: 4),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Row(
children: [
Text(
'${index + 1}.',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
// Tambahkan properti lainnya sesuai kebutuhan
],
),
),
SizedBox(width: 16),
Text(
' ${petiSqfliteApi?.fix_lot ?? ''}',
style: TextStyle(fontSize: 13),
),
// Tambahkan properti lainnya sesuai kebutuhan
],
),
),
),
);
},
),
),
);
},
),
),
SizedBox(height: 16),

92
lib/pages/transfer_peti/edit-finish.dart

@ -415,58 +415,56 @@ class _EditFinishTransferPetiState extends State<EditFinishTransferPeti> {
color: Colors.grey[100],
),
padding: EdgeInsets.all(8),
child: Expanded(
child: ListView.builder(
itemCount: widget.temporaryDataList.length,
itemBuilder: (context, index) {
int? petiId =
widget.temporaryDataList[index].peti_id;
PetiAssetModel? petiSqfliteApi =
_valpeti?.firstWhereOrNull(
(peti) => peti.id == petiId,
);
return ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
100, // Set your desired height here
),
child: Card(
elevation: 1,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Colors.grey.withOpacity(0.5),
width: 1,
),
child: ListView.builder(
itemCount: widget.temporaryDataList.length,
itemBuilder: (context, index) {
int? petiId =
widget.temporaryDataList[index].peti_id;
PetiAssetModel? petiSqfliteApi =
_valpeti?.firstWhereOrNull(
(peti) => peti.id == petiId,
);
return ConstrainedBox(
constraints: BoxConstraints(
maxHeight:
100, // Set your desired height here
),
child: Card(
elevation: 1,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
side: BorderSide(
color: Colors.grey.withOpacity(0.5),
width: 1,
),
margin: EdgeInsets.symmetric(vertical: 4),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Row(
children: [
Text(
'${index + 1}.',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
SizedBox(width: 16),
Text(
' ${petiSqfliteApi?.fix_lot ?? ''}',
style: TextStyle(fontSize: 13),
),
margin: EdgeInsets.symmetric(vertical: 4),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: SingleChildScrollView(
child: Row(
children: [
Text(
'${index + 1}.',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
),
// Tambahkan properti lainnya sesuai kebutuhan
],
),
),
SizedBox(width: 16),
Text(
' ${petiSqfliteApi?.fix_lot ?? ''}',
style: TextStyle(fontSize: 13),
),
// Tambahkan properti lainnya sesuai kebutuhan
],
),
),
),
);
},
),
),
);
},
),
),
SizedBox(height: 16),

46
lib/pages/transfer_peti/index.dart

@ -249,27 +249,33 @@ class TransferPetiPageState extends State<TransferPetiPage> {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 1,
child: Scaffold(
appBar: appBar(context),
body: _isLoading
? Column(
children: [
// shimmerSearch(),
Expanded(
child: ListView.builder(
itemCount:
4, // Set the number of shimmer cards based on your data count
itemBuilder: (context, index) {
return ShimmerLoadingAssetStatusCard();
},
return WillPopScope(
onWillPop: () async {
// Mencegah kembali ke halaman sebelumnya
return false;
},
child: DefaultTabController(
length: 1,
child: Scaffold(
appBar: appBar(context),
body: _isLoading
? Column(
children: [
// shimmerSearch(),
Expanded(
child: ListView.builder(
itemCount:
4, // Set the number of shimmer cards based on your data count
itemBuilder: (context, index) {
return ShimmerLoadingAssetStatusCard();
},
),
),
),
],
)
: bodyTransferPeti(),
bottomNavigationBar: bottomAppBar(context),
],
)
: bodyTransferPeti(),
bottomNavigationBar: bottomAppBar(context),
),
),
);
}

Loading…
Cancel
Save