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

🐛 Scrollbar, disappear when the mouse is not over #1077

Closed
WinXaito opened this issue Jun 25, 2024 · 1 comment
Closed

🐛 Scrollbar, disappear when the mouse is not over #1077

WinXaito opened this issue Jun 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@WinXaito
Copy link
Collaborator

Describe the bug
I'm not that sure if it's a problem with Fluent_ui or Flutter.
The scrollbar tend to disappear when the mouse move (so almost everytime I scroll, it's hard to grab the bar and it disappear).

Also, maybe it's another bug, but if I go over the scrollbar, it appear, and after that if I scroll with the mouse wheel, it stay appeared.
But wait a couple of second, the bar disappear, scroll with mouse will, you'll not see the bar again.

scroll

@bdlukaa bdlukaa added the bug Something isn't working label Jun 25, 2024
@bdlukaa
Copy link
Owner

bdlukaa commented Jun 25, 2024

I think it is an issue with Flutter's RawScrollbar, but it is resolvable using the callbacks they expose.

We hide the scrollbar as soon as the mouse leaves it, but we don't take into account if the user is still pressing it.

@override
void handleThumbPressStart(Offset localPosition) {
super.handleThumbPressStart(localPosition);
if (mounted) {
setState(() => _dragIsActive = true);
}
}
@override
void handleThumbPressEnd(Offset localPosition, Velocity velocity) {
super.handleThumbPressEnd(localPosition, velocity);
if (mounted) {
setState(() => _dragIsActive = false);
}
}
@override
void handleHover(PointerHoverEvent event) async {
super.handleHover(event);
// Check if the position of the pointer falls over the painted scrollbar
if (isPointerOverScrollbar(event.position, event.kind, forHover: true)) {
// Pointer is hovering over the scrollbar
await contractDelay;
if (mounted) {
setState(() => _hoverIsActive = true);
_hoverAnimationController.forward();
}
} else if (_hoverIsActive) {
await contractDelay;
if (mounted) {
// Pointer was, but is no longer over painted scrollbar.
await _hoverAnimationController.reverse();
setState(() => _hoverIsActive = false);
}
}
}
@override
void handleHoverExit(PointerExitEvent event) {
super.handleHoverExit(event);
if (mounted) {
setState(() => _hoverIsActive = false);
_hoverAnimationController.reverse();
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants