tbib_splash_screen 1.0.0 tbib_splash_screen: ^1.0.0 copied to clipboard
This flutter lib is used as Splash Screen of your app to display logo With Text Animated by Animated Text Kit.
import 'package:example/home_screen.dart';
import 'package:flutter/material.dart';
import 'package:tbib_splash_screen/splash_screen_view.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
// This widget is the home page of your application. It is stateful, meaning
// that it has a State object (defined below) that contains fields that affect
// how it looks.
// This class is the configuration for the state. It holds the values (in this
// case the title) provided by the parent (in this case the App widget) and
// used by the build method of the State. Fields in a Widget subclass are
// always marked "final".
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool isLoaded = false;
@override
void initState() {
super.initState();
Future.delayed(const Duration(seconds: 10)).then((value) => setState(() {
isLoaded = true;
}));
}
@override
Widget build(BuildContext context) {
return SplashScreenView(
navigateWhere: isLoaded,
navigateRoute: const HomeScreen(), backgroundColor: Colors.white,
linearGradient: const LinearGradient(
colors: [
Color(0xFF3366FF),
Color(0xFF00CCFF),
],
begin: FractionalOffset(0.0, 0.0),
end: FractionalOffset(1.0, 0.0),
stops: [0.0, 1.0],
tileMode: TileMode.clamp),
text: WavyAnimatedText(
"Splash Screen",
textStyle: const TextStyle(
color: Colors.red,
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
),
imageSrc: "assets/logo_light_lottie.json",
// displayLoading: false,
);
}
}