Created
June 30, 2021 20:01
-
-
Save hariprasadms/e5581f3b8236d6b3dee85d917ebc2979 to your computer and use it in GitHub Desktop.
A example code to show how splash screen can added to flutter apps
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 'package:fire_table_demo/home_page/landingpage.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:splash_screen_view/SplashScreenView.dart'; | |
class SplashScreenDemo extends StatefulWidget { | |
SplashScreenDemo({Key key}) : super(key: key); | |
@override | |
_SplashScreenDemoState createState() => _SplashScreenDemoState(); | |
} | |
class _SplashScreenDemoState extends State<SplashScreenDemo> { | |
@override | |
Widget build(BuildContext context) { | |
return SplashScreenView( | |
navigateRoute: LandingPage(), | |
duration: 5000, | |
text: "Splash Screen", | |
textType: TextType.ColorizeAnimationText, | |
textStyle: TextStyle( | |
fontSize: 40.0, | |
), | |
// colors: [ | |
// Colors.purple, | |
// Colors.blue, | |
// Colors.yellow, | |
// Colors.red, | |
// ], | |
backgroundColor: Colors.white, | |
); | |
} | |
} |
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
// this page has the navigate action to show splashscreen. | |
import 'package:fire_table_demo/home_page/flashscreen.dart'; | |
import 'package:flutter/material.dart'; | |
class LandingPage extends StatelessWidget { | |
const LandingPage({Key key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Lanidng Page'), | |
), | |
body: Column( | |
children: [ | |
Container( | |
color: Colors.redAccent, | |
width: MediaQuery.of(context).size.width, | |
height: 100, | |
child: InkWell( | |
onTap: () => Navigator.push(context, | |
MaterialPageRoute(builder: (context) => SplashScreenDemo())), | |
child: Padding( | |
padding: const EdgeInsets.all(12.0), | |
child: Center( | |
child: Text('Flash screen'), | |
), | |
), | |
), | |
) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment