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
76ee3b15
Commit
76ee3b15
authored
May 15, 2023
by
Izol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update version SS.15.WWW
parent
f4ae6b12
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
188 additions
and
83 deletions
+188
-83
local.properties
android/local.properties
+2
-2
home_page.dart
lib/ui/pages/home_page.dart
+129
-81
buttons.dart
lib/ui/widgets/buttons.dart
+57
-0
No files found.
android/local.properties
View file @
76ee3b15
sdk.dir
=
/Users/macbookpro/Library/Android/sdk
flutter.sdk
=
/Users/macbookpro/Developer/flutter
flutter.buildMode
=
debug
flutter.versionName
=
SS.14.WWW
flutter.versionCode
=
7
\ No newline at end of file
flutter.versionName
=
SS.15.WWW
flutter.versionCode
=
8
\ No newline at end of file
lib/ui/pages/home_page.dart
View file @
76ee3b15
...
...
@@ -79,6 +79,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
OtpFieldController
phoneController
=
OtpFieldController
();
late
Future
<
List
<
OutletModel
>>
listOutlet
;
late
Timer
?
timer
;
late
Timer
?
timerPage
;
bool
isShowingDialog
=
false
;
late
ConnectivityResult
_connectivityResult
;
Color
_statusColor1
=
Colors
.
grey
;
...
...
@@ -91,7 +92,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
double
_downloadSpeed
=
0
;
bool
checkCountZero
=
false
;
bool
isDenomDialogShowing
=
false
;
double
_targetDuration
=
3
;
// Durasi yang dituju (dalam detik)
double
_maxDurationPage
=
3
;
// Durasi maksimum (dalam detik)
late
Timer
timerPageHome
;
var
infoCard
,
prevInfoCard
,
balance
,
...
...
@@ -126,6 +130,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
bool
isHitApi
=
false
;
bool
_isLoading
=
false
;
@override
void
initState
()
{
super
.
initState
();
...
...
@@ -137,6 +142,20 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
tapDial
();
});
double
_targetDuration
=
3
;
// Durasi yang dituju (dalam detik)
double
_maxDurationPage
=
5
;
// Durasi maksimum (dalam detik)
ValueNotifier
<
double
>
progressValue
=
ValueNotifier
<
double
>(
0
);
ValueNotifier
<
int
>
displayValue
=
ValueNotifier
<
int
>(
0
);
timerPage
=
Timer
.
periodic
(
Duration
(
seconds:
1
),
(
timer
)
{
if
(
progressValue
.
value
<
_maxDurationPage
)
{
progressValue
.
value
+=
1
;
displayValue
.
value
-=
1
;
}
else
{
timer
.
cancel
();
}
});
idleDuration
=
ValueNotifier
<
int
>(
_maxDuration
);
Timer
.
periodic
(
Duration
(
seconds:
1
),
(
timer
)
{
if
(
idleDuration
.
value
>
0
)
{
...
...
@@ -157,6 +176,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
@override
void
dispose
()
{
timerPage
?.
cancel
();
idleDuration
.
dispose
();
// timer?.cancel();
super
.
dispose
();
...
...
@@ -899,8 +919,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// ValueNotifier<int> idleDuration = ValueNotifier<int>(0); // buat ValueNotifier untuk idleDuration
int
_maxDuration
=
int
.
parse
(
PreferencesHelper
.
getString
(
"idle"
));
int
_minDuration
=
3
;
late
ValueNotifier
<
int
>
idleDuration
;
// void tapIdle() {
// int duration = int.parse(idle);
// idleDuration.value =
...
...
@@ -939,6 +961,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
!
isShowingDialog
&&
!
checkCountZero
&&
!
isDenomDialogShowing
)
{
if
(
timer
!=
null
)
timer
?.
cancel
();
amountController
?.
clear
();
var
infoMap
=
jsonDecode
(
infoCard
);
plainCardExpirity
=
infoMap
[
'cardExpirity'
];
...
...
@@ -959,7 +982,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dialogType:
DialogType
.
info
,
animType:
AnimType
.
rightSlide
,
dismissOnTouchOutside:
false
,
autoHide:
Duration
(
seconds:
2
),
autoHide:
Duration
(
seconds:
1
),
headerAnimationLoop:
true
,
title:
'Anda sedang di alihkan ke halaman pilih nominal'
,
titleTextStyle:
blackTextStyle
.
copyWith
(
...
...
@@ -972,6 +995,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
fontWeight:
light
,
),
).
show
().
then
((
value
)
{
timer
?.
cancel
();
isDenomDialogShowing
=
true
;
// Set penanda dialog denom menjadi true
denom
(
outletName
,
infoCard
);
if
(
timer
!=
null
)
{
...
...
@@ -1712,73 +1736,98 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Container
(
margin:
const
EdgeInsets
.
only
(
right:
300
,
left:
300
),
child:
Row
(
child:
Column
(
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
)
{
Row
(
children:
[
Expanded
(
child:
CustomFilledButton
(
title:
'lanjut'
,
subtitle:
' / proceed'
,
onPressed:
()
{
setState
(()
{
if
(
timer
!=
null
)
timer
?.
cancel
();
AwesomeDialog
(
context:
context
,
dialogType:
DialogType
.
error
,
dialogType:
DialogType
.
info
,
animType:
AnimType
.
rightSlide
,
dismissOnTouchOutside:
false
,
autoHide:
Duration
(
seconds:
2
),
headerAnimationLoop:
true
,
title:
'Terjadi Kesalahan'
,
desc:
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
();
}
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:
10
),
Container
(
margin:
const
EdgeInsets
.
only
(
right:
350
,
left:
350
),
child:
Row
(
children:
[
Expanded
(
child:
CustomFillButton
(
title:
'Batal'
,
subtitle:
' / cancel'
,
onPressed:
(){
Navigator
.
of
(
context
).
pop
();
timer
?.
cancel
();
checkCountZero
=
false
;
isShowingDialog
=
true
;
_showTap
();
tapDial
();
},
)
)
]
),
),
SizedBox
(
height:
20
),
Positioned
(
bottom:
20
,
...
...
@@ -2709,30 +2758,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// subtitle: " topup balance",
// ),
// ),
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
),
),
),
),
],
),
// TextButton(
Stack
(
alignment:
Alignment
.
center
,
children:
[
ValueListenableBuilder
(
valueListenable:
idleDuration
,
builder:
(
context
,
value
,
child
)
=>
CircularProgressIndicator
(
strokeWidth:
5
,
value:
value
/
3
,
// Menggunakan nilai langsung dari value
valueColor:
AlwaysStoppedAnimation
<
Color
>(
Colors
.
blue
),
),
),
RotatedBox
(
quarterTurns:
(
idleDuration
.
value
.
toInt
()
%
5
),
// Menggunakan nilai bulat dari value
child:
ValueListenableBuilder
(
valueListenable:
idleDuration
,
builder:
(
context
,
value
,
child
)
=>
Text
(
(
value
.
toInt
()
%
4
).
toString
(),
// Menggunakan nilai bulat dari value
style:
TextStyle
(
fontSize:
20
),
),
),
),
],
),
// TextButton(
// onPressed: () {
// timer?.cancel();
// checkCountZero = false;
...
...
lib/ui/widgets/buttons.dart
View file @
76ee3b15
...
...
@@ -58,6 +58,63 @@ class CustomFilledButton extends StatelessWidget {
}
}
class
CustomFillButton
extends
StatelessWidget
{
final
String
title
;
final
String
subtitle
;
final
double
width
;
final
double
height
;
final
VoidCallback
?
onPressed
;
const
CustomFillButton
({
Key
?
key
,
required
this
.
title
,
required
this
.
subtitle
,
this
.
width
=
double
.
infinity
,
this
.
height
=
60
,
this
.
onPressed
,
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
SizedBox
(
width:
width
,
height:
height
,
child:
TextButton
(
onPressed:
onPressed
,
style:
TextButton
.
styleFrom
(
backgroundColor:
Colors
.
red
,
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
56
),
),
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
title
,
style:
whiteTextStyle
.
copyWith
(
fontSize:
25
,
fontWeight:
semiBold
,
),
),
SizedBox
(
width:
5
),
Text
(
subtitle
,
style:
greyTextStyle
.
copyWith
(
fontSize:
18
,
fontStyle:
FontStyle
.
italic
,
fontWeight:
light
,
),
textAlign:
TextAlign
.
center
,
),
],
),
),
);
}
}
class
CustomTextButton
extends
StatelessWidget
{
final
String
title
;
final
double
width
;
...
...
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