简体   繁体   English

堆栈小部件内的颤振定位类,不接受子属性

[英]Flutter Positioned class inside stack widget, won't accept a child property

the code runs, but I get an error which says 'child' parameter is undefined.代码运行,但我收到一个错误,提示“child”参数未定义。 I tried flutter doctors, everything is fine.我试过扑医生,一切都很好。 I did flutter clean, and flutter upgrade.我做了颤振清洁和颤振升级。

the 'child' parameter simple doesn't show up with the auto fill from intellesence either when I press ctrl+spacebar.当我按 ctrl+spacebar 时,'child' 参数 simple 也不会与来自 intellesence 的自动填充一起显示。

I don't know what the issue is.我不知道是什么问题。

Stack(
        children: [
          Container(
            height: size.height - 27,
            decoration: BoxDecoration(
              color: kPrimaryColor,
              borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(36),
                bottomRight: Radius.circular(36),
              ),
            ),
          ),
          Positioned(
            bottom: -30.0,
            left: 0,
            right: 0,
            // undefined error with 'child' here
            child: Container(
              margin: EdgeInsets.all(kDefaultPadding),
              height: 54.0,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(20.0),
                color: Colors.white,
              ),
            ),
          ),
        ],
       
      ),

Your code compiles well.你的代码编译得很好。 It may due to syntax errors in other parts of your code .这可能是由于代码其他部分的语法错误造成的 Thus try to find it out on other parts (or paste it to your question).因此尝试在其他部分找到它(或将其粘贴到您的问题中)。

Ok, It got solved on it's own.好的,它自己解决了。 I restarted the system and reinstalled the virtual device.我重新启动了系统并重新安装了虚拟设备。 I ran 'flutter clean' and 'get packages' from pubspeck.yaml, works fine now.我从 pubspeck.yaml 运行了“flutter clean”和“get packages”,现在工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在flutter中将定位的小部件拖动到堆栈小部件内 - How to drag positioned widget inside a stack widget in flutter 在 Flutter 中的 Stack 小部件内移动、缩放和调整定位小部件的大小 - Move, zoom and resize Positioned widget inside Stack widget in Flutter 如何让 Stack 小部件将自身约束到 Flutter 中的定位子项? - How to have a Stack widget constrain itself to a Positioned child in Flutter? Flutter:定位在堆栈中切断了我的小部件 - Flutter: Positioned inside stack cuts off my widget Flutter - 位于行内的堆栈内不呈现 - Flutter - Positioned inside Stack inside Row doesn't render 定位的小部件可以工作,但是对齐的小部件在堆栈中的小部件中不起作用 - positioned widget work but align widget don't work in stack widget in flutter Flutter 的 TextFormField 在 Positioned 小部件中不起作用 - Flutter's TextFormField doesn't work inside a Positioned widget Flutter - 堆栈中的定位小部件导致异常 - Flutter - Positioned Widget in Stack causing Exception 如何在颤动中隐藏堆栈小部件中的特定子项 - How to hide specific child inside Stack widget in flutter Flutter 在堆栈和列内包装定位小部件时出错(无限像素溢出的 RenderFlex。) - Flutter error when wrapping a Positioned widget inside Stack and Column (A RenderFlex overflowed by Infinity pixels.)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM