[英]Flutter Text overflows parent container with border radius
Just add some padding using the padding parameter in your container and you are good to go!只需使用容器中的 padding 参数添加一些填充,就可以了!
Container(padding: EdgeInsets.all(10),)
use the property clipBehavior and set it to Clip.antiAlias like the example below使用属性 clipBehavior 并将其设置为 Clip.antiAlias 如下例所示
Container(
margin: EdgeInsets.only(left: 10, right: 10),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: Colors.red,
borderRadius: const BorderRadius.all(Radius.circular(10)),
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 6,
offset: const Offset(0, 3),
),
],
child: Container(
colors: Colors.amber,
child:Text('hello world'),
),
),
Just your text to new container and give the height and width to it, and do not to forget to change overflow property in Text widget.只需将您的文本添加到新容器并为其指定高度和宽度,并且不要忘记更改文本小部件中的溢出属性。 You can also wrap these widgets in to FittedBox, to size text to the container.您还可以将这些小部件包装到 FittedBox 中,以根据容器调整文本大小。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.