diff --git a/CHANGELOG.md b/CHANGELOG.md index 921e342..bb76944 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/example/pubspec.lock b/example/pubspec.lock index a50b2cc..0670341 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -21,7 +21,7 @@ packages: path: ".." relative: true source: path - version: "0.6.2" + version: "0.7.0" boolean_selector: dependency: transitive description: diff --git a/lib/audio_video_progress_bar.dart b/lib/audio_video_progress_bar.dart index c43ca84..1302ea1 100644 --- a/lib/audio_video_progress_bar.dart +++ b/lib/audio_video_progress_bar.dart @@ -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); @@ -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; @@ -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 | @@ -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 | /// @@ -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; diff --git a/pubspec.lock b/pubspec.lock index 2439a04..03af40d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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 diff --git a/pubspec.yaml b/pubspec.yaml index 359aba2..3dfa4d8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: @@ -13,7 +13,7 @@ dependencies: sdk: flutter dev_dependencies: - flutter_lints: ^1.0.3 + flutter_lints: ^1.0.4 flutter_test: sdk: flutter