Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
153 lines
5.3 KiB
Dart
153 lines
5.3 KiB
Dart
import 'package:cutdex/l10n/l10n.dart';
|
||
import 'package:cutdex_native_flutter/contracts.dart';
|
||
import 'package:cutdex_core/timeline/model.dart';
|
||
import 'package:cutdex_core/timeline/engine.dart';
|
||
import 'package:flutter/material.dart';
|
||
|
||
import 'package:cutdex_ui/theme.dart';
|
||
import 'package:cutdex_ui/widgets.dart';
|
||
|
||
import '../../workspace/timeline_session.dart';
|
||
import '../../shared/widgets/listenable_selector.dart';
|
||
import 'canvas_presets.dart';
|
||
import 'project_settings_dialog.dart';
|
||
import 'project_property_row.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) {
|
||
String number(double value) => value == value.roundToDouble()
|
||
? value.toStringAsFixed(0)
|
||
: value.toStringAsFixed(3).replaceFirst(RegExp(r'0+$'), '');
|
||
TimelineKernel? timeline() {
|
||
final sequence = session.activeSequenceId;
|
||
return sequence == null ? null : session.persistence.timeline(sequence);
|
||
}
|
||
|
||
Widget info(String label, String Function() value) =>
|
||
_Info(label, session, value);
|
||
|
||
return WorkspacePanel(
|
||
paintBackground: false,
|
||
title: context.l10n.projectProperties,
|
||
trailing: SizedBox(
|
||
height: AppTheme.isDesktop(context) ? AppInspectorMetrics.input : null,
|
||
child: TextButton(
|
||
key: const ValueKey('project-settings-edit'),
|
||
style:
|
||
AppTheme.isDesktop(context) &&
|
||
!AppTheme.isCompactInspector(context)
|
||
? AppTheme.toolbarButtonStyle(context)
|
||
: null,
|
||
onPressed: () => showAppDialog<void>(
|
||
context: context,
|
||
builder: (_) => ProjectSettingsDialog(session: session),
|
||
),
|
||
child: Text(context.l10n.modify),
|
||
),
|
||
),
|
||
headerHeight: AppTheme.isDesktop(context)
|
||
? AppInspectorMetrics.sectionHeader
|
||
: AppControlSize.panelToolbar,
|
||
headerPadding: AppTheme.isDesktop(context)
|
||
? const EdgeInsets.only(
|
||
left: AppInspectorMetrics.padding,
|
||
right: AppInspectorMetrics.trailingPadding,
|
||
)
|
||
: const EdgeInsets.symmetric(
|
||
horizontal: AppSpacing.panelContentHorizontal,
|
||
),
|
||
showHeaderDivider: AppTheme.isCompactInspector(context),
|
||
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, () {
|
||
final canvas = session.canvas;
|
||
return '${number(canvas.width)} × ${number(canvas.height)} px';
|
||
}),
|
||
info(
|
||
context.l10n.canvasRatio,
|
||
() => session.canvas.label(context),
|
||
),
|
||
info(
|
||
context.l10n.projectOutputColorSpace,
|
||
() => switch (session.projectOutputColorSpace) {
|
||
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, () {
|
||
final frame = timeline()?.format.frameDuration;
|
||
return frame == null
|
||
? '—'
|
||
: '${number(frame.denominator / frame.numerator)} fps';
|
||
}),
|
||
info(context.l10n.totalDuration, () {
|
||
final sequence = session.activeSequenceId;
|
||
final duration = sequence == null
|
||
? 0
|
||
: session.sequenceDurationTicks(sequence);
|
||
return '${(duration / TimelineClock.ticksPerSecond).toStringAsFixed(2)} ${context.l10n.seconds}';
|
||
}),
|
||
],
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|
||
|
||
class _Info extends StatelessWidget {
|
||
const _Info(this.label, this.session, this.select);
|
||
|
||
final String label;
|
||
final EditorTimelineSession session;
|
||
final String Function() select;
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
if (AppTheme.isDesktop(context)) {
|
||
return ListenableSelector<String>(
|
||
listenable: session,
|
||
select: select,
|
||
builder: (context, value) =>
|
||
ProjectPropertyRow(label: label, value: value),
|
||
);
|
||
}
|
||
final value = ListenableSelector<String>(
|
||
listenable: session,
|
||
select: select,
|
||
builder: (context, value) => Text(
|
||
value,
|
||
textAlign: TextAlign.right,
|
||
style: Theme.of(context).textTheme.bodyMedium,
|
||
),
|
||
);
|
||
return AppPropertySection(
|
||
child: Row(
|
||
crossAxisAlignment: CrossAxisAlignment.start,
|
||
spacing: AppSpacing.small,
|
||
children: [
|
||
Text(label, style: Theme.of(context).textTheme.bodySmall),
|
||
Expanded(child: value),
|
||
],
|
||
),
|
||
);
|
||
}
|
||
}
|