我需要在对象底部添加一些间距,但是据我所知,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],
)));
}