Skip to content

Commit

Permalink
Added two more Picking States
Browse files Browse the repository at this point in the history
  • Loading branch information
TechnicJelle committed Oct 28, 2024
1 parent 7cb2198 commit 17625d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/main_menu/projects/project_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ enum _PickingState {
hashing,
wrongHash,
running,
mapping,
opening,
}

class _PickingStateNotifier extends Notifier<_PickingState> {
Expand Down Expand Up @@ -289,6 +291,7 @@ class _PathPickerButtonState extends ConsumerState<ProjectTile> {
}

// == Turn default maps directory into templates directory ==
ref.read(_pickingStateProvider.notifier).set(_PickingState.mapping);
final templatesDir =
Directory(p.join(projectDirectory.path, "config", "map-templates"));
//Make sure to support opening existing projects; only do this on fresh projects
Expand All @@ -299,6 +302,8 @@ class _PathPickerButtonState extends ConsumerState<ProjectTile> {
mapsDir.createSync(); //recreate maps dir (now empty)
}

// == Open project ==
ref.read(_pickingStateProvider.notifier).set(_PickingState.opening);
ref.read(openProjectProvider.notifier).openProject(projectDirectory);
}
}

0 comments on commit 17625d3

Please sign in to comment.