diff --git a/assets/images/splash.png b/assets/images/splash.png new file mode 100644 index 0000000..63ed04d Binary files /dev/null and b/assets/images/splash.png differ diff --git a/lib/main.dart b/lib/main.dart index f3b3b3c..348570a 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:learn/landing_page.dart'; +import 'package:learn/splash_screen.dart'; import 'package:learn/utils/route/routes.dart'; DateTime? currentBackPressTime; @@ -22,7 +23,7 @@ class MyApp extends StatelessWidget { debugShowCheckedModeBanner: false, title: 'Learn', themeMode: ThemeMode.system, - home: LandingPage(), + home: SplashScreen(), onGenerateRoute: Routers.generateRoute, ); } diff --git a/lib/splash_screen.dart b/lib/splash_screen.dart new file mode 100644 index 0000000..b176c18 --- /dev/null +++ b/lib/splash_screen.dart @@ -0,0 +1,97 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:learn/landing_page.dart'; + +class SplashScreen extends StatefulWidget { + const SplashScreen({super.key}); + + @override + State createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State with SingleTickerProviderStateMixin { + late AnimationController _controller; + late Animation _fadeInAnimation; + late Animation _scaleAnimation; + + @override + void initState() { + super.initState(); + + _controller = AnimationController( + duration: const Duration(seconds: 2), + vsync: this, + ); + + _fadeInAnimation = Tween(begin: 0.3, end: 1.0).animate( + CurvedAnimation(parent: _controller, curve: Curves.easeIn), + ); + + _scaleAnimation = Tween(begin: 0.8, end: 1.0).animate( + CurvedAnimation(parent: _controller, curve: Curves.easeOutBack), + ); + + _controller.forward(); + + Timer(const Duration(seconds: 5), () { + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) => const LandingPage()), + ); + }); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.white, + body: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AnimatedBuilder( + animation: _controller, + builder: (context, child) { + return Transform.scale( + scale: _scaleAnimation.value, + child: Opacity( + opacity: _fadeInAnimation.value, + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100), + ), + child: Center( + child: Image.asset( + "assets/images/splash.png", + height: 200, + width: 200, + ), + ), + ), + ), + ); + }, + ), + const SizedBox(height: 10), + FadeTransition( + opacity: _fadeInAnimation, + child: const Text( + "Curiosity Starts Here!", + style: TextStyle( + fontFamily: "Comic", + fontSize: 20, + color: Colors.black, + ), + ), + ), + ], + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index a284a1a..362eff5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -84,7 +84,6 @@ flutter: - assets/explore/ - assets/seasons/ - assets/occupations/ - - assets/fruitsVeges/ # An image asset can refer to one or more resolution-specific "variants", see