I have some text, which if long, is causing the renderflex on the right error.
I have tried wrapping the long text in Expanded – this makes no difference. The compiler suggests the first Row is to blame, but I cannot wrap this in Expanded because of the Incorrect use of ParentDataWidget error.
return
Container(
padding: EdgeInsets.only(top: 1, bottom: 5),
width: MediaQuery.of(context).size.width,
color: Colors.white,
child:
Row(. /** THIS IS THE ROW THE COMPILER SAYS IS AT FAULT - CANNOT WRAP IN EXPANDED **/
children: [
Column(
children: [
Row(
children: [
Column (
children: [
Image.asset(summary.getIconPath(),
width: 100,
errorBuilder: (ctx, error, stackTrace) =>
Text('Image Error')
),
],
),
Column (
children: [
Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(summary.time.toString() + " - " + summary.tempMax.toString()),
],
),
]
),
]
),
Row(
children: [
Text(summary.description ?? ""), /** THIS IS THE TEXT WHICH IF LONG CASES THE ERROR - WRAPPING IN. EXPANDED DOESN"T WORK **/
],
),
],
),
],
),
);
2
Answers
I removed unnecessary Rows and wrapped text with Flexible widget.
this is working.