Skip to content

Instantly share code, notes, and snippets.

@hariprasadms
Created June 30, 2021 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hariprasadms/e5581f3b8236d6b3dee85d917ebc2979 to your computer and use it in GitHub Desktop.
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
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 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