diff --git a/demo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux b/demo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux new file mode 120000 index 000000000..ab6707853 --- /dev/null +++ b/demo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux @@ -0,0 +1 @@ +/home/leo/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.1/ \ No newline at end of file diff --git a/lib/src/manager/state/layout_state.dart b/lib/src/manager/state/layout_state.dart index 0732270bb..3a6aaca38 100644 --- a/lib/src/manager/state/layout_state.dart +++ b/lib/src/manager/state/layout_state.dart @@ -89,6 +89,10 @@ abstract class ILayoutState { double get scrollOffsetByFrozenColumn; + bool get needsVerticalScrollbarSpace; + + bool get needsHorizontalScrollbarSpace; + TextDirection get textDirection; bool get isLTR; diff --git a/lib/src/ui/pluto_body_columns.dart b/lib/src/ui/pluto_body_columns.dart index 417c34a11..81028c71f 100644 --- a/lib/src/ui/pluto_body_columns.dart +++ b/lib/src/ui/pluto_body_columns.dart @@ -106,7 +106,9 @@ class PlutoBodyColumnsState extends PlutoStateWithChange { @override Widget build(BuildContext context) { - return SingleChildScrollView( + final scrollbarConfig = stateManager.configuration.scrollbar; + + Widget header = SingleChildScrollView( controller: _scroll, scrollDirection: Axis.horizontal, physics: const ClampingScrollPhysics(), @@ -125,6 +127,17 @@ class PlutoBodyColumnsState extends PlutoStateWithChange { : _columns.map(_makeColumn).toList(growable: false), ), ); + + if (scrollbarConfig.draggableScrollbar) { + header = Padding( + padding: EdgeInsetsDirectional.only( + end: scrollbarConfig.hoverWidth, + ), + child: header, + ); + } + + return header; } } diff --git a/lib/src/ui/pluto_body_columns_footer.dart b/lib/src/ui/pluto_body_columns_footer.dart index 264747485..be25fb317 100644 --- a/lib/src/ui/pluto_body_columns_footer.dart +++ b/lib/src/ui/pluto_body_columns_footer.dart @@ -73,7 +73,9 @@ class PlutoBodyColumnsFooterState @override Widget build(BuildContext context) { - return SingleChildScrollView( + final scrollbarConfig = stateManager.configuration.scrollbar; + + Widget footer = SingleChildScrollView( controller: _scroll, scrollDirection: Axis.horizontal, physics: const ClampingScrollPhysics(), @@ -88,6 +90,17 @@ class PlutoBodyColumnsFooterState children: _columns.map(_makeFooter).toList(growable: false), ), ); + + if (scrollbarConfig.draggableScrollbar) { + footer = Padding( + padding: EdgeInsetsDirectional.only( + end: scrollbarConfig.hoverWidth, + ), + child: footer, + ); + } + + return footer; } } diff --git a/lib/src/widgets/pluto_scrollbar.dart b/lib/src/widgets/pluto_scrollbar.dart index 9106c56f0..0e75629f9 100644 --- a/lib/src/widgets/pluto_scrollbar.dart +++ b/lib/src/widgets/pluto_scrollbar.dart @@ -52,6 +52,8 @@ class PlutoScrollbar extends StatefulWidget { this.radius = defaultRadius, this.radiusWhileDragging = defaultRadiusWhileDragging, required this.child, + this.reserveSpaceForVerticalScroll = false, + this.reserveSpaceForHorizontalScroll = false, }) : assert(thickness < double.infinity), assert(thicknessWhileDragging < double.infinity), assert(!isAlwaysShown || @@ -95,6 +97,10 @@ class PlutoScrollbar extends StatefulWidget { final Widget child; + final bool reserveSpaceForVerticalScroll; + + final bool reserveSpaceForHorizontalScroll; + static const double defaultThickness = 3; static const double defaultThicknessWhileDragging = 8.0; @@ -578,10 +584,30 @@ class PlutoGridCupertinoScrollbarState extends State @override Widget build(BuildContext context) { - Widget child = CustomPaint( + final bool hasVerticalScrollbar = widget.verticalController != null; + + final bool hasHorizontalScrollbar = widget.horizontalController != null; + + Widget child = widget.child; + + final double endPadding = hasVerticalScrollbar ? widget.hoverWidth : 0.0; + final double bottomPadding = + hasHorizontalScrollbar ? widget.hoverWidth : 0.0; + + if (endPadding > 0 || bottomPadding > 0) { + child = Padding( + padding: EdgeInsetsDirectional.only( + end: endPadding, + bottom: bottomPadding, + ), + child: child, + ); + } + + child = CustomPaint( key: _customPaintKey, foregroundPainter: _painter, - child: RepaintBoundary(child: widget.child), + child: RepaintBoundary(child: child), ); if (widget.enableHover) {