Created
March 29, 2020 17:54
-
-
Save rushabhshah065/6ef6bbd98a8f18a240b5cd3393fcdb66 to your computer and use it in GitHub Desktop.
Flutter Splash Screen Widget for customize splash screen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'package:flutter/material.dart'; | |
class SplashScreen extends StatefulWidget { | |
final Color backgroundColor = Colors.white; | |
final TextStyle styleTextUnderTheLoader = TextStyle( | |
fontSize: 18.0, fontWeight: FontWeight.bold, color: Colors.black); | |
@override | |
_SplashScreenState createState() => _SplashScreenState(); | |
} | |
class _SplashScreenState extends State<SplashScreen> { | |
String _versionName = 'V1.0'; | |
final splashDelay = 5; | |
@override | |
void initState() { | |
super.initState(); | |
_loadWidget(); | |
} | |
_loadWidget() async { | |
var _duration = Duration(seconds: splashDelay); | |
return Timer(_duration, navigationPage); | |
} | |
void navigationPage() { | |
Navigator.pushReplacement(context, MaterialPageRoute(builder: (BuildContext context) => AfterSplash())); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: InkWell( | |
child: Stack( | |
fit: StackFit.expand, | |
children: <Widget>[ | |
Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
children: <Widget>[ | |
Expanded( | |
flex: 7, | |
child: Container( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Image.asset( | |
'images/img_splash.png', | |
height: 300, | |
width: 300, | |
), | |
Padding( | |
padding: const EdgeInsets.only(top: 10.0), | |
), | |
], | |
)), | |
), | |
Expanded( | |
child: Column( | |
children: <Widget>[ | |
CircularProgressIndicator(), | |
Container( | |
height: 10, | |
), | |
Row( | |
mainAxisAlignment: MainAxisAlignment.spaceAround, | |
children: <Widget>[ | |
Spacer(), | |
Text(_versionName), | |
Spacer( | |
flex: 4, | |
), | |
Text('androing'), | |
Spacer(), | |
]) | |
], | |
), | |
), | |
], | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment