Commit 76ee3b15 authored by Izol's avatar Izol

Update version SS.15.WWW

parent f4ae6b12
sdk.dir=/Users/macbookpro/Library/Android/sdk sdk.dir=/Users/macbookpro/Library/Android/sdk
flutter.sdk=/Users/macbookpro/Developer/flutter flutter.sdk=/Users/macbookpro/Developer/flutter
flutter.buildMode=debug flutter.buildMode=debug
flutter.versionName=SS.14.WWW flutter.versionName=SS.15.WWW
flutter.versionCode=7 flutter.versionCode=8
\ No newline at end of file \ No newline at end of file
...@@ -79,6 +79,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -79,6 +79,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
OtpFieldController phoneController = OtpFieldController(); OtpFieldController phoneController = OtpFieldController();
late Future<List<OutletModel>> listOutlet; late Future<List<OutletModel>> listOutlet;
late Timer? timer; late Timer? timer;
late Timer? timerPage;
bool isShowingDialog = false; bool isShowingDialog = false;
late ConnectivityResult _connectivityResult; late ConnectivityResult _connectivityResult;
Color _statusColor1 = Colors.grey; Color _statusColor1 = Colors.grey;
...@@ -91,7 +92,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -91,7 +92,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
double _downloadSpeed = 0; double _downloadSpeed = 0;
bool checkCountZero = false; bool checkCountZero = false;
bool isDenomDialogShowing = false; bool isDenomDialogShowing = false;
double _targetDuration = 3; // Durasi yang dituju (dalam detik)
double _maxDurationPage = 3; // Durasi maksimum (dalam detik)
late Timer timerPageHome;
var infoCard, var infoCard,
prevInfoCard, prevInfoCard,
balance, balance,
...@@ -126,6 +130,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -126,6 +130,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
bool isHitApi = false; bool isHitApi = false;
bool _isLoading = false; bool _isLoading = false;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -137,6 +142,20 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -137,6 +142,20 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
tapDial(); 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); idleDuration = ValueNotifier<int>(_maxDuration);
Timer.periodic(Duration(seconds: 1), (timer) { Timer.periodic(Duration(seconds: 1), (timer) {
if (idleDuration.value > 0) { if (idleDuration.value > 0) {
...@@ -157,6 +176,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -157,6 +176,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
@override @override
void dispose() { void dispose() {
timerPage?.cancel();
idleDuration.dispose(); idleDuration.dispose();
// timer?.cancel(); // timer?.cancel();
super.dispose(); super.dispose();
...@@ -899,8 +919,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -899,8 +919,10 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// ValueNotifier<int> idleDuration = ValueNotifier<int>(0); // buat ValueNotifier untuk idleDuration // ValueNotifier<int> idleDuration = ValueNotifier<int>(0); // buat ValueNotifier untuk idleDuration
int _maxDuration = int.parse(PreferencesHelper.getString("idle")); int _maxDuration = int.parse(PreferencesHelper.getString("idle"));
int _minDuration = 3;
late ValueNotifier<int> idleDuration; late ValueNotifier<int> idleDuration;
// void tapIdle() { // void tapIdle() {
// int duration = int.parse(idle); // int duration = int.parse(idle);
// idleDuration.value = // idleDuration.value =
...@@ -939,6 +961,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -939,6 +961,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
!isShowingDialog && !isShowingDialog &&
!checkCountZero && !checkCountZero &&
!isDenomDialogShowing) { !isDenomDialogShowing) {
if (timer != null) timer?.cancel();
amountController?.clear(); amountController?.clear();
var infoMap = jsonDecode(infoCard); var infoMap = jsonDecode(infoCard);
plainCardExpirity = infoMap['cardExpirity']; plainCardExpirity = infoMap['cardExpirity'];
...@@ -959,7 +982,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -959,7 +982,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
dialogType: DialogType.info, dialogType: DialogType.info,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
dismissOnTouchOutside: false, dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2), autoHide: Duration(seconds: 1),
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Anda sedang di alihkan ke halaman pilih nominal', title: 'Anda sedang di alihkan ke halaman pilih nominal',
titleTextStyle: blackTextStyle.copyWith( titleTextStyle: blackTextStyle.copyWith(
...@@ -972,6 +995,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -972,6 +995,7 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
fontWeight: light, fontWeight: light,
), ),
).show().then((value) { ).show().then((value) {
timer?.cancel();
isDenomDialogShowing = true; // Set penanda dialog denom menjadi true isDenomDialogShowing = true; // Set penanda dialog denom menjadi true
denom(outletName, infoCard); denom(outletName, infoCard);
if (timer != null) { if (timer != null) {
...@@ -1712,73 +1736,98 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -1712,73 +1736,98 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
Container( Container(
margin: const EdgeInsets.only( margin: const EdgeInsets.only(
right: 300, left: 300), right: 300, left: 300),
child: Row( child: Column(
children: [ children: [
Expanded( Row(
child: CustomFilledButton( children: [
title: 'lanjut', Expanded(
subtitle: ' / proceed', child: CustomFilledButton(
onPressed: () { title: 'lanjut',
setState(() { subtitle: ' / proceed',
if (timer != null) timer?.cancel(); onPressed: () {
setState(() {
AwesomeDialog( if (timer != null) timer?.cancel();
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( AwesomeDialog(
context: context, context: context,
dialogType: DialogType.error, dialogType: DialogType.info,
animType: AnimType.rightSlide, animType: AnimType.rightSlide,
dismissOnTouchOutside: false,
autoHide: Duration(seconds: 2),
headerAnimationLoop: true, headerAnimationLoop: true,
title: 'Terjadi Kesalahan', title:
desc: '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", "Anda belum mengisi saldo",
btnOkOnPress: () { btnOkOnPress: () {
if (timer != null) if (timer != null)
timer?.cancel(); timer?.cancel();
tapIdle(); tapIdle();
}, },
btnOkIcon: Icons.cancel, btnOkIcon: Icons.cancel,
btnOkColor: Colors.red, btnOkColor: Colors.red,
).show(); ).show();
} }
if (mounted) { if (mounted) {
denomLimits( denomLimits(
outletName, outletName,
info, info,
int.parse(amountController! int.parse(amountController!
.text .text
.replaceAll(",", ""))); .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), SizedBox(height: 20),
Positioned( Positioned(
bottom: 20, bottom: 20,
...@@ -2709,30 +2758,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback { ...@@ -2709,30 +2758,29 @@ class _HomePageState extends State<HomePage> implements AlertDialogCallback {
// subtitle: " topup balance", // subtitle: " topup balance",
// ), // ),
// ), // ),
Stack( Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: idleDuration, valueListenable: idleDuration,
builder: (context, value, child) => CircularProgressIndicator( builder: (context, value, child) => CircularProgressIndicator(
strokeWidth: 5, strokeWidth: 5,
value: (idleDuration.value.toDouble()) / _maxDuration, value: value / 3, // Menggunakan nilai langsung dari value
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue), valueColor: AlwaysStoppedAnimation<Color>(Colors.blue),
), ),
), ),
RotatedBox( RotatedBox(
quarterTurns: 4, quarterTurns: (idleDuration.value.toInt() % 5), // Menggunakan nilai bulat dari value
child: ValueListenableBuilder( child: ValueListenableBuilder(
valueListenable: idleDuration, valueListenable: idleDuration,
builder: (context, value, child) => Text( builder: (context, value, child) => Text(
value.toString(), (value.toInt() % 4).toString(), // Menggunakan nilai bulat dari value
style: TextStyle(fontSize: 18), style: TextStyle(fontSize: 20),
), ),
), ),
), ),
], ],
), ), // TextButton(
// TextButton(
// onPressed: () { // onPressed: () {
// timer?.cancel(); // timer?.cancel();
// checkCountZero = false; // checkCountZero = false;
......
...@@ -58,6 +58,63 @@ class CustomFilledButton extends StatelessWidget { ...@@ -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 { class CustomTextButton extends StatelessWidget {
final String title; final String title;
final double width; final double width;
......
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