Files
SpotiFLAC-Mobile/lib/widgets/download_queue_feedback.dart
zarzet 962e582acc chore(flutter): move to Flutter 3.50.0 and the material_ui packages
Flutter 3.50 deprecates its built-in Material and Cupertino libraries in
favour of the material_ui and cupertino_ui packages. The imports move
with the official fix (dart fix, migrate_design_widgets); the app's old
two-library theme bridge collapses into one Theme type.

- MaterialExpressiveScope keeps the complete host theme nearest its
  child. The reduced copy made for the expressive widgets now shares the
  app's Theme type and would hide component themes and extensions.
- LegacyThemeBrightness hands the brightness to the glass package, which
  still reads Flutter's built-in theme.
- appLocalizationsDelegates lists the material_ui localization delegates;
  the generated list still names the built-in ones.
- Tests: findByTooltip and pageBack replace the flutter_test helpers that
  only know the built-in widgets, and several tests that had gone stale
  against earlier app changes are repaired.
2026-11-15 23:33:29 +07:00

40 lines
1.2 KiB
Dart

import 'package:material_ui/material_ui.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mornye/l10n/l10n.dart';
import 'package:mornye/providers/download_queue_provider.dart';
/// Presents live queue effects while the application shell is mounted.
class DownloadQueueFeedback extends ConsumerWidget {
const DownloadQueueFeedback({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context, WidgetRef ref) {
ref.listen(downloadQueueProvider.select((queue) => queue.reconnectRetry), (
_,
retry,
) {
if (retry == null ||
!context.mounted ||
WidgetsBinding.instance.lifecycleState != AppLifecycleState.resumed) {
return;
}
final queue = ref.read(downloadQueueProvider.notifier);
final l10n = context.l10n;
ScaffoldMessenger.of(context)
..removeCurrentSnackBar()
..showSnackBar(
SnackBar(
content: Text(l10n.queueNetworkFailedOffline(retry.failedCount)),
action: SnackBarAction(
label: l10n.dialogRetry,
onPressed: () => queue.retryAllFailed(networkOnly: true),
),
),
);
});
return child;
}
}