Repository navigation
Description
Steps to reproduce
For my Flutter project i switched recently to two_dimmensional_scrollables and ditched my solution wih two scrollviews. The performance with this Widget is much better due to lazy loading.
Around the TableView.builder() Widget is use a ScrollConfiguration with a CustomScollbehaviour as parent to be able to scroll by dragging with mouse instead only to drag with touch.
I divided my TableView into smaller pieces to make use of the lazy loading.
Now i have the problem, that when scrolling fast enough with a mousewheel, due to faster scrollspeed or by showing more elements at the same time and scrolling slightly slower, the widget crashes and start to disappear when i continue scrolling. I get the following errors. Even a hot restart of the application doesn't recover the programm. I have to stop and restart the programm from scratch.
The problem does not appear when scrolling with any device using drag and drop, even for mouse Inputs.
What i tried:
I tried to invstigate the problem. The problem appears especially on devices with lower compute power. It also get worse, when the small pieces of the TableView need some calculation to build. I made the problem less worse by caching the already build widgets instead of rebuilding them when returning to an already visited spot in the Tableview.
Problem appears on the following Platforms: Web, Windows, Linux. For Android the problem not yet appeared, because there we were scrolling by touch and not with a mousewheel.
We were now at the current latest Version 0.2.1 with Flutter 3.19.5
Expected results
The TableView shouldnt crash when scrolling with MouseWheel
Actual results
The widgets crashes and starts to disappear when scrolling further.
Code sample
Call of the TableView Widget
ScrollConfiguration(
behavior: MyCustomScrollBehavior(),
child: TableView.builder(
horizontalDetails: ScrollableDetails.horizontal(
controller: horizontalScrollController,
physics: BouncingScrollPhysics(),
),
diagonalDragBehavior: diagonalDragBehavior,
verticalDetails: ScrollableDetails.vertical(
controller: _verticalController,
physics: const AlwaysScrollableScrollPhysics(),
),
cellBuilder: _buildCell,
columnCount: Conf.timeToDisplay+1,
columnBuilder: _buildColumnSpan,
rowCount: numberOfRows,
rowBuilder: _buildRowSpan,
pinnedRowCount: (filterList.isNotEmpty)?2:1,
pinnedColumnCount: 1,
),
);Custom Scrollbehaviour:
class MyCustomScrollBehavior extends MaterialScrollBehavior {
@override
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
//PointerDeviceKind.invertedStylus,
//PointerDeviceKind.stylus,
PointerDeviceKind.mouse,
PointerDeviceKind.trackpad,
// etc.
};
ScrollPhysics get physics => AlwaysScrollableScrollPhysics();
}Logs
Logs
The following assertion was thrown during performLayout():
'package:flutter/src/widgets/two_dimensional_viewport.dart': Failed assertion: line 783 pos 12: '_children.containsValue(child)': is not true.
The relevant error-causing widget was:
TableView TableView:file:///home/<etc>/<etc>/file.dart:1131:40
When the exception was thrown, this was the stack:
#2 RenderTwoDimensionalViewport.parentDataOf (package:flutter/src/widgets/two_dimensional_viewport.dart:783:12)
#3 RenderTableViewport.parentDataOf (package:two_dimensional_scrollables/src/table_view/table.dart:395:13)
#4 RenderTwoDimensionalViewport.performLayout.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/two_dimensional_viewport.dart:1264:17)
#5 WhereIterator.moveNext (dart:_internal/iterable.dart:451:13)
#6 Iterable.isEmpty (dart:core/iterable.dart:540:33)
#7 RenderTwoDimensionalViewport.performLayout.<anonymous closure> (package:flutter/src/widgets/two_dimensional_viewport.dart:1265:10)
#8 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:2686:59)
#9 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:1097:15)
#10 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2686:14)
#11 RenderTwoDimensionalViewport.performLayout (package:flutter/src/widgets/two_dimensional_viewport.dart:1258:5)
#12 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2414:7)
#13 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1051:18)
#14 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1064:15)
#15 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:582:23)
#16 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:991:13)
#17 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:5)
#18 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:15)
#19 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:9)
#20 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:5)
#21 _invoke (dart:ui/hooks.dart:312:13)
#22 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:5)
#23 _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _AssertionError)
The following RenderObject was being processed when the exception was fired: RenderTableViewport#a1771 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=2133.3, h=919.2)
... layer: OffsetLayer#1f62a
... engine layer: OffsetEngineLayer#b03e9
... handles: 2
... offset: Offset(213.3, 356.9)
... size: Size(2133.3, 919.2)
RenderObject: RenderTableViewport#a1771 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(w=2133.3, h=919.2)
layer: OffsetLayer#1f62a
engine layer: OffsetEngineLayer#b03e9
handles: 2
offset: Offset(213.3, 356.9)
size: Size(2133.3, 919.2)
... (row: 0, column: 0): RenderRepaintBoundary#b39ec
... needs compositing
... parentData: vicinity=(row: 0, column: 0); layoutOffset=Offset(0.0, 0.0); paintOffset=Offset(0.0, 0.0); visible - paintExtent=Size(610.0, 150.0);
... constraints: BoxConstraints(w=610.0, h=150.0)
... layer: OffsetLayer#f7b0b
... engine layer: OffsetEngineLayer#89d12
... handles: 2
... offset: Offset(0.0, 0.0)
... size: Size(610.0, 150.0)
... metrics: 97.0% useful (1 bad vs 32 good)
... diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
... child: RenderFlex#80fea
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=610.0, h=150.0)
... size: Size(610.0, 150.0)
... direction: horizontal
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... textDirection: ltr
... verticalDirection: down
... child 1: RenderSemanticsAnnotations#94584 relayoutBoundary=up1
... parentData: offset=Offset(0.0, 4.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=150.0)
... semantics node: SemanticsNode#148
... Rect.fromLTRB(0.0, 4.0, 306.0, 146.0)
... label: "Gesamt
======== Exception caught by rendering library =====================================================
The following assertion was thrown during performLayout():
'package:flutter/src/widgets/two_dimensional_viewport.dart': Failed assertion: line 783 pos 12: '_children.containsValue(child)': is not true.
The relevant error-causing widget was:
TableView TableView:file:///home/<etc>/<etc>/file.dart:1131:40
When the exception was thrown, this was the stack:
#2 RenderTwoDimensionalViewport.parentDataOf (package:flutter/src/widgets/two_dimensional_viewport.dart:783:12)
#3 RenderTableViewport.parentDataOf (package:two_dimensional_scrollables/src/table_view/table.dart:395:13)
#4 RenderTwoDimensionalViewport.performLayout.<anonymous closure>.<anonymous closure> (package:flutter/src/widgets/two_dimensional_viewport.dart:1264:17)
#5 WhereIterator.moveNext (dart:_internal/iterable.dart:451:13)
#6 Iterable.isEmpty (dart:core/iterable.dart:540:33)
#7 RenderTwoDimensionalViewport.performLayout.<anonymous closure> (package:flutter/src/widgets/two_dimensional_viewport.dart:1265:10)
#8 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:2686:59)
#9 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:1097:15)
#10 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:2686:14)
#11 RenderTwoDimensionalViewport.performLayout (package:flutter/src/widgets/two_dimensional_viewport.dart:1258:5)
#12 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:2414:7)
#13 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1051:18)
#14 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:1064:15)
#15 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:582:23)
#16 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:991:13)
#17 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:448:5)
#18 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1386:15)
#19 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1311:9)
#20 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1169:5)
#21 _invoke (dart:ui/hooks.dart:312:13)
#22 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:399:5)
#23 _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _AssertionError)
The following RenderObject was being processed when the exception was fired: RenderTableViewport#a1771 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE
... needs compositing
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=2133.3, h=919.2)
... layer: OffsetLayer#1f62a
... engine layer: OffsetEngineLayer#278ca
... handles: 2
... offset: Offset(213.3, 356.9)
... size: Size(2133.3, 919.2)
RenderObject: RenderTableViewport#a1771 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE
needs compositing
parentData: <none> (can use size)
constraints: BoxConstraints(w=2133.3, h=919.2)
layer: OffsetLayer#1f62a
engine layer: OffsetEngineLayer#278ca
handles: 2
offset: Offset(213.3, 356.9)
size: Size(2133.3, 919.2)
... (row: 0, column: 0): RenderRepaintBoundary#b39ec
... needs compositing
... parentData: vicinity=(row: 0, column: 0); layoutOffset=Offset(0.0, 0.0); paintOffset=Offset(0.0, 0.0); visible - paintExtent=Size(610.0, 150.0);
... constraints: BoxConstraints(w=610.0, h=150.0)
... layer: OffsetLayer#f7b0b
... engine layer: OffsetEngineLayer#89d12
... handles: 2
... offset: Offset(0.0, 0.0)
... size: Size(610.0, 150.0)
... metrics: 97.1% useful (1 bad vs 33 good)
... diagnosis: this is an outstandingly useful repaint boundary and should definitely be kept
... child: RenderFlex#80fea
... parentData: <none> (can use size)
... constraints: BoxConstraints(w=610.0, h=150.0)
... size: Size(610.0, 150.0)
... direction: horizontal
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... textDirection: ltr
... verticalDirection: down
... child 1: RenderSemanticsAnnotations#94584 relayoutBoundary=up1
... parentData: offset=Offset(0.0, 4.0); flex=null; fit=null (can use size)
... constraints: BoxConstraints(0.0<=w<=Infinity, 0.0<=h<=150.0)
... semantics node: SemanticsNode#148
... STALE
... owner: null
... Rect.fromLTRB(0.0, 4.0, 306.0, 146.0)
... label: "Gesamt
Gesamt
Gesamt
Projekte: 59
Projekte: 59
Activity
darshankawar commentedon Apr 24, 2024
@yahooooza
A similar issue was fixed recently #141101 which should be available on master, so please switch to master, upgrade it and run your scenario again to confirm.
flutter channel masterflutter upgradeyahooooza commentedon Apr 25, 2024
@darshankawar
Thank you for the fast response. I upgraded like mentioned. I'm now on Flutter (Channel master, 3.22.0-16.0.pre.57). It is now a bit harder to reproduce the error (faster scrolling and/or displaying more elements neccessary) but the error continue to happen. But now i get a new error message. Still no recovery with Hot Restart, only a complete new rebuild of the app help. Checked on this platforms and mods:
Linux, debug mode -> crashes
Linux, release mode -> crashes
Chrome, debug mode -> not crashing (but scrolling too slow to test it)
Chrome, release mode -> crashes
Windows version yet to Test.
Edit:
Windows, debug mode -> crashes
Windows, release mode -> crashes
Error Message in Linux debug Mode:
Error Message in Linux release Mode:
darshankawar commentedon Apr 26, 2024
Thanks for the update @yahooooza
Can you provide us complete runnable reproducible code sample (ex: main.dart)?
yahooooza commentedon Apr 26, 2024
Appearently i cant provide code in a single file because of many dependencies. I will work on a strestest for this widget that i can share that should make the bad behaviour visible. Next week i'm on vacation, so this will take a bit. I will get back to you later. Thx @darshankawar
yahooooza commentedon May 6, 2024
Hi @darshankawar,
i build a stresstest that catches the principle of my projects two dimmensional scollable. Unfortunatley, i am not able to reproduce the error i get with my Project. Here is the stresstest in a main.dart file. This stresstest does not contains extra dependencies like riverpod or freezed that i use in my project.
stresstest.zip
During testing i found out, that i get different types of error messages at once. The messages are so large, that my terminal are not able to keep them all in storage. Here are three types of additional errors i was able to catch. I hope that helps.
darshankawar commentedon May 7, 2024
@yahooooza
I think you are hitting #137112 that you can follow-up in.
Closing this as a duplicate based on the latest error log you posted. If you disagree, write in comments and I'll reopen it.
github-actions commentedon May 21, 2024
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.