0

就像标题所说的那样,有没有办法将小部件放在屏幕底部展开

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

我希望将 ElevatedButton 放置在屏幕底部,我也不想将其放置在 Expanded 小部件之外,有没有办法做到这一点?

4

2 回答 2

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

更新:

Column(
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: [
      Container(
        height: MediaQuery.of(context).size.height - APPBAR_SIZE - ElevatedButtonHeight,
        child: SingleChildScrollView(
          child: Container(child: CHILD),
        ),
      ),
      ElevatedButton(),
    ],
  ),
于 2022-02-27T08:12:29.403 回答
0
Expanded(
  child: Column(
     children: [
       Container(),
       //use Spacer(),
       Spacer(),
       ElevatedButton()
     ],
     
   ),
)

尝试在列内使用垫片

于 2022-02-27T07:43:59.067 回答