Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Show why a clip export failed instead of nothing happening

Barnabas2d3a7c48847f
diff --git a/lib/widgets/clip_editor_sheet.dart b/lib/widgets/clip_editor_sheet.dart
index f2504e1b..121dce5e 100644
--- a/lib/widgets/clip_editor_sheet.dart
+++ b/lib/widgets/clip_editor_sheet.dart
@@ -114,10 +114,23 @@ class _ClipEditorSheetState extends State<ClipEditorSheet> {
debugPrint('[ClipEditor] save failed: $e');
if (!mounted) return;
setState(() => _saving = false);
- messenger.showSnackBar(SnackBar(
- content: Text(l.clipExportFailed),
- behavior: SnackBarBehavior.floating,
- ));
+ // Show the reason in a dialog rather than a SnackBar: the editor is a
+ // bottom sheet, and on iPad a SnackBar shown from within it hides behind
+ // the sheet, so a failure looked like "nothing happened".
+ final detail = e is ClipExportException ? e.message : e.toString();
+ await showDialog<void>(
+ context: context,
+ builder: (ctx) => AlertDialog(
+ title: Text(l.clipExportFailed),
+ content: Text(detail),
+ actions: [
+ TextButton(
+ onPressed: () => Navigator.pop(ctx),
+ child: Text(MaterialLocalizations.of(ctx).okButtonLabel),
+ ),
+ ],
+ ),
+ );
}
}