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,98 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/l10n.dart';
|
||||
|
||||
import 'package:cutdex_native/cutdex_native.dart';
|
||||
|
||||
/// Windows caption buttons; native window state only rebuilds this strip.
|
||||
class WindowCaptionControls extends StatelessWidget {
|
||||
const WindowCaptionControls({
|
||||
super.key,
|
||||
required this.session,
|
||||
required this.height,
|
||||
});
|
||||
static const buttonWidth = 46.0;
|
||||
static const width = buttonWidth * 3;
|
||||
final WindowChromeSession session;
|
||||
final double height;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => ListenableBuilder(
|
||||
listenable: session,
|
||||
builder: (context, _) => Material(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
child: Row(
|
||||
children: [
|
||||
_button(
|
||||
context,
|
||||
WindowCaptionCommand.minimize,
|
||||
Icons.remove,
|
||||
context.l10n.windowMinimize,
|
||||
),
|
||||
_button(
|
||||
context,
|
||||
WindowCaptionCommand.toggleMaximize,
|
||||
session.maximized ? Icons.filter_none : Icons.crop_square,
|
||||
session.maximized
|
||||
? context.l10n.windowRestore
|
||||
: context.l10n.windowMaximize,
|
||||
role: HeaderControlRole.maximize,
|
||||
hovered: session.maximizeHovered,
|
||||
),
|
||||
_button(
|
||||
context,
|
||||
WindowCaptionCommand.close,
|
||||
Icons.close,
|
||||
MaterialLocalizations.of(context).closeButtonTooltip,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Widget _button(
|
||||
BuildContext context,
|
||||
WindowCaptionCommand command,
|
||||
IconData icon,
|
||||
String label, {
|
||||
HeaderControlRole role = HeaderControlRole.control,
|
||||
bool hovered = false,
|
||||
}) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
final close = command == WindowCaptionCommand.close;
|
||||
final key = command == WindowCaptionCommand.toggleMaximize
|
||||
? 'maximize'
|
||||
: command.name;
|
||||
return HeaderControlRegion(
|
||||
role: role,
|
||||
child: SizedBox(
|
||||
width: buttonWidth,
|
||||
height: height,
|
||||
child: IconButton(
|
||||
key: Key('window-$key'),
|
||||
tooltip: label,
|
||||
onPressed: () => unawaited(session.perform(command)),
|
||||
icon: Icon(icon, size: 16),
|
||||
style: ButtonStyle(
|
||||
padding: const WidgetStatePropertyAll(EdgeInsets.zero),
|
||||
shape: const WidgetStatePropertyAll(RoundedRectangleBorder()),
|
||||
backgroundColor: WidgetStateProperty.resolveWith(
|
||||
(states) => states.contains(WidgetState.hovered) || hovered
|
||||
? close
|
||||
? const Color(0xffc42b1c)
|
||||
: colors.onSurface.withValues(alpha: 0.08)
|
||||
: Colors.transparent,
|
||||
),
|
||||
foregroundColor: WidgetStateProperty.resolveWith(
|
||||
(states) => close && states.contains(WidgetState.hovered)
|
||||
? Colors.white
|
||||
: colors.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user