You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
class LegendItem extends StatelessWidget {
const LegendItem({
super.key,
required this.color,
required this.text,
this.size = 16,
this.textColor = const Color(0xff505050),
required this.valueLabel,
required this.percentLabel,
});
/// Legend item color
final Color color;
/// Legend indicator size
final double size;
/// Item description
final String text;
/// Color of [text]
final Color textColor;
/// Value label
final String valueLabel;
/// Label describing the percentage of the total value
final String percentLabel;
static const kSpacing = 2.0;
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: size,
height: size,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: color,
),
),
const SizedBox(width: kSpacing),
Flexible(
child: AutoSizeText(
text,
style: Theme.of(context).textTheme.labelSmall,
textAlign: TextAlign.start,
),
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(child: AutoSizeText(percentLabel)),
const SizedBox(width: kSpacing),
Flexible(
child: AutoSizeText(
valueLabel,
style: Theme.of(context).textTheme.titleSmall,
textAlign: TextAlign.start,
),
),
],
),
],
);
}
}
Steps to reproduce
Wrap given LegendItem in alchemist golden test
Try updating goldens using said test
Encounter compile-time errors
Expected 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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: