@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Container"),
),
body: Container(
width: 200,
height: 200,
color: Colors.red,
child: Container(
width: 100,
height: 100,
color: Colors.blue,
),
),
);
}
Screenshot 2023-03-02 at 09.42.00.png
解决办法:设置第一个Container的alignment即可