扑来中不同设备大小的错误或不兼容
正如我在代码中所述,我将介质的尺寸提供给小部件的大小,但是尽管如此,尽管如此,诸如不同设备上的图像之类的不兼容性,或者我遇到了溢出错误。解决方案是什么?我应该如何尺寸的小部件以及内部按钮和图像之类的东西?
被切断的文本:
Padding(
padding: const EdgeInsets.only(top: 20.0, right: 30),
child: Container(
height: MediaQuery.of(context).size.height * 0.02,
width: MediaQuery.of(context).size.width * 0.23,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: back_color,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
),
child: const Text(
'Discover',
style: TextStyle(fontSize: 15, color: Colors.black),
),
),
),
),
As I stated in the code, I give the widget sizes with MediaQuery, but despite this, there are incompatibilities like the images on different devices or I get an Overflow error. What is the solution to this? How should I size my widgets and things like buttons and images inside?
The text being cut off:
Padding(
padding: const EdgeInsets.only(top: 20.0, right: 30),
child: Container(
height: MediaQuery.of(context).size.height * 0.02,
width: MediaQuery.of(context).size.width * 0.23,
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
primary: back_color,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),
),
),
child: const Text(
'Discover',
style: TextStyle(fontSize: 15, color: Colors.black),
),
),
),
),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为避免文本被切断,您可以包装
fittedbox()
在您的text()
widget上:在这里是Google Team的YouTube视频,on
fittitesbox()
) 。To avoid the text from being cut off, you can wrap
FittedBox()
on yourText()
widget:Here is a YouTube video from the Google team on
FittedBox()
.