Flutter 容器之间的自定义空间

Flutter 容器之间的自定义空间,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,我想在一行中的两个容器之间创建自定义空间。正如您所看到的,当图像容器结束时,另一个容器开始。尝试使用填充来包装行,但没有效果 这是我的密码 Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( body: Align( alignment: Alignment.c

我想在一行中的两个容器之间创建自定义空间。正如您所看到的,当图像容器结束时,另一个容器开始。尝试使用填充来包装行,但没有效果

这是我的密码

  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Align(
          alignment: Alignment.centerLeft,
          child: LayoutBuilder(
            builder: (BuildContext context, BoxConstraints constraints) {
              return Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  Container(
                    height: MediaQuery.of(context).size.height * 0.75,
                    width: MediaQuery.of(context).size.width / 2,
                    child: Stack(
                      children: <Widget>[
                        Container(
                          color: Colors.lightBlue,
                        ),
                        CustomPaint(
                          size: Size.infinite,
                          painter: MyPainter(pointsList: points),
                        ),
                        displayImage(context, widget.imagePath),
                      ],
                    ),
                  ),
                  Container(
                    height: MediaQuery.of(context).size.height * 0.75,
                    width: MediaQuery.of(context).size.width / 4,
                    color: Colors.blue,
                  ),
                ],
              );
            },
          ),
        ),
      ),
    );
小部件构建(构建上下文){
返回材料PP(
debugShowCheckedModeBanner:false,
家:脚手架(
主体:对齐(
对齐:alignment.centerLeft,
子:布局生成器(
生成器:(BuildContext上下文,BoxConstraints){
返回行(
crossAxisAlignment:crossAxisAlignment.start,
mainAxisAlignment:mainAxisAlignment.space,
儿童:[
容器(
高度:MediaQuery.of(上下文).size.height*0.75,
宽度:MediaQuery.of(context).size.width/2,
子:堆栈(
儿童:[
容器(
颜色:颜色。浅蓝色,
),
定制油漆(
大小:size.infinite,
画家:我的画家(点列表:点),
),
displayImage(上下文,widget.imagePath),
],
),
),
容器(
高度:MediaQuery.of(上下文).size.height*0.75,
宽度:MediaQuery.of(context).size.width/4,
颜色:颜色,蓝色,
),
],
);
},
),
),
),
);
这是我到目前为止得到的结果:


我认为您可以使用灵活:

Row(
 children:
   [
     Flexible(
        flex 4,
        fit: FlexFit.tight,
        child: Container(color: Colors.green),),
     Flexible(
        flex 1,
        fit: FlexFit.tight,
        child: Container(color: Colors.white),),
     Flexible(
        flex 2,
        fit: FlexFit.tight,
        child: Container(color: Colors.yellow),),
   ],),

可能在它们之间添加一个特定宽度的容器,并使用空content@SaraBean但这不会使容器背靠背对吗?我的错,我以为你想要它们之间的空间,但你希望它们的空间灵活,所以这可能不是解决方案