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

[Bug] scroll controller Assertion failed (with fix suggestion) #1134

Open
shawnAshton opened this issue Jan 3, 2025 · 1 comment
Open

[Bug] scroll controller Assertion failed (with fix suggestion) #1134

shawnAshton opened this issue Jan 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@shawnAshton
Copy link

shawnAshton commented Jan 3, 2025

Steps to reproduce the bug

  1. use PlutoLazyPagination
  2. trigger the lazy loading.
  3. navigate away from the plutogrid widget (while it is loading), so that it is off screen.

Expected results

No assertion thrown

Actual results

DartError: Assertion failed: file:///Users/redacted/fvm/versions/3.24.3/packages/flutter/lib/src/widgets/scroll_controller.dart:220:12
_positions.isNotEmpty
"ScrollController not attached to any scroll views."
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3 throw
errors.dart:296
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
errors.dart:29
packages/flutter/src/widgets/scroll_controller.dart 220:23 jumpTo
scroll_controller.dart:220
packages/pluto_grid/src/plugin/pluto_lazy_pagination.dart 183:27
pluto_lazy_pagination.dart:183

Code fix suggestion

Before

// pluto_lazy_pagination.dart around line 183
      stateManager.scroll.bodyRowsVertical!.jumpTo(0);

After

   if (stateManager.scroll.bodyRowsVertical?.hasClients == true) {
        stateManager.scroll.bodyRowsVertical!.jumpTo(0);
      }

Execution Environment

Flutter version
Flutter version is 3.24.3

PlutoGrid version
pluto_grid: ^8.0.0

OS
mac 14.5

@shawnAshton shawnAshton added the bug Something isn't working label Jan 3, 2025
@Fourchettedev
Copy link

I have the same issue with the InfinityScrollRows. A similar fix works.

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