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

Commit 9392670

Browse files
committed
feat: In app splash screen
Not an native splash screen, but at least the screen is not black until the app is ready.
1 parent 093136a commit 9392670

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
@@ -79,23 +79,29 @@ class _TenTenOneState extends State<TenTenOneApp> {
7979
Widget build(BuildContext context) {
8080
const mainColor = Colors.blue;
8181

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

0 commit comments

Comments
 (0)