颤动对齐按钮到抽屉底部 [英] Flutter align button to bottom of Drawer

查看:74
本文介绍了颤动对齐按钮到抽屉底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm trying to have a Widget align to the bottom of my NavDrawer while still keeping a DrawerHeader and a list at the top of the Drawer. Here's what I'm trying:

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

底部文本应与抽屉底部对齐,但不是!

The bottom text should be aligned to the bottom of the drawer, but It isn't!

推荐答案

您需要将 Align 小部件包装在 Expanded 中。

You need to wrap your Align widget in Expanded.

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

这篇关于颤动对齐按钮到抽屉底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆