Commit afc75ab7 authored by Izol's avatar Izol

simply #3

parent dbead1a0
......@@ -101,6 +101,7 @@ class StartService {
String approvalCode,
String paymentMethod,
String paymentProvider,
String paymentNotes,
) async {
var result;
try {
......@@ -112,6 +113,7 @@ class StartService {
'approval_code': approvalCode,
'payment_method': paymentMethod,
'payment_provider': paymentProvider,
'payment_notes': paymentNotes,
});
} catch (error) {
result = error.toString();
......
......@@ -423,6 +423,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
samReport,
paymentMethod,
paymentProvider,
paymentNotes,
metodeBayar,
status;
......@@ -430,16 +431,20 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
infoMap = jsonDecode(info);
lastBalance = infoMap['balance'].toString();
samReport = infoMap['report'].toString();
paymentMethod = 'QRIS';
// paymentProvider = PreferencesHelper.getString('provider');
paymentProvider = '';
paymentMethod = 'Qris';
var infoPaymentNotes = jsonDecode(info);
var reffNo = trxId.toString();
paymentProvider = '';
paymentNotes = "reffNo: $reffNo\nprovider: $paymentNotes";
print("ini adalag test hasil payment notes:$paymentNotes");
tid = PreferencesHelper.getString('outletname');
tid = tid.substring(tid.length -4);
if (int.parse(lastBalance) > int.parse(prevBalance!)) {
countMax = 0;
var result = await StartService.topUpConfirm(cardNumber, lastBalance, tid,
samReport, approvalCode, paymentMethod, paymentProvider);
samReport, approvalCode, paymentMethod, paymentProvider, paymentNotes);
print('topUpConfirm result: $result');
String readerDate,
......@@ -942,6 +947,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
),
).show().then((value) {
denom(outletName, infoCard);
// isShowingDialog = false;
// if (timer != null) timer?.cancel();
// tapIdle();
});
}
if (duration == 0 && !isShowingDialog) {
......@@ -954,8 +962,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
});
}
void tapDial() async {
Future.delayed(const Duration(milliseconds: 500), () async {
var isTap = await StartService.getCard();
......@@ -1239,19 +1245,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
showDialog(
context: context,
builder: (context) {
Future.delayed(Duration(seconds: int.parse(idle)), () {
Navigator.of(context).pop(true);
setState(() {
isShowingDialog = true;
if (timer != null) timer?.cancel();
dataQris = null;
_showTap();
tapIdle();
});// Menutup dialog setelah durasi tertentu
});
return StatefulBuilder(builder: (context, StateSetter setState) {
return Container(
decoration: BoxDecoration(
color: lightBackgroundColor
image: const DecorationImage(
fit: BoxFit.cover,
image: AssetImage(
'assets/img_bg_card.png',
),
),
color: purpleColor
),
child: Stack(
children: [
BackdropFilter(
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Container(
color: Colors.black.withOpacity(0.2),
),
),
Center(
child: SingleChildScrollView(
child: AlertDialog(
......@@ -1269,16 +1285,15 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
),
),
width: 1100,
margin:
const EdgeInsets.symmetric(vertical: 10, horizontal: 0),
margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
child: Row(
children: [
Align(
alignment: Alignment.topLeft,
child: GestureDetector(
onTap: () {
Navigator.pop(context);
setState(() {
Navigator.pop(context);
timer?.cancel();
dataQris = null;
isShowingDialog = true;
......@@ -1432,105 +1447,142 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 15,),
Text(
'Pilih nominal isi ulang',
style: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
Container(
padding: EdgeInsets.symmetric(horizontal: 17),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 15,),
Text(
'Pilih nominal isi ulang',
style: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
),
),
Text(
'Choose topup amount',
style: greyTextStyle.copyWith(
fontSize: 15,
fontStyle: FontStyle.italic,
fontWeight: light,
Text(
'Choose topup amount',
style: greyTextStyle.copyWith(
fontSize: 15,
fontStyle: FontStyle.italic,
fontWeight: light,
),
),
),
SizedBox(
height: 20,
),
Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
tapIdle();
SizedBox(
height: 20,
),
Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
tapIdle();
if (mounted) {
setState(() {
amountController!.text = cTopUp1;
});
}
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
border: Border.all(
color: amountController!.text ==
cTopUp1
? purpleColor
: Colors.black12),
borderRadius: BorderRadius.circular(7),
),
child: Center(
child: Text("50,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
if (mounted) {
setState(() {
amountController!.text = cTopUp1;
});
}
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
border: Border.all(
color: amountController!.text ==
cTopUp1
? purpleColor
: Colors.black12),
borderRadius: BorderRadius.circular(7),
),
child: Center(
child: Text("50,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
),
),
),
)),
SizedBox(
width: 10,
),
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
tapIdle();
)),
SizedBox(
width: 10,
),
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
tapIdle();
if (mounted) {
setState(() {
amountController!.text = cTopUp2;
});
}
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
border: Border.all(
color: (amountController!.text ==
cTopUp2)
? Color(0xff005DAC)
: Colors.black12),
borderRadius: BorderRadius.circular(7),
if (mounted) {
setState(() {
amountController!.text = cTopUp2;
});
}
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
border: Border.all(
color: (amountController!.text ==
cTopUp2)
? Color(0xff005DAC)
: Colors.black12),
borderRadius: BorderRadius.circular(7),
),
child: Center(
child: Text("150,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
),
),
child: Center(
child: Text("150,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
))
],
),
SizedBox(
height: 10,
),
Row(
children: [
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
tapIdle();
if (mounted) {
setState(() {
amountController!.text = cTopUp3;
});
}
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
border: Border.all(
color: (amountController!.text ==
cTopUp3)
? Color(0xff005DAC)
: Colors.black12),
borderRadius: BorderRadius.circular(7),
),
child: Center(
child: Text("100,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
),
),
),
))
],
),
SizedBox(
height: 10,
),
Row(
children: [
Expanded(
)),
SizedBox(
width: 10,
),
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
......@@ -1538,7 +1590,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
if (mounted) {
setState(() {
amountController!.text = cTopUp3;
amountController!.text = cTopUp4;
});
}
},
......@@ -1548,126 +1600,119 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
decoration: BoxDecoration(
border: Border.all(
color: (amountController!.text ==
cTopUp3)
cTopUp4)
? Color(0xff005DAC)
: Colors.black12),
borderRadius: BorderRadius.circular(7),
borderRadius:
BorderRadius.circular(7),
),
child: Center(
child: Text("100,000",
child: Text("200,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
),
),
)),
SizedBox(
width: 10,
),
Expanded(
child: GestureDetector(
onTap: () {
if (timer != null) timer?.cancel();
tapIdle();
if (mounted) {
setState(() {
amountController!.text = cTopUp4;
});
}
},
child: Container(
padding:
EdgeInsets.symmetric(vertical: 15),
decoration: BoxDecoration(
border: Border.all(
color: (amountController!.text ==
cTopUp4)
? Color(0xff005DAC)
: Colors.black12),
borderRadius:
BorderRadius.circular(7),
),
child: Center(
child: Text("200,000",
style: blackTextStyle.copyWith(
fontSize: 25,
fontWeight: bold,
)),
),
),
),
),
],
),
],
],
),
],
),
),
SizedBox(height: 30),
Column(
children: [
Row(
children: [
Expanded(
child: CustomFilledButton(
title: 'lanjut',
subtitle: ' / proceed',
onPressed: () {
setState(() {
if (timer != null)
timer?.cancel();
AwesomeDialog(
context: context,
dialogType: DialogType.info,
animType: AnimType.rightSlide,
dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2),
headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...',
titleTextStyle: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
desc: "Please wait a moment ...",
descTextStyle: greyTextStyle.copyWith(
fontSize: 18,
fontWeight: light,
),
).show().then((value) {
if(amountController!.text.isEmpty){
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Terjadi Kesalahan',
desc: "Anda belum mengisi saldo",
btnOkOnPress: () {
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red,
).show();
}
Container(
margin: const EdgeInsets.only(right:300, left:300),
child: Row(
children: [
Expanded(
child: CustomFilledButton(
title: 'lanjut',
subtitle: ' / proceed',
onPressed: () {
setState(() {
if (timer != null)
timer?.cancel();
AwesomeDialog(
context: context,
dialogType: DialogType.info,
animType: AnimType.rightSlide,
dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2),
headerAnimationLoop: true,
title: 'Mohon Tunggu Sebentar ...',
titleTextStyle: blackTextStyle.copyWith(
fontSize: 20,
fontWeight: bold,
),
desc: "Please wait a moment ...",
descTextStyle: greyTextStyle.copyWith(
fontSize: 18,
fontWeight: light,
),
).show().then((value) {
if(amountController!.text.isEmpty){
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
headerAnimationLoop: true,
title: 'Terjadi Kesalahan',
desc: "Anda belum mengisi saldo",
btnOkOnPress: () {
if (timer != null) timer?.cancel();
tapIdle();
},
btnOkIcon: Icons.cancel,
btnOkColor: Colors.red,
).show();
}
if (mounted) {
denomLimits(
outletName,
info,
int.parse(amountController!
.text
.replaceAll(",", "")));
}
});
if (mounted) {
denomLimits(
outletName,
info,
int.parse(amountController!
.text
.replaceAll(",", "")));
}
});
},
});
},
),
),
],
),
),
SizedBox(height: 20),
Positioned(
bottom: 20,
right: 0,
child: Stack(
alignment: Alignment.center,
children: [
ValueListenableBuilder(
valueListenable: idleDuration,
builder: (context, value, child) => CircularProgressIndicator(
strokeWidth: 5,
value: (idleDuration.value.toDouble()) / _maxDuration,
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
),
),
RotatedBox(
quarterTurns: 4,
child: ValueListenableBuilder(
valueListenable: idleDuration,
builder: (context, value, child) => Text(
value.toString(),
style: TextStyle(fontSize: 18),
),
),
],
),
],
),
],
),
),
],
),
......
......@@ -103,6 +103,8 @@ class _SplashPageState extends State<SplashPage> with TickerProviderStateMixin{
checkActivation();
});
}
void navigationToSetConfig() {
Navigator.pushReplacement(
context,
......
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