A cross platform Audiobookshelf client for Android and iOS
Dart
Keep the last book fully visible at the end of home shelves
Barnabas024259b3faf1
diff --git a/lib/widgets/home_section.dart b/lib/widgets/home_section.dartindex 751abaaa..c494202b 100644--- a/lib/widgets/home_section.dart+++ b/lib/widgets/home_section.dart@@ -203,10 +203,15 @@ class _SnapScrollListState extends State<_SnapScrollList> {return NotificationListener<ScrollEndNotification>(onNotification: (notification) {+ final maxExtent = _controller.position.maxScrollExtent;final offset = _controller.offset;final targetIndex = (offset / itemExtent).round();- final targetOffset =- (targetIndex * itemExtent).clamp(0.0, _controller.position.maxScrollExtent);+ var targetOffset = (targetIndex * itemExtent).toDouble();+ // The last card can't left-align (no content after it), so snapping in+ // the final stretch leaves it cut off the right edge. Rest at the true+ // end instead so the last card stays fully visible.+ if (targetOffset > maxExtent - itemExtent) targetOffset = maxExtent;+ targetOffset = targetOffset.clamp(0.0, maxExtent);if ((offset - targetOffset).abs() > 1) {Future.microtask(() {if (_controller.hasClients) {