Files
SpotiFLAC-Mobile/lib/widgets/lyrics_size_setting.dart
T
zarzet 3d0d198ebd feat(material): size desktop dialogs and show slider values in pills
Desktop sheet dialogs had one 560dp width for every task, so a crash
report or the metadata editor wrapped tightly while short prompts
floated in empty space. AppSheetDialog now takes a size class (compact
440dp, medium 560dp by default, wide 720dp), threaded through the sheet
helpers. The metadata editor, crash report and re-enrich review open
wide. On Material the dialog corner comes from the sheet radius token,
the body's scrollbar stays visible, and a titled header ends with a
close button. Material alert dialogs stay within the M3 280 to 560dp
range, starting at the compact width on desktop.

Settings sliders showed their value inline or not at all. A shared
SliderValueHeader puts the value with its unit in a secondaryContainer
pill at the end of the title row, used by music haptics, normalization
pre-amp, AutoMix, lyrics size and the equalizer tone sliders. These
already save on release; lyrics size and the equalizer keep live writes
because their preview needs every step. Mornye keeps its inline labels.

The player details sheet called showModalBottomSheet with Flutter's
drag handle on Material phones. It now opens through
showAppScrollableBottomSheet with the shared handle, shape and header
naming the track, and lists the tags in one group instead of a titled,
outlined card. Mornye keeps its glass details on both platforms.
2026-10-21 22:13:12 +07:00

73 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mornye/l10n/l10n.dart';
import 'package:mornye/providers/theme_provider.dart';
import 'package:mornye/theme/mornye_theme.dart';
import 'package:mornye/widgets/app_icon_button.dart';
import 'package:mornye/widgets/app_slider.dart';
import 'package:mornye/widgets/lyrics_text_scale.dart';
import 'package:mornye/widgets/slider_value_header.dart';
class LyricsSizeSetting extends ConsumerWidget {
const LyricsSizeSetting({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final scale = ref.watch(
themeProvider.select((theme) => theme.lyricsTextScale),
);
final notifier = ref.read(themeProvider.notifier);
final percent = '${(scale * 100).round()}%';
final reset = AppIconButton(
tooltip: context.l10n.libraryFilterReset,
onPressed: scale == 1 ? null : () => notifier.setLyricsTextScale(1),
icon: const Icon(Icons.restart_alt),
);
return Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (context.isMornye)
Row(
children: [
Expanded(
child: Text(
context.l10n.lyricsTextSize,
style: Theme.of(context).textTheme.titleMedium,
),
),
Text(percent),
reset,
],
)
else
SliderValueHeader(
title: context.l10n.lyricsTextSize,
value: percent,
trailing: reset,
),
LyricsTextScale(
child: Text(
context.l10n.lyricsTextPreview,
style: Theme.of(context).textTheme.headlineSmall,
),
),
AppSlider(
value: scale,
min: 0.8,
max: 1.4,
divisions: 12,
label: percent,
semanticLabel: context.l10n.lyricsTextSize,
semanticFormatterCallback: (value) => '${(value * 100).round()}%',
onChanged: (value) =>
notifier.setLyricsTextScale(value, persist: false),
onChangeEnd: notifier.setLyricsTextScale,
),
],
),
);
}
}