flutter - Flutter 的绝对位置
问题描述
我是来自 Web 开发方面的 Flutter 新手。只是为了好玩和练习 Flutter 布局,我想做一个“架子鼓”应用程序。但问题是,我无法按应有的方式设置 Drum Kit 部件。
您知道在 Web 开发中,网页上的元素有绝对位置选项。Flutter 有类似的东西吗?
我会很感激任何答案。谢谢。:)
让我展示一下我的期望:在这里
这就是我得到的结果:结果
解决方案
Stack(
children: <Widget>[
Positioned(
top: 100,
left: 0,
right: 0,
child: Text("Search",
style: TextStyle(
color: Color(0xff757575),
fontWeight: FontWeight.w700,
fontFamily: "Roboto",
fontStyle: FontStyle.normal,
fontSize: 56.0),
textAlign: TextAlign.center),
),
]
)
你可以试试这个你可以在屏幕上固定位置
推荐阅读
- angular - Angular 6 - 将子组件渲染为父组件中的内容
- node.js - Vue 不使用 axios 钩子打开 .json 文件
- javascript - Sweetalert as a service in Angular
- jquery - jQuery .clone() only getting first instance of class
- regex - 正则表达式日期解析
- python - 如何使用 python attrs 为可变属性提供默认值?
- amazon-web-services - 查看 AWS 对资源使用的权限?
- node.js - 无法从命令行运行 clasp
- sql-server - 如何在 VARCHAR(MAX) 中的 SQL Server 中的两个已知字符串之间选择可变长度字符串,其中某些列没有适用的字符串
- javascript - RegExp for Postal Code, faster/better way?