From 1b1e82ebbd642da90ee251002b9cfc74e1abd7c6 Mon Sep 17 00:00:00 2001 From: ashilkn Date: Tue, 15 Jul 2025 12:07:38 +0530 Subject: [PATCH] Add bottom padding to new gallery scrollbar --- .../scrollbar/custom_scroll_bar_2.dart | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/custom_scroll_bar_2.dart b/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/custom_scroll_bar_2.dart index 57a82cc6d1..c5b868cdd4 100644 --- a/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/custom_scroll_bar_2.dart +++ b/mobile/apps/photos/lib/ui/viewer/gallery/scrollbar/custom_scroll_bar_2.dart @@ -39,6 +39,7 @@ class _CustomScrollBar2State extends State { final _key = GlobalKey(); final inUseNotifier = ValueNotifier(false); List<({double position, String title})>? positionToTitleMap; + static const _bottomPadding = 92.0; @override void initState() { @@ -103,10 +104,12 @@ class _CustomScrollBar2State extends State { final renderBox = _key.currentContext?.findRenderObject() as RenderBox?; assert(renderBox != null, "RenderBox is null"); // Retry for : https://github.com/flutter/flutter/issues/25827 - return MiscUtil().getNonZeroDoubleWithRetry( - () => renderBox!.size.height, - id: "getHeightOfScrollTrack", - ); + return MiscUtil() + .getNonZeroDoubleWithRetry( + () => renderBox!.size.height, + id: "getHeightOfScrollTrack", + ) + .then((value) => value - _bottomPadding); } @override @@ -115,12 +118,18 @@ class _CustomScrollBar2State extends State { clipBehavior: Clip.none, alignment: Alignment.centerLeft, children: [ - ScrollbarWithUseNotifer( - key: _key, - controller: widget.scrollController, - interactive: true, - inUseNotifier: inUseNotifier, - child: widget.child, + // This media query is used to adjust the bottom padding of the scrollbar + MediaQuery( + data: MediaQuery.of(context).copyWith( + padding: const EdgeInsets.only(bottom: _bottomPadding), + ), + child: ScrollbarWithUseNotifer( + key: _key, + controller: widget.scrollController, + interactive: true, + inUseNotifier: inUseNotifier, + child: widget.child, + ), ), positionToTitleMap == null ? const SizedBox.shrink()