Skip to content

added foreground color #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class CustomDemo extends StatelessWidget {
backgroundColor: Colors.blue,
scrollThumbBuilder: (
Color backgroundColor,
Color foregroundColor,
Animation<double> thumbAnimation,
Animation<double> labelAnimation,
double height, {
Expand Down
14 changes: 13 additions & 1 deletion lib/draggable_scrollbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<double> thumbAnimation,
Animation<double> labelAnimation,
double height, {
Expand All @@ -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;

Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -164,6 +172,7 @@ class DraggableScrollbar extends StatefulWidget {
double width, Key scrollThumbKey, bool alwaysVisibleScrollThumb) {
return (
Color backgroundColor,
Color foregroundColor,
Animation<double> thumbAnimation,
Animation<double> labelAnimation,
double height, {
Expand All @@ -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(
Expand Down Expand Up @@ -204,6 +213,7 @@ class DraggableScrollbar extends StatefulWidget {
Key scrollThumbKey, bool alwaysVisibleScrollThumb) {
return (
Color backgroundColor,
Color foregroundColor,
Animation<double> thumbAnimation,
Animation<double> labelAnimation,
double height, {
Expand Down Expand Up @@ -240,6 +250,7 @@ class DraggableScrollbar extends StatefulWidget {
Key scrollThumbKey, bool alwaysVisibleScrollThumb) {
return (
Color backgroundColor,
Color foregroundColor,
Animation<double> thumbAnimation,
Animation<double> labelAnimation,
double height, {
Expand Down Expand Up @@ -397,6 +408,7 @@ class _DraggableScrollbarState extends State<DraggableScrollbar>
padding: widget.padding,
child: widget.scrollThumbBuilder(
widget.backgroundColor,
widget.foregroundColor,
_thumbAnimation,
_labelAnimation,
widget.heightScrollThumb,
Expand Down