-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add splash screen from the new logo widget
- Loading branch information
1 parent
062d34c
commit 2a09835
Showing
2 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:threebotlogin/screens/main_screen.dart'; | ||
import 'package:threebotlogin/widgets/home_logo.dart'; | ||
|
||
class SplashScreen extends StatefulWidget { | ||
const SplashScreen( | ||
{super.key, required this.initDone, required this.registered}); | ||
|
||
final bool initDone; | ||
final bool registered; | ||
|
||
@override | ||
State<SplashScreen> createState() => _SplashScreenState(); | ||
} | ||
|
||
class _SplashScreenState extends State<SplashScreen> | ||
with SingleTickerProviderStateMixin { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive); | ||
Future.delayed( | ||
const Duration(seconds: 2), | ||
() { | ||
Navigator.of(context).pushReplacement(MaterialPageRoute( | ||
builder: (_) => MainScreen( | ||
initDone: widget.initDone, registered: widget.registered))); | ||
}, | ||
); | ||
} | ||
|
||
@override | ||
void dispose() { | ||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, | ||
overlays: SystemUiOverlay.values); | ||
super.dispose(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const Scaffold( | ||
body: Center( | ||
child: Hero( | ||
tag: 'logo', | ||
child: HomeLogoWidget(), | ||
), | ||
), | ||
); | ||
} | ||
} |