Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
Mobile App
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Code
Mobile App
Commits
222a16e6
Commit
222a16e6
authored
5 years ago
by
Markin Igor
Browse files
Options
Downloads
Patches
Plain Diff
Use custom splash screen.
parent
e32513f4
Branches
Branches containing commit
No related tags found
1 merge request
!1
Mobile app initial implementation.
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/src/app.dart
+20
-22
20 additions, 22 deletions
lib/src/app.dart
lib/src/screens/splashscreen.dart
+80
-0
80 additions, 0 deletions
lib/src/screens/splashscreen.dart
pubspec.lock
+0
-7
0 additions, 7 deletions
pubspec.lock
pubspec.yaml
+0
-1
0 additions, 1 deletion
pubspec.yaml
with
100 additions
and
30 deletions
lib/src/app.dart
+
20
−
22
View file @
222a16e6
// app.dart
import
'screens/splashscreen.dart'
;
import
'package:flutter/material.dart'
;
import
'screens/home.dart'
;
import
'package:flutter/services.dart'
;
...
...
@@ -6,9 +7,22 @@ import 'dart:async';
import
'dart:developer'
;
import
'package:uni_links/uni_links.dart'
;
import
'package:splashscreen/splashscreen.dart'
;
class
App
extends
StatelessWidget
{
Future
<
Widget
>
initApplication
()
async
{
Uri
initialUri
;
try
{
initialUri
=
await
getInitialUri
();
}
on
PlatformException
{
initialUri
=
null
;
}
on
FormatException
{
initialUri
=
null
;
}
return
new
MainApp
(
initialUri:
initialUri
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
...
...
@@ -20,16 +34,7 @@ class App extends StatelessWidget {
button:
TextStyle
(
color:
Colors
.
white
,
fontSize:
18.0
),
title:
TextStyle
(
color:
Colors
.
red
))),
home:
new
SplashScreen
(
seconds:
3
,
title:
new
Text
(
''
),
navigateAfterSeconds:
new
MainApp
(),
image:
new
Image
.
asset
(
'assets/images/vereign_logo_text.png'
),
backgroundColor:
Color
(
0xFFd51d32
),
photoSize:
100.0
,
loaderColor:
Colors
.
white
,
loadingText:
new
Text
(
'Loading'
,
style:
new
TextStyle
(
color:
Colors
.
white
)),
navigateAfterFuture:
initApplication
,
)
);
...
...
@@ -38,6 +43,9 @@ class App extends StatelessWidget {
}
class
MainApp
extends
StatefulWidget
{
MainApp
({
@required
this
.
initialUri
});
final
Uri
initialUri
;
@override
_MainAppState
createState
()
=
>
_MainAppState
();
}
...
...
@@ -55,7 +63,6 @@ class _MainAppState extends State<MainApp> {
initState
()
{
super
.
initState
();
initUniLinks
();
// FlutterWebBrowser.openWebPage(url: 'https://demo1.vereign.com', androidToolbarColor: Color(0xFFd51d32));
}
@override
...
...
@@ -65,16 +72,7 @@ class _MainAppState extends State<MainApp> {
}
Future
<
Null
>
initUniLinks
()
async
{
Uri
initialUri
;
try
{
initialUri
=
await
getInitialUri
();
}
on
PlatformException
{
initialUri
=
null
;
}
on
FormatException
{
initialUri
=
null
;
}
updateAppMode
(
initialUri
);
updateAppMode
(
widget
.
initialUri
);
_sub
=
getUriLinksStream
()
.
listen
((
Uri
uri
)
{
updateAppMode
(
uri
);
...
...
This diff is collapsed.
Click to expand it.
lib/src/screens/splashscreen.dart
0 → 100644
+
80
−
0
View file @
222a16e6
import
'dart:core'
;
import
'dart:async'
;
import
'package:flutter/material.dart'
;
class
SplashScreen
extends
StatefulWidget
{
final
dynamic
navigateAfterFuture
;
SplashScreen
({
this
.
navigateAfterFuture
});
@override
_SplashScreenState
createState
()
=
>
_SplashScreenState
();
}
class
_SplashScreenState
extends
State
<
SplashScreen
>
{
@override
void
initState
()
{
super
.
initState
();
load
();
}
load
()
async
{
var
newWidget
=
await
widget
.
navigateAfterFuture
();
// Show loader additional 2 seconds
Timer
(
Duration
(
seconds:
2
),
()
{
Navigator
.
of
(
context
)
.
pushReplacement
(
new
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=
>
newWidget
));
}
);
}
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
body:
new
InkWell
(
child:
new
Stack
(
fit:
StackFit
.
expand
,
children:
<
Widget
>[
new
Container
(
decoration:
new
BoxDecoration
(
color:
Color
(
0xFFd51d32
),
),
),
new
Column
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
<
Widget
>[
new
Expanded
(
flex:
2
,
child:
new
Container
(
child:
new
Image
.
asset
(
'assets/images/vereign_logo_text.png'
),
padding:
EdgeInsets
.
all
(
40
)
),
),
Expanded
(
flex:
1
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
CircularProgressIndicator
(
valueColor:
new
AlwaysStoppedAnimation
<
Color
>(
Colors
.
white
),
),
Padding
(
padding:
const
EdgeInsets
.
only
(
top:
20.0
),
),
new
Text
(
'Loading'
,
style:
new
TextStyle
(
color:
Colors
.
white
))
],
),
),
],
),
],
),
),
);
}
}
This diff is collapsed.
Click to expand it.
pubspec.lock
+
0
−
7
View file @
222a16e6
...
...
@@ -172,13 +172,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
splashscreen:
dependency: "direct main"
description:
name: splashscreen
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
stack_trace:
dependency: transitive
description:
...
...
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
0
−
1
View file @
222a16e6
...
...
@@ -29,7 +29,6 @@ dependencies:
http
:
^0.12.0
flutter_app_auth_wrapper
:
^0.1.1+3
url_launcher
:
5.1.0
splashscreen
:
1.2.0
dev_dependencies
:
flutter_test
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment