Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dolan SelfService Topup
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Faizol
Dolan SelfService Topup
Commits
bbf42789
Commit
bbf42789
authored
Aug 09, 2023
by
Izol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added hidden button already paid and cancel
parent
917ce335
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
199 additions
and
218 deletions
+199
-218
home_page.dart
lib/ui/pages/home_page.dart
+199
-218
No files found.
lib/ui/pages/home_page.dart
View file @
bbf42789
...
@@ -97,6 +97,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -97,6 +97,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
bool
checkCountZero
=
false
;
bool
checkCountZero
=
false
;
bool
isDenomDialogShowing
=
false
;
bool
isDenomDialogShowing
=
false
;
bool
isPaymentProcessed
=
false
;
bool
isPaymentProcessed
=
false
;
bool
isShowingButton
=
true
;
double
_targetDuration
=
3
;
// Durasi yang dituju (dalam detik)
double
_targetDuration
=
3
;
// Durasi yang dituju (dalam detik)
double
_maxDurationPage
=
3
;
// Durasi maksimum (dalam detik)
double
_maxDurationPage
=
3
;
// Durasi maksimum (dalam detik)
...
@@ -968,7 +969,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -968,7 +969,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// }
// }
void
tapIdle
()
{
void
tapIdle
()
{
var
connectivityResult
=
Connectivity
().
checkConnectivity
();
var
connectivityResult
=
Connectivity
().
checkConnectivity
();
if
(
connectivityResult
==
ConnectivityResult
.
none
)
{
if
(
connectivityResult
==
ConnectivityResult
.
none
)
{
AwesomeDialog
(
AwesomeDialog
(
...
@@ -978,9 +979,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -978,9 +979,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dismissOnTouchOutside:
false
,
dismissOnTouchOutside:
false
,
headerAnimationLoop:
true
,
headerAnimationLoop:
true
,
title:
'Internet Tidak Tersedia'
,
title:
'Internet Tidak Tersedia'
,
desc:
'Tidak ada koneksi internet. Pastikan Anda terhubung ke internet untuk melanjutkan.'
,
desc:
'Tidak ada koneksi internet. Pastikan Anda terhubung ke internet untuk melanjutkan.'
,
btnOkOnPress:
()
{
btnOkOnPress:
()
{
tapIdle
();
tapIdle
();
},
},
btnOkIcon:
Icons
.
error
,
btnOkIcon:
Icons
.
error
,
btnOkColor:
Colors
.
red
,
btnOkColor:
Colors
.
red
,
...
@@ -1078,7 +1080,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -1078,7 +1080,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dismissOnTouchOutside:
false
,
dismissOnTouchOutside:
false
,
headerAnimationLoop:
true
,
headerAnimationLoop:
true
,
title:
'Internet Tidak Tersedia'
,
title:
'Internet Tidak Tersedia'
,
desc:
'Tidak ada koneksi internet. Pastikan Anda terhubung ke internet untuk melanjutkan.'
,
desc:
'Tidak ada koneksi internet. Pastikan Anda terhubung ke internet untuk melanjutkan.'
,
btnOkOnPress:
()
{
btnOkOnPress:
()
{
tapDial
();
tapDial
();
},
},
...
@@ -1110,7 +1113,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -1110,7 +1113,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dismissOnTouchOutside:
false
,
dismissOnTouchOutside:
false
,
headerAnimationLoop:
true
,
headerAnimationLoop:
true
,
title:
'Internet Tidak Tersedia'
,
title:
'Internet Tidak Tersedia'
,
desc:
'Tidak ada koneksi internet. Pastikan Anda terhubung ke internet untuk melanjutkan.'
,
desc:
'Tidak ada koneksi internet. Pastikan Anda terhubung ke internet untuk melanjutkan.'
,
btnOkOnPress:
()
{
btnOkOnPress:
()
{
countMax
=
0
;
countMax
=
0
;
tapBalance
();
tapBalance
();
...
@@ -1603,9 +1607,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -1603,9 +1607,6 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
tapIdle
();
tapIdle
();
},
},
onFieldSubmitted:
(
value
)
{
onFieldSubmitted:
(
value
)
{
if
(
timer
!=
null
)
{
timer
!.
cancel
();
}
AwesomeDialog
(
AwesomeDialog
(
context:
context
,
context:
context
,
dialogType:
dialogType:
...
@@ -1634,7 +1635,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -1634,7 +1635,9 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
fontWeight:
light
,
fontWeight:
light
,
),
),
).
show
().
then
((
value
)
{
).
show
().
then
((
value
)
{
// isProcessGet = true;
if
(
timer
!=
null
)
{
timer
!.
cancel
();
}
if
(
amountController
!
if
(
amountController
!
.
text
.
isEmpty
)
{
.
text
.
isEmpty
)
{
AwesomeDialog
(
AwesomeDialog
(
...
@@ -2055,6 +2058,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -2055,6 +2058,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
}
}
void
_showQris
(
BuildContext
context
)
async
{
void
_showQris
(
BuildContext
context
)
async
{
isProcessCheck
=
false
;
isProcessGet
=
false
;
isProcessGet
=
false
;
await
showDialog
(
await
showDialog
(
context:
context
,
context:
context
,
...
@@ -2170,174 +2174,152 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -2170,174 +2174,152 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
[
children:
[
TextButton
(
Visibility
(
onPressed:
()
async
{
visible:
isShowingButton
,
print
(
"Click-button-cancel"
);
maintainState:
true
,
setState
(()
{
child:
FutureBuilder
(
isProcessCheck
=
true
;
future:
Future
.
delayed
(
Duration
(
seconds:
5
)),
});
builder:
(
context
,
snapshot
)
{
try
{
if
(
snapshot
.
connectionState
==
ConnectionState
.
waiting
)
{
bool
value
=
await
_cekStatus
();
return
Container
();
// Placeholder widget while waiting
if
(
value
)
{
}
else
{
isProcessGet
=
false
;
return
TextButton
(
print
(
"pembayaran berhasil dilakukan"
);
onPressed:
isProcessCheck
Navigator
.
pop
(
context
);
?
null
showPop
(
approvalCode
);
:
()
async
{
}
else
{
print
(
"Click-button-cancel"
);
await
AwesomeDialog
(
setState
(()
{
context:
context
,
isProcessCheck
=
true
;
dismissOnTouchOutside:
false
,
dialogType:
DialogType
.
warning
,
autoHide:
Duration
(
seconds:
3
),
animType:
AnimType
.
rightSlide
,
headerAnimationLoop:
true
,
title:
'Anda telah membatalkan transaksi'
,
desc:
"You have canceled the transaction"
,
).
show
().
then
((
value
)
{
Navigator
.
of
(
context
).
pop
();
timer
?.
cancel
();
dataQris
=
null
;
checkCountZero
=
false
;
isShowingDialog
=
true
;
_showTap
();
tapDial
();
});
});
try
{
bool
value
=
await
_cekStatus
();
if
(
value
)
{
isProcessGet
=
false
;
print
(
"pembayaran berhasil dilakukan"
);
Navigator
.
pop
(
context
);
showPop
(
approvalCode
);
}
else
{
await
AwesomeDialog
(
context:
context
,
dismissOnTouchOutside:
false
,
dialogType:
DialogType
.
warning
,
autoHide:
Duration
(
seconds:
3
),
animType:
AnimType
.
rightSlide
,
headerAnimationLoop:
true
,
title:
'Anda telah membatalkan transaksi'
,
desc:
"You have canceled the transaction"
,
).
show
().
then
((
value
)
{
Navigator
.
of
(
context
).
pop
();
timer
?.
cancel
();
dataQris
=
null
;
checkCountZero
=
false
;
isShowingDialog
=
true
;
_showTap
();
tapDial
();
});
}
}
catch
(
e
)
{
// Handle any errors that occur during _cekStatus()
}
finally
{
setState
(()
=>
isProcessCheck
=
false
);
}
},
child:
ButtonQris
(
iconUrl:
'assets/cancel.png'
,
title:
'batalkan'
,
subtitle:
'cancel'
,
),
);
}
}
}
catch
(
e
)
{
},
// Handle any errors that occur during _cekStatus()
}
finally
{
)),
setState
(()
=>
isProcessCheck
=
false
);
Visibility
(
}
visible:
isShowingButton
,
},
maintainState:
true
,
child:
(
isProcessCheck
)
child:
FutureBuilder
(
?
Column
(
future:
Future
.
delayed
(
Duration
(
seconds:
5
)),
children:
[
builder:
(
context
,
snapshot
){
Container
(
if
(
snapshot
.
connectionState
==
ConnectionState
.
waiting
){
width:
250
,
return
Container
();
height:
70
,
}
else
{
margin:
const
EdgeInsets
.
only
(
bottom:
10
),
return
TextButton
(
decoration:
BoxDecoration
(
onPressed:
isProcessCheck
borderRadius:
BorderRadius
.
circular
(
20
),
?
null
color:
purpleColor
,
:
()
async
{
boxShadow:
[
AwesomeDialog
(
BoxShadow
(
context:
context
,
color:
Colors
.
grey
.
withOpacity
(
0.3
),
dialogType:
spreadRadius:
3
,
DialogType
.
info
,
blurRadius:
7
,
animType:
offset:
Offset
(
3
,
3
),
AnimType
.
rightSlide
,
),
dismissOnTouchOutside:
],
false
,
),
autoHide:
child:
Center
(
Duration
(
seconds:
2
),
child:
CircularProgressIndicator
(
headerAnimationLoop:
true
,
color:
lightBackgroundColor
,
title:
),
'Mohon Tunggu Sebentar ...'
,
),
titleTextStyle:
),
blackTextStyle
Text
(
.
copyWith
(
'Mohon Tunggu ...'
,
fontSize:
20
,
style:
blackTextStyle
.
copyWith
(
fontWeight:
bold
,
fontWeight:
bold
,
fontSize:
15
,
),
),
),
desc:
Text
(
"Please wait a moment ..."
,
'please wait ...'
,
descTextStyle:
style:
greyTextStyle
.
copyWith
(
greyTextStyle
.
copyWith
(
fontSize:
18
,
fontWeight:
light
,
fontWeight:
light
,
fontStyle:
FontStyle
.
italic
,
fontSize:
8
,
),
),
),
).
show
().
then
((
value
)
async
{
],
print
(
"Click-button-saya-sudah-bayar"
);
)
if
(
isProcessCheck
)
return
;
:
ButtonQris
(
setState
(()
=>
isProcessCheck
=
true
);
iconUrl:
'assets/cancel.png'
,
try
{
title:
'batalkan'
,
bool
result
=
await
_cekStatus
();
subtitle:
'cancel'
,
if
(
result
)
{
),
isProcessGet
=
false
;
),
}
TextButton
(
setState
(()
{
onPressed:
()
async
{
if
(
result
)
{
print
(
"Click-button-saya-sudah-bayar"
);
isProcessCheck
=
true
;
if
(
isProcessCheck
)
return
;
print
(
"pembayaran berhasil dilakukan"
);
setState
(()
=>
isProcessCheck
=
true
);
Navigator
.
pop
(
context
);
try
{
showPop
(
approvalCode
);
bool
result
=
await
_cekStatus
();
}
else
{
if
(
result
)
{
isProcessCheck
=
false
;
isProcessGet
=
false
;
AwesomeDialog
(
context:
context
,
dialogType:
DialogType
.
error
,
animType:
AnimType
.
rightSlide
,
dismissOnTouchOutside:
false
,
autoHide:
Duration
(
seconds:
2
),
headerAnimationLoop:
true
,
title:
'Belum Terbayar !'
,
desc:
"Not paid yet !"
,
btnOkIcon:
Icons
.
cancel
,
btnOkColor:
Colors
.
red
,
).
show
();
}
});
}
catch
(
e
)
{
print
(
"Error:
$e
"
);
setState
(()
=>
isProcessCheck
=
false
);
}
});
},
child:
ButtonQris
(
iconUrl:
'assets/check-mark.png'
,
title:
'Saya Sudah Bayar'
,
subtitle:
'i have already paid'
,
),
);
}
}
setState
(()
{
if
(
result
)
{
isProcessCheck
=
true
;
print
(
"pembayaran berhasil dilakukan"
);
Navigator
.
pop
(
context
);
showPop
(
approvalCode
);
}
else
{
isProcessCheck
=
false
;
AwesomeDialog
(
context:
context
,
dialogType:
DialogType
.
error
,
animType:
AnimType
.
rightSlide
,
headerAnimationLoop:
true
,
title:
'Belum Terbayar !'
,
desc:
"Not paid yet !"
,
btnOkOnPress:
()
{},
btnOkIcon:
Icons
.
cancel
,
btnOkColor:
Colors
.
red
,
).
show
();
}
});
}
catch
(
e
)
{
print
(
"Error:
$e
"
);
setState
(()
=>
isProcessCheck
=
false
);
}
}
},
),
child:
(
isProcessCheck
)
?
Column
(
children:
[
Container
(
width:
250
,
height:
70
,
margin:
const
EdgeInsets
.
only
(
bottom:
10
,
),
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
20
),
color:
purpleColor
,
boxShadow:
[
BoxShadow
(
color:
Colors
.
grey
.
withOpacity
(
0.3
),
//color of shadow
spreadRadius:
3
,
//spread radius
blurRadius:
7
,
// blur radius
offset:
Offset
(
3
,
3
),
// changes position of shadow
),
],
),
child:
Center
(
child:
CircularProgressIndicator
(
color:
lightBackgroundColor
,
),
),
),
Text
(
'Mohon Tunggu ...'
,
style:
blackTextStyle
.
copyWith
(
fontWeight:
bold
,
fontSize:
15
,
),
),
],
)
:
ButtonQris
(
iconUrl:
'assets/check-mark.png'
,
title:
'Saya Sudah Bayar'
,
subtitle:
'i have already paid'
,
),
),
),
// Time DI Menu Qris
// Time DI Menu Qris
Column
(
Column
(
...
@@ -2374,57 +2356,56 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -2374,57 +2356,56 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dialogType:
DialogType
.
warning
,
dialogType:
DialogType
.
warning
,
dismissOnTouchOutside:
false
,
dismissOnTouchOutside:
false
,
animType:
AnimType
.
rightSlide
,
animType:
AnimType
.
rightSlide
,
autoHide:
Duration
(
seconds:
2
),
headerAnimationLoop:
true
,
headerAnimationLoop:
true
,
title:
title:
'Waktu pembayaran anda sudah habis !'
,
'Waktu pembayaran anda sudah habis !'
,
desc:
"Your payment time has expired !"
,
desc:
"Your payment time has expired !"
,
btnOkOnPress:
()
async
{
setState
(()
{
isProcessCheck
=
true
;
});
try
{
bool
result
=
await
_cekStatus
();
setState
(()
{
if
(
result
)
{
isProcessGet
=
false
;
print
(
"pembayaran berhasil dilakukan"
);
Navigator
.
pop
(
context
);
showPop
(
approvalCode
);
}
else
{
setState
(()
=>
isProcessCheck
=
false
);
AwesomeDialog
(
context:
context
,
dismissOnTouchOutside:
false
,
dialogType:
DialogType
.
error
,
animType:
AnimType
.
rightSlide
,
autoHide:
Duration
(
seconds:
3
),
headerAnimationLoop:
true
,
title:
'Belum Terbayar , Silahkan Ulangi Kembali !'
,
desc:
"Not paid yet , please try again !"
,
).
show
().
then
((
value
){
Navigator
.
of
(
context
).
pop
();
timer
?.
cancel
();
dataQris
=
null
;
checkCountZero
=
false
;
isShowingDialog
=
true
;
_showTap
();
tapDial
();
});
}
// isProcessCheck = false;
});
}
catch
(
e
)
{
print
(
"Error:
$e
"
);
setState
(
()
=>
isProcessCheck
=
false
);
}
},
btnOkIcon:
Icons
.
cancel
,
btnOkIcon:
Icons
.
cancel
,
btnOkColor:
Colors
.
red
)
btnOkColor:
Colors
.
red
)
.
show
();
.
show
()
.
then
((
value
)
async
{
setState
(()
{
isProcessCheck
=
true
;
});
try
{
bool
result
=
await
_cekStatus
();
setState
(()
{
if
(
result
)
{
isProcessGet
=
false
;
print
(
"pembayaran berhasil dilakukan"
);
Navigator
.
pop
(
context
);
showPop
(
approvalCode
);
}
else
{
setState
(
()
=>
isProcessCheck
=
false
);
AwesomeDialog
(
context:
context
,
dismissOnTouchOutside:
false
,
dialogType:
DialogType
.
error
,
animType:
AnimType
.
rightSlide
,
autoHide:
Duration
(
seconds:
2
),
headerAnimationLoop:
true
,
title:
'Belum Terbayar , Silahkan Ulangi Kembali !'
,
desc:
"Not paid yet , please try again !"
,
).
show
().
then
((
value
)
{
Navigator
.
of
(
context
).
pop
();
timer
?.
cancel
();
dataQris
=
null
;
checkCountZero
=
false
;
isShowingDialog
=
true
;
_showTap
();
tapDial
();
});
}
// isProcessCheck = false;
});
}
catch
(
e
)
{
print
(
"Error:
$e
"
);
setState
(()
=>
isProcessCheck
=
false
);
}
});
},
},
builder:
(
BuildContext
context
,
Duration
value
,
builder:
(
BuildContext
context
,
Duration
value
,
Widget
?
child
)
{
Widget
?
child
)
{
...
@@ -2438,8 +2419,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
...
@@ -2438,8 +2419,8 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
int
.
parse
(
seconds
)
==
int
.
parse
(
"30"
))
{
int
.
parse
(
seconds
)
==
int
.
parse
(
"30"
))
{
if
(!
isHitApi
)
{
if
(!
isHitApi
)
{
isHitApi
=
true
;
isHitApi
=
true
;
isProcessCheck
=
true
;
_cekStatus
(
isBackgroundServices:
true
);
_cekStatus
(
isBackgroundServices:
true
);
print
(
"pembayaran berhasil dilakukan"
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment