Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit d7af113

Browse files
bors[bot]holzeis
andauthored
Merge #365
365: feat: In app splash screen r=luckysori a=holzeis Not an native splash screen, but at least the screen is not black until the app is ready. ![startup](https://user-images.githubusercontent.com/382048/203768253-a65764b0-f314-4071-92a5-66ade5cb768d.gif) Co-authored-by: Richard Holzeis <richard@holzeis.me>
2 parents d01aef9 + 9392670 commit d7af113

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

lib/main.dart

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,29 @@ class _TenTenOneState extends State<TenTenOneApp> {
8181
Widget build(BuildContext context) {
8282
const mainColor = Colors.blue;
8383

84-
return Visibility(
85-
visible: ready,
86-
child: MaterialApp.router(
87-
debugShowCheckedModeBanner: false,
88-
title: 'TenTenOne',
89-
theme: ThemeData(
90-
primarySwatch: mainColor,
91-
elevatedButtonTheme: ElevatedButtonThemeData(
92-
style: ElevatedButton.styleFrom(foregroundColor: Colors.white)),
93-
floatingActionButtonTheme: const FloatingActionButtonThemeData(
94-
foregroundColor: Colors.white,
95-
),
96-
appBarTheme: const AppBarTheme(
97-
foregroundColor: Colors.white,
98-
)),
99-
routerConfig: _router,
100-
),
84+
if (!ready) {
85+
return MaterialApp(
86+
debugShowCheckedModeBanner: false,
87+
home: Scaffold(
88+
body: Container(
89+
color: Colors.white,
90+
child: Center(
91+
child: Image.asset('assets/10101_logo.png', width: 130, height: 130)))));
92+
}
93+
return MaterialApp.router(
94+
debugShowCheckedModeBanner: false,
95+
title: 'TenTenOne',
96+
theme: ThemeData(
97+
primarySwatch: mainColor,
98+
elevatedButtonTheme: ElevatedButtonThemeData(
99+
style: ElevatedButton.styleFrom(foregroundColor: Colors.white)),
100+
floatingActionButtonTheme: const FloatingActionButtonThemeData(
101+
foregroundColor: Colors.white,
102+
),
103+
appBarTheme: const AppBarTheme(
104+
foregroundColor: Colors.white,
105+
)),
106+
routerConfig: _router,
101107
);
102108
}
103109

0 commit comments

Comments
 (0)