when i read the Container layout behavior of Container document:
If the widget has no child, no height, no width, no constraints, and the parent provides unbounded constraints, then Container tries to size as small as possible.
so i write some code like below ,i think the second container should be as small as possible,but it fill the application’s content area (the entire screen) ,why?
class ContainerWithScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Container with scaffold',
home: Scaffold(
body: Container(
color: Colors.blue,
height: double.infinity,// provides unbounded height constraints for the child container
width: double.infinity,// provides unbounded width constraints for the child container
child: new Container(
color: Colors.white,
),
),
),
);
}
}