Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

An assert in LayoutConfig.getMinPixel fires sometimes #456

Open
winksaville opened this issue May 6, 2020 · 1 comment
Open

An assert in LayoutConfig.getMinPixel fires sometimes #456

winksaville opened this issue May 6, 2020 · 1 comment

Comments

@winksaville
Copy link

I was writing an application that uses charts and was testing it on an an Android device using a USB cable. When I tested the app with the display off (i.e. phone is on my desk, the display is off because the phone is "sleeping") and I run the app I see an assertion that '_minPixel < totalPixels:' is not true, see below.

I created this very simple test app which reproduces the problem.

wink@wink-desktop:~/prgs/flutter/projects/charts_issue_minPixel_LT_totalPixels (master)
$ flutter run -d moto
Launching lib/main.dart on moto x4 in debug mode...
Running Gradle task 'assembleDebug'...                                  
Running Gradle task 'assembleDebug'... Done                        18.9s
✓ Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app.apk...                 7.1s
Waiting for moto x4 to report its views...                          12ms
Syncing files to device moto x4...                                 506ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
An Observatory debugger and profiler on moto x4 is available at: http://127.0.0.1:35693/VswkvMW4sUY=/
I/flutter (17446): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (17446): The following assertion was thrown during performLayout():
I/flutter (17446): 'package:charts_common/src/chart/layout/layout_config.dart': Failed assertion: line 101 pos 14:
I/flutter (17446): '_minPixel < totalPixels': is not true.
I/flutter (17446): 
I/flutter (17446): The relevant error-causing widget was:
I/flutter (17446):   ChartContainer<num>
I/flutter (17446):   file:///home/wink/prgs/flutter/projects/charts_issue_minPixel_LT_totalPixels/submodules/charts/charts_flutter/lib/src/base_chart_state.dart:89:32
I/flutter (17446): 
I/flutter (17446): When the exception was thrown, this was the stack:
I/flutter (17446): #2      MarginSpec.getMinPixels (package:charts_common/src/chart/layout/layout_config.dart:101:14)
I/flutter (17446): #3      LayoutManagerImpl._measure (package:charts_common/src/chart/layout/layout_manager_impl.dart:305:54)

...

I/flutter (17446): #60     PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18)
I/flutter (17446): #61     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:402:19)
I/flutter (17446): #62     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:865:13)
I/flutter (17446): #63     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
I/flutter (17446): #64     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1074:15)
I/flutter (17446): #65     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1013:9)
I/flutter (17446): #66     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:822:7)
I/flutter (17446): (elided 13 frames from class _AssertionError, class _RawReceivePortImpl, class _Timer, dart:async, and dart:async-patch)
I/flutter (17446): 
I/flutter (17446): The following RenderObject was being processed when the exception was fired: ChartContainerRenderObject<num>#137e2 NEEDS-LAYOUT NEEDS-PAINT:
I/flutter (17446):   creator: ChartContainer<num> ← _PointerListener ← Listener ← _GestureSemantics ← RawGestureDetector
I/flutter (17446):     ← GestureDetector ← LayoutId-[<chartContainer>] ← CustomMultiChildLayout ← LineChart ←
I/flutter (17446):     SimpleLineChart ← Container ← _BodyBuilder ← ⋯
I/flutter (17446):   parentData: <none> (can use size)
I/flutter (17446):   constraints: BoxConstraints(w=0.0, h=0.0)
I/flutter (17446):   semantic boundary
I/flutter (17446):   size: MISSING
I/flutter (17446): This RenderObject has no descendants.
I/flutter (17446): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (17446): Another exception was thrown: RenderBox was not laid out: ChartContainerRenderObject<num>#137e2 NEEDS-PAINT
I/flutter (17446): Another exception was thrown: RenderBox was not laid out: RenderPointerListener#889de NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (17446): Another exception was thrown: RenderBox was not laid out: RenderSemanticsGestureHandler#be907 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
I/flutter (17446): Another exception was thrown: RenderBox was not laid out: ChartContainerRenderObject<num>#137e2
@winksaville
Copy link
Author

I've created PR #457 which is a fix for this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant