During widget testing, I am testing different screensize. And I am getting:
The overflowing RenderFlex has an orientation of Axis.horizontal.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be
seen. If the content is legitimately bigger than the available space, consider clipping it with a
ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
like a ListView.
On the actual device, I do not get this error. That is because I changed the screensize of test to check if this error occurs. Now that I know this error occurs, how to fix it?
Because if this was not a widget test, I would just look at the yellow and black striped pattern on the rendering. But in widget test, there is no rendering.
This is how I changed the screensize:
void setScreenSize({int width, int height}) {
final dpi = tester.binding.window.devicePixelRatio;
tester.binding.window.physicalSizeTestValue = Size(width * dpi, height * dpi);
}