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,130 @@
|
||||
import 'package:cutdex/l10n/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:cutdex_ui/theme.dart';
|
||||
import 'package:cutdex_ui/widgets.dart';
|
||||
|
||||
|
||||
/// Shared layout for downloading a processing resource before a task starts.
|
||||
class ProcessingResourceDownloadDialog extends StatelessWidget {
|
||||
const ProcessingResourceDownloadDialog({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.resourceName,
|
||||
required this.downloadSize,
|
||||
required this.downloading,
|
||||
required this.paused,
|
||||
required this.downloadedBytes,
|
||||
required this.totalBytes,
|
||||
required this.bytesPerSecond,
|
||||
required this.onCancel,
|
||||
required this.onDownload,
|
||||
required this.onTogglePause,
|
||||
required this.onBackground,
|
||||
this.error,
|
||||
this.downloadButtonKey,
|
||||
this.pauseButtonKey,
|
||||
this.backgroundButtonKey,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String description;
|
||||
final String resourceName;
|
||||
final String downloadSize;
|
||||
final bool downloading;
|
||||
final bool paused;
|
||||
final int downloadedBytes;
|
||||
final int totalBytes;
|
||||
final int bytesPerSecond;
|
||||
final VoidCallback onCancel;
|
||||
final VoidCallback onDownload;
|
||||
final VoidCallback onTogglePause;
|
||||
final VoidCallback onBackground;
|
||||
final String? error;
|
||||
final Key? downloadButtonKey;
|
||||
final Key? pauseButtonKey;
|
||||
final Key? backgroundButtonKey;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final percentage = totalBytes <= 0
|
||||
? 0
|
||||
: (downloadedBytes * 100 / totalBytes).floor().clamp(0, 100);
|
||||
return AppDialog(
|
||||
title: title,
|
||||
description: description,
|
||||
width: 440,
|
||||
closeLabel: downloading ? context.l10n.downloadInBackground : null,
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: onCancel,
|
||||
child: Text(
|
||||
downloading ? context.l10n.cancelDownload : context.l10n.cancel,
|
||||
),
|
||||
),
|
||||
if (downloading)
|
||||
TextButton(
|
||||
key: pauseButtonKey,
|
||||
onPressed: onTogglePause,
|
||||
child: Text(
|
||||
paused ? context.l10n.resumeDownload : context.l10n.pauseDownload,
|
||||
),
|
||||
),
|
||||
FilledButton(
|
||||
key: downloading ? backgroundButtonKey : downloadButtonKey,
|
||||
onPressed: downloading ? onBackground : onDownload,
|
||||
child: Text(
|
||||
downloading
|
||||
? context.l10n.downloadInBackground
|
||||
: context.l10n.downloadModelAction,
|
||||
),
|
||||
),
|
||||
],
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
if (!downloading) Text(downloadSize),
|
||||
if (downloading) ...[
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
resourceName,
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
paused ? context.l10n.downloadPaused : '$percentage%',
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: theme.colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: AppSpacing.small),
|
||||
ResourceDownloadProgress(
|
||||
downloadedBytes: downloadedBytes,
|
||||
totalBytes: totalBytes,
|
||||
bytesPerSecond: bytesPerSecond,
|
||||
status: '',
|
||||
paused: paused,
|
||||
),
|
||||
],
|
||||
if (error != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: AppSpacing.compact),
|
||||
child: Text(
|
||||
error!,
|
||||
style: TextStyle(color: theme.colorScheme.error),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user