为弹出菜单按钮抖动添加边距

时间:2021-02-12 20:43:14

标签: flutter flutter-layout flutter-animation

enter image description here 隐藏菜单

enter image description here 活动菜单

我需要在对象底部添加一些间距,但是据我所知,flutter 没有提供此功能。

这是我的弹出菜单按钮代码。

  Widget usersPopupMenuButton(BuildContext context) {
    return Builder(builder: (context) {
      return PopupMenuButton(
        itemBuilder: (context) => userTagsList(tags),
        elevation: 2,
        offset: Offset(2, -100),
        // offset doesn't work, because it starts from the top of menu, not from the 
        // bottom. menu should be always rendered above chattextfield, however amount of items of menu        
        // are not fixed.
        onSelected: (UserTag val) {
          BlocProvider.of<ChatFieldBloc>(context)
              .add(ChatFieldAddUser(tag: val));
        },
      );
    });
  }

用户标签列表:

List<PopupMenuEntry<UserTag>> userTagsList(List<UserTag> tags) {
    return List.generate(
        tags.length,
        (index) => PopupMenuItem(
            value: tags[index],
            child: UserTile(
              tag: tags[index],
            )));
  }

0 个答案:

没有答案