doonfrs / pluto_grid_plus

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
26 stars 28 forks source link

[Bug] PlutoGrid Unexpected null value. #88

Open roberto-gigli opened 3 weeks ago

roberto-gigli commented 3 weeks ago

Steps to reproduce the bug

  1. set all columns minWidth: 100,
  2. set all columns titlePadding: EdgeInsets.zero
  3. autoFit all columns when onLoaded is called
  4. horizontally scroll the grid

Expected results

Scroll horizontally

Actual results

Columns are no longer displayed and whole app does not work until restarted

Code sample

PlutoGrid(
        configuration:
            const PlutoGridConfiguration(style: PlutoGridStyleConfig.dark()),
        columns: [
          for (int i = 0; i < 30; i++)
            PlutoColumn(
              title: 'Column $i',
              field: 'column$i',
              minWidth: 100,
              type: PlutoColumnType.text(),
              titlePadding: EdgeInsets.zero,
            ),
        ],
        rows: const [],
        onLoaded: (event) {
          event.stateManager;

          for (final column in event.stateManager.columns) {
            event.stateManager.autoFitColumn(context, column);
          }
        },

Execution Environment

Flutter version 3.19.6

PlutoGrid version 8.4.0

OS Windows 11 23H2 Web, Edge 130.0.2849.52

Video

https://github.com/user-attachments/assets/3e597780-4aad-41f9-b0c5-bb5ad5be962d

Logs

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following TypeErrorImpl was thrown building PlutoBaseColumn-[#17acb](state:
PlutoBaseColumnState#700c7):
Unexpected null value.

The relevant error-causing widget was:
  PlutoGrid
  PlutoGrid:file:///D:/Progetti/mw/mw-onex-supervisor-flutter/lib/view/debug/debug_view.dart:19:13

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 297:3        throw_
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 806:18   nullCheck
packages/flutter/src/rendering/object.dart 4137:54                                 [_debugUltimatePreviousSiblingOf]
packages/flutter/src/rendering/object.dart 4219:14                                 [_insertIntoChildList]
packages/flutter/src/rendering/object.dart 4254:5                                  insert
packages/pluto_grid_plus/src/ui/miscellaneous/pluto_visibility_layout.dart 320:17  insertRenderObjectChild
packages/flutter/src/widgets/framework.dart 6780:35                                attachRenderObject
packages/flutter/src/widgets/framework.dart 6644:5                                 mount
packages/flutter/src/widgets/framework.dart 7113:11                                mount
packages/flutter/src/widgets/framework.dart 4466:15                                inflateWidget
packages/flutter/src/widgets/framework.dart 3940:18                                updateChild
packages/flutter/src/widgets/framework.dart 5678:16                                performRebuild
packages/flutter/src/widgets/framework.dart 5817:11                                performRebuild
packages/flutter/src/widgets/framework.dart 5365:7                                 rebuild
packages/flutter/src/widgets/framework.dart 5636:5                                 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5808:11                                [_firstBuild]
packages/flutter/src/widgets/framework.dart 5630:5                                 mount
packages/flutter/src/widgets/framework.dart 4466:15                                inflateWidget
packages/flutter/src/widgets/framework.dart 3940:18                                updateChild
packages/flutter/src/widgets/framework.dart 5678:16                                performRebuild
packages/flutter/src/widgets/framework.dart 5365:7                                 rebuild
packages/flutter/src/widgets/framework.dart 5636:5                                 [_firstBuild]
packages/flutter/src/widgets/framework.dart 5630:5                                 mount
packages/flutter/src/widgets/framework.dart 4466:15                                inflateWidget
packages/pluto_grid_plus/src/ui/miscellaneous/pluto_visibility_layout.dart 362:36  inflateWidget
packages/flutter/src/widgets/framework.dart 3940:18                                updateChild
packages/flutter/src/widgets/framework.dart 4141:32                                updateChildren
packages/pluto_grid_plus/src/ui/miscellaneous/pluto_visibility_layout.dart 222:17  performRebuild
packages/flutter/src/widgets/framework.dart 5365:7                                 rebuild
packages/flutter/src/widgets/framework.dart 2941:18                                buildScope
packages/flutter/src/widgets/binding.dart 989:9                                    drawFrame
packages/flutter/src/rendering/binding.dart 448:5                                  [_handlePersistentFrameCallback]
packages/flutter/src/scheduler/binding.dart 1386:7                                 [_invokeFrameCallback]
packages/flutter/src/scheduler/binding.dart 1311:9                                 handleDrawFrame
packages/flutter/src/scheduler/binding.dart 1169:5                                 [_handleDrawFrame]
lib/_engine/engine/platform_dispatcher.dart 1346:5                                 invoke
lib/_engine/engine/platform_dispatcher.dart 260:5                                  invokeOnDrawFrame
lib/_engine/engine/initialization.dart 185:36                                      <fn>
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 550:37   _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 555:39   dcall
roberto-gigli commented 3 days ago

Any news on what could cause this? This could be a make or break problem for my application