Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
49 lines
1.4 KiB
Dart
49 lines
1.4 KiB
Dart
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
enum EditorTool { media, properties }
|
|
|
|
final editorPresentationProvider =
|
|
Provider.family<EditorPresentationController, String>((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();
|
|
}
|
|
}
|