From df7834a5167408fea9b9ebbd26ee45829d94981f Mon Sep 17 00:00:00 2001 From: TechnicJelle <22576047+TechnicJelle@users.noreply.github.com> Date: Sun, 8 Sep 2024 04:51:08 +0200 Subject: [PATCH] Redid most of the file structure --- lib/main.dart | 8 ++++---- lib/{ => main_menu}/java/java_picker.dart | 2 +- .../java/radio_list_tile_custom_java_picker.dart | 0 .../java/radio_list_tile_system_java_picker.dart | 2 +- .../java/util_for_checking_java_path_version.dart | 0 lib/{onboarding.dart => main_menu/main_menu.dart} | 6 +++--- lib/{ => main_menu}/path_picker_button.dart | 4 ++-- lib/{ => project_view}/close_project_button.dart | 4 ++-- lib/{ => project_view}/config_editor.dart | 4 ++-- lib/{ => project_view}/console.dart | 4 ++-- lib/{ => project_view}/control_panel.dart | 0 lib/{ => project_view}/control_row.dart | 4 ++-- lib/{ => project_view}/new_map_dialog.dart | 6 +++--- .../project_view.dart} | 8 ++++---- lib/{ => project_view/sidebar}/config_tile.dart | 4 ++-- lib/{ => project_view/sidebar}/map_tile.dart | 10 +++++----- lib/{ => project_view/sidebar}/new_map_button.dart | 2 +- .../sidebar/sidebar.dart} | 12 ++++++------ 18 files changed, 40 insertions(+), 40 deletions(-) rename lib/{ => main_menu}/java/java_picker.dart (98%) rename lib/{ => main_menu}/java/radio_list_tile_custom_java_picker.dart (100%) rename lib/{ => main_menu}/java/radio_list_tile_system_java_picker.dart (98%) rename lib/{ => main_menu}/java/util_for_checking_java_path_version.dart (100%) rename lib/{onboarding.dart => main_menu/main_menu.dart} (92%) rename lib/{ => main_menu}/path_picker_button.dart (99%) rename lib/{ => project_view}/close_project_button.dart (92%) rename lib/{ => project_view}/config_editor.dart (98%) rename lib/{ => project_view}/console.dart (99%) rename lib/{ => project_view}/control_panel.dart (100%) rename lib/{ => project_view}/control_row.dart (99%) rename lib/{ => project_view}/new_map_dialog.dart (98%) rename lib/{dual_pane.dart => project_view/project_view.dart} (86%) rename lib/{ => project_view/sidebar}/config_tile.dart (93%) rename lib/{ => project_view/sidebar}/map_tile.dart (96%) rename lib/{ => project_view/sidebar}/new_map_button.dart (97%) rename lib/{config_tree.dart => project_view/sidebar/sidebar.dart} (96%) diff --git a/lib/main.dart b/lib/main.dart index 56f9805..e22ac38 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,10 +3,10 @@ import "dart:io"; import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; -import "close_project_button.dart"; -import "dual_pane.dart"; -import "onboarding.dart"; +import "main_menu/main_menu.dart"; import "prefs.dart"; +import "project_view/close_project_button.dart"; +import "project_view/project_view.dart"; import "tech_app.dart"; // == Hardcoded BlueMap CLI JAR download URL and hash == @@ -60,7 +60,7 @@ class MyHomePage extends ConsumerWidget { if (projectDirectory != null) const CloseProjectButton(), ], ), - body: projectDirectory == null ? const Onboarding() : const DualPane(), + body: projectDirectory == null ? const MainMenu() : const ProjectView(), ); } } diff --git a/lib/java/java_picker.dart b/lib/main_menu/java/java_picker.dart similarity index 98% rename from lib/java/java_picker.dart rename to lib/main_menu/java/java_picker.dart index 664f35e..6583a2a 100644 --- a/lib/java/java_picker.dart +++ b/lib/main_menu/java/java_picker.dart @@ -1,7 +1,7 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; -import "../prefs.dart"; +import "../../prefs.dart"; import "radio_list_tile_custom_java_picker.dart"; import "radio_list_tile_system_java_picker.dart"; diff --git a/lib/java/radio_list_tile_custom_java_picker.dart b/lib/main_menu/java/radio_list_tile_custom_java_picker.dart similarity index 100% rename from lib/java/radio_list_tile_custom_java_picker.dart rename to lib/main_menu/java/radio_list_tile_custom_java_picker.dart diff --git a/lib/java/radio_list_tile_system_java_picker.dart b/lib/main_menu/java/radio_list_tile_system_java_picker.dart similarity index 98% rename from lib/java/radio_list_tile_system_java_picker.dart rename to lib/main_menu/java/radio_list_tile_system_java_picker.dart index 3f9b011..eb95f81 100644 --- a/lib/java/radio_list_tile_system_java_picker.dart +++ b/lib/main_menu/java/radio_list_tile_system_java_picker.dart @@ -1,7 +1,7 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; -import "../utils.dart"; +import "../../utils.dart"; import "java_picker.dart"; import "util_for_checking_java_path_version.dart"; diff --git a/lib/java/util_for_checking_java_path_version.dart b/lib/main_menu/java/util_for_checking_java_path_version.dart similarity index 100% rename from lib/java/util_for_checking_java_path_version.dart rename to lib/main_menu/java/util_for_checking_java_path_version.dart diff --git a/lib/onboarding.dart b/lib/main_menu/main_menu.dart similarity index 92% rename from lib/onboarding.dart rename to lib/main_menu/main_menu.dart index f953441..578e5bc 100644 --- a/lib/onboarding.dart +++ b/lib/main_menu/main_menu.dart @@ -1,12 +1,12 @@ 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 "prefs.dart"; -class Onboarding extends ConsumerWidget { - const Onboarding({super.key}); +class MainMenu extends ConsumerWidget { + const MainMenu({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { diff --git a/lib/path_picker_button.dart b/lib/main_menu/path_picker_button.dart similarity index 99% rename from lib/path_picker_button.dart rename to lib/main_menu/path_picker_button.dart index 2ff1e22..8945a5b 100644 --- a/lib/path_picker_button.dart +++ b/lib/main_menu/path_picker_button.dart @@ -8,8 +8,8 @@ import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:path/path.dart" as p; import "package:url_launcher/url_launcher_string.dart"; -import "main.dart"; -import "prefs.dart"; +import "../main.dart"; +import "../prefs.dart"; enum _PickingState { nothing, diff --git a/lib/close_project_button.dart b/lib/project_view/close_project_button.dart similarity index 92% rename from lib/close_project_button.dart rename to lib/project_view/close_project_button.dart index 2d53462..3c5e892 100644 --- a/lib/close_project_button.dart +++ b/lib/project_view/close_project_button.dart @@ -1,8 +1,8 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; -import "confirmation_dialog.dart"; -import "prefs.dart"; +import "../confirmation_dialog.dart"; +import "../prefs.dart"; class CloseProjectButton extends ConsumerWidget { const CloseProjectButton({super.key}); diff --git a/lib/config_editor.dart b/lib/project_view/config_editor.dart similarity index 98% rename from lib/config_editor.dart rename to lib/project_view/config_editor.dart index 31848e7..0f78813 100644 --- a/lib/config_editor.dart +++ b/lib/project_view/config_editor.dart @@ -7,8 +7,8 @@ import "package:re_editor/re_editor.dart"; import "package:re_highlight/languages/yaml.dart" show langYaml; import "package:re_highlight/styles/ir-black.dart" show irBlackTheme; -import "dual_pane.dart"; -import "utils.dart"; +import "../utils.dart"; +import "project_view.dart"; class ConfigEditor extends ConsumerStatefulWidget { final File openConfig; diff --git a/lib/console.dart b/lib/project_view/console.dart similarity index 99% rename from lib/console.dart rename to lib/project_view/console.dart index 7edaf4c..a24d49a 100644 --- a/lib/console.dart +++ b/lib/project_view/console.dart @@ -2,9 +2,9 @@ import "package:animated_visibility/animated_visibility.dart"; import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; +import "../prefs.dart"; +import "../utils.dart"; import "control_row.dart"; -import "prefs.dart"; -import "utils.dart"; class OutputNotifier extends Notifier> { @override diff --git a/lib/control_panel.dart b/lib/project_view/control_panel.dart similarity index 100% rename from lib/control_panel.dart rename to lib/project_view/control_panel.dart diff --git a/lib/control_row.dart b/lib/project_view/control_row.dart similarity index 99% rename from lib/control_row.dart rename to lib/project_view/control_row.dart index a1def5e..eb16e30 100644 --- a/lib/control_row.dart +++ b/lib/project_view/control_row.dart @@ -10,8 +10,8 @@ import "package:path/path.dart" as p; import "package:rxdart/rxdart.dart"; import "package:url_launcher/url_launcher.dart"; -import "main.dart"; -import "prefs.dart"; +import "../main.dart"; +import "../prefs.dart"; final portExtractionRegex = RegExp(r"(?:port\s*|:)(\d{4,5})$"); diff --git a/lib/new_map_dialog.dart b/lib/project_view/new_map_dialog.dart similarity index 98% rename from lib/new_map_dialog.dart rename to lib/project_view/new_map_dialog.dart index 2b4e5dc..9379b1f 100644 --- a/lib/new_map_dialog.dart +++ b/lib/project_view/new_map_dialog.dart @@ -4,9 +4,9 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:path/path.dart" as p; -import "dual_pane.dart"; -import "prefs.dart"; -import "utils.dart"; +import "../prefs.dart"; +import "../utils.dart"; +import "project_view.dart"; final RegExp regexIDValidation = RegExp(r"^[a-zA-Z0-9_-]+$"); diff --git a/lib/dual_pane.dart b/lib/project_view/project_view.dart similarity index 86% rename from lib/dual_pane.dart rename to lib/project_view/project_view.dart index fc2cf03..61491d9 100644 --- a/lib/dual_pane.dart +++ b/lib/project_view/project_view.dart @@ -4,8 +4,8 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; import "config_editor.dart"; -import "config_tree.dart"; import "control_panel.dart"; +import "sidebar/sidebar.dart"; class OpenFileNotifier extends Notifier { @override @@ -25,8 +25,8 @@ class OpenFileNotifier extends Notifier { final openConfigProvider = NotifierProvider(() => OpenFileNotifier()); -class DualPane extends ConsumerWidget { - const DualPane({super.key}); +class ProjectView extends ConsumerWidget { + const ProjectView({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { @@ -37,7 +37,7 @@ class DualPane extends ConsumerWidget { children: [ Container( constraints: const BoxConstraints(maxWidth: 200), - child: const ConfigTree(), + child: const Sidebar(), ), Expanded( child: openConfig == null ? const ControlPanel() : ConfigEditor(openConfig), diff --git a/lib/config_tile.dart b/lib/project_view/sidebar/config_tile.dart similarity index 93% rename from lib/config_tile.dart rename to lib/project_view/sidebar/config_tile.dart index 24f4603..3ba2323 100644 --- a/lib/config_tile.dart +++ b/lib/project_view/sidebar/config_tile.dart @@ -4,8 +4,8 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:path/path.dart" as p; -import "dual_pane.dart"; -import "utils.dart"; +import "../../utils.dart"; +import "../project_view.dart"; class ConfigTile extends ConsumerWidget { final File configFile; diff --git a/lib/map_tile.dart b/lib/project_view/sidebar/map_tile.dart similarity index 96% rename from lib/map_tile.dart rename to lib/project_view/sidebar/map_tile.dart index 07d283e..681c1e5 100644 --- a/lib/map_tile.dart +++ b/lib/project_view/sidebar/map_tile.dart @@ -4,11 +4,11 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:path/path.dart" as p; -import "confirmation_dialog.dart"; -import "delete_icon.dart"; -import "dual_pane.dart"; -import "prefs.dart"; -import "utils.dart"; +import "../../confirmation_dialog.dart"; +import "../../delete_icon.dart"; +import "../../prefs.dart"; +import "../../utils.dart"; +import "../project_view.dart"; class MapTile extends ConsumerStatefulWidget { final File configFile; diff --git a/lib/new_map_button.dart b/lib/project_view/sidebar/new_map_button.dart similarity index 97% rename from lib/new_map_button.dart rename to lib/project_view/sidebar/new_map_button.dart index 31862a4..34663b1 100644 --- a/lib/new_map_button.dart +++ b/lib/project_view/sidebar/new_map_button.dart @@ -1,7 +1,7 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; -import "new_map_dialog.dart"; +import "../new_map_dialog.dart"; class NewMapButton extends ConsumerWidget { const NewMapButton({super.key}); diff --git a/lib/config_tree.dart b/lib/project_view/sidebar/sidebar.dart similarity index 96% rename from lib/config_tree.dart rename to lib/project_view/sidebar/sidebar.dart index 4477e0b..8e44fe7 100644 --- a/lib/config_tree.dart +++ b/lib/project_view/sidebar/sidebar.dart @@ -5,11 +5,11 @@ import "package:flutter/material.dart"; import "package:flutter_riverpod/flutter_riverpod.dart"; import "package:path/path.dart" as p; +import "../../prefs.dart"; +import "../project_view.dart"; import "config_tile.dart"; -import "dual_pane.dart"; import "map_tile.dart"; import "new_map_button.dart"; -import "prefs.dart"; ///Group 1: Is commented? ///Group 2: Actual sorting value @@ -18,14 +18,14 @@ final RegExp sortingRegex = RegExp( multiLine: true, ); -class ConfigTree extends ConsumerStatefulWidget { - const ConfigTree({super.key}); +class Sidebar extends ConsumerStatefulWidget { + const Sidebar({super.key}); @override - ConsumerState createState() => _ConfigTreeState(); + ConsumerState createState() => _ConfigTreeState(); } -class _ConfigTreeState extends ConsumerState { +class _ConfigTreeState extends ConsumerState { final List configs = []; final List storages = []; final List maps = [];