album: fixed padding around scroll thumb
This commit is contained in:
parent
af7f5536ac
commit
5768b8a056
2 changed files with 30 additions and 18 deletions
|
@ -45,6 +45,16 @@ class ThumbnailCollectionContent extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final bottomInsets = MediaQuery.of(context).viewInsets.bottom;
|
final bottomInsets = MediaQuery.of(context).viewInsets.bottom;
|
||||||
final sectionKeys = _sections.keys.toList();
|
final sectionKeys = _sections.keys.toList();
|
||||||
|
double topPadding = 0;
|
||||||
|
if (appBar != null) {
|
||||||
|
final topWidget = appBar;
|
||||||
|
if (topWidget is PreferredSizeWidget) {
|
||||||
|
topPadding = topWidget.preferredSize.height;
|
||||||
|
} else if (topWidget is SliverAppBar) {
|
||||||
|
topPadding = kToolbarHeight + (topWidget.bottom?.preferredSize?.height ?? 0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: DraggableScrollbar.arrows(
|
child: DraggableScrollbar.arrows(
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
|
@ -68,7 +78,7 @@ class ThumbnailCollectionContent extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
padding: EdgeInsets.only(bottom: bottomInsets),
|
padding: EdgeInsets.only(top: topPadding, bottom: bottomInsets),
|
||||||
labelTextBuilder: (double offset) => Text(
|
labelTextBuilder: (double offset) => Text(
|
||||||
"${offset ~/ 1}",
|
"${offset ~/ 1}",
|
||||||
style: TextStyle(color: Colors.blueGrey),
|
style: TextStyle(color: Colors.blueGrey),
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// TLAD: copied from https://pub.dev/packages/draggable_scrollbar 0.0.4
|
/// TLAD: copied from https://pub.dev/packages/draggable_scrollbar 0.0.4
|
||||||
/// modified to allow any `ScrollView` as a child, not just `BoxScrollView`
|
/// modified to allow any `ScrollView` as a child, not just `BoxScrollView`
|
||||||
|
/// modified to apply vertical padding when computing `barMaxScrollExtent`
|
||||||
|
|
||||||
/// Build the Scroll Thumb and label using the current configuration
|
/// Build the Scroll Thumb and label using the current configuration
|
||||||
typedef Widget ScrollThumbBuilder(
|
typedef Widget ScrollThumbBuilder(
|
||||||
|
@ -343,7 +344,7 @@ class _DraggableScrollbarState extends State<DraggableScrollbar> with TickerProv
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
double get barMaxScrollExtent => context.size.height - widget.heightScrollThumb;
|
double get barMaxScrollExtent => context.size.height - widget.heightScrollThumb - widget.padding.vertical;
|
||||||
|
|
||||||
double get barMinScrollExtent => 0.0;
|
double get barMinScrollExtent => 0.0;
|
||||||
|
|
||||||
|
@ -391,7 +392,8 @@ class _DraggableScrollbarState extends State<DraggableScrollbar> with TickerProv
|
||||||
labelConstraints: widget.labelConstraints,
|
labelConstraints: widget.labelConstraints,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue