Flutter-ConstrainedBox 与 Stack使用

//通过ConstrainedBox来确保Stack占满屏幕
ConstrainedBox(
  constraints: BoxConstraints.expand(),
  child: Stack(
    alignment:Alignment.center , //指定未定位或部分定位widget的对齐方式
    children: <Widget>[
      Positioned(
        left: 18.0,
        child: Text("KK"),
      ),
      Positioned(
        top: 18.0,
        child: Text("KKKKK"),
      )        
    ],
  ),
);

 

posted @ 2022-06-08 17:52  macroK  阅读(109)  评论(0编辑  收藏  举报