feat: replace layer toggle with layer selector menu

- Replace ToggleMapLayerAction with SelectMapLayerAction that takes a specific layer
- Update fireMapReducer to handle SelectMapLayerAction instead of toggling
- Use PopupMenuButton with GlobalKey to open menu on button tap
- Show check icon and bold text for currently selected layer
- Menu items display layer names: OSMC Grey, OSMC, Esri Street, Esri Satellite, Esri Terrain
- Selecting a layer immediately updates Redux state and closes the menu
This commit is contained in:
vjrj 2026-03-06 08:33:52 +01:00
parent 498f2ca7d6
commit 14b558340d
3 changed files with 66 additions and 18 deletions

View file

@ -21,7 +21,7 @@ final fireMapReducer = combineReducers<FireMapState>([
_editConfirmYourLocationMap),
new TypedReducer<FireMapState, EditCancelYourLocationAction>(
_editCancelYourLocationMap),
new TypedReducer<FireMapState, ToggleMapLayerAction>(_toggleMapLayer),
new TypedReducer<FireMapState, SelectMapLayerAction>(_selectMapLayer),
new TypedReducer<FireMapState, UpdateYourLocationMapAction>(
_updateYourLocationMap)
]);
@ -99,12 +99,6 @@ FireMapState _editCancelYourLocationMap(
FireMapStatus restoreStatusAfterSave(loc) =>
loc.subscribed ? FireMapStatus.unsubscribe : FireMapStatus.view;
FireMapState _toggleMapLayer(FireMapState state, ToggleMapLayerAction action) {
FireMapLayer currentLayer = state.layer;
List<FireMapLayer> list = FireMapLayer.values;
int currentPos = list.indexOf(currentLayer);
currentPos++;
FireMapLayer next =
list.elementAt(currentPos >= list.length ? 0 : currentPos);
return state.copyWith(layer: next);
FireMapState _selectMapLayer(FireMapState state, SelectMapLayerAction action) {
return state.copyWith(layer: action.layer);
}