fix(flutter): clear analyze --fatal-infos errors from admin parity slice
CI caught six issues against the new admin slice: - AsyncValue<T> in this Riverpod 3.3.1 codebase exposes `.value` (returns T?), not `.valueOrNull`. Switched the three admin readers to match the established convention (player_bar, queue_screen, now_playing_screen all use `.value`). - home_screen.dart still has ctx.push calls in _albumsRow / _artistsRow (carousel tap handlers) — restored the go_router import that Task 2 over-eagerly removed. - admin_user_edit_sheet.dart had a single-line `if (!await ...) return;` that violated curly_braces_in_flow_control_structures. Wrapped in braces. - admin_quarantine_item.dart doc comment had `<top>` placeholders that the analyzer flagged as unintended HTML. Rephrased without angle brackets. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ class AdminRequestsScreen extends ConsumerWidget {
|
||||
// Best-effort lookup for requester usernames. If the users provider
|
||||
// hasn't loaded yet, valueOrNull is null and rows fall back to the
|
||||
// UUID prefix; no blocking spinner.
|
||||
final users = ref.watch(adminUsersProvider).valueOrNull ?? const <AdminUser>[];
|
||||
final users = ref.watch(adminUsersProvider).value ?? const <AdminUser>[];
|
||||
final usersById = {for (final u in users) u.id: u};
|
||||
|
||||
return Scaffold(
|
||||
|
||||
@@ -151,7 +151,9 @@ class AdminUserEditSheet extends ConsumerWidget {
|
||||
message:
|
||||
'Permanently delete user "${user.username}" and all their data. '
|
||||
'Cannot be undone.',
|
||||
)) return;
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await users.delete(user.id);
|
||||
if (context.mounted) Navigator.pop(context);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import '../api/errors.dart';
|
||||
import '../models/album.dart';
|
||||
|
||||
@@ -55,9 +55,9 @@ class AdminQuarantineItem {
|
||||
|
||||
final List<AdminQuarantineReport> reports;
|
||||
|
||||
/// One-line summary of the most-cited reason. Returns "<top>" when
|
||||
/// only one reason exists or "<top> (+N more)" when there are
|
||||
/// additional distinct reasons.
|
||||
/// One-line summary of the most-cited reason. Returns just the top
|
||||
/// reason when only one reason exists, or `top (+N more)` when there
|
||||
/// are additional distinct reasons.
|
||||
String get topReasonSummary {
|
||||
if (reasonCounts.isEmpty) return '';
|
||||
final entries = reasonCounts.entries.toList()
|
||||
|
||||
@@ -97,7 +97,7 @@ class _AdminSection extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final fs = Theme.of(context).extension<FabledSwordTheme>()!;
|
||||
final profile = ref.watch(_profileProvider).valueOrNull;
|
||||
final profile = ref.watch(_profileProvider).value;
|
||||
if (profile == null || !profile.isAdmin) return const SizedBox.shrink();
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
||||
@@ -17,7 +17,7 @@ class MainAppBarActions extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final fs = Theme.of(context).extension<FabledSwordTheme>()!;
|
||||
final user = ref.watch(authControllerProvider).valueOrNull;
|
||||
final user = ref.watch(authControllerProvider).value;
|
||||
final isAdmin = user?.isAdmin ?? false;
|
||||
|
||||
return Row(
|
||||
|
||||
Reference in New Issue
Block a user