android - 颤动中的android版本或像素问题?
问题描述
我是 Flutter 应用程序开发的初学者(约 1 个月)。我在代码中遇到错误,其中相同的代码在像素 2XL(尺寸:- 5.99,API -:29)中运行良好,但是当我在 Galaxy Nexus 中运行相同的代码时(尺寸-:4.65,API-:23 ) 它的运行方式不同。这是像素 2XL 中的简单页面 这是银河系中的同一页面
import 'package:flutter/material.dart';
class page1 extends StatefulWidget {
@override
_page1State createState() => _page1State();
}
class _page1State extends State<page1> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue,
body: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
height: 300,
width: 200,
child: Image.asset(
'assets/oreo.png',
fit: BoxFit.fitHeight,
),
),
Padding(
padding: const EdgeInsets.only(left: 15),
child: Row(
children: <Widget>[
Column(
children: <Widget>[
Text(
"mytime is an initiative",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
letterSpacing: 2.5,
color: Colors.white,
),
),
Text(
"by XYZ Texhnologies",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
letterSpacing: 2.5,
color: Colors.white,
),
),
Text(
"to provide quality",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
letterSpacing: 2.5,
color: Colors.white,
),
),
Text(
"programming education to people",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
letterSpacing: 2.5,
color: Colors.white,
),
),
SizedBox(height: 20,),
],
),
],
),
),
],
),
),
);
}
}
这是页面的代码。
我不知道为什么会这样。谁能帮我这个?先感谢您。
解决方案
黄色,黑色的条带表示您“溢出”。溢出意味着元素对于它的容器来说太大了。
在您的特定情况下,文本字体和间距太大,并且在更改手机时,因为您没有动态设置它以适应不同的屏幕尺寸,它超出了边界。
您可以减小字体大小或动态设置。
如果你是 Flutter 新手,我推荐这门课程来学习这些基础知识。
--> https://www.udemy.com/course/learn-flutter-dart-to-build-ios-android-apps/
我自己拿了它,它得到了很好的解释,从像这样的基础主题到困难的主题。
希望这对您有所帮助,而不仅仅是回答问题。
推荐阅读
- regex - TCL 脚本中使用的正则表达式中的变量不匹配
- javascript - javascript对其他变量的引用
- android - 操作栏渲染问题
- android - 如何正确使用 bitwise_and?
- hadoop - 如何使用 hive 在本地文件系统(不是 hdfs)上读取 CSV?
- r - 仅从第 n 个 epoch 开始绘制训练运行损失和指标
- r - 列出 r 中的名称和值
- laravel-5 - 在 laravel 中动态更改配置值
- javascript - Mailto 链接在 contentEditable 中未触发
- react-native - 在 React Native Maps 中设置最大和最小缩放级别