@letsar Congratulations on the package, it is really great!
I have found a possible bug, which I have a failing test for it.
If I have the OverflowView widget showing the indicator because items don't fit, if I setState or rebuild the UI with a set of children that fits, it throws an error.
This is a failing test with the latest version of the repo. It only seems to happen with the flexible mode.
It looks like the issue is in the layout logic, but I have low experience with it to make a PR.
If I add a different key based on the children it doesn't throw.
testWidgets(
'failing test',
(tester) async {
print("Building first with indicator...");
await tester.pumpWidget(
Center(
child: SizedBox(
width: 100,
child: OverflowView.flexible(
builder: (context, count) {
return const SizedBox(width: 30);
},
children: [
const SizedBox(width: 50),
const SizedBox(width: 20),
const SizedBox(width: 50),
const SizedBox(width: 50),
],
),
),
),
);
print("Building second without indicator...");
await tester.pumpWidget(
Center(
child: SizedBox(
width: 100,
child: OverflowView.flexible(
builder: (context, count) {
return const SizedBox(width: 30);
},
children: [
const SizedBox(width: 50),
],
),
),
),
);
},
);
And this is the stacktrace
Output for failing test
Building first with indicator...
Building second without indicator...
ââ⥠EXCEPTION CAUGHT BY WIDGETS LIBRARY ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
The following assertion was thrown while finalizing the widget tree:
'package:flutter/src/rendering/object.dart': Failed assertion: line 1532 pos 14:
'_debugSubtreeRelayoutRootAlreadyMarkedNeedsLayout()': is not true.
Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
https://github.com/flutter/flutter/issues/new?template=BUG.md
When the exception was thrown, this was the stack:
#2 RenderObject.markNeedsLayout (package:flutter/src/rendering/object.dart:1532:14)
#3 RenderBox.markNeedsLayout (package:flutter/src/rendering/box.dart:2147:11)
#4 RenderConstrainedLayoutBuilder.updateCallback (package:flutter/src/widgets/layout_builder.dart:192:5)
#5 _LayoutBuilderElement.unmount (package:flutter/src/widgets/layout_builder.dart:115:18)
#6 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1998:13)
#7 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1996:7)
#8 MultiChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6218:16)
#9 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1994:13)
#10 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1996:7)
#11 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6105:14)
#12 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1994:13)
#13 _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:1996:7)
#14 SingleChildRenderObjectElement.visitChildren (package:flutter/src/widgets/framework.dart:6105:14)
#15 _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:1994:13)
#16 ListIterable.forEach (dart:_internal/iterable.dart:39:13)
#17 _InactiveElements._unmountAll (package:flutter/src/widgets/framework.dart:2007:25)
#18 BuildOwner.finalizeTree.<anonymous closure> (package:flutter/src/widgets/framework.dart:2821:27)
#19 BuildOwner.lockState (package:flutter/src/widgets/framework.dart:2621:15)
#20 BuildOwner.finalizeTree (package:flutter/src/widgets/framework.dart:2820:7)
#21 AutomatedTestWidgetsFlutterBinding.drawFrame (package:flutter_test/src/binding.dart:1108:18)
#22 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:302:5)
#23 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1117:15)
#24 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1055:9)
#25 AutomatedTestWidgetsFlutterBinding.scheduleWarmUpFrame (package:flutter_test/src/binding.dart:1036:5)
#26 runApp (package:flutter/src/widgets/binding.dart:1063:7)
#27 TestWidgetsFlutterBinding._runTestBody (package:flutter_test/src/binding.dart:791:7)
<asynchronous suspension>
#30 TestWidgetsFlutterBinding._runTest (package:flutter_test/src/binding.dart:764:14)
#31 AutomatedTestWidgetsFlutterBinding.runTest.<anonymous closure> (package:flutter_test/src/binding.dart:1173:24)
#32 FakeAsync.run.<anonymous closure>.<anonymous closure> (package:fake_async/fake_async.dart:178:54)
#37 withClock (package:clock/src/default.dart:48:10)
#38 FakeAsync.run.<anonymous closure> (package:fake_async/fake_async.dart:178:22)
#43 FakeAsync.run (package:fake_async/fake_async.dart:178:7)
#44 AutomatedTestWidgetsFlutterBinding.runTest (package:flutter_test/src/binding.dart:1170:15)
#45 testWidgets.<anonymous closure> (package:flutter_test/src/widget_tester.dart:138:24)
#46 Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart:175:19)
<asynchronous suspension>
#47 Declarer.test.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/declarer.dart)
#52 Declarer.test.<anonymous closure> (package:test_api/src/backend/declarer.dart:173:13)
#53 Invoker.waitForOutstandingCallbacks.<anonymous closure> (package:test_api/src/backend/invoker.dart:231:15)
#58 Invoker.waitForOutstandingCallbacks (package:test_api/src/backend/invoker.dart:228:5)
#59 Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:383:17)
<asynchronous suspension>
#60 Invoker._onRun.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart)
#65 Invoker._onRun.<anonymous closure>.<anonymous closure> (package:test_api/src/backend/invoker.dart:370:9)
#66 Invoker._guardIfGuarded (package:test_api/src/backend/invoker.dart:415:15)
#67 Invoker._onRun.<anonymous closure> (package:test_api/src/backend/invoker.dart:369:7)
#74 Invoker._onRun (package:test_api/src/backend/invoker.dart:368:11)
#75 LiveTestController.run (package:test_api/src/backend/live_test_controller.dart:153:11)
#76 RemoteListener._runLiveTest.<anonymous closure> (package:test_api/src/remote_listener.dart:256:16)
#81 RemoteListener._runLiveTest (package:test_api/src/remote_listener.dart:255:5)
#82 RemoteListener._serializeTest.<anonymous closure> (package:test_api/src/remote_listener.dart:208:7)
#100 _GuaranteeSink.add (package:stream_channel/src/guarantee_channel.dart:125:12)
#101 new _MultiChannel.<anonymous closure> (package:stream_channel/src/multi_channel.dart:159:31)
#105 CastStreamSubscription._onData (dart:_internal/async_cast.dart:85:11)
#139 new _WebSocketImpl._fromSocket.<anonymous closure> (dart:_http/websocket_impl.dart:1145:21)
#147 _WebSocketProtocolTransformer._messageFrameEnd (dart:_http/websocket_impl.dart:338:23)
#148 _WebSocketProtocolTransformer.add (dart:_http/websocket_impl.dart:232:46)
#158 _Socket._onData (dart:io-patch/socket_patch.dart:2044:41)
#167 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1580:33)
#168 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1076:14)
(elided 113 frames from class _AssertionError, dart:async, and package:stack_trace)
ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
Test failed. See exception logs above.
The test description was: failing test