feat(workspace): 桌面工作区、主题与交互更新,发布 0.1.2
Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s

This commit was merged in pull request #13.
This commit is contained in:
lingjhf committed 2026-10-08 18:17:12 +00:00
1 parent aa5255d1e4
commit abc1868550
260 files changed
+43964 -5591

No files matched your search

+188 -166
View File
@@ -1,9 +1,12 @@
import '../../shared/widgets/listenable_selector.dart';
import 'package:cutdex/l10n/l10n.dart';
import 'package:cutdex/features/properties/audio_gain_scale.dart';
import 'package:cutdex_sdk/timeline/engine.dart';
import 'package:cutdex_sdk/timeline/model.dart';
import 'package:flutter/material.dart';
import 'package:cutdex_ui/icons.dart';
import 'package:cutdex_ui/widgets.dart';
import 'package:cutdex_ui/theme.dart';
@@ -123,8 +126,28 @@ class _AudioPropertiesState extends State<AudioProperties> {
@override
Widget build(BuildContext context) {
final view = widget.session.view(widget.sequence);
return ListenableBuilder(
listenable: view,
return ListenableSelector<Object>(
listenable: Listenable.merge([view, widget.session]),
select: () {
final query = view.version.kernelVersion.query();
final handle = query.elementById(widget.clip.id);
final record = handle == null ? widget.clip : query.element(handle);
final localTick = handle == null
? 0
: view.playheadTick - query.absoluteStart(handle);
final tick = TimelineSourceClock(record).nearestSourceTick(
localTick.clamp(0, record.duration > 0 ? record.duration - 1 : 0),
);
final gain = ClipAudioGain.fromRecord(record, sourceTick: tick);
return (
record,
gain.db,
gain.muted,
record.parameters?[ClipAudioGain.gainId]?.keyframeAt(tick),
widget.session.acceptsEdits,
_editValid,
);
},
builder: (context, _) {
final query = view.version.kernelVersion.query();
final handle = query.elementById(widget.clip.id);
@@ -147,7 +170,7 @@ class _AudioPropertiesState extends State<AudioProperties> {
}
if (ClipAudioGain.isDetached(record)) {
return Padding(
padding: AppSpacing.panelSection,
padding: AppTheme.propertySectionPadding(context),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -155,10 +178,10 @@ class _AudioPropertiesState extends State<AudioProperties> {
context.l10n.audioDetached,
style: AppTheme.propertySectionTitleStyle(context),
),
const SizedBox(height: AppSpacing.small),
SizedBox(height: AppTheme.propertyRowGap(context)),
OutlinedButton.icon(
key: const Key('audio-restore'),
icon: const Icon(Icons.volume_up_outlined),
icon: const Icon(AppIcons.volume),
label: Text(context.l10n.restoreAudio),
onPressed: !enabled || !widget.session.acceptsEdits
? null
@@ -187,172 +210,171 @@ class _AudioPropertiesState extends State<AudioProperties> {
),
);
}
final volumeActions = <Widget>[
IconButton(
key: const Key('audio-key'),
tooltip: context.l10n.toggleKeyframe(
keyed ? context.l10n.delete : context.l10n.addKeyframeAction,
context.l10n.volume,
),
isSelected: keyed,
icon: Transform.rotate(
angle: 0.7853981633974483,
child: Icon(
keyed ? AppIcons.squareFilled : AppIcons.square,
size: 12,
),
),
onPressed: !enabled
? null
: () {
if (_dirty && !_submit(_text.text)) return;
_focus.unfocus();
FocusManager.instance.applyFocusChangesIfNeeded();
try {
widget.session.commands.editKeyframeChannel(
sequence: widget.sequence,
clip: widget.clip.id,
tick: view.playheadTick,
parameterIds: [ClipAudioGain.gainId],
);
} catch (_) {
setState(
() => _error = context.l10n.updateKeyframesFailed,
);
}
},
),
IconButton(
key: const Key('audio-mute'),
tooltip: value.muted ? context.l10n.unmute : context.l10n.mute,
isSelected: value.muted,
icon: Icon(value.muted ? AppIcons.mute : AppIcons.volume),
onPressed: !enabled
? null
: () {
_editVersion = null;
_editTick = null;
_commit(ClipAudioGain(saved.db, muted: !saved.muted));
},
),
IconButton(
key: const Key('audio-reset'),
tooltip: context.l10n.resetVolume,
icon: const Icon(AppIcons.reset),
onPressed: !enabled
? null
: () {
_editVersion = null;
_editTick = null;
_commit(const ClipAudioGain(0));
},
),
];
final volumeControls = Row(
children: [
Expanded(
child: AppSlider(
key: const Key('audio-slider'),
value: value.muted ? 0 : AudioGainScale.positionAt(value.db),
semanticFormatterCallback: (p) => p == 0
? context.l10n.mute
: '${AudioGainScale.formatDb(AudioGainScale.dbAt(p))} dB',
onChangeStart: !enabled
? null
: (_) {
_focus.unfocus();
FocusManager.instance.applyFocusChangesIfNeeded();
_beginEdit();
},
onChanged: !enabled
? null
: (p) => setState(() {
if (!_editValid) {
widget.session.clearAudioGainPreview(widget.clip.id);
_timeline = null;
return;
}
_dirty = false;
_timeline = p == 0
? ClipAudioGain(saved.db, muted: true)
: ClipAudioGain(
AudioGainScale.quantizeDb(
AudioGainScale.dbAt(p),
),
);
widget.session.previewAudioGain(
widget.sequence,
widget.clip.id,
_timeline!,
);
}),
onChangeEnd: !enabled
? null
: (_) => _commit(_timeline ?? saved),
),
),
SizedBox(width: AppTheme.propertyRowGap(context)),
SizedBox(
width: 84,
child: AppTextField(
key: const Key('audio-db'),
controller: _text,
focusNode: _focus,
label: null,
unit: 'dB',
enabled: enabled,
errorText: _error,
keyboardType: const TextInputType.numberWithOptions(
signed: true,
decimal: true,
),
onChanged: (_) {
if (!_dirty) {
_beginEdit();
}
_dirty = true;
},
onSubmitted: _submit,
),
),
],
);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: AppSpacing.panelSection,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
Expanded(
child: Text(
widget.hasAudio
? context.l10n.volume
: context.l10n.unboundAudio,
style: AppTheme.propertySectionTitleStyle(context),
padding: AppTheme.propertySectionPadding(context),
child: AppTheme.isDesktop(context)
? AppPropertyGroup(
label: widget.hasAudio
? context.l10n.volume
: context.l10n.unboundAudio,
actions: volumeActions,
child: volumeControls,
)
: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Row(
children: [
Expanded(
child: Text(
widget.hasAudio
? context.l10n.volume
: context.l10n.unboundAudio,
style: AppTheme.propertySectionTitleStyle(
context,
),
),
),
...volumeActions,
],
),
),
IconButton(
key: const Key('audio-key'),
tooltip: context.l10n.toggleKeyframe(
keyed
? context.l10n.delete
: context.l10n.addKeyframeAction,
context.l10n.volume,
),
isSelected: keyed,
icon: Transform.rotate(
angle: 0.7853981633974483,
child: Icon(
keyed ? Icons.square : Icons.crop_square,
size: 12,
),
),
onPressed: !enabled
? null
: () {
if (_dirty && !_submit(_text.text)) return;
_focus.unfocus();
FocusManager.instance
.applyFocusChangesIfNeeded();
try {
widget.session.commands.editKeyframeChannel(
sequence: widget.sequence,
clip: widget.clip.id,
tick: view.playheadTick,
parameterIds: [ClipAudioGain.gainId],
);
} catch (_) {
setState(
() => _error =
context.l10n.updateKeyframesFailed,
);
}
},
),
IconButton(
key: const Key('audio-mute'),
tooltip: value.muted
? context.l10n.unmute
: context.l10n.mute,
isSelected: value.muted,
icon: Icon(
value.muted ? Icons.volume_off : Icons.volume_up,
),
onPressed: !enabled
? null
: () {
_editVersion = null;
_editTick = null;
_commit(
ClipAudioGain(saved.db, muted: !saved.muted),
);
},
),
IconButton(
key: const Key('audio-reset'),
tooltip: context.l10n.resetVolume,
icon: const Icon(Icons.restart_alt),
onPressed: !enabled
? null
: () {
_editVersion = null;
_editTick = null;
_commit(const ClipAudioGain(0));
},
),
],
),
const SizedBox(height: AppSpacing.small),
Row(
children: [
Expanded(
child: AppSlider(
key: const Key('audio-slider'),
value: value.muted
? 0
: AudioGainScale.positionAt(value.db),
semanticFormatterCallback: (p) => p == 0
? context.l10n.mute
: '${AudioGainScale.formatDb(AudioGainScale.dbAt(p))} dB',
onChangeStart: !enabled
? null
: (_) {
_focus.unfocus();
FocusManager.instance
.applyFocusChangesIfNeeded();
_beginEdit();
},
onChanged: !enabled
? null
: (p) => setState(() {
if (!_editValid) {
widget.session.clearAudioGainPreview(
widget.clip.id,
);
_timeline = null;
return;
}
_dirty = false;
_timeline = p == 0
? ClipAudioGain(saved.db, muted: true)
: ClipAudioGain(
AudioGainScale.quantizeDb(
AudioGainScale.dbAt(p),
),
);
widget.session.previewAudioGain(
widget.sequence,
widget.clip.id,
_timeline!,
);
}),
onChangeEnd: !enabled
? null
: (_) => _commit(_timeline ?? saved),
),
),
const SizedBox(width: AppSpacing.small),
SizedBox(
width: 84,
child: AppTextField(
key: const Key('audio-db'),
controller: _text,
focusNode: _focus,
label: null,
unit: 'dB',
enabled: enabled,
errorText: _error,
keyboardType: const TextInputType.numberWithOptions(
signed: true,
decimal: true,
),
onChanged: (_) {
if (!_dirty) {
_beginEdit();
}
_dirty = true;
},
onSubmitted: _submit,
),
),
],
),
],
),
SizedBox(height: AppTheme.propertyRowGap(context)),
volumeControls,
],
),
),
],
);