feat: initial Cutdex application
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.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,57 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'bounds_reporter.dart';
|
||||
import 'window_chrome_session.dart';
|
||||
|
||||
export 'window_chrome_session.dart' show HeaderControlRole;
|
||||
|
||||
/// Reports actual Flutter control bounds so native windows drag empty header space.
|
||||
class HeaderControlRegion extends StatefulWidget {
|
||||
const HeaderControlRegion({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.role = HeaderControlRole.control,
|
||||
});
|
||||
final Widget child;
|
||||
final HeaderControlRole role;
|
||||
@override
|
||||
State<HeaderControlRegion> createState() => _HeaderControlRegionState();
|
||||
}
|
||||
|
||||
class _HeaderControlRegionState extends State<HeaderControlRegion> {
|
||||
static int _nextId = 0;
|
||||
late final _id = 'control-${_nextId++}';
|
||||
Rect? _lastRect;
|
||||
Future<void> _send(Rect? rect) =>
|
||||
WindowChromeSession.reportControl(_id, rect, widget.role);
|
||||
|
||||
void _report(Rect rect) {
|
||||
if (!mounted || !WindowChromeSession.supported) return;
|
||||
final next = TickerMode.valuesOf(context).enabled ? rect : null;
|
||||
if (next == _lastRect) return;
|
||||
_lastRect = next;
|
||||
unawaited(_send(next));
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant HeaderControlRegion oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.role != widget.role && _lastRect != null) {
|
||||
unawaited(_send(_lastRect));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (_lastRect != null) unawaited(_send(null));
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
TickerMode.valuesOf(context);
|
||||
return NativeBoundsReporter(onBounds: _report, child: widget.child);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user