I have a row with only flexible expanded widgets:
Row(child:[
Expanded(flex:1, child: greenChild), //Expanded -> Flexible, same result
Expanded(flex:3, child: redChild),
]);
What I see is:
… the green child is black (not green) — it is actually unpainted and changes from white/black when dragging the window between desktops (This is a linux target).
Why is this? How can I fix it?
void main() {
Widget child = Row(
children: [
Expanded(
flex: 1,
child: Expanded(
child: Container(
color: Colors.green, child: Container(color: Colors.yellow))),
),
Expanded(
flex: 3,
child: Container(
color: Colors.red,
)),
],
);
return runApp(MaterialApp(
debugShowCheckedModeBanner: false,
// Does not help
home: Scaffold(
body: Builder(builder: (context) => child),
)));
}
The Widget inspector shows that the left column data has a defined size:
If I remove red container, I get the result below (yellow container). Why is this not a fixed size? Is this related to the first problem?
Widget child = Row(
children: [
Expanded(
flex: 1,
child: Container(
color: Colors.green,
child: Container(width: 50, height: 50, color: Colors.yellow)
),
),
// Expanded(
// flex: 3,
// child: Container(
// color: Colors.red,
// )),
],
);