Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何正确地将红色椭圆形放置在颤振中?_Flutter_Position - Fatal编程技术网

Flutter 如何正确地将红色椭圆形放置在颤振中?

Flutter 如何正确地将红色椭圆形放置在颤振中?,flutter,position,Flutter,Position,您好,我的问题是如何将上图中的红色椭圆形移动到下面标记的位置?有人知道吗?我先谢谢你 这是我的代码: 返回脚手架( 背景颜色:常量颜色(0xFFFFFF), 主体:堆栈( 儿童:[ 容器( 子对象:对齐( 对齐:对齐.bottomCenter, ), 宽度:436.0, 身高:207.0, 装饰:盒子装饰( 边界半径:边界半径。圆形(29.0), 图像:装饰图像( 图片:const AssetImage('assets/images/vorlage.png'), 适合:BoxFit.cover,

您好,我的问题是如何将上图中的红色椭圆形移动到下面标记的位置?有人知道吗?我先谢谢你

这是我的代码:

返回脚手架(
背景颜色:常量颜色(0xFFFFFF),
主体:堆栈(
儿童:[
容器(
子对象:对齐(
对齐:对齐.bottomCenter,
),
宽度:436.0,
身高:207.0,
装饰:盒子装饰(
边界半径:边界半径。圆形(29.0),
图像:装饰图像(
图片:const AssetImage('assets/images/vorlage.png'),
适合:BoxFit.cover,
),
),
),
容器(
子对象:对齐(
对齐:对齐.bottomCenter,
),
宽度:265.0,
身高:20.0,
装饰:盒子装饰(
边界半径:边界半径。圆形(14.0),
颜色:常量颜色(0xffff0000),
),
),

您可能需要研究画布的绘制。画布开发得相当完善,并且有很多教程信息(甚至包括如何制作动画!)。所有东西都是一个小部件,但其中一些小部件是渲染对象。:)如果你想把红色椭圆形固定在它的父控件中的一个位置,你可以使用定位小部件来固定顶部的距离,然后使用中心将它放在中间。你必须调整顶部值(我随意放300)。
返回脚手架(
背景颜色:常量颜色(0xFFFFFF),
主体:堆栈(
儿童:[
容器(
子对象:对齐(
对齐:对齐.bottomCenter,
),
宽度:436.0,
身高:207.0,
装饰:盒子装饰(
边界半径:边界半径。圆形(29.0),
图像:装饰图像(
图片:const AssetImage('assets/images/vorlage.png'),
适合:BoxFit.cover,
),
),
),
定位(
top:300//
return Scaffold(
  backgroundColor: const Color(0xffffffff),
  body: Stack(
    children: <Widget>[
      Container(
        child: Align(
          alignment: Alignment.bottomCenter,
        ),
        width: 436.0,
        height: 207.0,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(29.0),
          image: DecorationImage(
            image: const AssetImage('assets/images/vorlage.png'),
            fit: BoxFit.cover,
          ),
        ),
      ),
      Container(
        child: Align(
          alignment: Alignment.bottomCenter,
        ),
        width: 265.0,
        height: 20.0,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(14.0),
          color: const Color(0xffff0000),
        ),
      ),
return Scaffold(
  backgroundColor: const Color(0xffffffff),
  body: Stack(
    children: <Widget>[
      Container(
        child: Align(
          alignment: Alignment.bottomCenter,
        ),
        width: 436.0,
        height: 207.0,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(29.0),
          image: DecorationImage(
            image: const AssetImage('assets/images/vorlage.png'),
            fit: BoxFit.cover,
          ),
        ),
      ),
      Positioned(
        top: 300 // <----tweak this till it's where you want it (distance from top)
        child: Center(
          child: Container(
            child: Align(
              alignment: Alignment.bottomCenter,
            ),
            width: 265.0,
            height: 20.0,
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(14.0),
              color: const Color(0xffff0000),
            ),
          ),
        ),
      ),