-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split main menu into two screens (projects&settings)
- Loading branch information
1 parent
4b5af29
commit 4325f5e
Showing
7 changed files
with
96 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,53 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:flutter_riverpod/flutter_riverpod.dart"; | ||
|
||
import "../prefs.dart"; | ||
import "java/java_picker.dart"; | ||
import "path_picker_button.dart"; | ||
import "settings/projects_screen.dart"; | ||
import "settings/settings_screen.dart"; | ||
|
||
class MainMenu extends ConsumerWidget { | ||
enum MainMenuState { | ||
projects, | ||
settings, | ||
} | ||
|
||
class MainMenu extends ConsumerStatefulWidget { | ||
const MainMenu({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
return Center( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
const JavaPicker(), | ||
if (ref.watch(javaPathProvider.select((path) => path != null))) ...[ | ||
ConstrainedBox( | ||
constraints: const BoxConstraints(maxWidth: 600), | ||
child: const Divider(), | ||
), | ||
const Text("Select an empty folder to store your BlueMap files in:"), | ||
const SizedBox(height: 8), | ||
const PathPickerButton(), | ||
const SizedBox(height: 8), | ||
const Text("The BlueMap CLI tool will be downloaded into that folder."), | ||
const SizedBox(height: 4), | ||
const Text("It will generate some default config files for you."), | ||
const SizedBox(height: 4), | ||
const Text("You will then need to configure your maps in the BlueMap GUI."), | ||
], | ||
], | ||
), | ||
ConsumerState<MainMenu> createState() => _MainMenuState(); | ||
} | ||
|
||
class _MainMenuState extends ConsumerState<MainMenu> { | ||
MainMenuState state = MainMenuState.projects; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Row( | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
Container( | ||
constraints: const BoxConstraints(maxWidth: 200), | ||
child: ListView( | ||
children: [ | ||
ListTile( | ||
title: const Text("Projects"), | ||
selected: state == MainMenuState.projects, | ||
onTap: () => setState(() => state = MainMenuState.projects), | ||
), | ||
ListTile( | ||
title: const Text("Settings"), | ||
selected: state == MainMenuState.settings, | ||
onTap: () => setState(() => state = MainMenuState.settings), | ||
), | ||
], | ||
), | ||
), | ||
Expanded( | ||
child: switch (state) { | ||
MainMenuState.projects => const ProjectsScreen(), | ||
MainMenuState.settings => const SettingsScreen(), | ||
}, | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...a/radio_list_tile_system_java_picker.dart → ...a/radio_list_tile_system_java_picker.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:flutter_riverpod/flutter_riverpod.dart"; | ||
|
||
import "../../prefs.dart"; | ||
import "../path_picker_button.dart"; | ||
|
||
class ProjectsScreen extends ConsumerWidget { | ||
const ProjectsScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
if (ref.watch(javaPathProvider.select((path) => path == null))) { | ||
return const Center( | ||
child: Text("⬅ Please select your Java in the settings"), | ||
); | ||
} | ||
|
||
return const Center( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Text("Select an empty folder to store your BlueMap files in:"), | ||
SizedBox(height: 8), | ||
PathPickerButton(), | ||
SizedBox(height: 8), | ||
Text("The BlueMap CLI tool will be downloaded into that folder."), | ||
SizedBox(height: 4), | ||
Text("It will generate some default config files for you."), | ||
SizedBox(height: 4), | ||
Text("You will then need to configure your maps in the BlueMap GUI."), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import "package:flutter/material.dart"; | ||
|
||
import "java/java_picker.dart"; | ||
|
||
class SettingsScreen extends StatelessWidget { | ||
const SettingsScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ListView(children: const [ | ||
Text("Java Executable"), //TODO: Add link to download Java | ||
SizedBox(height: 4), | ||
JavaPicker(), | ||
]); | ||
} | ||
} |