diff --git a/assets/images/splash_logo.png b/assets/images/splash_logo.png new file mode 100644 index 0000000..97a1181 Binary files /dev/null and b/assets/images/splash_logo.png differ diff --git a/lib/main.dart b/lib/main.dart index c0d2932..f1c9386 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,7 @@ import 'package:flutter/services.dart'; import 'package:flutter/material.dart'; -import 'package:easy_learn/view/screens/list_contents.dart'; +import 'package:easy_learn/view/screens/splash_screen.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -15,8 +15,8 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return MaterialApp( - home: ListContents() + return const MaterialApp( + home: SplashScreen() ); } } \ No newline at end of file diff --git a/lib/view/screens/splash_screen.dart b/lib/view/screens/splash_screen.dart new file mode 100644 index 0000000..6d6bcf2 --- /dev/null +++ b/lib/view/screens/splash_screen.dart @@ -0,0 +1,60 @@ +import 'dart:async'; +import 'package:page_transition/page_transition.dart'; +import 'package:flutter/material.dart'; + +import 'package:easy_learn/view/screens/list_contents.dart'; + +class SplashScreen extends StatefulWidget { + const SplashScreen({Key? key}) : super(key: key); + + @override + _SplashScreenState createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State { + @override + void initState() { + super.initState(); + loadSplash(); + } + + loadSplash() async { + var duration = const Duration(seconds: 5); + return Timer(duration, () { + Navigator.pushReplacement(context, PageTransition( + type: PageTransitionType.fade, + child: ListContents() + )); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + decoration: const BoxDecoration( + color: Colors.blueAccent + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: 500, + height: 500, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/splash_logo.png'), + ) + ), + ), + Container( + margin: const EdgeInsets.all(20.0), + child: const Text("Easy Learn 👩‍🏫", style: TextStyle(fontSize: 40),) + ) + ], + ), + ), + ); + } +} \ No newline at end of file