Commit 996c898e authored by Faizol's avatar Faizol

added animated

parent 965e5fff
import 'dart:async';
import 'dart:convert';
import 'package:shimmer/shimmer.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
......@@ -28,9 +28,19 @@ class HomePageCheckBalance extends StatefulWidget {
State<HomePageCheckBalance> createState() => _HomePageCheckBalanceState();
}
class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements AlertDialogCallback{
var regDb,cardUid,balance,cardNumber,name,cardType,cardExpirity,deposit,infoCard,plainCardExpirity,dateTimeCardExpirity;
class _HomePageCheckBalanceState extends State<HomePageCheckBalance>
implements AlertDialogCallback {
var regDb,
cardUid,
balance,
cardNumber,
name,
cardType,
cardExpirity,
deposit,
infoCard,
plainCardExpirity,
dateTimeCardExpirity;
String? prevBalance, maskedText, getRegDb;
late Timer? timerPage;
late Timer? timer;
......@@ -48,7 +58,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
List<Map<String, dynamic>> balanceHistoryData = [];
List<Map<String, dynamic>> ticketHistoryData = [];
ScrollController _scrollController = ScrollController();
bool showShimmer = false;
@override
void initState() {
......@@ -60,6 +70,9 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
_showTap(context);
tapDial(context);
});
_maxDuration = int.parse(idle);
idleDuration = ValueNotifier<int>(_maxDuration);
double _maxDurationPage = 5; // Durasi maksimum (dalam detik)
......@@ -75,7 +88,6 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
}
});
Connectivity()
.onConnectivityChanged
.listen((ConnectivityResult connectivityResult) {
......@@ -185,8 +197,9 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
checkCountZero = false;
});
tapIdle(context);
Navigator.pop(context);
tapIdle(context); // Adjust the duration as needed
Navigator.of(context, rootNavigator: true).pop();
showShimmerEffect();
}
} catch (e) {
// Tangani kesalahan saat memproses data
......@@ -197,7 +210,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Future<void> _getAuditHistoryBalance(String cardUid, String regDb) async {
try {
var auditHistoryBalance = await ServiceApi.fetchAuditHistory(cardUid, regDb, "balance");
var auditHistoryBalance =
await ServiceApi.fetchAuditHistory(cardUid, regDb, "balance");
print("AUDIT HISTORY BALANCE: $auditHistoryBalance");
setState(() {
......@@ -222,7 +236,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Future<void> _getAuditHistoryTicket(String cardUid, String regDb) async {
try {
var auditHistoryTicket = await ServiceApi.fetchAuditHistory(cardUid, regDb, "ticket");
var auditHistoryTicket =
await ServiceApi.fetchAuditHistory(cardUid, regDb, "ticket");
print("AUDIT HISTORY TICKET: $auditHistoryTicket");
setState(() {
......@@ -244,8 +259,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
}
}
Future <void> tapIdle(BuildContext context) async{
Future<void> tapIdle(BuildContext context) async {
var connectivityResult = Connectivity().checkConnectivity();
if (connectivityResult == ConnectivityResult.none) {
......@@ -288,6 +302,13 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Future<void> tapDial(BuildContext context) async {
var connectivityResult = await Connectivity().checkConnectivity();
_scrollController.animateTo(
0.0,
// Ganti dengan posisi yang sesuai (biasanya 0.0 untuk pindah ke atas)
duration: Duration(milliseconds: 500), // Durasi animasi
curve: Curves.easeInOut, // Efek animasi
);
if (connectivityResult == ConnectivityResult.none) {
AwesomeDialog(
context: context,
......@@ -328,7 +349,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
print('APP VERSION SELFSERVICE: $appVersion');
RegExp regExp = RegExp(r'www', caseSensitive: false);
String imageLogoShowTap = regExp.hasMatch(appVersion) ? 'assets/wahoo.png' : '';
String imageLogoShowTap =
regExp.hasMatch(appVersion) ? 'assets/wahoo.png' : '';
print('imageLogoShowTap: $imageLogoShowTap');
return imageLogoShowTap;
}
......@@ -344,7 +366,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
}
Future<void> _showTap(BuildContext context) async {
String imageLogoShowTap =await _getImageLogoShowTap();
String imageLogoShowTap = await _getImageLogoShowTap();
String selectMode = await _getSelectMode();
String wordingTap = await _getWordingTap(selectMode);
print('imageLogoShowTap before _showTap: $imageLogoShowTap');
......@@ -535,19 +557,36 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
void showToastMessage(String message) {
Fluttertoast.showToast(
msg: message,
toastLength: Toast.LENGTH_SHORT, // Durasi toast
gravity: ToastGravity.BOTTOM, // Posisi toast (dalam hal ini, di bawah)
timeInSecForIosWeb: 1, // Durasi untuk iOS (dalam detik)
backgroundColor: Colors.grey, // Warna latar belakang toast
toastLength: Toast.LENGTH_SHORT,
// Durasi toast
gravity: ToastGravity.BOTTOM,
// Posisi toast (dalam hal ini, di bawah)
timeInSecForIosWeb: 1,
// Durasi untuk iOS (dalam detik)
backgroundColor: Colors.grey,
// Warna latar belakang toast
textColor: Colors.white, // Warna teks
);
}
Future<bool> onWillPop() {
return Future.value(false);
}
void showShimmerEffect() {
setState(() {
showShimmer = true;
if (timer != null) timer?.cancel();
});
Future.delayed(Duration(seconds: 2), () {
setState(() {
showShimmer = false;
tapIdle(context);
});
});
}
@override
Widget build(BuildContext context) {
double screenWidth = MediaQuery.of(context).size.width;
......@@ -568,6 +607,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
body: Stack(
children: [
SingleChildScrollView(
controller: _scrollController,
physics: BouncingScrollPhysics(),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
......@@ -576,26 +616,66 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Column(
children: [
Container(
width: screenWidth * 0.10, // Container untuk spasi di kiri
width: screenWidth *
0.10, // Container untuk spasi di kiri
),
Container(
width: screenWidth * 0.70,
height: screenHeight * 0.80,
child: buildWalletSection(),
child: showShimmer
? Shimmer(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.white,
veryLightTextColor,
Colors.white,
],
),
child: buildWalletSection()
)
: buildWalletSection(),
),
Container(
margin: EdgeInsets.fromLTRB(30,0,0,0 ),
margin: EdgeInsets.fromLTRB(30, 0, 0, 0),
width: screenWidth * 0.95,
height: screenHeight * 0.70, // Container untuk "balance section"
child: buildBalanceSection(),
height: screenHeight * 0.70,
// Container untuk "balance section"
child:showShimmer
? Shimmer(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.white,
veryLightTextColor,
Colors.white,// Ivory (Putih Kuning Muda)
],
),
child: buildBalanceSection()
)
: buildBalanceSection(),
),
SizedBox(height: 20),
SizedBox(height: 20),
Container(
margin: EdgeInsets.fromLTRB(30,0,0,0 ),
margin: EdgeInsets.fromLTRB(30, 0, 0, 0),
width: screenWidth * 0.95,
height: screenHeight * 0.70,
child: buildTicketSection()),
child:showShimmer
? Shimmer(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.white,
veryLightTextColor,
Colors.white, // Ivory (Putih Kuning Muda)
],
),
child: buildTicketSection()
)
: buildTicketSection()),
SizedBox(height: 20),
],
),
......@@ -605,10 +685,36 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Positioned(
bottom: 90.0, // Adjust the position as needed
right: 5.0, // Adjust the position as needed
child:showShimmer
? Shimmer(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.white,
veryLightTextColor,
Colors.white, // Ivory (Putih Kuning Muda)
],
),
child: FloatingActionButton(
backgroundColor: purpleColor,
onPressed: () {
onPressed: () {},
child: Icon(
Icons.sync,
color: Colors.white,
),
),
) : FloatingActionButton(
backgroundColor: purpleColor,
onPressed: () async {
// Add the action for your floating button
_scrollController.animateTo(
0.0,
// Ganti dengan posisi yang sesuai (biasanya 0.0 untuk pindah ke atas)
duration: Duration(milliseconds: 500), // Durasi animasi
curve: Curves.easeInOut, // Efek animasi
);
isShowingDialog = true;
timer?.cancel();
_showTap(context);
......@@ -616,7 +722,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
},
child: Icon(
Icons.sync,
color: Colors.white,),
color: Colors.white,
),
),
),
// Positioned(
......@@ -652,95 +759,24 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Positioned(
bottom: 100.0, // Adjust the position as needed
right: 14.5, // Adjust the position as needed
child: buildTimerSection(context),
),
child:showShimmer
? Shimmer(
gradient: LinearGradient(
begin: Alignment.centerLeft,
end: Alignment.centerRight,
colors: [
Colors.white,
veryLightTextColor,
Colors.white, // Ivory (Putih Kuning Muda)
],
),
child: buildTimerSection(context)
): buildTimerSection(context),
),
),
);
}
buildWellcomeCustomer(){
double screenWidth = MediaQuery.of(context).size.width;
double textScaleFactor = screenWidth / 1700;
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Halo ${name != null ? '$name' : 'Teman Dolan'}',
style: TextStyle(
fontSize: 26,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.start,
),
Text(
'Selamat datang di mesin point check balance',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
Column(
children: [
ListTile(
title: Text(
(balance != null) ? 'Saldo $balance' : 'Saldo 0',
style: TextStyle(
fontSize: 28 * textScaleFactor,
fontWeight: FontWeight.w500,
),
),
subtitle: Text(
'balance',
style: TextStyle(
fontSize: 15 * textScaleFactor,
fontStyle: FontStyle.italic,
),
),
),
Divider(),
ListTile(
title: Text('Nama/name'),
subtitle: Text((name != null) ? ': $name' : ': -'),
),
ListTile(
title: Text('Nomor Wristband/wristband no'),
subtitle: Text((maskedText != null) ? ': $maskedText' : ': -'),
),
ListTile(
title: Text('Status'),
subtitle: Text((cardType != null) ? ': $cardType' : ': -'),
),
ListTile(
title: Text('Masa Berlaku/expirity'),
subtitle: Text((cardExpirity != null) ? ': $cardExpirity' : ': -'),
),
ListTile(
title: Text('Deposit'),
subtitle: Text((deposit != null) ? ': $deposit' : ': -'),
),
Divider(),
Text(
'Saldo dan deposit wristband bisa dikembalikan di Refund Center',
style: TextStyle(
fontSize: 16 * textScaleFactor,
fontWeight: FontWeight.w500,
],
),
),
Text(
'Wristband balance and deposit can be returned at the Refund Center',
style: TextStyle(
fontSize: 12 * textScaleFactor,
fontStyle: FontStyle.italic,
),
),
],
),
],
);
}
......@@ -761,7 +797,9 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
),
Column(
children: [
TimerBuilder.periodic(Duration(seconds: 1), builder: (context) {
TimerBuilder.periodic(
Duration(seconds: 1),
builder: (context) {
return Row(
children: [
Text(
......@@ -829,7 +867,9 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
letterSpacing: 3,
),
),
SizedBox(height: 20,),
SizedBox(
height: 20,
),
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
......@@ -843,7 +883,9 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(height: 10,),
SizedBox(
height: 10,
),
Text(
(balance != null) ? 'Saldo $balance' : 'Saldo 0',
style: whiteTextStyle.copyWith(
......@@ -884,7 +926,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
'Nama/name' ,
'Nama/name',
style: whiteTextStyle.copyWith(
fontSize: 20 * textScaleFactor,
fontWeight: medium,
......@@ -1017,15 +1059,12 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Widget buildBalanceSection() {
double screenWidth = MediaQuery.of(context).size.width;
double textScaleFactor = screenWidth / 1700;
return Visibility(
visible: balanceHistoryData.isNotEmpty,
child: Container(
return Container(
width: screenWidth * 40,
height: 500,
padding: EdgeInsets.only(bottom: 20),//
margin: EdgeInsets.all(20), // Add margin to the outer Container
child:
Column(
padding: EdgeInsets.only(bottom: 20),
margin: EdgeInsets.all(20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
......@@ -1034,7 +1073,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
child: Column(
children: [
Text(
"History Saldo Wristband",
"Riwayat Saldo Wristband",
style: blackTextStyle.copyWith(
fontSize: 28,
fontWeight: medium,
......@@ -1053,14 +1092,16 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
],
),
),
SizedBox(height: 20,),
SizedBox(
height: 20,
),
Center(
child: Container(
height: 80,
margin: EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Card(
child: Padding(
padding: const EdgeInsets.fromLTRB(10,10,10,10),
padding: const EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
children: [
Expanded(
......@@ -1068,24 +1109,89 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [
TableRow(
children: [
TableCell(child: Text('Terminal',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center,)),
TableCell(child: Text('Tid',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel pertama// Judul untuk sel pertama
TableCell(child: Text('Tipe', style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // 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
TableCell(
child: Text('Terminal',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
TableCell(
child: Text('Tid',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
TableCell(
child: Text('Tipe',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
TableCell(
child: Text('Tanggal',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
TableCell(
child: Text('Jam',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
TableCell(
child: Text('Jumlah',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
TableCell(
child: Text('Saldo Akhir',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center),
),
],
),
TableRow(
children: [
TableCell(child: Text('-',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // 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),textAlign: TextAlign.center)), // 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
TableCell(
child: Text('-',
style: TextStyle(
fontWeight: light,
fontStyle: FontStyle.italic),
textAlign: TextAlign.center)),
TableCell(
child: Text('-',
style: TextStyle(
fontWeight: light,
fontStyle: FontStyle.italic),
textAlign: TextAlign.center)),
TableCell(
child: Text('type',
style: TextStyle(
fontWeight: light,
fontStyle: FontStyle.italic),
textAlign: TextAlign.center)),
TableCell(
child: Text('date',
style: TextStyle(
fontWeight: light,
fontStyle: FontStyle.italic),
textAlign: TextAlign.center)),
TableCell(
child: Text('time',
style: TextStyle(
fontWeight: light,
fontStyle: FontStyle.italic),
textAlign: TextAlign.center)),
TableCell(
child: Text('amount',
style: TextStyle(
fontWeight: light,
fontStyle: FontStyle.italic),
textAlign: TextAlign.center)),
TableCell(
child: Text('last balance',
style: TextStyle(
fontWeight: light,
fontStyle: FontStyle.italic),
textAlign: TextAlign.center),
),
],
),
],
......@@ -1100,19 +1206,65 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
Expanded(
child: Container(
child: Scrollbar(
controller: _scrollController, // Use the same ScrollController
controller: _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
radius: Radius.circular(6),
thickness: 6,
child: balanceHistoryData.isEmpty
? Center(
child: Card(
margin: EdgeInsets.fromLTRB(20, 25, 20, 12),
child: Container(
height: 300,
width: double.infinity,
child: Center(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
// Tengahkan vertikal
children: [
Align(
alignment: Alignment.center,
// Tengahkan horizontal
child: Text(
"ⓘ Tidak ada informasi saldo yang tercatat pada wristband Anda.",
style: blackTextStyle.copyWith(
fontSize: 20 * textScaleFactor,
fontWeight: bold,
letterSpacing: 3),
textAlign: TextAlign.center),
),
Align(
alignment: Alignment.center,
// Tengahkan horizontal
child: Text(
"ⓘ There is no recorded balance information on your wristband.",
style: greyTextStyle.copyWith(
fontSize: 15 * textScaleFactor,
fontWeight: light,
fontStyle: FontStyle.italic,
letterSpacing: 3),
textAlign: TextAlign.center),
),
],
),
),
),
),
),
)
: ListView.builder(
shrinkWrap: true,
itemCount: balanceHistoryData.length,
itemBuilder: (context, index) {
final data = balanceHistoryData[index];
int amount = data['amount'];
int lastBalance = data['last_balance'];
String fAmount = NumberFormat.decimalPattern().format(amount);
String fLastBalance = NumberFormat.decimalPattern().format(lastBalance);
String fAmount =
NumberFormat.decimalPattern().format(amount);
String fLastBalance =
NumberFormat.decimalPattern().format(lastBalance);
String dateTimeString = data['datetime'];
List<String> parts = dateTimeString.split(" ");
String date = parts[0];
......@@ -1123,24 +1275,25 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
String name = "-";
if (terminalName.length > 4) {
name = terminalName.substring(0, terminalName.length - 5);
name = terminalName.substring(
0, terminalName.length - 5);
} else {
terminalName = "";
}
if (terminalTid.length >= 4) {
tid = terminalTid.substring(terminalTid.length - 4); // Mengambil 4 karakter terakhir
tid = terminalTid.substring(terminalTid.length - 4);
} else {
while (terminalTid.length < 4) {
terminalTid = "0" + terminalTid;
}
}
return SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Card(
margin: EdgeInsets.fromLTRB(20,0,20,12),
return Card(
margin: EdgeInsets.fromLTRB(20, 0, 20, 12),
child: Padding(
padding: const EdgeInsets.fromLTRB(20,10,20,10),
padding:
const EdgeInsets.fromLTRB(20, 10, 20, 10),
child: Column(
children: [
Row(
......@@ -1150,13 +1303,34 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [
TableRow(
children: [
TableCell(child: Text(name,textAlign: TextAlign.center)),
TableCell(child: Text(tid,textAlign: TextAlign.center)),
TableCell(child: Text(data['type'],textAlign: TextAlign.center)),
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)),
TableCell(
child: Text(name,
textAlign:
TextAlign.center)),
TableCell(
child: Text(tid,
textAlign:
TextAlign.center)),
TableCell(
child: Text(data['type'],
textAlign:
TextAlign.center)),
TableCell(
child: Text(date,
textAlign:
TextAlign.center)),
TableCell(
child: Text(time,
textAlign:
TextAlign.center)),
TableCell(
child: Text(fAmount,
textAlign:
TextAlign.center)),
TableCell(
child: Text(fLastBalance,
textAlign:
TextAlign.center)),
],
),
],
......@@ -1167,7 +1341,6 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
],
),
),
),
);
},
),
......@@ -1176,26 +1349,24 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
),
],
),
),
);
}
Widget buildTicketSection() {
double screenWidth = MediaQuery.of(context).size.width;
double textScaleFactor = screenWidth / 1700;
return Visibility(
visible: ticketHistoryData.isNotEmpty,
child: Container(
return Container(
width: screenWidth * 40,
height: 500,
margin: EdgeInsets.all(20),
padding: EdgeInsets.only(bottom: 20),// Add margin to the outer Container
padding: EdgeInsets.only(bottom: 20),
// Add margin to the outer Container
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"History Card Ticket",
"Riwayat Tiket Wristband",
style: blackTextStyle.copyWith(
fontSize: 28,
fontWeight: medium,
......@@ -1203,7 +1374,7 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
),
),
Text(
'history card ticket',
'history wristband ticket',
style: blackTextStyle.copyWith(
fontSize: 15,
fontWeight: light,
......@@ -1211,14 +1382,16 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
letterSpacing: 3,
),
),
SizedBox(height: 20,),
SizedBox(
height: 20,
),
Center(
child: Container(
height: 80,
margin: EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Card(
child: Padding(
padding: const EdgeInsets.fromLTRB(10,10,10,10),
padding: const EdgeInsets.fromLTRB(10, 10, 10, 10),
child: Row(
children: [
Expanded(
......@@ -1226,24 +1399,99 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [
TableRow(
children: [
TableCell(child: Text('Terminal',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel pertama
TableCell(child: Text('Tid',style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // Judul untuk sel pertama
TableCell(child: Text('Tipe', style: TextStyle(fontWeight: FontWeight.bold),textAlign: TextAlign.center)), // 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
TableCell(
child: Text('Terminal',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
// Judul untuk sel pertama
TableCell(
child: Text('Tid',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
// Judul untuk sel pertama
TableCell(
child: Text('Tipe',
style: TextStyle(
fontWeight: FontWeight.bold),
textAlign: TextAlign.center)),
// 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(
children: [
TableCell(child: Text('-',style: TextStyle(fontWeight: light , fontStyle: FontStyle.italic),textAlign: TextAlign.center)), // 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),textAlign: TextAlign.center)),
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
TableCell(
child: Text('-',
style: TextStyle(
fontWeight: light,
fontStyle: FontStyle.italic),
textAlign: TextAlign.center)),
// 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),
textAlign: TextAlign.center)),
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
],
),
],
......@@ -1257,13 +1505,58 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
),
Expanded(
child: Container(
child:
Scrollbar(
controller: _scrollController, // Use the same ScrollController
child: Scrollbar(
controller: _scrollController,
// Use the same ScrollController
thumbVisibility: true,
radius: Radius.circular(6), // Customize the scrollbar appearance
radius: Radius.circular(6),
// Customize the scrollbar appearance
thickness: 6,
child: ListView.builder(
child: ticketHistoryData.isEmpty
? Center(
child: Card(
margin: EdgeInsets.fromLTRB(20, 25, 20, 12),
child: Container(
height: 300,
width: double.infinity,
child: Center(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
// Tengahkan vertikal
children: [
Align(
alignment: Alignment.center,
// Tengahkan horizontal
child: Text(
"ⓘ Tidak ada informasi tiket yang tercatat pada wristband Anda.",
style: blackTextStyle.copyWith(
fontSize: 20 * textScaleFactor,
fontWeight: bold,
letterSpacing: 3),
textAlign: TextAlign.center),
),
Align(
alignment: Alignment.center,
// Tengahkan horizontal
child: Text(
"ⓘ There is no recorded ticket information on your wristband.",
style: greyTextStyle.copyWith(
fontSize: 15 * textScaleFactor,
fontWeight: light,
fontStyle: FontStyle.italic,
letterSpacing: 3),
textAlign: TextAlign.center),
),
],
),
),
),
),
),
)
: ListView.builder(
shrinkWrap: true, // Make sure to set shrinkWrap to true
itemCount: ticketHistoryData.length,
itemBuilder: (context, index) {
......@@ -1278,13 +1571,15 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
String name = "-";
if (terminalName.length > 4) {
name = terminalName.substring(0, terminalName.length - 5);
name = terminalName.substring(
0, terminalName.length - 5);
} else {
terminalName = "";
}
if (terminalTid.length >= 4) {
tid = terminalTid.substring(terminalTid.length - 4); // Mengambil 4 karakter terakhir
tid = terminalTid.substring(terminalTid.length -
4); // Mengambil 4 karakter terakhir
} else {
while (terminalTid.length < 4) {
terminalTid = "0" + terminalTid;
......@@ -1292,11 +1587,22 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
}
return SingleChildScrollView(
physics: BouncingScrollPhysics(),
child:
Card(
margin: EdgeInsets.fromLTRB(20,0,20,12),
child: ticketHistoryData.isEmpty
? Center(
child: Text(
"Tidak ada histori tiket",
style: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: medium,
letterSpacing: 3,
),
),
)
: Card(
margin: EdgeInsets.fromLTRB(20, 0, 20, 12),
child: Padding(
padding: const EdgeInsets.fromLTRB(10,10,10,10),
padding: const EdgeInsets.fromLTRB(
10, 10, 10, 10),
child: Column(
children: [
Row(
......@@ -1306,12 +1612,46 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
children: [
TableRow(
children: [
TableCell(child: Text(name,textAlign: TextAlign.center)),
TableCell(child: Text(tid,textAlign: TextAlign.center)),
TableCell(child: Text(data['type'],textAlign: TextAlign.center)),
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)),
TableCell(
child: Text(name,
textAlign:
TextAlign
.center)),
TableCell(
child: Text(tid,
textAlign:
TextAlign
.center)),
TableCell(
child: Text(
data['type'],
textAlign:
TextAlign
.center)),
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)),
],
),
],
......@@ -1324,13 +1664,12 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
),
),
);
},
),
),
),
), ],
),
],
),
);
}
......@@ -1374,9 +1713,9 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
CircularProgressIndicator(
strokeWidth: 5,
value: progressValue,
valueColor: AlwaysStoppedAnimation<Color>(progressBarColor),
valueColor: AlwaysStoppedAnimation<Color>(
progressBarColor),
),
],
);
},
......@@ -1387,7 +1726,8 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
valueListenable: idleDuration,
builder: (context, value, child) => Text(
(value.toInt() % _maxDuration).toString(),
style: TextStyle(color: darkBackgroundColor,fontSize: 15),
style: TextStyle(
color: darkBackgroundColor, fontSize: 15),
),
),
),
......@@ -1412,7 +1752,4 @@ class _HomePageCheckBalanceState extends State<HomePageCheckBalance> implements
void onPositive(Object object) {
// TODO: implement onPositive
}
}
......@@ -949,6 +949,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.3"
shimmer:
dependency: "direct main"
description:
name: shimmer
sha256: "5f88c883a22e9f9f299e5ba0e4f7e6054857224976a5d9f839d4ebdc94a14ac9"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
simple_animations:
dependency: "direct main"
description:
......
......@@ -59,6 +59,7 @@ dependencies:
flutter_staggered_grid_view: ^0.6.2
timer_count_down: ^2.2.1
easy_localization: ^3.0.0
shimmer: ^3.0.0
sqflite: ^2.2.0+3
device_info_plus: ^8.1.0
lottie: ^2.3.0
......
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