Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Always show the Lists tab and say when collections could not be loaded

Barnabas916d49f31f70
diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb
index 332ac9d8..b7134bc9 100644
--- a/lib/l10n/app_en.arb
+++ b/lib/l10n/app_en.arb
@@ -5,6 +5,10 @@
"offline": "Offline",
"stillOffline": "Still offline. Tap to try again.",
"retry": "Retry",
+ "listsNone": "No collections or playlists",
+ "listsNoneHint": "Collections and playlists are made on your Audiobookshelf server, and show up here.",
+ "listsLoadFailed": "Couldn't load your lists",
+ "listsLoadFailedHint": "Absorb couldn't reach your server for collections and playlists.",
"cancel": "Cancel",
"delete": "Delete",
"remove": "Remove",
diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart
index ac95f0d5..294f007a 100644
--- a/lib/l10n/app_localizations.dart
+++ b/lib/l10n/app_localizations.dart
@@ -148,6 +148,30 @@ abstract class AppLocalizations {
/// **'Retry'**
String get retry;
+ /// No description provided for @listsNone.
+ ///
+ /// In en, this message translates to:
+ /// **'No collections or playlists'**
+ String get listsNone;
+
+ /// No description provided for @listsNoneHint.
+ ///
+ /// In en, this message translates to:
+ /// **'Collections and playlists are made on your Audiobookshelf server, and show up here.'**
+ String get listsNoneHint;
+
+ /// No description provided for @listsLoadFailed.
+ ///
+ /// In en, this message translates to:
+ /// **'Couldn\'t load your lists'**
+ String get listsLoadFailed;
+
+ /// No description provided for @listsLoadFailedHint.
+ ///
+ /// In en, this message translates to:
+ /// **'Absorb couldn\'t reach your server for collections and playlists.'**
+ String get listsLoadFailedHint;
+
/// No description provided for @cancel.
///
/// In en, this message translates to:
diff --git a/lib/l10n/app_localizations_de.dart b/lib/l10n/app_localizations_de.dart
index bf817902..1802df64 100644
--- a/lib/l10n/app_localizations_de.dart
+++ b/lib/l10n/app_localizations_de.dart
@@ -24,6 +24,20 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get retry => 'Erneut versuchen';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Abbrechen';
diff --git a/lib/l10n/app_localizations_el.dart b/lib/l10n/app_localizations_el.dart
index a144f8e0..da48fd17 100644
--- a/lib/l10n/app_localizations_el.dart
+++ b/lib/l10n/app_localizations_el.dart
@@ -23,6 +23,20 @@ class AppLocalizationsEl extends AppLocalizations {
@override
String get retry => 'Retry';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Cancel';
diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart
index 644465b6..78f8654d 100644
--- a/lib/l10n/app_localizations_en.dart
+++ b/lib/l10n/app_localizations_en.dart
@@ -23,6 +23,20 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get retry => 'Retry';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Cancel';
diff --git a/lib/l10n/app_localizations_es.dart b/lib/l10n/app_localizations_es.dart
index 11a6ff87..69a831cb 100644
--- a/lib/l10n/app_localizations_es.dart
+++ b/lib/l10n/app_localizations_es.dart
@@ -23,6 +23,20 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get retry => 'Reintentar';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Cancelar';
diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart
index 8c8e16c5..5378b634 100644
--- a/lib/l10n/app_localizations_fr.dart
+++ b/lib/l10n/app_localizations_fr.dart
@@ -24,6 +24,20 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get retry => 'Réessayer';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Annuler';
diff --git a/lib/l10n/app_localizations_it.dart b/lib/l10n/app_localizations_it.dart
index 38cd23be..2913909c 100644
--- a/lib/l10n/app_localizations_it.dart
+++ b/lib/l10n/app_localizations_it.dart
@@ -23,6 +23,20 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get retry => 'Retry';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Cancel';
diff --git a/lib/l10n/app_localizations_ja.dart b/lib/l10n/app_localizations_ja.dart
index d9b3649e..d50c0924 100644
--- a/lib/l10n/app_localizations_ja.dart
+++ b/lib/l10n/app_localizations_ja.dart
@@ -23,6 +23,20 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get retry => 'Retry';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Cancel';
diff --git a/lib/l10n/app_localizations_no.dart b/lib/l10n/app_localizations_no.dart
index ac12ae24..6ece2f2e 100644
--- a/lib/l10n/app_localizations_no.dart
+++ b/lib/l10n/app_localizations_no.dart
@@ -23,6 +23,20 @@ class AppLocalizationsNo extends AppLocalizations {
@override
String get retry => 'Retry';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Cancel';
diff --git a/lib/l10n/app_localizations_pt.dart b/lib/l10n/app_localizations_pt.dart
index b80e1687..d7aff842 100644
--- a/lib/l10n/app_localizations_pt.dart
+++ b/lib/l10n/app_localizations_pt.dart
@@ -23,6 +23,20 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get retry => 'Retry';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Cancel';
diff --git a/lib/l10n/app_localizations_ro.dart b/lib/l10n/app_localizations_ro.dart
index 4aa0f27b..bc4636f2 100644
--- a/lib/l10n/app_localizations_ro.dart
+++ b/lib/l10n/app_localizations_ro.dart
@@ -23,6 +23,20 @@ class AppLocalizationsRo extends AppLocalizations {
@override
String get retry => 'Retry';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Cancel';
diff --git a/lib/l10n/app_localizations_ru.dart b/lib/l10n/app_localizations_ru.dart
index b92989f4..c2ef7335 100644
--- a/lib/l10n/app_localizations_ru.dart
+++ b/lib/l10n/app_localizations_ru.dart
@@ -24,6 +24,20 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get retry => 'Повторить';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => 'Отменить';
diff --git a/lib/l10n/app_localizations_zh.dart b/lib/l10n/app_localizations_zh.dart
index 9c011a03..85257b06 100644
--- a/lib/l10n/app_localizations_zh.dart
+++ b/lib/l10n/app_localizations_zh.dart
@@ -23,6 +23,20 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get retry => '重试';
+ @override
+ String get listsNone => 'No collections or playlists';
+
+ @override
+ String get listsNoneHint =>
+ 'Collections and playlists are made on your Audiobookshelf server, and show up here.';
+
+ @override
+ String get listsLoadFailed => 'Couldn\'t load your lists';
+
+ @override
+ String get listsLoadFailedHint =>
+ 'Absorb couldn\'t reach your server for collections and playlists.';
+
@override
String get cancel => '取消';
diff --git a/lib/providers/_lp_core.dart b/lib/providers/_lp_core.dart
index 7c9f96c5..bf023771 100644
--- a/lib/providers/_lp_core.dart
+++ b/lib/providers/_lp_core.dart
@@ -1933,7 +1933,10 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
Future<void> _doLoadPlaylists() async {
_isLoadingPlaylists = true;
try {
- _playlists = await _api!.getLibraryPlaylists(_selectedLibraryId!);
+ // Keep whatever we already had when the request fails, rather than
+ // blanking the shelves over one bad response.
+ final loaded = await _api!.getLibraryPlaylists(_selectedLibraryId!);
+ if (loaded != null) _playlists = loaded;
} catch (_) {}
_isLoadingPlaylists = false;
notifyListeners();
@@ -2039,7 +2042,8 @@ mixin _CoreMixin on ChangeNotifier, _StateMixin {
Future<void> _doLoadCollections() async {
_isLoadingCollections = true;
try {
- _collections = await _api!.getLibraryCollections(_selectedLibraryId!);
+ final loaded = await _api!.getLibraryCollections(_selectedLibraryId!);
+ if (loaded != null) _collections = loaded;
} catch (_) {}
_isLoadingCollections = false;
notifyListeners();
diff --git a/lib/screens/library_screen.dart b/lib/screens/library_screen.dart
index 6e221807..f9299337 100644
--- a/lib/screens/library_screen.dart
+++ b/lib/screens/library_screen.dart
@@ -393,15 +393,11 @@ class LibraryScreenState extends State<LibraryScreen>
LibrarySort _listsSort = LibrarySort.alphabetical;
bool _listsSortAsc = true;
final _listsScrollController = ScrollController();
- // Remembered per library (persisted): once a library is known to have lists,
- // keep the Lists pill shown immediately on later opens and don't let it blink
- // out while the lists reload. Cleared only when a load confirms zero lists.
- bool _cachedHasLists = false;
- bool get _showLists =>
- _tabController != null &&
- (_collections.isNotEmpty || _playlists.isNotEmpty || _cachedHasLists);
-
- String _listsPresentKey(String libId) => 'lists_present_$libId';
+ // The Lists tab is always offered. It used to appear only once lists were
+ // known to exist, which made "the request failed", "the server returned
+ // none" and "you have none" all look identical - an absent tab, with nowhere
+ // to say which it was (#362).
+ bool _listsFailed = false;
bool _isLoadingPage = false;
bool _hasMore = true;
@@ -608,9 +604,7 @@ class LibraryScreenState extends State<LibraryScreen>
_narrators.clear();
_narratorsLoaded = false;
_isLoadingNarrators = false;
- // Different library: drop the old Lists state; _fetchLists re-seeds the
- // pill from the new library's remembered flag.
- _cachedHasLists = false;
+ _listsFailed = false;
_allNarratorsCache = null;
_allNarratorsCacheLibraryId = null;
_searchNarratorResults = [];
@@ -711,12 +705,6 @@ class LibraryScreenState extends State<LibraryScreen>
final podcastFilterValueLabel = results[24] as String;
final lib = context.read<LibraryProvider>();
final isPodcast = lib.isPodcastLibrary;
- // Read the remembered "has lists" flag so the Lists tab (and its pill) can
- // be restored immediately on cold start, before the lists finish loading.
- final libId = lib.selectedLibraryId;
- final hasListsRemembered = libId != null
- ? (await ScopedPrefs.getBool(_listsPresentKey(libId)) ?? false)
- : false;
if (!mounted) return;
setState(() {
// Book library sort/filter
@@ -821,12 +809,8 @@ class LibraryScreenState extends State<LibraryScreen>
_sort = _podcastSort;
_sortAsc = _podcastSortAsc;
}
- // Seed the Lists pill from the remembered flag so it (and the restored
- // Lists tab) show right away, before the lists load.
- if (hasListsRemembered) _cachedHasLists = true;
- // Restore last active tab (only for book libraries with tabs). The Lists
- // tab (4) is only restorable if the library is known to have lists.
- final maxRestorableTab = hasListsRemembered ? 4 : 3;
+ // Restore last active tab (only for book libraries with tabs).
+ const maxRestorableTab = 4;
if (!isPodcast && savedTab > 0 && savedTab <= maxRestorableTab) {
_currentTab = savedTab;
_tabController?.animateTo(savedTab);
@@ -1894,17 +1878,13 @@ class LibraryScreenState extends State<LibraryScreen>
}
Future<void> _fetchLists(String key, ApiService api, String libId) async {
- // Seed the Lists pill from the remembered flag so it shows right away (and
- // doesn't blink out while reloading) before the network confirms.
- final remembered =
- await ScopedPrefs.getBool(_listsPresentKey(libId)) ?? false;
if (!mounted || _listsLoadingKey != key) return;
// New key (library/account changed) or first load: drop the previous lists
// before fetching the new ones.
setState(() {
_collections = [];
_playlists = [];
- _cachedHasLists = remembered;
+ _listsFailed = false;
});
try {
final results = await Future.wait([
@@ -1912,23 +1892,21 @@ class LibraryScreenState extends State<LibraryScreen>
api.getLibraryPlaylists(libId),
]);
if (!mounted || _listsLoadingKey != key) return;
- final cols = results[0].whereType<Map<String, dynamic>>().toList();
- final pls = results[1].whereType<Map<String, dynamic>>().toList();
- final hasLists = cols.isNotEmpty || pls.isNotEmpty;
+ // Either call returning null means the server never answered. Saying
+ // "no collections or playlists" to that is how #362 went unexplained for
+ // a user who had plenty of both.
+ final failed = results[0] == null && results[1] == null;
+ final cols =
+ (results[0] ?? const []).whereType<Map<String, dynamic>>().toList();
+ final pls =
+ (results[1] ?? const []).whereType<Map<String, dynamic>>().toList();
setState(() {
_collections = cols;
_playlists = pls;
- _listsLoadedKey = key;
- _cachedHasLists = hasLists;
- // Fall back to Library if the Lists tab is open but has nothing.
- if (_currentTab == 4 && !_showLists) {
- _currentTab = 0;
- _tabController?.animateTo(0);
- }
+ _listsFailed = failed;
+ // A failed load is not a loaded one - let the next visit retry.
+ if (!failed) _listsLoadedKey = key;
});
- // Remember for next time so the pill is instant, and forget once a load
- // confirms the library genuinely has none.
- await ScopedPrefs.setBool(_listsPresentKey(libId), hasLists);
} finally {
if (_listsLoadingKey == key) _listsLoadFuture = null;
}
@@ -2976,7 +2954,7 @@ class LibraryScreenState extends State<LibraryScreen>
l.libraryTabSeries,
l.libraryTabAuthors,
l.libraryTabNarrators,
- if (_showLists) 'Lists',
+ 'Lists',
];
return Center(
child: Padding(
@@ -3261,8 +3239,7 @@ class LibraryScreenState extends State<LibraryScreen>
// the SearchBar inside binds to the screen-level _focusNode. Inactive
// tabs' SearchBars use their own internal focus, avoiding the multi-bind
// bug that left the search bar unresponsive on first tap.
- // If we're somehow on the Lists tab without any lists, fall back to Library.
- final effectiveTab = (_currentTab == 4 && !_showLists) ? 0 : _currentTab;
+ final effectiveTab = _currentTab;
Widget headerFor(int i) =>
_buildHeaderSliver(context, useSharedFocus: i == effectiveTab);
return IndexedStack(
@@ -3279,11 +3256,13 @@ class LibraryScreenState extends State<LibraryScreen>
Widget _buildListsGrid(Widget headerSliver) {
final entries = _sortedLists();
+ final loading = _listsLoadFuture != null;
return LibraryListsTab(
entries: entries,
- // We expect lists (the remembered flag is set) but haven't loaded them
- // yet - show a spinner instead of flashing the empty state.
- isLoading: entries.isEmpty && _cachedHasLists,
+ // Only claim the library has none once a load has actually said so.
+ isLoading: entries.isEmpty && loading && !_listsFailed,
+ hasError: _listsFailed,
+ onRetry: _refreshLists,
coverAspectRatio: _coverAspectRatio,
onOpenCollection: (c) {
final id = c['id'] as String?;
diff --git a/lib/services/api_service.dart b/lib/services/api_service.dart
index 66daee4c..1518af29 100644
--- a/lib/services/api_service.dart
+++ b/lib/services/api_service.dart
@@ -4043,7 +4043,8 @@ class ApiService {
// ── Playlists ──────────────────────────────────────────────────────────
/// GET /api/libraries/:libraryId/playlists
- Future<List<dynamic>> getLibraryPlaylists(String libraryId) async {
+ /// Null means the request failed - see [getLibraryCollections].
+ Future<List<dynamic>?> getLibraryPlaylists(String libraryId) async {
try {
final resp = await _authGet(
Uri.parse('$_cleanBaseUrl/api/libraries/$libraryId/playlists'),
@@ -4052,8 +4053,11 @@ class ApiService {
final data = jsonDecode(resp.body);
return (data['results'] as List<dynamic>?) ?? [];
}
- } catch (_) {}
- return [];
+ debugPrint('[API] getLibraryPlaylists failed: HTTP ${resp.statusCode}');
+ } catch (e) {
+ debugPrint('[API] getLibraryPlaylists error: $e');
+ }
+ return null;
}
/// GET /api/playlists/:id
@@ -4165,7 +4169,9 @@ class ApiService {
// ── Collections ────────────────────────────────────────────────────────
/// GET /api/libraries/:libraryId/collections
- Future<List<dynamic>> getLibraryCollections(String libraryId) async {
+ /// Null means the request failed, which is not the same as a library with no
+ /// collections - the Lists tab tells the user which of the two happened.
+ Future<List<dynamic>?> getLibraryCollections(String libraryId) async {
try {
final resp = await _authGet(
Uri.parse('$_cleanBaseUrl/api/libraries/$libraryId/collections'),
@@ -4174,8 +4180,11 @@ class ApiService {
final data = jsonDecode(resp.body);
return (data['results'] as List<dynamic>?) ?? [];
}
- } catch (_) {}
- return [];
+ debugPrint('[API] getLibraryCollections failed: HTTP ${resp.statusCode}');
+ } catch (e) {
+ debugPrint('[API] getLibraryCollections error: $e');
+ }
+ return null;
}
/// GET /api/collections/:id
diff --git a/lib/widgets/library_lists_tab.dart b/lib/widgets/library_lists_tab.dart
index 484e62d1..8bc49830 100644
--- a/lib/widgets/library_lists_tab.dart
+++ b/lib/widgets/library_lists_tab.dart
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
+import '../l10n/app_localizations.dart';
import '../screens/library_screen.dart';
import 'library_grid_tiles.dart';
@@ -12,6 +13,10 @@ class LibraryListsTab extends StatelessWidget {
final void Function(Map<String, dynamic>) onOpenCollection;
final void Function(Map<String, dynamic>) onOpenPlaylist;
final Future<void> Function() onRefresh;
+ /// The lists couldn't be loaded, which is a different thing from having
+ /// none - the tab says so rather than claiming the library is empty.
+ final bool hasError;
+ final Future<void> Function()? onRetry;
final Widget? headerSliver;
final ScrollController? scrollController;
@@ -23,6 +28,8 @@ class LibraryListsTab extends StatelessWidget {
required this.onOpenPlaylist,
required this.onRefresh,
this.isLoading = false,
+ this.hasError = false,
+ this.onRetry,
this.headerSliver,
this.scrollController,
});
@@ -52,6 +59,7 @@ class LibraryListsTab extends StatelessWidget {
Widget build(BuildContext context) {
final cs = Theme.of(context).colorScheme;
final tt = Theme.of(context).textTheme;
+ final l = AppLocalizations.of(context)!;
final headers = <Widget>[if (headerSliver != null) headerSliver!];
Widget body;
@@ -69,13 +77,37 @@ class LibraryListsTab extends StatelessWidget {
: Column(
mainAxisSize: MainAxisSize.min,
children: [
- Icon(Icons.collections_bookmark_outlined,
+ Icon(
+ hasError
+ ? Icons.cloud_off_rounded
+ : Icons.collections_bookmark_outlined,
size: 56,
color: cs.onSurfaceVariant.withValues(alpha: 0.3)),
const SizedBox(height: 12),
- Text('No collections or playlists',
+ Text(hasError ? l.listsLoadFailed : l.listsNone,
style: tt.bodyLarge
?.copyWith(color: cs.onSurfaceVariant)),
+ const SizedBox(height: 6),
+ Padding(
+ padding:
+ const EdgeInsets.symmetric(horizontal: 40),
+ child: Text(
+ hasError
+ ? l.listsLoadFailedHint
+ : l.listsNoneHint,
+ textAlign: TextAlign.center,
+ style: tt.bodySmall?.copyWith(
+ color: cs.onSurfaceVariant
+ .withValues(alpha: 0.7)),
+ ),
+ ),
+ if (hasError && onRetry != null) ...[
+ const SizedBox(height: 16),
+ FilledButton.tonal(
+ onPressed: () => onRetry!(),
+ child: Text(l.retry),
+ ),
+ ],
],
),
),