Skip to content

Commit

Permalink
fix for issue #15
Browse files Browse the repository at this point in the history
  • Loading branch information
suragch committed Aug 2, 2021
1 parent 89cb47d commit 1fa1ac4
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [0.7.0] - August 2, 2021

* Reverted back to centering the thumb at the ends because otherwise it wouldn't move for the first and last few seconds. (#15)
* The thumb radius is not included in the widget width calculations when the labels are above or below. That means it will get drawn outside of the widget dimentions (which was already true for the glow radius). Users can wrap the widget with Padding if more padding is needed on the ends.

## [0.6.2] - July 30, 2021

* Initialize the thumb position based on progress and total time. This allows compatibily with the `Visibility` even when not maintaining state. (#12)
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.6.2"
version: "0.7.0"
boolean_selector:
dependency: transitive
description:
Expand Down
18 changes: 8 additions & 10 deletions lib/audio_video_progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ class _RenderProgressBar extends RenderBox {
// time as a [progress] update there won't be a conflict.
bool _userIsDraggingThumb = false;

// This padding is always used between the time labels and the progress bar
// when the time labels are on the sides. Any user defined [timeLabelPadding]
// is in addition to this.
double get _defaultSidePadding => thumbRadius + 5;

void _onDragStart(DragStartDetails details) {
_userIsDraggingThumb = true;
_updateThumbPosition(details.localPosition);
Expand Down Expand Up @@ -533,11 +538,6 @@ class _RenderProgressBar extends RenderBox {
markNeedsLayout();
}

// This padding is always used between the time labels and the progress bar
// when the time labels are on the sides. Any user defined [timeLabelPadding]
// is in addition to this.
static const _defaultSidePadding = 10;

// The smallest that this widget would ever want to be.
static const _minDesiredWidth = 100.0;

Expand Down Expand Up @@ -631,7 +631,7 @@ class _RenderProgressBar extends RenderBox {
canvas.restore();
}

/// Draw the progress bar and labels like this:
/// Draw the progress bar and labels vertically aligned:
///
/// | -------O---------------- |
/// | 01:23 05:00 |
Expand Down Expand Up @@ -666,7 +666,7 @@ class _RenderProgressBar extends RenderBox {
_drawProgressBar(canvas, Offset(0, barDy), Size(barWidth, barHeight));
}

/// Draw the progress bar and labels in the following locations:
/// Draw the progress bar and labels horizontally aligned:
///
/// | 01:23 -------O---------------- 05:00 |
///
Expand Down Expand Up @@ -763,9 +763,7 @@ class _RenderProgressBar extends RenderBox {

void _drawThumb(Canvas canvas, Size localSize) {
final thumbPaint = Paint()..color = thumbColor;
final width = localSize.width;
final thumbDx =
(_thumbValue * width).clamp(_thumbRadius, width - _thumbRadius);
final thumbDx = _thumbValue * localSize.width;
final center = Offset(thumbDx, localSize.height / 2);
if (_userIsDraggingThumb) {
final thumbGlowPaint = Paint()..color = thumbGlowColor;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ packages:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "1.0.4"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: audio_video_progress_bar
description: A progress bar widget to show or change the position of an audio or
video stream.
version: 0.6.2
version: 0.7.0
homepage: https://github.com/suragch/audio_video_progress_bar

environment:
Expand All @@ -13,7 +13,7 @@ dependencies:
sdk: flutter

dev_dependencies:
flutter_lints: ^1.0.3
flutter_lints: ^1.0.4
flutter_test:
sdk: flutter

Expand Down

0 comments on commit 1fa1ac4

Please sign in to comment.