【发布时间】:2018-05-04 15:55:34
【问题描述】:
按照卡片主题教程,编写flutter图库卡片示例代码
这里是官方卡片示例
我不知道堆栈与fitbox结合的逻辑。为什么会有高度?我只是按照将底部、左右边距设置为 16.0、16.0、16.0 的教程进行操作。如果我没有任何误解,那就是父级和大小框之间的边距。为什么会有高度存在?有什么黑魔法代码吗?我只是想了解其中的逻辑。
我的结果图片
var titleImage2 = new SizedBox(
height: 200.0,
child: new Stack(
children : <Widget> [
//new Text("First element" , style: new TextStyle(color: Colors.red),),
new Positioned(
//top: 0.0,
left : 16.0,
right : 16.0,
bottom: 16.0,
//width: 100.0,
child: new FittedBox(
fit : BoxFit.scaleDown,
alignment: Alignment.topLeft,
child : new Container(
child: new Text(
"Hello world"
),
)
),
)],
),
);
总结:为什么只设置left,right,bottom到margin 16.0,它会出现一个现有的高度?我是flutter的新手
left : 16.0,
right : 16.0,
bottom: 16.0,
奇怪的图片
【问题讨论】:
标签: layout stack material-design flutter