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.
117 lines
3.8 KiB
Dart
117 lines
3.8 KiB
Dart
import 'package:cutdex/l10n/l10n.dart';
|
||
import 'package:cutdex_sdk/runtime/contracts.dart';
|
||
import 'package:cutdex_sdk/timeline/model.dart';
|
||
import 'package:flutter/material.dart';
|
||
|
||
import 'package:cutdex_ui/theme.dart';
|
||
import 'package:cutdex_ui/widgets.dart';
|
||
|
||
import '../../workspace/timeline_session.dart';
|
||
import 'canvas_presets.dart';
|
||
import 'project_settings_dialog.dart';
|
||
|
||
/// Project information uses the live editing session, including unsaved edits.
|
||
class ProjectProperties extends StatelessWidget {
|
||
const ProjectProperties({super.key, required this.session});
|
||
|
||
final EditorTimelineSession session;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
final sequence = session.activeSequenceId;
|
||
final timeline = sequence == null
|
||
? null
|
||
: session.persistence.timeline(sequence);
|
||
final duration = sequence == null
|
||
? 0
|
||
: session.sequenceDurationTicks(sequence);
|
||
final frame = timeline?.format.frameDuration;
|
||
final fps = frame == null ? null : frame.denominator / frame.numerator;
|
||
final canvas = session.canvas;
|
||
String number(double value) => value == value.roundToDouble()
|
||
? value.toStringAsFixed(0)
|
||
: value.toStringAsFixed(3).replaceFirst(RegExp(r'0+$'), '');
|
||
|
||
return WorkspacePanel(
|
||
paintBackground: false,
|
||
title: context.l10n.projectProperties,
|
||
trailing: TextButton(
|
||
key: const ValueKey('project-settings-edit'),
|
||
onPressed: () => showAppDialog<void>(
|
||
context: context,
|
||
builder: (_) => ProjectSettingsDialog(session: session),
|
||
),
|
||
child: Text(context.l10n.modify),
|
||
),
|
||
headerHeight: AppControlSize.panelToolbar,
|
||
headerPadding: const EdgeInsets.symmetric(
|
||
horizontal: AppSpacing.panelContentHorizontal,
|
||
),
|
||
showHeaderDivider: false,
|
||
child: ScrollEdgeFadeBuilder(
|
||
builder: (controller) => SingleChildScrollView(
|
||
controller: controller,
|
||
physics: const ClampingScrollPhysics(),
|
||
child: Column(
|
||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||
children: [
|
||
_Info(context.l10n.timelineName, session.document.name),
|
||
_Info(
|
||
context.l10n.canvasSize,
|
||
'${number(canvas.width)} × ${number(canvas.height)} px',
|
||
),
|
||
_Info(context.l10n.canvasRatio, canvas.label(context)),
|
||
_Info(
|
||
context.l10n.projectColorSpace,
|
||
switch (session.projectColorSpace) {
|
||
RenderColorSpace.rec2020HLG => 'HDR · Rec.2020 HLG',
|
||
RenderColorSpace.rec2020PQ => 'HDR · Rec.2020 PQ',
|
||
_ => 'SDR · Rec.709',
|
||
},
|
||
),
|
||
_Info(
|
||
context.l10n.currentSequence,
|
||
timeline?.name ?? context.l10n.none,
|
||
),
|
||
_Info(
|
||
context.l10n.frameRate,
|
||
fps == null ? '—' : '${number(fps)} fps',
|
||
),
|
||
_Info(
|
||
context.l10n.totalDuration,
|
||
'${(duration / TimelineClock.ticksPerSecond).toStringAsFixed(2)} ${context.l10n.seconds}',
|
||
),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|
||
|
||
class _Info extends StatelessWidget {
|
||
const _Info(this.label, this.value);
|
||
|
||
final String label;
|
||
final String value;
|
||
|
||
@override
|
||
Widget build(BuildContext context) => Padding(
|
||
padding: AppSpacing.panelSection,
|
||
child: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
spacing: AppSpacing.small,
|
||
children: [
|
||
Text(label, style: Theme.of(context).textTheme.bodySmall),
|
||
Expanded(
|
||
child: Text(
|
||
value,
|
||
textAlign: TextAlign.right,
|
||
style: Theme.of(context).textTheme.bodyMedium,
|
||
),
|
||
),
|
||
],
|
||
),
|
||
);
|
||
}
|