Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,11 @@ in [docs/FILTER_SCHEMA.md](docs/FILTER_SCHEMA.md). **Stamp only what is new**
(the option, not the parameter it was added to; never a hidden parameter):
every control leading to it badges automatically — its dropdown, the switch
that reveals it, its section, the pass row, and for a new Settings tab the
Settings button.
Settings button. Things outside the schemas take a hard-coded stamp: a codec
`VideoCodec.sinceAppVersion` (badging its radio, the Video Codec heading, the
Output tab and the Settings button through `SettingsDialog.isOutputTabNew` /
`hasNew`), other UI a `static const sinceAppVersion` (`AddonsSettingsTab`,
`CropDetectPanel`, `ComparisonViewMode`); see FILTER_SCHEMA.md.

Several ongoing rules for schemas and the panel that renders them, each guarded by
`filter_schema_curation_test.dart` unless noted — see
Expand Down
9 changes: 9 additions & 0 deletions app/lib/models/video_job.dart
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ enum VideoCodec {
final String value;
final String displayName;

/// The app version this codec was first offered in, for its NEW badge in
/// Settings → Output (`WhatsNewService.isNew`). Null for every codec that
/// shipped before codecs had stamps. Never change a shipped value: stamp
/// a new codec in the change that adds it.
String? get sinceAppVersion => switch (this) {
VideoCodec.av1 || VideoCodec.v210 => '1.8.0',
_ => null,
};

String get description {
switch (this) {
case VideoCodec.h264:
Expand Down
9 changes: 3 additions & 6 deletions app/lib/views/main_window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import 'queue_panel.dart';
import 'settings/settings_dialog.dart';
import '../widgets/resizable_split.dart';
import '../widgets/warning_banner.dart';
import '../services/whats_new_service.dart';
import 'settings/addons_settings_tab.dart';

class MainWindow extends StatelessWidget {
const MainWindow({super.key});
Expand Down Expand Up @@ -415,11 +413,10 @@ class MainWindow extends StatelessWidget {

// Settings button — About and bug reporting live in its General tab
IconButton(
// Marked in the NEW badge's colour while a Settings tab is new, so
// the badge inside is not the only way to find it.
// Marked in the NEW badge's colour while a Settings tab holds
// something new, so the badge inside is not the only way to find it.
icon: Badge(
isLabelVisible:
WhatsNewService.instance.isNew(AddonsSettingsTab.sinceAppVersion),
isLabelVisible: SettingsDialog.hasNew,
smallSize: 8,
backgroundColor: Theme.of(context).colorScheme.tertiary,
child: const Icon(Icons.settings),
Expand Down
11 changes: 3 additions & 8 deletions app/lib/views/pass_settings/crop_detect_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import '../../models/crop_detect_report.dart';
import '../../services/whats_new_service.dart';
import '../../viewmodels/main_viewmodel.dart';
import '../../widgets/new_badge.dart';
import '../../widgets/warning_banner.dart';

/// Crop & Resize's Detect (app 1.7.0): measures the selected video's black
Expand All @@ -24,17 +25,11 @@ class CropDetectPanel extends StatelessWidget {
final report = viewModel.cropReport;
final running = viewModel.detectingCrop;
final canRun = viewModel.selectedItem != null && !running;
final scheme = theme.colorScheme;
final children = <Widget>[
Row(
children: [
Badge(
isLabelVisible: WhatsNewService.instance.isNew(sinceAppVersion),
backgroundColor: scheme.tertiaryContainer,
textColor: scheme.onTertiaryContainer,
textStyle: const TextStyle(fontSize: 9, fontWeight: FontWeight.w700, letterSpacing: 0.4),
offset: const Offset(10, -8),
label: const Text('NEW'),
NewCornerBadge(
visible: WhatsNewService.instance.isNew(sinceAppVersion),
child: OutlinedButton.icon(
onPressed: canRun ? viewModel.detectCrop : null,
icon: running
Expand Down
11 changes: 3 additions & 8 deletions app/lib/views/settings/addons_settings_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';

import '../../services/addon_service.dart';
import '../../services/whats_new_service.dart';
import '../../widgets/new_badge.dart';
import '../addon_dialogs.dart';

/// Settings → Add-ons: every optional download, grouped by the feature that
Expand Down Expand Up @@ -174,14 +175,8 @@ class AddonsTabLabel extends StatelessWidget {

@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Badge(
isLabelVisible: WhatsNewService.instance.isNew(AddonsSettingsTab.sinceAppVersion),
backgroundColor: scheme.tertiaryContainer,
textColor: scheme.onTertiaryContainer,
textStyle: const TextStyle(fontSize: 9, fontWeight: FontWeight.w700, letterSpacing: 0.4),
offset: const Offset(10, -8),
label: const Text('NEW'),
return NewCornerBadge(
visible: WhatsNewService.instance.isNew(AddonsSettingsTab.sinceAppVersion),
child: const Text('Add-ons'),
);
}
Expand Down
54 changes: 47 additions & 7 deletions app/lib/views/settings/settings_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,18 @@ List<AudioCodec> audioCodecChoices(EncodingSettings settings) =>
class SettingsDialog extends StatefulWidget {
const SettingsDialog({super.key});

/// Whether Settings → Output holds something new since the last update: a
/// codec stamped with [VideoCodec.sinceAppVersion]. Badges the Video Codec
/// heading and the Output tab. Anything else new in the Output tab must be
/// added here, so the tab and the Settings button lead to it.
static bool get isOutputTabNew =>
VideoCodec.values.any((c) => WhatsNewService.instance.isNew(c.sinceAppVersion));

/// Whether any Settings tab carries a NEW badge: the toolbar's Settings
/// button marks itself while this is true.
static bool get hasNew =>
isOutputTabNew || WhatsNewService.instance.isNew(AddonsSettingsTab.sinceAppVersion);

@override
State<SettingsDialog> createState() => _SettingsDialogState();
}
Expand Down Expand Up @@ -384,7 +396,7 @@ class _SettingsDialogState extends State<SettingsDialog>
controller: _tabController,
tabs: [
const Tab(text: 'General'),
const Tab(text: 'Output'),
const Tab(child: OutputTabLabel()),
const Tab(text: 'Input'),
const Tab(child: AddonsTabLabel()),
const Tab(text: 'Changes'),
Expand Down Expand Up @@ -723,6 +735,18 @@ class _ChangesSettingsTabState extends State<_ChangesSettingsTab> {
}
}

/// The Output tab's label, with its NEW badge overlaid on the corner (as
/// [AddonsTabLabel]: the tabs share the dialog's width equally).
class OutputTabLabel extends StatelessWidget {
const OutputTabLabel({super.key});

@override
Widget build(BuildContext context) => NewCornerBadge(
visible: SettingsDialog.isOutputTabNew,
child: const Text('Output'),
);
}

class _OutputSettingsTab extends StatefulWidget {
const _OutputSettingsTab();

Expand Down Expand Up @@ -1029,6 +1053,7 @@ class _OutputSettingsTabState extends State<_OutputSettingsTab> {
_buildSection(
context,
title: 'Video Codec',
isNew: SettingsDialog.isOutputTabNew,
child: _buildCodecList(context, viewModel, settings),
),

Expand Down Expand Up @@ -1967,6 +1992,12 @@ class _OutputSettingsTabState extends State<_OutputSettingsTab> {
style: clickable ? null : disabledStyle,
),
),
// Badged whether or not it can be chosen here: a disabled AV1 in
// MOV is still where the user learns it exists, beside the reason.
if (WhatsNewService.instance.isNew(codec.sinceAppVersion)) ...[
const SizedBox(width: 6),
const NewBadge(),
],
if (indicator != null) ...[
const SizedBox(width: 8),
indicator,
Expand Down Expand Up @@ -2064,16 +2095,25 @@ class _OutputSettingsTabState extends State<_OutputSettingsTab> {
BuildContext context, {
required String title,
required Widget child,
bool isNew = false,
}) {
final heading = Text(
title,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: Theme.of(context).textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
if (isNew)
Row(children: [
Flexible(child: heading),
const SizedBox(width: 6),
const NewBadge(),
])
else
heading,
const SizedBox(height: 12),
child,
],
Expand Down
9 changes: 9 additions & 0 deletions app/lib/widgets/before_after_comparison.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import 'package:flutter/services.dart';

import '../models/app_shortcut.dart';
import '../services/image_dimensions.dart';
import '../services/whats_new_service.dart';
import 'comparison_view_mode.dart';
import 'comparison_zoom_controller.dart';
import 'new_badge.dart';

/// A widget that displays a before/after comparison with a draggable divider.
///
Expand Down Expand Up @@ -737,6 +739,13 @@ class _BeforeAfterComparisonWidgetState
/// Original | Split | Processed, styled like the zoom pill, in the order
/// the panes sit.
Widget _buildViewModeControl() {
return NewCornerBadge(
visible: WhatsNewService.instance.isNew(ComparisonViewMode.sinceAppVersion),
child: _buildViewModePill(),
);
}

Widget _buildViewModePill() {
return Container(
key: const Key('comparison-view-mode'),
decoration: BoxDecoration(
Expand Down
4 changes: 4 additions & 0 deletions app/lib/widgets/comparison_view_mode.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ enum ComparisonViewMode {
final String description;
const ComparisonViewMode(this.label, this.description);

/// The app version the Original / Split / Processed control shipped in,
/// for its NEW badge. Never change it once shipped.
static const sinceAppVersion = '1.8.0';

/// The keyboard shortcut that selects this mode.
AppShortcut get shortcut => switch (this) {
ComparisonViewMode.original => AppShortcut.previewOriginal,
Expand Down
24 changes: 24 additions & 0 deletions app/lib/widgets/new_badge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,27 @@ class NewBadge extends StatelessWidget {
);
}
}

/// A "NEW" label overlaid on [child]'s top-right corner, for a control with no
/// room for a [NewBadge] pill beside it (a tab label, a button, the preview's
/// view-mode pill). Draws [child] alone when [visible] is false.
class NewCornerBadge extends StatelessWidget {
final bool visible;
final Widget child;

const NewCornerBadge({super.key, required this.visible, required this.child});

@override
Widget build(BuildContext context) {
final scheme = Theme.of(context).colorScheme;
return Badge(
isLabelVisible: visible,
backgroundColor: scheme.tertiaryContainer,
textColor: scheme.onTertiaryContainer,
textStyle: const TextStyle(fontSize: 9, fontWeight: FontWeight.w700, letterSpacing: 0.4),
offset: const Offset(10, -8),
label: const Text('NEW'),
child: child,
);
}
}
Loading
Loading