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
b000df42
Commit
b000df42
authored
Jan 20, 2023
by
Izol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing splash page
parent
1f8257a5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
38 deletions
+78
-38
splash_page.dart
lib/ui/pages/splash_page.dart
+78
-38
No files found.
lib/ui/pages/splash_page.dart
View file @
b000df42
// ignore_for_file: unused_import, prefer_const_constructors, avoid_print
import
'dart:async'
;
import
'package:awesome_dialog/awesome_dialog.dart'
;
import
'package:permission_handler/permission_handler.dart'
;
import
'package:self_service_3/database/database.dart'
;
import
'package:self_service_3/database/database_helper.dart'
;
...
...
@@ -18,6 +19,7 @@ import 'package:self_service_3/shared/theme.dart';
import
'package:self_service_3/ui/pages/set_merchant.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'../../shared/preference_constant.dart'
;
import
'../../shared/preferences_helper.dart'
;
...
...
@@ -37,26 +39,24 @@ class SplashPage extends StatefulWidget {
State
<
SplashPage
>
createState
()
=>
_SplashPageState
();
}
class
_SplashPageState
extends
State
<
SplashPage
>
{
void
checkAktivation
()
{
bool
isDoneConfig
=
PreferencesHelper
.
getBool
(
kIsDoneConfig
);
bool
isTapConfig
=
PreferencesHelper
.
getBool
(
kIsTap
);
// bool isHashOutlet = PreferencesHelper.getBool(kTap);
// bool isHashOutlet = PreferencesHelper.getString('multioutletname',"false") ;
print
(
'ini pesan:
$isDoneConfig
'
);
print
(
"ini pesan
$isTapConfig
"
);
class
_SplashPageState
extends
State
<
SplashPage
>
with
TickerProviderStateMixin
{
if
(
isDoneConfig
)
{
if
(
isTapConfig
&&
isDoneConfig
)
{
navigationToAktivation
();
}
else
{
navigationToGetOutlet
();
}
}
else
{
navigationToSetConfig
();
}
late
final
AnimationController
_controller
=
AnimationController
(
duration:
const
Duration
(
seconds:
2
),
vsync:
this
,
)..
repeat
(
reverse:
true
);
@override
void
dispose
()
{
_controller
.
dispose
();
super
.
dispose
();
}
late
final
Animation
<
double
>
_animation
=
CurvedAnimation
(
parent:
_controller
,
curve:
Curves
.
easeIn
);
void
navigationToGetOutlet
()
{
Navigator
.
of
(
context
)
.
restorablePopAndPushNamed
(
'/set-merchant'
,
arguments:
kIsTap
);
...
...
@@ -86,29 +86,57 @@ class _SplashPageState extends State<SplashPage> {
}
void
permissionState
()
async
{
if
(
await
Permission
.
storage
.
request
().
isGranted
&&
await
Permission
.
phone
.
request
().
isGranted
)
{
StartService
.
initLibrary
().
then
((
value
)
{
PermissionStatus
status
=
await
Permission
.
storage
.
request
();
if
(
status
!=
PermissionStatus
.
granted
){
// handle user denied the permissions
return
;
}
// request phone permissions
status
=
await
Permission
.
phone
.
request
();
if
(
status
!=
PermissionStatus
.
granted
){
// handle user denied the permissions
return
;
}
// Initialize library and check activation
StartService
.
initLibrary
().
then
((
value
){
Future
.
delayed
(
Duration
(
seconds:
3
),
()
{
if
(
mounted
){
checkAktivation
();
}
});
});
}
// You can request multiple permissions at once.
Map
<
Permission
,
PermissionStatus
>
statuses
=
await
[
Permission
.
phone
,
Permission
.
storage
,
].
request
();
print
(
"phone :
${statuses[Permission.phone]}
"
);
print
(
"storage :
${statuses[Permission.storage]}
"
);
void
checkAktivation
()
{
bool
isDoneConfig
=
PreferencesHelper
.
getBool
(
kIsDoneConfig
);
bool
isTapConfig
=
PreferencesHelper
.
getBool
(
kIsTap
);
// bool isHashOutlet = PreferencesHelper.getBool(kTap);
// bool isHashOutlet = PreferencesHelper.getString('multioutletname',"false") ;
print
(
'ini pesan:
$isDoneConfig
'
);
print
(
"ini pesan
$isTapConfig
"
);
if
(
isDoneConfig
)
{
if
(
isTapConfig
&&
isDoneConfig
)
{
navigationToAktivation
();
}
else
{
navigationToGetOutlet
();
}
}
else
{
navigationToSetConfig
();
}
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
backgroundColor:
lightBackgroundColor
,
body:
Center
(
child:
Stack
(
children:
[
FadeTransition
(
opacity:
_animation
,
child:
Center
(
child:
Container
(
width:
300
,
height:
300
,
...
...
@@ -121,6 +149,18 @@ class _SplashPageState extends State<SplashPage> {
),
),
),
),
Positioned
(
child:
Container
(
color:
Colors
.
black12
,
child:
const
Center
(
child:
CircularProgressIndicator
(),
),
),
),
]
),
),
);
}
}
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