Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Add text labels to bookmark sort buttons, compact sheet button

Nathan Poulson3982151cd39d
diff --git a/lib/screens/bookmarks_screen.dart b/lib/screens/bookmarks_screen.dart
index 80a5b553..92347c49 100644
--- a/lib/screens/bookmarks_screen.dart
+++ b/lib/screens/bookmarks_screen.dart
@@ -359,17 +359,8 @@ class _BookmarksScreenState extends State<BookmarksScreen> {
)
else ...[
if (_allBookmarks.isNotEmpty) ...[
- IconButton(
- icon: Icon(
- _sort == 'newest' ? Icons.schedule_rounded
- : _sort == 'position' ? Icons.arrow_upward_rounded
- : Icons.arrow_downward_rounded,
- color: cs.onSurfaceVariant,
- ),
- tooltip: _sort == 'newest' ? 'Sorted by newest'
- : _sort == 'position' ? 'Sorted by position'
- : 'Sorted by position (reversed)',
- onPressed: () {
+ GestureDetector(
+ onTap: () {
final next = _sort == 'newest' ? 'position'
: _sort == 'position' ? 'position_desc'
: 'newest';
@@ -377,6 +368,29 @@ class _BookmarksScreenState extends State<BookmarksScreen> {
PlayerSettings.setBookmarkSort(next);
_load();
},
+ child: Container(
+ height: 32,
+ padding: const EdgeInsets.symmetric(horizontal: 10),
+ decoration: BoxDecoration(
+ color: cs.onSurface.withValues(alpha: 0.06),
+ borderRadius: BorderRadius.circular(8),
+ ),
+ child: Row(mainAxisSize: MainAxisSize.min, children: [
+ Icon(
+ _sort == 'newest' ? Icons.schedule_rounded
+ : _sort == 'position' ? Icons.arrow_upward_rounded
+ : Icons.arrow_downward_rounded,
+ color: cs.onSurfaceVariant, size: 16,
+ ),
+ const SizedBox(width: 4),
+ Text(
+ _sort == 'newest' ? 'Newest'
+ : _sort == 'position' ? 'Position'
+ : 'Position',
+ style: Theme.of(context).textTheme.labelSmall?.copyWith(color: cs.onSurfaceVariant),
+ ),
+ ]),
+ ),
),
IconButton(
icon: Icon(Icons.checklist_rounded, color: cs.onSurfaceVariant),
diff --git a/lib/widgets/card_buttons.dart b/lib/widgets/card_buttons.dart
index 47bd1d21..9d1f1bd1 100644
--- a/lib/widgets/card_buttons.dart
+++ b/lib/widgets/card_buttons.dart
@@ -19,6 +19,7 @@ import 'episode_detail_sheet.dart';
import 'episode_list_sheet.dart';
import 'equalizer_sheet.dart';
import 'notes_sheet.dart';
+import 'overlay_toast.dart';
import 'sleep_timer_sheet.dart';
/// Wrapper that gives any child a press-down opacity+scale effect.
@@ -69,13 +70,7 @@ void showInactiveToast(BuildContext context) {
/// Show an error message to the user.
void showErrorSnackBar(BuildContext context, String message) {
- ScaffoldMessenger.of(context)
- ..clearSnackBars()
- ..showSnackBar(SnackBar(
- content: Text(message),
- duration: const Duration(seconds: 4),
- behavior: SnackBarBehavior.floating,
- ));
+ showOverlayToast(context, message, icon: Icons.error_outline_rounded);
}
// ─── WIDE GLASS BUTTON (for 2-column grid) ─────────────────
@@ -596,14 +591,19 @@ class _SimpleBookmarkSheetState extends State<SimpleBookmarkSheet> {
PlayerSettings.setBookmarkSort(next);
_load();
},
- child: Container(
- width: 36, height: 36,
- decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(10)),
- child: Icon(
- _sort == 'newest' ? Icons.schedule_rounded
- : _sort == 'position' ? Icons.arrow_upward_rounded
- : Icons.arrow_downward_rounded,
- color: cs.onSurfaceVariant, size: 20,
+ child: Tooltip(
+ message: _sort == 'newest' ? 'Sorted by newest'
+ : _sort == 'position' ? 'Sorted by position'
+ : 'Sorted by position (reversed)',
+ child: Container(
+ width: 36, height: 36,
+ decoration: BoxDecoration(color: cs.onSurface.withValues(alpha: 0.06), borderRadius: BorderRadius.circular(10)),
+ child: Icon(
+ _sort == 'newest' ? Icons.schedule_rounded
+ : _sort == 'position' ? Icons.arrow_upward_rounded
+ : Icons.arrow_downward_rounded,
+ color: cs.onSurfaceVariant, size: 20,
+ ),
),
),
),