flutter探索

Flutter(十二)Padding内边距

2019-07-17  本文已影响0人  天色将变
属性
const Padding({
    Key key,
    @required this.padding,// 内边距
    Widget child,
  })
image.png
class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: ConstrainedBox(
        constraints: BoxConstraints.expand(),
        child: Padding(
//          padding: EdgeInsets.all(12),// 指定四个方向相同的值
//        padding: EdgeInsets.fromLTRB(10, 20, 30, 40),// 分别指定四个方向的值
//        padding: EdgeInsets.only(left: 10,right: 30),// 指定任意方向的值
        padding: EdgeInsets.symmetric(vertical: 10,horizontal: 50),//指定水平(left right)或垂直方向(top,bottom)的值
          child: Stack(
            fit: StackFit.expand, //
            children: <Widget>[
              Container(
                child: Text(
                  "444",
                  style: TextStyle(backgroundColor: Colors.orange),
                ),
                color: Colors.grey,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
欢迎添加我的微信号:zrf540592766
欢迎关注我的公众号:Flutter和Dart开发实践
让我们共同学习进步,It is never too late to learn!
image.png
上一篇 下一篇

猜你喜欢

热点阅读