一尘不染

颤动对齐按钮到抽屉底部

flutter

我正在尝试使Widget与NavDrawer的底部对齐,同时仍将DrawerHeader和列表保留在Drawer的顶部。这是我正在尝试的:

drawer: new Drawer(
    child: new Column(
      mainAxisSize: MainAxisSize.max,
      children: <Widget>[
        new Text('Top'),
        new Align(
          alignment: FractionalOffset.bottomCenter,
          child: new Text('Bottom'),
        ),
      ],
    ),
  ),

底部文本应与抽屉底部对齐,但事实并非如此!


阅读 216

收藏
2020-08-13

共1个答案

一尘不染

您需要将AlignWidget 包装在中Expanded

drawer: Drawer(
  child: Column(
    mainAxisSize: MainAxisSize.max,
    children: <Widget>[
      Text('Top'),
      Expanded(
        child: Align(
          alignment: Alignment.bottomCenter,
          child: Text('Bottom'),
        ),
      ),
    ],
  ),
),
2020-08-13