feat: Refactor MaterialApp initialization into a separate method for improved readability

This commit is contained in:
Janez T
2025-10-16 14:57:11 +02:00
parent 3a8eac2ec2
commit 9def8daf0c

View File

@@ -136,10 +136,16 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
), ),
), ),
], ],
child: Builder( child: _buildMaterialApp(),
);
}
Widget _buildMaterialApp() {
return Builder(
builder: (context) { builder: (context) {
final systemBrightness = MediaQuery.platformBrightnessOf(context); final systemBrightness = MediaQuery.platformBrightnessOf(context);
return MaterialApp( return MaterialApp(
key: ValueKey<String?>('${_locale?.languageCode ?? 'system'}_${_themeMode.name}'),
title: 'MeshCore SAR', title: 'MeshCore SAR',
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
theme: AppTheme.getTheme(_themeMode, systemBrightness), theme: AppTheme.getTheme(_themeMode, systemBrightness),
@@ -159,7 +165,6 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
), ),
); );
}, },
),
); );
} }
} }