Flutter 定位小部件工作,但对齐小部件don';t在flatter中的堆栈窗口小部件中工作

Flutter 定位小部件工作,但对齐小部件don';t在flatter中的堆栈窗口小部件中工作,flutter,flutter-positioned,Flutter,Flutter Positioned,为什么当我尝试使用“堆栈中对齐”和“对齐”时,他的孩子不会移动, 但它的工作定位(我想使用它,因为我不能在所有移动维度中居中) 这是我的代码: @覆盖 小部件构建(构建上下文){ 返回手势检测器( onTap:_launchURL, 子:容器( 子:容器( 子:堆栈(子:[ 纵队( 儿童:[ 容器( 装饰:新盒子装饰( 边框:边框。全部(颜色:Colors.black12), borderRadius:borderRadius.all(半径圆形(13)), 形状:BoxShape.rectang

为什么当我尝试使用“堆栈中对齐”和“对齐”时,他的孩子不会移动, 但它的工作定位(我想使用它,因为我不能在所有移动维度中居中)

这是我的代码:

@覆盖
小部件构建(构建上下文){
返回手势检测器(
onTap:_launchURL,
子:容器(
子:容器(
子:堆栈(子:[
纵队(
儿童:[
容器(
装饰:新盒子装饰(
边框:边框。全部(颜色:Colors.black12),
borderRadius:borderRadius.all(半径圆形(13)),
形状:BoxShape.rectangle,
颜色:颜色,白色,
boxShadow:[
箱形阴影(
颜色:颜色。黑色,
偏移量:偏移量(3,7),
半径:7.0,
),
],
),
身高:140,
宽度:MediaQuery.of(context).size.width*0.42,
),
],
),
//这是我使用align小部件时的代码
//对齐(
//对齐:对齐.bottomCenter,
定位(
顶部:MediaQuery.of(context).size.width*0.42/7,
左:40,,
子:容器(
子:列(
儿童:[
容器(
装饰:新盒子装饰(
borderRadius:borderRadius.all(半径圆形(16)),
形状:BoxShape.rectangle,
颜色:颜色。透明,
boxShadow:[
箱形阴影(
颜色:颜色。灰色,
偏移量:偏移量(2,5),
半径:5.0,
),
],
),
孩子:ClipRRect(
边界半径:新边界半径。圆形(16.0),
子:Image.asset(
“assets/RoundStyle/”+socialEdge+“.png”,
身高:60,
宽度:60,
),
),
),
大小盒子(
身高:20,
),
MyText3(
“@hisname”,
颜色:颜色。灰色,
)
],
),
),
),
]),
),
),
);
}

就这样,谢谢:)

如果您想将小部件集中在
容器中,您不需要
堆栈
,只需将其作为
子项添加即可

   @override
  Widget build(BuildContext context) {
   return GestureDetector(
   onTap: _launchURL,
   child:   Container(
              decoration: new BoxDecoration(
                border: Border.all(color: Colors.black12),
                borderRadius: BorderRadius.all(Radius.circular(13)),
                shape: BoxShape.rectangle,
                color: Colors.white,
                boxShadow: <BoxShadow>[
                  BoxShadow(
                    color: Colors.black26,
                    offset: Offset(3, 7),
                    blurRadius: 7.0,
                  ),
                ],
              ),
              height: 140,
              width: MediaQuery.of(context).size.width * 0.42,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Container(
                    decoration: new BoxDecoration(
                      borderRadius: BorderRadius.all(Radius.circular(16)),
                      shape: BoxShape.rectangle,
                      color: Colors.transparent,
                      boxShadow: <BoxShadow>[
                        BoxShadow(
                          color: Colors.grey,
                          offset: Offset(2, 5),
                          blurRadius: 5.0,
                        ),
                      ],
                    ),
                    child: ClipRRect(
                    borderRadius: new BorderRadius.circular(16.0),
                    child: Image.asset(
                      "assets/RoundStyle/" + socialBadge + ".png",
                      height: 60,
                      width: 60,
                    ),
                  ),
                ),
                SizedBox(
                  height: 20,
                ),
                MyText3(
                  "@BensebaBillal",
                  color: Colors.grey,
                )
                ],
              ),
            ),
            );
     }
@覆盖
小部件构建(构建上下文){
返回手势检测器(
onTap:_launchURL,
子:容器(
装饰:新盒子装饰(
边框:边框。全部(颜色:Colors.black12),
borderRadius:borderRadius.all(半径圆形(13)),
形状:BoxShape.rectangle,
颜色:颜色,白色,
boxShadow:[
箱形阴影(
颜色:颜色。黑色,
偏移量:偏移量(3,7),
半径:7.0,
),
],
),
身高:140,
宽度:MediaQuery.of(context).size.width*0.42,
子:列(
mainAxisAlignment:mainAxisAlignment.center,
儿童:[
容器(
装饰:新盒子装饰(
borderRadius:borderRadius.all(半径圆形(16)),
形状:BoxShape.rectangle,
颜色:颜色。透明,
boxShadow:[
箱形阴影(
颜色:颜色。灰色,
偏移量:偏移量(2,5),
半径:5.0,
),
],
),
孩子:ClipRRect(
边界半径:新边界半径。圆形(16.0),
子:Image.asset(
“assets/RoundStyle/”+socialEdge+“.png”,
身高:60,
宽度:60,
),
),
),
大小盒子(
身高:20,
),
MyText3(
“@BensebaBillal”,
颜色:颜色。灰色,
)
],
),
),
);
}

你想创建什么UI?谢谢兄弟,这是真的,我很愚蠢,我不知道是什么让我使用它:(