简体   繁体   English

颤振将小部件放在屏幕底部展开

[英]flutter place widget on bottom of screen in expanded

like the title says is there a way to place a widget on bottom of screen in expanded就像标题所说的那样,有没有办法将小部件放在屏幕底部展开

Expanded -> SingleChildScrollView() -> column(children: [ -> Container() -> ElevatedButton() ])

i want the ElevatedButton to be placed on the bottom of screen also i don't want to place it away of the Expanded widget, is there a way to do that ?我希望将 ElevatedButton 放置在屏幕底部,我也不想将其放置在 Expanded 小部件之外,有没有办法做到这一点?

Expanded(
  child: Column(
     children: [
       Container(),
       //use Spacer(),
       Spacer(),
       ElevatedButton()
     ],
     
   ),
)

try use spacer inside column尝试在列内使用垫片

SingleChildScrollView(
    child: Container(
      height: MediaQuery.of(context).size.height - APPBAR_SIZE,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Container(child: CHILD),
          ElevatedButton(),
        ],
      ),
    ),
  )

UPDATE:更新:

Column(
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: [
      Container(
        height: MediaQuery.of(context).size.height - APPBAR_SIZE - ElevatedButtonHeight,
        child: SingleChildScrollView(
          child: Container(child: CHILD),
        ),
      ),
      ElevatedButton(),
    ],
  ),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM