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 颤振填充边缘LTRB中的插入将内容推到底部_Flutter_Dart_Padding - Fatal编程技术网

Flutter 颤振填充边缘LTRB中的插入将内容推到底部

Flutter 颤振填充边缘LTRB中的插入将内容推到底部,flutter,dart,padding,Flutter,Dart,Padding,我正在尝试将底部填充添加到卡片小部件内部的列中(请参阅下面的图片和代码): [![我的代码和布局快照][1][1] 代码: 列( 儿童:[ Padding(Padding:EdgeInsets.fromLTRB(10,0,10,20)), 文本(“${e.phrase}”,样式:TextStyle(颜色:Colors.white60),), 分隔器(高度:5,颜色:颜色。透明,), 文本(“${e.author}”,样式:TextStyle(颜色:Colors.white60),) ], ),

我正在尝试将底部填充添加到卡片小部件内部的列中(请参阅下面的图片和代码): [![我的代码和布局快照][1][1]

代码:

列(
儿童:[
Padding(Padding:EdgeInsets.fromLTRB(10,0,10,20)),
文本(“${e.phrase}”,样式:TextStyle(颜色:Colors.white60),),
分隔器(高度:5,颜色:颜色。透明,),
文本(“${e.author}”,样式:TextStyle(颜色:Colors.white60),)
],
),
问题:我越是增加底部填充值,列的内容就越被推到底部,这与预期相反,我做错了什么?请解释一下。
[1] :

你做错了。您需要将列包装在容器中,然后添加边距

                Container(
                  margin: EdgeInsets.fromLTRB(10, 0, 10, 20),//Add Margin here
                  child: Column(
                    children: <Widget>[
                      Text(
                        '${e.phrase}',
                        style: TextStyle(color: Colors.white60),
                      ),
                      Divider(
                        height: 5,
                        color: Colors.transparent,
                      ),
                      Text(
                        '${e.author}',
                        style: TextStyle(color: Colors.white60),
                      )
                    ],
                  ),
                ),
容器(
margin:EdgeInsets.fromLTRB(10,0,10,20),//在此处添加margin
子:列(
儿童:[
正文(
“${e.phrase}”,
样式:TextStyle(颜色:Colors.white60),
),
分隔器(
身高:5,,
颜色:颜色。透明,
),
正文(
“${e.author}”,
样式:TextStyle(颜色:Colors.white60),
)
],
),
),

你做错了。您需要将列包装在容器中,然后添加边距

                Container(
                  margin: EdgeInsets.fromLTRB(10, 0, 10, 20),//Add Margin here
                  child: Column(
                    children: <Widget>[
                      Text(
                        '${e.phrase}',
                        style: TextStyle(color: Colors.white60),
                      ),
                      Divider(
                        height: 5,
                        color: Colors.transparent,
                      ),
                      Text(
                        '${e.author}',
                        style: TextStyle(color: Colors.white60),
                      )
                    ],
                  ),
                ),
容器(
margin:EdgeInsets.fromLTRB(10,0,10,20),//在此处添加margin
子:列(
儿童:[
正文(
“${e.phrase}”,
样式:TextStyle(颜色:Colors.white60),
),
分隔器(
身高:5,,
颜色:颜色。透明,
),
正文(
“${e.author}”,
样式:TextStyle(颜色:Colors.white60),
)
],
),
),

我想为列小部件设置填充,请这样做

Padding(
    padding: EdgeInsets.fromLTRB(10, 0, 10, 20),
    child: Column(
        children: <Widget>[
            Text('quotes'),
            Text('quotes author')
        ],
    ),
),

所以,如果你想为容器列设置填充,你应该让它成为填充小部件的子部件。

我你想为列小部件设置填充,就这样做吧

Padding(
    padding: EdgeInsets.fromLTRB(10, 0, 10, 20),
    child: Column(
        children: <Widget>[
            Text('quotes'),
            Text('quotes author')
        ],
    ),
),

所以,如果您想为容器列设置填充,应该将其设置为padding小部件的子项。

您需要使用列包装填充


您需要用列包装填充


您能解释一下我的代码中发生了什么吗?我的意思是,其他属性,如
Top
值,除了
Bottom
一个属性外,都能正常工作。在列中作为子级传递填充只会在列中创建一个空框,它对另一个孩子不起作用你能解释一下我的代码中发生了什么吗?我的意思是,其他属性,如
Top
值,除了
Bottom
一个之外,都能按预期工作。在列中作为子级传递填充只会在列中创建一个空框,它对其他子级不起作用
Padding(
      padding: const EdgeInsets.all(50.0),
      child: Text('Text Widget'),
    ),