Open timokz opened 1 year ago
Hi @timokz , thanks for submitting an issue!
I looked into it and it seems like this error is due to the LayoutBuilder
within the AutoSizeText
. It can't used inside a table that has IntrinsicColumnWidth
, because the layout builder doesn't have an intrinsic size. We use IntrinsicColumnWidth
by default inside the golden test group, but allow you to override this per column. So, I think the best way to fix this issue is to provide a fixed width for the columns within the group, ie columnWidthBuilder: (_) => FixedColumnWidth(600)
.
You could also provide constraints to the GoldenTestScenario
, ie constraints: const BoxConstraints.tightFor(width: 600, height: 600)
.
Hey @Kirpal , thank you for taking a look! I've actually tried giving my scenarios constraints, but they also led to the same errors, depending on the given dimensions, so trial-and-erroring the right ones wasn't a solution imo. Giving the columns a fixed width solved my provided example, thanks for that!
I'm just wondering: did I miss a section in the documentation about this, or is this something one should know beforehand? I'd say I have an ok grasp of flutter, but the errors I encountered left me with no real leads on how to progress. Please let me know if you think extending the docs or adding an exception at the alchemist level would help.
Is there an existing issue for this?
Version
0.6.1
Description
During the creation of golden tests for our existing app, I've encountered following error executing said tests:
I've tried going down the tree of the tested components and identifying the root cause of these errors, but after isolating the affected widgets in widget-tests without using alchemist, I don't encounter them anymore. Also, the affected RenderObject seems to be within the alchemist source.
I've tried to produce a POC that enables the reproduction of the error, the possibility of a fault within my test structure I didn't notice is also very real.
Alchemist golden test:
Code for the tested widget:
Steps to reproduce
LegendItem
in alchemist golden testExpected behavior
Expected behavior would include a successful compilation of the test as well as rendering of goldens for the current host platform.
Screenshots
No response
Additional context and comments
I can provide more information about the projects/my current setup if necessary. If the error is actually within alchemist, I would be happy to provide help regarding the identification and fixing of the bug.