Skip to content
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.1.1

- **Bug Fixes**:
- Fixed `AnimationController.reverse() called after AnimationController.dispose()` when a page with a
`RoundScrollbar` is closed before the auto-hide duration elapses. The fade-out timer is now cancelled in
`dispose()` and its callback checks `mounted`.

## 1.1.0

- **Bug Fixes**:
Expand Down
5 changes: 4 additions & 1 deletion lib/widgets/round_scrollbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,9 @@ class _RoundScrollbarState extends State<RoundScrollbar>
_fadeOutTimer?.cancel();
if (!widget.autoHide) return;
_fadeOutTimer = Timer(widget.autoHideDuration, () {
_opacityController.reverse();
if (mounted) {
_opacityController.reverse();
}
_fadeOutTimer = null;
});
}
Expand Down Expand Up @@ -243,6 +245,7 @@ class _RoundScrollbarState extends State<RoundScrollbar>

@override
void dispose() {
_fadeOutTimer?.cancel();
_currentController?.removeListener(_onScroll);
_opacityController.dispose();
super.dispose();
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: rotary_scrollbar
description: circular scrollbar for Wear OS devices. It can be controlled with rotary input and it includes haptic feedback.
version: 1.1.0
version: 1.1.1
homepage: https://github.com/hyperfluid-tech/rotary_scrollbar

environment:
Expand Down
20 changes: 20 additions & 0 deletions test/round_scrollbar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,26 @@ void main() {
);
});

group('Lifecycle', () {
testWidgets(
'GIVEN visible scrollbar '
'WHEN it is disposed before the autoHide duration elapses '
'THEN the pending fade-out does not touch the disposed controller',
(tester) async {
// Arrange
await setUpWidget(tester);
await tester.pumpAndSettle(defaultOpacityDuration); // Fade in

// Act - leave the page while the fade-out timer is pending
await tester.pumpWidget(const SizedBox());
await tester.pump(defaultAutoHideDuration);

// Assert
expect(tester.takeException(), isNull);
},
);
});

group('Animation control', () {
group('Fade in animation', () {
testWidgets(
Expand Down