图片 从图中可以看出,1 行和 6 行大小相同。如果我有一个 20 行,它们的大小也将与最大的相同。
Flutter 中容器的最小尺寸没有属性。因此,如果我有一些包含 10 行的容器文本小部件,而其他有 1 行的容器文本小部件。如何制作最小尺寸以使它们看起来更均匀?
Column(
children: <Widget> [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15), color: Colors.white),
padding: EdgeInsets.symmetric(horizontal: 10.0),
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Text(
'10 lines worth of text.....',
style: TextStyle(
fontSize: 16.0,
fontFamily: 'NotoSans',
color: Colors.black),
),
),
],
),
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15), color: Colors.white),
padding: EdgeInsets.symmetric(horizontal: 10.0),
width: MediaQuery.of(context).size.width,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Text(
'1 line of Text',
style: TextStyle(
fontSize: 16.0,
fontFamily: 'NotoSans',
color: Colors.black),
),
),
],
),
),
]),