Skip to content
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

allow to specify small dot scale #94

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
5 changes: 5 additions & 0 deletions lib/src/effects/scrolling_dots_effect.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class ScrollingDotsEffect extends BasicIndicatorEffect {
/// active dot scaling
final double activeDotScale;

/// [smallDotScale] is multiplied by [dotWidth] to resolve
/// side dots
final double smallDotScale;

/// The max number of dots to display at a time
/// if count is <= [maxVisibleDots] [maxVisibleDots] = count
/// must be an odd number that's >= 5
Expand All @@ -30,6 +34,7 @@ class ScrollingDotsEffect extends BasicIndicatorEffect {
const ScrollingDotsEffect({
this.activeStrokeWidth = 1.5,
this.activeDotScale = 1.3,
this.smallDotScale = 0.66,
this.maxVisibleDots = 5,
this.fixedCenter = false,
double offset = 16.0,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/painters/scrolling_dots_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class ScrollingDotsPainter extends BasicIndicatorPainter {
? -(firstVisibleDot * distance)
: -((offset - switchPoint) * distance);

const smallDotScale = 0.66;
final smallDotScale = effect.smallDotScale;
final activeScale = effect.activeDotScale - 1.0;
for (var index = firstVisibleDot; index <= lastVisibleDot; index++) {
var color = effect.dotColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ScrollingDotsWithFixedCenterPainter extends BasicIndicatorPainter {
}

var scale = 1.0;
const smallDotScale = 0.66;
final smallDotScale = effect.smallDotScale;
final revDotOffset = 1 - dotOffset;
final switchPoint = (effect.maxVisibleDots - 1) / 2;

Expand Down