Files
SpotiFLAC-Mobile/lib/widgets/lyrics_text_scale.dart
T
zarzet 37e21b5712 feat(branding): rename app and native backend to Mornye
Rename the Dart package, Android and iOS identifiers, Rust crates, native libraries, and Discord plugin. Preserve legacy data readers and compatibility aliases.

Update localized branding, documentation, artwork, build tooling, and release artifacts. Route Telegram release notifications to @mornyeupdates and link @mornyecommunity.
2026-10-20 12:00:44 +07:00

45 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mornye/providers/theme_provider.dart';
/// Applies the lyric preference on top of the system's accessibility scaling.
class LyricsTextScale extends ConsumerWidget {
const LyricsTextScale({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context, WidgetRef ref) {
final factor = ref.watch(
themeProvider.select((theme) => theme.lyricsTextScale),
);
final media = MediaQuery.of(context);
return MediaQuery(
data: media.copyWith(
textScaler: LyricsTextScaler(media.textScaler, factor),
),
child: child,
);
}
}
class LyricsTextScaler extends TextScaler {
const LyricsTextScaler(this.system, this.factor);
final TextScaler system;
final double factor;
@override
double scale(double fontSize) => system.scale(fontSize) * factor;
@override
double get textScaleFactor => scale(14) / 14;
@override
bool operator ==(Object other) =>
other is LyricsTextScaler &&
other.system == system &&
other.factor == factor;
@override
int get hashCode => Object.hash(system, factor);
}