【发布时间】:2019-07-23 10:42:29
【问题描述】:
我正在尝试创建PopupMenuButton。我使用了PopupMenuButton class。
PopupMenuButton(
padding: EdgeInsets.only(right: 8.0),
offset: Offset(-16, 0),
child: Container(
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.all(
Radius.circular(16.0),
)),
padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
child: Text(
"Category",
style: TextStyle(color: Colors.white),
),
),
itemBuilder: (_) => <PopupMenuItem<String>>[
new PopupMenuItem<String>(
//I want this context to be scrollable with some fixed height on the screen
child: Row(
children: <Widget>[
Icon(Icons.arrow_right),
Text("Dairy & Bakery")
],
),
value: '1'),
],
)
我已尝试实现PreferredSizeWidget,但无法处理PopupMenuButton。
【问题讨论】:
-
为 Conrainer 元素添加 height 属性
-
顺便说一句,我建议您将问题标题更改为“如何为 Flutter 中的 PopUpMenu 赋予高度?”
-
我建议你使用
ListView从头实现你需要的东西 -
我将如何展示我想要的效果