import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; enum EditorTool { media, properties } final editorPresentationProvider = Provider.family((ref, projectId) { final controller = EditorPresentationController(); ref.onDispose(controller.dispose); return controller; }); /// Presentation choices survive shell changes without changing project data. class EditorPresentationController extends ChangeNotifier { bool _mediaOpen = false; EditorTool? _activeTool; EditorTool _preferredDesktopTool = EditorTool.properties; bool get mediaOpen => _mediaOpen; EditorTool? get activeTool => _activeTool; EditorTool desktopTool({required bool propertiesOpen}) => _preferredDesktopTool == EditorTool.media && _mediaOpen ? EditorTool.media : propertiesOpen ? EditorTool.properties : EditorTool.media; void preferDesktopTool(EditorTool tool) { _preferredDesktopTool = tool; notifyListeners(); } void toggleMedia() { _mediaOpen = !_mediaOpen; if (_mediaOpen) _preferredDesktopTool = EditorTool.media; notifyListeners(); } void toggleTool(EditorTool tool) { _activeTool = _activeTool == tool ? null : tool; notifyListeners(); } void closeTool() { _activeTool = null; notifyListeners(); } }