fix(flutter): clear analyze --fatal-infos issues
Three classes:
1. album_cover_cache.dart docstring used <applicationCacheDirectory>
and <albumId> which the analyzer reads as unintended HTML. Wrapped
the path in backticks and used {} placeholders.
2. settings AppearanceSection used RadioListTile.groupValue + onChanged,
deprecated in Flutter 3.32+. Wrapped the radios in a RadioGroup
ancestor (the new API) so individual tiles only declare value +
activeColor. Test updated to read groupValue off the RadioGroup
ancestor.
3. theme_extension.dart factories built FabledSwordTheme(...) without
const, even though all args are static const tokens. Added const to
the outer constructor calls in both .dark() and .light() — this
propagates const to the inner TextStyle(...) calls automatically.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -503,26 +503,32 @@ class _AppearanceSection extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final fs = Theme.of(context).extension<FabledSwordTheme>()!;
|
||||
final current = ref.watch(themeModeProvider).value ?? AppThemeMode.system;
|
||||
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
const _SectionHeader('Appearance'),
|
||||
for (final mode in AppThemeMode.values)
|
||||
RadioListTile<AppThemeMode>(
|
||||
key: Key('appearance_${mode.name}'),
|
||||
title: Text(_label(mode), style: TextStyle(color: fs.parchment)),
|
||||
subtitle: mode == AppThemeMode.system
|
||||
? Text('Match the device setting',
|
||||
style: TextStyle(color: fs.ash))
|
||||
: null,
|
||||
value: mode,
|
||||
groupValue: current,
|
||||
activeColor: fs.accent,
|
||||
onChanged: (m) {
|
||||
if (m != null) {
|
||||
ref.read(themeModeProvider.notifier).set(m);
|
||||
}
|
||||
},
|
||||
),
|
||||
]);
|
||||
// RadioGroup is the post-Flutter-3.32 API: the ancestor owns
|
||||
// groupValue/onChanged so individual RadioListTiles don't have
|
||||
// to repeat them. Pre-3.32 RadioListTile.groupValue/onChanged
|
||||
// are deprecated.
|
||||
return RadioGroup<AppThemeMode>(
|
||||
groupValue: current,
|
||||
onChanged: (m) {
|
||||
if (m != null) {
|
||||
ref.read(themeModeProvider.notifier).set(m);
|
||||
}
|
||||
},
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
const _SectionHeader('Appearance'),
|
||||
for (final mode in AppThemeMode.values)
|
||||
RadioListTile<AppThemeMode>(
|
||||
key: Key('appearance_${mode.name}'),
|
||||
title: Text(_label(mode), style: TextStyle(color: fs.parchment)),
|
||||
subtitle: mode == AppThemeMode.system
|
||||
? Text('Match the device setting',
|
||||
style: TextStyle(color: fs.ash))
|
||||
: null,
|
||||
value: mode,
|
||||
activeColor: fs.accent,
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
String _label(AppThemeMode m) => switch (m) {
|
||||
|
||||
Reference in New Issue
Block a user