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,322 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/app_theme.dart';
|
||||
|
||||
Future<T?> showAppDialog<T>({
|
||||
required BuildContext context,
|
||||
required WidgetBuilder builder,
|
||||
}) => showDialog<T>(
|
||||
context: context,
|
||||
barrierColor: Theme.of(context).dialogTheme.barrierColor,
|
||||
animationStyle: const AnimationStyle(duration: Duration(milliseconds: 200)),
|
||||
builder: builder,
|
||||
);
|
||||
|
||||
/// A compact selectable row for dialogs that ask the user to choose an item.
|
||||
class AppDialogOption extends StatelessWidget {
|
||||
const AppDialogOption({
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.onPressed,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => InkWell(
|
||||
onTap: onPressed,
|
||||
borderRadius: BorderRadius.circular(AppRadius.large),
|
||||
child: SizedBox(
|
||||
height: 32,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppSpacing.small),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Text(label, overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Shared desktop dialog with Codex content, header and footer spacing.
|
||||
class AppDialog extends StatelessWidget {
|
||||
const AppDialog({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.child,
|
||||
this.description,
|
||||
this.header,
|
||||
this.navigation,
|
||||
this.actions = const [],
|
||||
this.width = 420,
|
||||
this.height,
|
||||
this.closeLabel,
|
||||
this.withShadow = true,
|
||||
this.editorHeader = false,
|
||||
this.contentOnly = false,
|
||||
this.showEditorTitle = true,
|
||||
this.editorHeaderHeight = AppControlSize.panelHeader,
|
||||
this.editorHeaderHorizontalPadding = AppSpacing.compact,
|
||||
this.editorContentPadding,
|
||||
this.scrollContent = true,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String? description;
|
||||
final Widget? header;
|
||||
final Widget? navigation;
|
||||
final Widget child;
|
||||
final List<Widget> actions;
|
||||
final double width;
|
||||
final double? height;
|
||||
final String? closeLabel;
|
||||
final bool withShadow;
|
||||
final bool editorHeader;
|
||||
final bool contentOnly;
|
||||
final bool showEditorTitle;
|
||||
final double editorHeaderHeight;
|
||||
final double editorHeaderHorizontalPadding;
|
||||
final EdgeInsets? editorContentPadding;
|
||||
final bool scrollContent;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final colors = theme.colorScheme;
|
||||
final dialogTheme = theme.dialogTheme;
|
||||
final shape =
|
||||
dialogTheme.shape ??
|
||||
const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(AppRadius.dialog)),
|
||||
);
|
||||
final radius = shape is RoundedRectangleBorder
|
||||
? shape.borderRadius
|
||||
: const BorderRadius.all(Radius.circular(AppRadius.dialog));
|
||||
return Theme(
|
||||
data: editorHeader || contentOnly
|
||||
? theme
|
||||
: AppTheme.dialogContentTheme(theme),
|
||||
child: Dialog(
|
||||
insetPadding: const EdgeInsets.all(AppSpacing.medium),
|
||||
backgroundColor: Colors.transparent,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
constraints: const BoxConstraints(),
|
||||
clipBehavior: Clip.none,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: radius,
|
||||
// Approximate Tailwind shadow-lg using two Flutter shadows.
|
||||
boxShadow: withShadow
|
||||
? [
|
||||
BoxShadow(
|
||||
color: colors.shadow.withValues(alpha: .1),
|
||||
offset: const Offset(0, 10),
|
||||
blurRadius: 15,
|
||||
spreadRadius: -3,
|
||||
),
|
||||
BoxShadow(
|
||||
color: colors.shadow.withValues(alpha: .1),
|
||||
offset: const Offset(0, 4),
|
||||
blurRadius: 6,
|
||||
spreadRadius: -4,
|
||||
),
|
||||
]
|
||||
: null,
|
||||
),
|
||||
child: Material(
|
||||
color: dialogTheme.backgroundColor ?? colors.surfaceContainer,
|
||||
shape: shape,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: SizedBox(
|
||||
key: const Key('app-dialog-frame'),
|
||||
width: width,
|
||||
height: height,
|
||||
child: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: contentOnly
|
||||
? EdgeInsets.zero
|
||||
: editorHeader
|
||||
? editorContentPadding ??
|
||||
EdgeInsets.fromLTRB(
|
||||
AppSpacing.medium,
|
||||
editorHeaderHeight + AppSpacing.medium,
|
||||
AppSpacing.medium,
|
||||
AppSpacing.medium,
|
||||
)
|
||||
: const EdgeInsets.all(AppSpacing.large),
|
||||
child: DefaultTextStyle(
|
||||
style:
|
||||
dialogTheme.contentTextStyle ??
|
||||
theme.textTheme.bodyMedium!,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (!editorHeader && !contentOnly)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.only(
|
||||
end:
|
||||
AppControlSize.headerButton +
|
||||
AppSpacing.gap,
|
||||
),
|
||||
child: Semantics(
|
||||
namesRoute: true,
|
||||
header: true,
|
||||
label: header != null ? title : null,
|
||||
child:
|
||||
header ??
|
||||
Text(
|
||||
title,
|
||||
style: dialogTheme.titleTextStyle,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (description != null) ...[
|
||||
const SizedBox(height: AppSpacing.tiny),
|
||||
Text(
|
||||
description!,
|
||||
style: dialogTheme.contentTextStyle?.copyWith(
|
||||
color: colors.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
if (navigation != null) ...[
|
||||
const SizedBox(height: AppSpacing.medium),
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: navigation,
|
||||
),
|
||||
],
|
||||
if (!editorHeader && !contentOnly)
|
||||
const SizedBox(height: AppSpacing.compact),
|
||||
Flexible(
|
||||
fit: height == null ? FlexFit.loose : FlexFit.tight,
|
||||
child: scrollContent
|
||||
? SingleChildScrollView(child: child)
|
||||
: child,
|
||||
),
|
||||
if (actions.isNotEmpty) ...[
|
||||
const SizedBox(height: AppSpacing.compact),
|
||||
Builder(
|
||||
builder: (context) => Theme(
|
||||
data: AppTheme.dialogActionTheme(
|
||||
Theme.of(context),
|
||||
),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.end,
|
||||
spacing: AppSpacing.compact,
|
||||
runSpacing: AppSpacing.small,
|
||||
children: actions,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (editorHeader && !contentOnly) ...[
|
||||
PositionedDirectional(
|
||||
top: 0,
|
||||
start: 0,
|
||||
end: 0,
|
||||
height: editorHeaderHeight,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.only(
|
||||
start: editorHeaderHorizontalPadding,
|
||||
end:
|
||||
editorHeaderHorizontalPadding +
|
||||
AppControlSize.headerButton +
|
||||
AppSpacing.tiny,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (showEditorTitle)
|
||||
Semantics(
|
||||
namesRoute: true,
|
||||
header: true,
|
||||
child: Text(
|
||||
title,
|
||||
key: const Key('app-dialog-header-title'),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: theme.textTheme.titleSmall,
|
||||
),
|
||||
),
|
||||
if (header != null) ...[
|
||||
if (showEditorTitle)
|
||||
const SizedBox(width: AppSpacing.compact),
|
||||
Flexible(
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: KeyedSubtree(
|
||||
key: const Key('app-dialog-header-content'),
|
||||
child: header!,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
PositionedDirectional(
|
||||
top: editorHeaderHeight - 1,
|
||||
start: 0,
|
||||
end: 0,
|
||||
child: const Divider(
|
||||
key: Key('app-dialog-header-divider'),
|
||||
height: 1,
|
||||
),
|
||||
),
|
||||
],
|
||||
PositionedDirectional(
|
||||
top: editorHeader
|
||||
? (editorHeaderHeight - AppControlSize.headerButton) / 2
|
||||
: AppSpacing.medium,
|
||||
end: editorHeader
|
||||
? editorHeaderHorizontalPadding
|
||||
: AppSpacing.medium,
|
||||
child: SizedBox.square(
|
||||
dimension: editorHeader
|
||||
? AppControlSize.headerButton
|
||||
: 24,
|
||||
child: IconButton(
|
||||
key: const Key('app-dialog-close-button'),
|
||||
tooltip:
|
||||
closeLabel ??
|
||||
MaterialLocalizations.of(context)
|
||||
.closeButtonTooltip,
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
style: IconButton.styleFrom(
|
||||
foregroundColor: colors.onSurface.withValues(
|
||||
alpha: .7,
|
||||
),
|
||||
minimumSize: Size.square(
|
||||
editorHeader ? AppControlSize.headerButton : 24,
|
||||
),
|
||||
padding: const EdgeInsets.all(AppSpacing.tiny),
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppRadius.large,
|
||||
),
|
||||
),
|
||||
),
|
||||
icon: const Icon(Icons.close, size: AppIconSize.header),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user