Skip to content

Commit 77556c9

Browse files
splash screen added
1 parent f6d5c3c commit 77556c9

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

lib/Pages/splash_screen.dart

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import 'dart:async';
2+
3+
import 'package:flutter/material.dart';
4+
import 'package:text_to_image_gen/Pages/home_page.dart';
5+
6+
class SplashScreen extends StatefulWidget {
7+
const SplashScreen({super.key});
8+
9+
@override
10+
_SplashScreenState createState() => _SplashScreenState();
11+
}
12+
13+
class _SplashScreenState extends State<SplashScreen> {
14+
@override
15+
void initState() {
16+
// TODO: implement initState
17+
super.initState();
18+
Timer(
19+
const Duration(seconds: 4),
20+
() {
21+
Navigator.of(context).pushReplacement(
22+
MaterialPageRoute(builder: (_) => const HomePage()));
23+
},
24+
);
25+
}
26+
27+
@override
28+
Widget build(BuildContext context) {
29+
return Scaffold(
30+
backgroundColor: Colors.deepPurple.shade50,
31+
body: Center(
32+
child: Column(
33+
mainAxisAlignment: MainAxisAlignment.center,
34+
children: [
35+
// logo here
36+
Image.asset(
37+
'assets/images/TexFusion.png',
38+
height: 150,
39+
),
40+
const SizedBox(
41+
height: 20,
42+
),
43+
const CircularProgressIndicator(
44+
valueColor: AlwaysStoppedAnimation<Color>(Colors.deepPurple),
45+
),
46+
],
47+
),
48+
),
49+
);
50+
}
51+
}

0 commit comments

Comments
 (0)