summaryrefslogtreecommitdiff
path: root/player-android/lib/main.dart
diff options
context:
space:
mode:
Diffstat (limited to 'player-android/lib/main.dart')
-rw-r--r--player-android/lib/main.dart14
1 files changed, 12 insertions, 2 deletions
diff --git a/player-android/lib/main.dart b/player-android/lib/main.dart
index 2c1b193..3358383 100644
--- a/player-android/lib/main.dart
+++ b/player-android/lib/main.dart
@@ -64,6 +64,16 @@ void main() async {
}
// ---------------------------------------------------------------------------
+// Module-level theme constants
+// ---------------------------------------------------------------------------
+
+// Built once at startup rather than on every rebuild of PlayerAndroidApp.
+// ThemeData construction is not cheap, and the colour tokens never change
+// at runtime — only the active ThemeMode (light/dark/system) does.
+final _lightTheme = buildLightTheme();
+final _darkTheme = buildDarkTheme();
+
+// ---------------------------------------------------------------------------
// Root widget
// ---------------------------------------------------------------------------
@@ -92,8 +102,8 @@ class PlayerAndroidApp extends ConsumerWidget {
title: 'Player',
routerConfig: router,
// Material 3 is enabled in both ThemeData instances; see theme_provider.dart.
- theme: buildLightTheme(),
- darkTheme: buildDarkTheme(),
+ theme: _lightTheme,
+ darkTheme: _darkTheme,
themeMode: themeMode,
);
}