Merge branch '5-splash-screen' into 'main'
Resolve "Splash Screen" Closes #5 See merge request easy-learn-aic/app!4
This commit is contained in:
commit
39b5b3dbfc
3 changed files with 63 additions and 3 deletions
BIN
assets/images/splash_logo.png
Normal file
BIN
assets/images/splash_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 315 KiB |
|
@ -1,7 +1,7 @@
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/material.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() {
|
void main() {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
@ -15,8 +15,8 @@ class MyApp extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return const MaterialApp(
|
||||||
home: ListContents()
|
home: SplashScreen()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
60
lib/view/screens/splash_screen.dart
Normal file
60
lib/view/screens/splash_screen.dart
Normal file
|
@ -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<SplashScreen> {
|
||||||
|
@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),)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue