mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-12 00:40:28 +00:00
feat: Refactor MaterialApp initialization into a separate method for improved readability
This commit is contained in:
@@ -136,30 +136,35 @@ class _MeshCoreSarAppState extends State<MeshCoreSarApp> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: Builder(
|
child: _buildMaterialApp(),
|
||||||
builder: (context) {
|
);
|
||||||
final systemBrightness = MediaQuery.platformBrightnessOf(context);
|
}
|
||||||
return MaterialApp(
|
|
||||||
title: 'MeshCore SAR',
|
Widget _buildMaterialApp() {
|
||||||
debugShowCheckedModeBanner: false,
|
return Builder(
|
||||||
theme: AppTheme.getTheme(_themeMode, systemBrightness),
|
builder: (context) {
|
||||||
locale: _locale,
|
final systemBrightness = MediaQuery.platformBrightnessOf(context);
|
||||||
localizationsDelegates: const [
|
return MaterialApp(
|
||||||
AppLocalizations.delegate,
|
key: ValueKey<String?>('${_locale?.languageCode ?? 'system'}_${_themeMode.name}'),
|
||||||
GlobalMaterialLocalizations.delegate,
|
title: 'MeshCore SAR',
|
||||||
GlobalWidgetsLocalizations.delegate,
|
debugShowCheckedModeBanner: false,
|
||||||
GlobalCupertinoLocalizations.delegate,
|
theme: AppTheme.getTheme(_themeMode, systemBrightness),
|
||||||
],
|
locale: _locale,
|
||||||
supportedLocales: LocalePreferences.supportedLocales,
|
localizationsDelegates: const [
|
||||||
home: HomeScreen(
|
AppLocalizations.delegate,
|
||||||
onThemeChanged: _handleThemeChanged,
|
GlobalMaterialLocalizations.delegate,
|
||||||
onLocaleChanged: _handleLocaleChanged,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
currentTheme: _themeMode,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
currentLocale: _locale,
|
],
|
||||||
),
|
supportedLocales: LocalePreferences.supportedLocales,
|
||||||
);
|
home: HomeScreen(
|
||||||
},
|
onThemeChanged: _handleThemeChanged,
|
||||||
),
|
onLocaleChanged: _handleLocaleChanged,
|
||||||
|
currentTheme: _themeMode,
|
||||||
|
currentLocale: _locale,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user