update
This commit is contained in:
1 parent
212410f716
commit
1ecbd7b6b1
34 files changed
+107
-155
No files matched your search
+20
-20
@@ -19,7 +19,7 @@ class MobileApp extends StatefulWidget {
|
||||
class _MobileAppState extends State<MobileApp> {
|
||||
late final ThemeController _themeController;
|
||||
late final MatchResultsViewModel _matchResultsViewModel;
|
||||
int _currentTabIndex = 0;
|
||||
bool _showSettings = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -51,25 +51,30 @@ class _MobileAppState extends State<MobileApp> {
|
||||
themeMode: _themeController.themeMode,
|
||||
home: Builder(
|
||||
builder: (context) {
|
||||
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
||||
|
||||
return ResponsiveScaffold(
|
||||
selectedIndex: _currentTabIndex,
|
||||
selectedIndex: 0,
|
||||
onDestinationSelected: (index) {
|
||||
setState(() => _currentTabIndex = index);
|
||||
if (index == 0) {
|
||||
setState(() => _showSettings = false);
|
||||
}
|
||||
},
|
||||
appBarTitle: Text(
|
||||
_currentTabIndex == 0 ? 'Match Results' : 'Settings',
|
||||
_showSettings ? 'Settings' : 'Match Results',
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
isDarkMode ? Icons.light_mode : Icons.dark_mode,
|
||||
if (_showSettings)
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back_rounded),
|
||||
tooltip: 'Back to results',
|
||||
onPressed: () => setState(() => _showSettings = false),
|
||||
)
|
||||
else
|
||||
IconButton(
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
tooltip: 'Settings',
|
||||
onPressed: () => setState(() => _showSettings = true),
|
||||
),
|
||||
tooltip: isDarkMode ? 'Switch to light mode' : 'Switch to dark mode',
|
||||
onPressed: _themeController.toggleTheme,
|
||||
),
|
||||
],
|
||||
destinations: const [
|
||||
NavigationDestinationItem(
|
||||
@@ -77,15 +82,10 @@ class _MobileAppState extends State<MobileApp> {
|
||||
selectedIcon: Icon(Icons.sports_hockey),
|
||||
label: 'Results',
|
||||
),
|
||||
NavigationDestinationItem(
|
||||
icon: Icon(Icons.settings_outlined),
|
||||
selectedIcon: Icon(Icons.settings),
|
||||
label: 'Settings',
|
||||
),
|
||||
],
|
||||
body: _currentTabIndex == 0
|
||||
? MatchResultsView(viewModel: _matchResultsViewModel)
|
||||
: SettingsView(themeController: _themeController),
|
||||
body: _showSettings
|
||||
? SettingsView(themeController: _themeController)
|
||||
: MatchResultsView(viewModel: _matchResultsViewModel),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user