首页 > 解决方案 > Flutter 的绝对位置

问题描述

我是来自 Web 开发方面的 Flutter 新手。只是为了好玩和练习 Flutter 布局,我想做一个“架子鼓”应用程序。但问题是,我无法按应有的方式设置 Drum Kit 部件。

您知道在 Web 开发中,网页上的元素有绝对位置选项。Flutter 有类似的东西吗?

我会很感激任何答案。谢谢。:)

让我展示一下我的期望:在这里

这就是我得到的结果:结果

标签: flutterflutter-layout

解决方案


     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),
  ),
 ]
 )

你可以试试这个你可以在屏幕上固定位置


推荐阅读