Commit 965e5fff authored by Faizol's avatar Faizol

fixing ui

parent af2930c1
...@@ -18,11 +18,16 @@ This project is a starting point for a Flutter application. ...@@ -18,11 +18,16 @@ This project is a starting point for a Flutter application.
** Added Card history endpoint ticket & balance ✅ ** Added Card history endpoint ticket & balance ✅
** Added UI Card history endpoint ticket & balance ✅ ** Added UI Card history endpoint ticket & balance ✅
** Adjust Ui check balance ✅ ** Adjust Ui check balance ✅
** Added function print card history ** Added function print card history
** Added Ui print card history ** Added Ui print card history
** Update mifare mdd lib to version version: 0.1.42 ✅ ** Update mifare mdd lib to version version: 0.1.42 ✅
** Disable print history ✅ ** Disable print history ✅
** Update version ✅ ** Update version ✅
## Version App Change Log SS.23.2.WWW.SB.PC ## Version App Change Log SS.23.2.WWW.SB.PC
## Version Code 17 ## Version Code 17 (actual)
** remove icon printer ✅
** change icon reload ✅
** add datetime in history saldo & ticket ✅
** add scrollable effect to table history ✅
\ No newline at end of file
sdk.dir=C:\\Users\\MDD HP\\AndroidSDK sdk.dir=C:\\Users\\MDD HP\\AndroidSDK
flutter.sdk=C:\\Users\\MDD HP\\flutter flutter.sdk=C:\\Users\\MDD HP\\flutter
flutter.buildMode=debug flutter.buildMode=debug
flutter.versionName=SS.23.2.WWW.SB.PC flutter.versionName=1.0.0
flutter.versionCode=17 flutter.versionCode=1
\ No newline at end of file \ No newline at end of file
...@@ -11,6 +11,12 @@ Color blueColor = const Color(0xff53c1f9); ...@@ -11,6 +11,12 @@ Color blueColor = const Color(0xff53c1f9);
Color purpleColor = const Color(0xff5142E6); Color purpleColor = const Color(0xff5142E6);
Color greenColor = const Color(0xff22B07D); Color greenColor = const Color(0xff22B07D);
//Pallet timer
Color color1 = const Color(0xffFFCD4B);
Color color2 = const Color(0xff3876BF);
Color color3 = const Color(0xffDA0C81);
Color color4 = const Color(0xffE95793);
//Background color //Background color
Color lightBackgroundColor = const Color(0xffF6F8FB); Color lightBackgroundColor = const Color(0xffF6F8FB);
Color darkBackgroundColor = const Color(0xff020518); Color darkBackgroundColor = const Color(0xff020518);
......
...@@ -47,6 +47,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -47,6 +47,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
int _activeContainerIndex = 1; int _activeContainerIndex = 1;
List<Map<String, dynamic>> balanceHistoryData = []; List<Map<String, dynamic>> balanceHistoryData = [];
List<Map<String, dynamic>> ticketHistoryData = []; List<Map<String, dynamic>> ticketHistoryData = [];
ScrollController _scrollController = ScrollController();
@override @override
void initState() { void initState() {
...@@ -99,28 +101,29 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -99,28 +101,29 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
return DateFormat('dd-MMM-yyyy').format(nowt); return DateFormat('dd-MMM-yyyy').format(nowt);
} }
_getInfoCard(var info, BuildContext context) { void _getInfoCard(var info, BuildContext context) async {
setState((){ try {
if (info.toString().toLowerCase().contains('failed')) { if (info == null) {
print('ini pesan salah'); print('Data tidak ditemukan');
return;
}
if (info.toString().toLowerCase().contains('card not found')) {
message = "Silakan Tempel Wristband Anda Di Reader"; message = "Silakan Tempel Wristband Anda Di Reader";
tapDial(context); tapDial(context);
if (timer != null) timer?.cancel(); if (timer != null) timer?.cancel();
// tapIdle();
} else { } else {
infoCard = info; infoCard = info;
var infoMap = jsonDecode(info); var infoMap = jsonDecode(info);
if (infoMap["cardType"] != null) {
switch (infoMap["cardType"]) { switch (infoMap["cardType"]) {
case 1: case 1:
// Perubahan cardType 1 baru menjadi
cardType = "Kartu Belum Aktif"; cardType = "Kartu Belum Aktif";
break; break;
case 2: case 2:
// Perubahan cardType 2 Belum aktif menjadi
cardType = "Kartu Aktif"; cardType = "Kartu Aktif";
break; break;
case 3: case 3:
// Perubahan cardType 3 aktif menjadi
cardType = "Binding Customer"; cardType = "Binding Customer";
break; break;
case 4: case 4:
...@@ -133,67 +136,116 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -133,67 +136,116 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
cardType = "Tidak Terdaftar"; cardType = "Tidak Terdaftar";
break; break;
} }
} else {
cardType = "Tidak Terdaftar";
}
if (infoMap["balance"] != null) {
balance = CurrencyFormat.convertToIdr( balance = CurrencyFormat.convertToIdr(
infoMap["balance"], infoMap["balance"],
2, 2,
); );
// NOTE merubah tanggal }
var change = DateTime.fromMillisecondsSinceEpoch(
int.parse(infoMap['cardExpirity']) * 1000); if (infoMap["cardExpirity"] != null) {
var cardExpiryMillis = int.parse(infoMap['cardExpirity']) * 1000;
var change = DateTime.fromMillisecondsSinceEpoch(cardExpiryMillis);
final DateFormat formatter = DateFormat('dd-MMM-yyyy'); final DateFormat formatter = DateFormat('dd-MMM-yyyy');
cardExpirity = formatter.format(change); cardExpirity = formatter.format(change);
deposit = CurrencyFormat.convertToIdr(infoMap["deposit"], 2,); }
if (infoMap["deposit"] != null) {
deposit = CurrencyFormat.convertToIdr(infoMap["deposit"], 2);
}
if (infoMap["cardNumber"] != null) {
cardNumber = infoMap["cardNumber"]; cardNumber = infoMap["cardNumber"];
String cardNo = cardNumber.toString(); String cardNo = cardNumber.toString();
String targetMasked = cardNo.substring(0, 12); String targetMasked = cardNo.substring(0, 12);
maskedText = cardNo.replaceAll(targetMasked, '************'); maskedText = cardNo.replaceAll(targetMasked, '************');
}
if (infoMap["name"] != null) {
name = infoMap["name"].toString().split("-")[0]; name = infoMap["name"].toString().split("-")[0];
}
if (infoMap["cardUid"] != null) {
cardUid = infoMap["cardUid"]; cardUid = infoMap["cardUid"];
regDb= infoMap["regDb"];
} }
if (infoMap["regDb"] != null) {
regDb = infoMap["regDb"];
await _getAuditHistoryBalance(cardUid, regDb);
await _getAuditHistoryTicket(cardUid, regDb);
}
setState(() {
isShowingDialog = false;
isDenomDialogShowing = false;
checkCountZero = false;
}); });
tapIdle(context);
Navigator.pop(context);
}
} catch (e) {
// Tangani kesalahan saat memproses data
print("Kesalahan saat memproses data: $e");
// Lakukan sesuatu untuk menangani kesalahan ini, seperti menampilkan pesan kesalahan kepada pengguna.
}
} }
Future<void> getAuditHistoryBalance(String cardUid, String regDb) async { Future<void> _getAuditHistoryBalance(String cardUid, String regDb) async {
try { try {
var auditHistoryBalance = await ServiceApi.fetchAuditHistory(cardUid, regDb, "balance"); var auditHistoryBalance = await ServiceApi.fetchAuditHistory(cardUid, regDb, "balance");
print("AUDIT HISTORY BALANCE: $auditHistoryBalance"); print("AUDIT HISTORY BALANCE: $auditHistoryBalance");
setState(() {
balanceHistoryData.clear(); balanceHistoryData.clear();
// Your data is already a Map, so you don't need to decode it if (auditHistoryBalance != null) {
List<dynamic> dataBalance = auditHistoryBalance['data']; List<dynamic> dataBalance = auditHistoryBalance['data'];
// Tambahkan data dari respons ke dalam balanceHistoryData
for (var itemBalance in dataBalance) { for (var itemBalance in dataBalance) {
// print("isi dari $item");
balanceHistoryData.add(itemBalance); balanceHistoryData.add(itemBalance);
} }
balanceHistoryData = balanceHistoryData.reversed.toList();
balanceHistoryData = balanceHistoryData.reversed.toList();
}
});
} catch (error) { } catch (error) {
setState(() {
print("AUDIT BALANCE ERROR: $error"); print("AUDIT BALANCE ERROR: $error");
});
} }
} }
Future<void> getAuditHistoryTicket(String cardUid, String regDb) async { Future<void> _getAuditHistoryTicket(String cardUid, String regDb) async {
try { try {
var auditHistoryTicket = await ServiceApi.fetchAuditHistory(cardUid, regDb, "ticket"); var auditHistoryTicket = await ServiceApi.fetchAuditHistory(cardUid, regDb, "ticket");
print("AUDIT HISTORY TICKET: $auditHistoryTicket"); print("AUDIT HISTORY TICKET: $auditHistoryTicket");
setState(() {
ticketHistoryData.clear(); ticketHistoryData.clear();
if (auditHistoryTicket != null) {
List<dynamic> dataTicket = auditHistoryTicket['data']; List<dynamic> dataTicket = auditHistoryTicket['data'];
for (var itemTicket in dataTicket) { for (var itemTicket in dataTicket) {
ticketHistoryData.add(itemTicket); ticketHistoryData.add(itemTicket);
} }
ticketHistoryData = ticketHistoryData.reversed.toList(); ticketHistoryData = ticketHistoryData.reversed.toList();
}
});
} catch (error) { } catch (error) {
setState(() {
print("AUDIT TICKET ERROR: $error"); print("AUDIT TICKET ERROR: $error");
});
} }
} }
void tapIdle(BuildContext context) { Future <void> tapIdle(BuildContext context) async{
var connectivityResult = Connectivity().checkConnectivity(); var connectivityResult = Connectivity().checkConnectivity();
if (connectivityResult == ConnectivityResult.none) { if (connectivityResult == ConnectivityResult.none) {
...@@ -233,7 +285,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -233,7 +285,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
}); });
} }
void tapDial(BuildContext context) async { Future<void> tapDial(BuildContext context) async {
var connectivityResult = await Connectivity().checkConnectivity(); var connectivityResult = await Connectivity().checkConnectivity();
if (connectivityResult == ConnectivityResult.none) { if (connectivityResult == ConnectivityResult.none) {
...@@ -258,15 +310,6 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -258,15 +310,6 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
var isTap = await StartService.getCard(); var isTap = await StartService.getCard();
try { try {
_getInfoCard(isTap, context); _getInfoCard(isTap, context);
await Future.wait([
getAuditHistoryTicket(cardUid, regDb),
getAuditHistoryBalance(cardUid, regDb),
]);
isShowingDialog = false;
isDenomDialogShowing = false;
checkCountZero = false;
tapIdle(context);
Navigator.pop(context);
} catch (e) { } catch (e) {
print("Error $isTap"); print("Error $isTap");
tapDial(context); tapDial(context);
...@@ -533,7 +576,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -533,7 +576,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Column( Column(
children: [ children: [
Container( Container(
width: screenWidth * 0.01, // Container untuk spasi di kiri width: screenWidth * 0.10, // Container untuk spasi di kiri
), ),
Container( Container(
width: screenWidth * 0.70, width: screenWidth * 0.70,
...@@ -541,14 +584,18 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -541,14 +584,18 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
child: buildWalletSection(), child: buildWalletSection(),
), ),
Container( Container(
margin: EdgeInsets.fromLTRB(0,0,0,0 ), margin: EdgeInsets.fromLTRB(30,0,0,0 ),
width: screenWidth * 0.95, width: screenWidth * 0.95,
height: screenHeight * 0.70, // Container untuk "balance section" height: screenHeight * 0.70, // Container untuk "balance section"
child: buildBalanceSection(), child: buildBalanceSection(),
), ),
SizedBox(height: 20), SizedBox(height: 20),
SizedBox(height: 20), SizedBox(height: 20),
buildTicketSection(), Container(
margin: EdgeInsets.fromLTRB(30,0,0,0 ),
width: screenWidth * 0.95,
height: screenHeight * 0.70,
child: buildTicketSection()),
SizedBox(height: 20), SizedBox(height: 20),
], ],
), ),
...@@ -556,9 +603,10 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -556,9 +603,10 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
), ),
), ),
Positioned( Positioned(
bottom: 20.0, // Adjust the position as needed bottom: 90.0, // Adjust the position as needed
right: 20.0, // Adjust the position as needed right: 5.0, // Adjust the position as needed
child: FloatingActionButton( child: FloatingActionButton(
backgroundColor: purpleColor,
onPressed: () { onPressed: () {
// Add the action for your floating button // Add the action for your floating button
isShowingDialog = true; isShowingDialog = true;
...@@ -566,15 +614,17 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -566,15 +614,17 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
_showTap(context); _showTap(context);
tapDial(context); tapDial(context);
}, },
child: Icon(Icons.search), child: Icon(
Icons.sync,
color: Colors.white,),
), ),
), ),
Positioned( // Positioned(
bottom: 100.0, // Adjust the position as needed // bottom: 100.0, // Adjust the position as needed
right: 20.0, // Adjust the position as needed // right: 20.0, // Adjust the position as needed
child: FloatingActionButton( // child: FloatingActionButton(
onPressed: () { // onPressed: () {
showToastMessage('Maaf , fitur tidak tersedia'); // showToastMessage('Maaf , fitur tidak tersedia');
//Nyalakan kembali jika dibutuhkan //Nyalakan kembali jika dibutuhkan
// Konversi data ke JSON // Konversi data ke JSON
...@@ -595,13 +645,13 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -595,13 +645,13 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
// deposit, // deposit,
// balance // balance
// ); // );
}, // },
child: Icon(Icons.print), // child: Icon(Icons.print),
), // ),
), // ),
Positioned( Positioned(
bottom: 120.0, // Adjust the position as needed bottom: 100.0, // Adjust the position as needed
right: 30.0, // Adjust the position as needed right: 14.5, // Adjust the position as needed
child: buildTimerSection(context), child: buildTimerSection(context),
), ),
], ],
...@@ -970,7 +1020,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -970,7 +1020,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
return Visibility( return Visibility(
visible: balanceHistoryData.isNotEmpty, visible: balanceHistoryData.isNotEmpty,
child: Container( child: Container(
width: screenWidth , width: screenWidth * 40,
height: 500, height: 500,
padding: EdgeInsets.only(bottom: 20),// padding: EdgeInsets.only(bottom: 20),//
margin: EdgeInsets.all(20), // Add margin to the outer Container margin: EdgeInsets.all(20), // Add margin to the outer Container
...@@ -1018,18 +1068,24 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1018,18 +1068,24 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [ children: [
TableRow( TableRow(
children: [ children: [
TableCell(child: Text('Terminal',style: TextStyle(fontWeight: FontWeight.bold),)), // Judul untuk sel pertama TableCell(child: Text('Terminal',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center,)),
TableCell(child: Text('Tipe', style: TextStyle(fontWeight: FontWeight.bold))), // Judul untuk sel kedua TableCell(child: Text('Tid',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel pertama// Judul untuk sel pertama
TableCell(child: Text('Jumlah',style: TextStyle(fontWeight: FontWeight.bold))), // Judul untuk sel kedua TableCell(child: Text('Tipe', style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('Saldo Akhir',style: TextStyle(fontWeight: FontWeight.bold))), // Judul untuk sel kedua TableCell(child: Text('Tanggal', style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('Jam', style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('Jumlah',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('Saldo Akhir',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
], ],
), ),
TableRow( TableRow(
children: [ children: [
TableCell(child: Text('-',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic))), // Judul untuk sel pertama TableCell(child: Text('-',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel pertama
TableCell(child: Text('type',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic))), // Judul untuk sel kedua TableCell(child: Text('-',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel pertama
TableCell(child: Text('amount',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic))), // Judul untuk sel kedua TableCell(child: Text('type',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('last balance',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic))), // Judul untuk sel kedua TableCell(child: Text('date',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('time',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('amount',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('last balance',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
], ],
), ),
], ],
...@@ -1043,8 +1099,12 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1043,8 +1099,12 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
), ),
Expanded( Expanded(
child: Container( child: Container(
child: child: Scrollbar(
ListView.builder( controller: _scrollController, // Use the same ScrollController
thumbVisibility: true,
radius: Radius.circular(6), // Customize the scrollbar appearance
thickness: 6,// Ensure scrollbar is always shown
child: ListView.builder(
shrinkWrap: true, // Make sure to set shrinkWrap to true shrinkWrap: true, // Make sure to set shrinkWrap to true
itemCount: balanceHistoryData.length, itemCount: balanceHistoryData.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
...@@ -1053,10 +1113,31 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1053,10 +1113,31 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
int lastBalance = data['last_balance']; int lastBalance = data['last_balance'];
String fAmount = NumberFormat.decimalPattern().format(amount); String fAmount = NumberFormat.decimalPattern().format(amount);
String fLastBalance = NumberFormat.decimalPattern().format(lastBalance); String fLastBalance = NumberFormat.decimalPattern().format(lastBalance);
String dateTimeString = data['datetime'];
List<String> parts = dateTimeString.split(" ");
String date = parts[0];
String time = parts[1];
String terminalTid = data['terminal'];
String terminalName = data['terminal'];
String tid = "-";
String name = "-";
if (terminalName.length > 4) {
name = terminalName.substring(0, terminalName.length - 5);
} else {
terminalName = "";
}
if (terminalTid.length >= 4) {
tid = terminalTid.substring(terminalTid.length - 4); // Mengambil 4 karakter terakhir
} else {
while (terminalTid.length < 4) {
terminalTid = "0" + terminalTid;
}
}
return SingleChildScrollView( return SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: child: Card(
Card(
margin: EdgeInsets.fromLTRB(20,0,20,12), margin: EdgeInsets.fromLTRB(20,0,20,12),
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(20,10,20,10), padding: const EdgeInsets.fromLTRB(20,10,20,10),
...@@ -1069,10 +1150,13 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1069,10 +1150,13 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [ children: [
TableRow( TableRow(
children: [ children: [
TableCell(child: Text(data['terminal'])), TableCell(child: Text(name,textAlign: TextAlign.center)),
TableCell(child: Text(data['type'])), TableCell(child: Text(tid,textAlign: TextAlign.center)),
TableCell(child: Text(fAmount.toString())), TableCell(child: Text(data['type'],textAlign: TextAlign.center)),
TableCell(child: Text(fLastBalance.toString())), TableCell(child: Text(date,textAlign: TextAlign.center)),
TableCell(child: Text(time,textAlign: TextAlign.center)),
TableCell(child: Text(fAmount.toString(),textAlign: TextAlign.center)),
TableCell(child: Text(fLastBalance.toString(),textAlign: TextAlign.center)),
], ],
), ),
], ],
...@@ -1089,6 +1173,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1089,6 +1173,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
), ),
), ),
), ),
),
], ],
), ),
), ),
...@@ -1098,10 +1183,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1098,10 +1183,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Widget buildTicketSection() { Widget buildTicketSection() {
double screenWidth = MediaQuery.of(context).size.width; double screenWidth = MediaQuery.of(context).size.width;
double textScaleFactor = screenWidth / 1700; double textScaleFactor = screenWidth / 1700;
return Visibility( return Visibility(
visible: ticketHistoryData.isNotEmpty, visible: ticketHistoryData.isNotEmpty,
child: SingleChildScrollView(
child: Container( child: Container(
width: screenWidth * 40, width: screenWidth * 40,
height: 500, height: 500,
...@@ -1135,7 +1218,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1135,7 +1218,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
margin: EdgeInsets.fromLTRB(20, 0, 20, 0), margin: EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Card( child: Card(
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(20,10,20,10), padding: const EdgeInsets.fromLTRB(10,10,10,10),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
...@@ -1143,18 +1226,24 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1143,18 +1226,24 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [ children: [
TableRow( TableRow(
children: [ children: [
TableCell(child: Text('Terminal',style: TextStyle(fontWeight: FontWeight.bold),)), // Judul untuk sel pertama TableCell(child: Text('Terminal',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel pertama
TableCell(child: Text('Tipe', style: TextStyle(fontWeight: FontWeight.bold))), // Judul untuk sel kedua TableCell(child: Text('Tid',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel pertama
TableCell(child: Text('Kuantitas',style: TextStyle(fontWeight: FontWeight.bold))), // Judul untuk sel kedua TableCell(child: Text('Tipe', style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('Tiket Akhir',style: TextStyle(fontWeight: FontWeight.bold))), // Judul untuk sel kedua TableCell(child: Text('Tanggal', style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('Jam', style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)),
TableCell(child: Text('Kuantitas',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('Tiket Akhir',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel kedua
], ],
), ),
TableRow( TableRow(
children: [ children: [
TableCell(child: Text('-',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic))), // Judul untuk sel pertama TableCell(child: Text('-',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel pertama
TableCell(child: Text('type',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic))), // Judul untuk sel kedua TableCell(child: Text('-',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel pertama
TableCell(child: Text('quantity',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic))), // Judul untuk sel kedua TableCell(child: Text('type',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)),
TableCell(child: Text('last ticket',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic))), // Judul untuk sel kedua TableCell(child: Text('date',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('time',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('quantity',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
TableCell(child: Text('last ticket',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // Judul untuk sel kedua
], ],
), ),
], ],
...@@ -1169,11 +1258,38 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1169,11 +1258,38 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Expanded( Expanded(
child: Container( child: Container(
child: child:
ListView.builder( Scrollbar(
controller: _scrollController, // Use the same ScrollController
thumbVisibility: true,
radius: Radius.circular(6), // Customize the scrollbar appearance
thickness: 6,
child: ListView.builder(
shrinkWrap: true, // Make sure to set shrinkWrap to true shrinkWrap: true, // Make sure to set shrinkWrap to true
itemCount: ticketHistoryData.length, itemCount: ticketHistoryData.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final data = ticketHistoryData[index]; final data = ticketHistoryData[index];
String dateTimeString = data['datetime'];
List<String> parts = dateTimeString.split(" ");
String date = parts[0];
String time = parts[1];
String terminalTid = data['terminal'];
String terminalName = data['terminal'];
String tid = "-";
String name = "-";
if (terminalName.length > 4) {
name = terminalName.substring(0, terminalName.length - 5);
} else {
terminalName = "";
}
if (terminalTid.length >= 4) {
tid = terminalTid.substring(terminalTid.length - 4); // Mengambil 4 karakter terakhir
} else {
while (terminalTid.length < 4) {
terminalTid = "0" + terminalTid;
}
}
return SingleChildScrollView( return SingleChildScrollView(
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
child: child:
...@@ -1190,10 +1306,12 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1190,10 +1306,12 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [ children: [
TableRow( TableRow(
children: [ children: [
TableCell(child: Text(data['terminal'])), TableCell(child: Text(name,textAlign: TextAlign.center)),
TableCell(child: Text(data['type'])), TableCell(child: Text(tid,textAlign: TextAlign.center)),
TableCell(child: Text(data['amount'].toString())), TableCell(child: Text(data['type'],textAlign: TextAlign.center)),
TableCell(child: Text(data['last_balance'].toString())), TableCell(child: Text(date,textAlign: TextAlign.center)),
TableCell(child: Text(time,textAlign: TextAlign.center)), TableCell(child: Text(data['amount'].toString(),textAlign: TextAlign.center)),
TableCell(child: Text(data['last_balance'].toString(),textAlign: TextAlign.center)),
], ],
), ),
], ],
...@@ -1210,15 +1328,14 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1210,15 +1328,14 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
}, },
), ),
), ),
), ],
), ),
), ],
), ),
), ),
); );
} }
buildTimerSection(BuildContext context) { buildTimerSection(BuildContext context) {
return Container( return Container(
height: 80, height: 80,
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
...@@ -1239,23 +1356,38 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements ...@@ -1239,23 +1356,38 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [ children: [
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: idleDuration, valueListenable: idleDuration,
builder: (context, value, child) => builder: (context, value, child) {
Color progressBarColor;
double progressValue = value / _maxDuration;
if (progressValue < 0.25) {
progressBarColor = color4;
} else if (progressValue < 0.5) {
progressBarColor = color3;
} else {
progressBarColor = blueColor;
}
return Stack(
alignment: Alignment.center,
children: [
CircularProgressIndicator( CircularProgressIndicator(
strokeWidth: 5, strokeWidth: 5,
value: value / _maxDuration, value: progressValue,
// Menggunakan nilai langsung dari value valueColor: AlwaysStoppedAnimation<Color>(progressBarColor),
valueColor:
AlwaysStoppedAnimation<Color>(Colors.blue),
), ),
],
);
},
), ),
RotatedBox( RotatedBox(
quarterTurns: 4, // Menggunakan nilai bulat dari value quarterTurns: 4,
child: ValueListenableBuilder( child: ValueListenableBuilder(
valueListenable: idleDuration, valueListenable: idleDuration,
builder: (context, value, child) => Text( builder: (context, value, child) => Text(
(value.toInt() % _maxDuration).toString(), (value.toInt() % _maxDuration).toString(),
// Menggunakan nilai bulat dari value style: TextStyle(color: darkBackgroundColor,fontSize: 15),
style: TextStyle(fontSize: 19),
), ),
), ),
), ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment