diff --git a/example/lib/main.dart b/example/lib/main.dart index 01aa7c2..1565024 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -212,6 +212,7 @@ class CustomDemo extends StatelessWidget { backgroundColor: Colors.blue, scrollThumbBuilder: ( Color backgroundColor, + Color foregroundColor, Animation thumbAnimation, Animation labelAnimation, double height, { diff --git a/lib/draggable_scrollbar.dart b/lib/draggable_scrollbar.dart index 9573486..55fdcc4 100755 --- a/lib/draggable_scrollbar.dart +++ b/lib/draggable_scrollbar.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; /// Build the Scroll Thumb and label using the current configuration typedef Widget ScrollThumbBuilder( Color backgroundColor, + Color foregroundColor, Animation thumbAnimation, Animation labelAnimation, double height, { @@ -31,6 +32,9 @@ class DraggableScrollbar extends StatefulWidget { /// The background color of the label and thumb final Color backgroundColor; + /// The color of the foreground + final Color foregroundColor; + /// The amount of padding that should surround the thumb final EdgeInsetsGeometry padding; @@ -60,6 +64,7 @@ class DraggableScrollbar extends StatefulWidget { @required this.scrollThumbBuilder, @required this.child, @required this.controller, + this.foregroundColor, this.padding, this.scrollbarAnimationDuration = const Duration(milliseconds: 300), this.scrollbarTimeToFade = const Duration(milliseconds: 600), @@ -78,6 +83,7 @@ class DraggableScrollbar extends StatefulWidget { @required this.controller, this.heightScrollThumb = 48.0, this.backgroundColor = Colors.white, + this.foregroundColor = Colors.grey, this.padding, this.scrollbarAnimationDuration = const Duration(milliseconds: 300), this.scrollbarTimeToFade = const Duration(milliseconds: 600), @@ -96,6 +102,7 @@ class DraggableScrollbar extends StatefulWidget { @required this.controller, this.heightScrollThumb = 48.0, this.backgroundColor = Colors.white, + this.foregroundColor = Colors.grey, this.padding, this.scrollbarAnimationDuration = const Duration(milliseconds: 300), this.scrollbarTimeToFade = const Duration(milliseconds: 600), @@ -114,6 +121,7 @@ class DraggableScrollbar extends StatefulWidget { @required this.controller, this.heightScrollThumb = 48.0, this.backgroundColor = Colors.white, + this.foregroundColor = Colors.grey, this.padding, this.scrollbarAnimationDuration = const Duration(milliseconds: 300), this.scrollbarTimeToFade = const Duration(milliseconds: 600), @@ -164,6 +172,7 @@ class DraggableScrollbar extends StatefulWidget { double width, Key scrollThumbKey, bool alwaysVisibleScrollThumb) { return ( Color backgroundColor, + Color foregroundColor, Animation thumbAnimation, Animation labelAnimation, double height, { @@ -172,7 +181,7 @@ class DraggableScrollbar extends StatefulWidget { }) { final scrollThumb = CustomPaint( key: scrollThumbKey, - foregroundPainter: ArrowCustomPainter(Colors.grey), + foregroundPainter: ArrowCustomPainter(foregroundColor), child: Material( elevation: 4.0, child: Container( @@ -204,6 +213,7 @@ class DraggableScrollbar extends StatefulWidget { Key scrollThumbKey, bool alwaysVisibleScrollThumb) { return ( Color backgroundColor, + Color foregroundColor, Animation thumbAnimation, Animation labelAnimation, double height, { @@ -240,6 +250,7 @@ class DraggableScrollbar extends StatefulWidget { Key scrollThumbKey, bool alwaysVisibleScrollThumb) { return ( Color backgroundColor, + Color foregroundColor, Animation thumbAnimation, Animation labelAnimation, double height, { @@ -397,6 +408,7 @@ class _DraggableScrollbarState extends State padding: widget.padding, child: widget.scrollThumbBuilder( widget.backgroundColor, + widget.foregroundColor, _thumbAnimation, _labelAnimation, widget.heightScrollThumb,