用百分比将小部件放在堆栈中

用百分比将小部件放在堆栈中,第1张

百分比将小部件放在堆栈

您可以将

Positioned.fill
和组合在一起
LayoutBuilder
以达到这样的结果。

    new Stack(    children: <Widget>[      new Positioned.fill(        child: new LayoutBuilder(          builder: (context, constraints) { return new Padding(   padding: new EdgeInsets.only(top: constraints.biggest.height * .59, bottom: constraints.biggest.height * .31),   child: new Text("toto", textAlign: TextAlign.center,), );          },        ),      )    ],  ),


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4923707.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-12
下一篇 2022-11-12

发表评论

登录后才能评论

评论列表(0条)

保存