Skip to content

A cross platform Audiobookshelf client for Android and iOS

Dart

Fix bottom sheet overflow and dismiss behavior

Nathan Poulsona467efda72f8
diff --git a/lib/widgets/absorbing_card.dart b/lib/widgets/absorbing_card.dart
index a3db1724..34dbb520 100644
--- a/lib/widgets/absorbing_card.dart
+++ b/lib/widgets/absorbing_card.dart
@@ -1005,7 +1005,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
Navigator.pop(ctx);
showModalBottomSheet(context: context, backgroundColor: Colors.transparent, isScrollControlled: true, useSafeArea: true,
builder: (_) => DraggableScrollableSheet(
- initialChildSize: 0.6, minChildSize: 0.05, maxChildSize: 0.9, expand: false,
+ initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9, expand: false,
builder: (_, sc) => SimpleBookmarkSheet(itemId: _itemId, player: widget.player, accent: accent, scrollController: sc, onChanged: () {}),
),
);
@@ -1111,7 +1111,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
context: context, isScrollControlled: true, useSafeArea: true,
backgroundColor: Colors.transparent,
builder: (ctx) => DraggableScrollableSheet(
- expand: false, initialChildSize: 0.6, minChildSize: 0.05, maxChildSize: 0.9,
+ expand: false, initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9,
builder: (_, sc) => Container(
decoration: BoxDecoration(
color: Theme.of(context).bottomSheetTheme.backgroundColor,
@@ -1171,7 +1171,7 @@ class AbsorbingCardState extends State<AbsorbingCard> with AutomaticKeepAliveCli
context: context, isScrollControlled: true, useSafeArea: true,
backgroundColor: Colors.transparent,
builder: (ctx) => DraggableScrollableSheet(
- expand: false, initialChildSize: 0.6, minChildSize: 0.05, maxChildSize: 0.9,
+ expand: false, initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9,
builder: (_, sc) => Container(
decoration: BoxDecoration(
color: Theme.of(context).bottomSheetTheme.backgroundColor,
diff --git a/lib/widgets/book_detail_sheet.dart b/lib/widgets/book_detail_sheet.dart
index 22d8915d..bff8829c 100644
--- a/lib/widgets/book_detail_sheet.dart
+++ b/lib/widgets/book_detail_sheet.dart
@@ -29,7 +29,7 @@ void showBookDetailSheet(BuildContext context, String itemId) {
context: context, isScrollControlled: true, useSafeArea: true,
backgroundColor: Colors.transparent,
builder: (ctx) => DraggableScrollableSheet(
- expand: false, initialChildSize: 0.85, minChildSize: 0.05, maxChildSize: 0.95,
+ expand: false, initialChildSize: 0.85, minChildSize: 0.05, snap: true, maxChildSize: 0.95,
builder: (ctx, sc) => _BookDetailSheetContent(itemId: itemId, scrollController: sc),
),
);
@@ -769,7 +769,7 @@ class _BookDetailSheetContentState extends State<_BookDetailSheetContent> {
builder: (_) => DraggableScrollableSheet(
expand: false,
initialChildSize: 0.85,
- minChildSize: 0.05,
+ minChildSize: 0.05, snap: true,
maxChildSize: 0.95,
builder: (ctx, sc) => MetadataLookupSheet(
itemId: widget.itemId,
diff --git a/lib/widgets/card_buttons.dart b/lib/widgets/card_buttons.dart
index 4fe9e3a7..8fc1e6ef 100644
--- a/lib/widgets/card_buttons.dart
+++ b/lib/widgets/card_buttons.dart
@@ -260,7 +260,7 @@ class _CardBookmarkButtonInlineState extends State<CardBookmarkButtonInline> {
showModalBottomSheet(
context: context, backgroundColor: Colors.transparent, isScrollControlled: true, useSafeArea: true,
builder: (ctx) => DraggableScrollableSheet(
- initialChildSize: 0.6, minChildSize: 0.05, maxChildSize: 0.9, expand: false,
+ initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9, expand: false,
builder: (ctx, sc) => SimpleBookmarkSheet(itemId: widget.itemId, player: widget.player, accent: widget.accent, scrollController: sc, onChanged: _loadCount),
),
);
diff --git a/lib/widgets/episode_list_sheet.dart b/lib/widgets/episode_list_sheet.dart
index e27887d5..aaf0495e 100644
--- a/lib/widgets/episode_list_sheet.dart
+++ b/lib/widgets/episode_list_sheet.dart
@@ -31,7 +31,7 @@ class EpisodeListSheet extends StatefulWidget {
backgroundColor: Colors.transparent,
builder: (_) => DraggableScrollableSheet(
initialChildSize: 0.85,
- minChildSize: 0.05,
+ minChildSize: 0.05, snap: true,
maxChildSize: 0.95,
expand: false,
builder: (_, scrollController) => EpisodeListSheet._(
@@ -461,7 +461,7 @@ class EpisodeDetailSheet extends StatefulWidget {
backgroundColor: Colors.transparent,
builder: (_) => DraggableScrollableSheet(
initialChildSize: 0.75,
- minChildSize: 0.05,
+ minChildSize: 0.05, snap: true,
maxChildSize: 0.95,
expand: false,
builder: (_, scrollController) => EpisodeDetailSheet._(
diff --git a/lib/widgets/equalizer_sheet.dart b/lib/widgets/equalizer_sheet.dart
index 79273587..f3220794 100644
--- a/lib/widgets/equalizer_sheet.dart
+++ b/lib/widgets/equalizer_sheet.dart
@@ -11,7 +11,7 @@ void showEqualizerSheet(BuildContext context, Color accent) {
builder: (ctx) => DraggableScrollableSheet(
expand: false,
initialChildSize: 0.75,
- minChildSize: 0.05,
+ minChildSize: 0.05, snap: true,
maxChildSize: 0.92,
builder: (ctx, sc) => _EqualizerSheetContent(accent: accent, scrollController: sc),
),
diff --git a/lib/widgets/expanded_card.dart b/lib/widgets/expanded_card.dart
index 5666d401..9293654d 100644
--- a/lib/widgets/expanded_card.dart
+++ b/lib/widgets/expanded_card.dart
@@ -1107,7 +1107,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
Navigator.pop(ctx);
showModalBottomSheet(context: context, backgroundColor: Colors.transparent, isScrollControlled: true, useSafeArea: true,
builder: (_) => DraggableScrollableSheet(
- initialChildSize: 0.6, minChildSize: 0.05, maxChildSize: 0.9, expand: false,
+ initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9, expand: false,
builder: (_, sc) => SimpleBookmarkSheet(itemId: _itemId, player: widget.player, accent: accent, scrollController: sc, onChanged: () {}),
),
);
@@ -1215,7 +1215,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
context: context, isScrollControlled: true, useSafeArea: true,
backgroundColor: Colors.transparent,
builder: (ctx) => DraggableScrollableSheet(
- expand: false, initialChildSize: 0.6, minChildSize: 0.05, maxChildSize: 0.9,
+ expand: false, initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9,
builder: (_, sc) => Container(
decoration: BoxDecoration(
color: Theme.of(context).bottomSheetTheme.backgroundColor,
@@ -1275,7 +1275,7 @@ class _ExpandedCardState extends State<ExpandedCard> {
context: context, isScrollControlled: true, useSafeArea: true,
backgroundColor: Colors.transparent,
builder: (ctx) => DraggableScrollableSheet(
- expand: false, initialChildSize: 0.6, minChildSize: 0.05, maxChildSize: 0.9,
+ expand: false, initialChildSize: 0.6, minChildSize: 0.05, snap: true, maxChildSize: 0.9,
builder: (_, sc) => Container(
decoration: BoxDecoration(
color: Theme.of(context).bottomSheetTheme.backgroundColor,
diff --git a/lib/widgets/library_search_results.dart b/lib/widgets/library_search_results.dart
index 6c6cc799..f5bca56b 100644
--- a/lib/widgets/library_search_results.dart
+++ b/lib/widgets/library_search_results.dart
@@ -324,7 +324,7 @@ class AuthorResultTile extends StatelessWidget {
showDragHandle: true,
builder: (_) => DraggableScrollableSheet(
initialChildSize: 0.7,
- minChildSize: 0.05,
+ minChildSize: 0.05, snap: true,
maxChildSize: 0.9,
expand: false,
builder: (ctx, scrollController) => AuthorBooksSheet(
diff --git a/lib/widgets/series_books_sheet.dart b/lib/widgets/series_books_sheet.dart
index 793aa16d..4a84d293 100644
--- a/lib/widgets/series_books_sheet.dart
+++ b/lib/widgets/series_books_sheet.dart
@@ -23,7 +23,7 @@ void showSeriesBooksSheet(BuildContext context, {
showDragHandle: true,
builder: (_) => DraggableScrollableSheet(
initialChildSize: 0.7,
- minChildSize: 0.05,
+ minChildSize: 0.05, snap: true,
maxChildSize: 0.9,
expand: false,
builder: (ctx, scrollController) => SeriesBooksSheet(
@@ -222,7 +222,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
final seriesProgress = totalDuration > 0 ? (listenedDuration / totalDuration).clamp(0.0, 1.0) : 0.0;
final seriesPercent = (seriesProgress * 100).round();
- return Column(
+ return ClipRect(child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
@@ -613,7 +613,7 @@ class _SeriesBooksSheetState extends State<SeriesBooksSheet> {
),
),
],
- );
+ ));
}
Widget _placeholder(ColorScheme cs) {