Flutter PopupMenuButton 自定义菜单中的 3 个点
Flutter PopupMenuButton customizing the 3 dots in menu
我在使用 flutter 的菜单中有应用栏,问题是我不知道我想要给它特定颜色的 3 点图标在哪里,谢谢大家的帮助
PopupMenuButton(itemBuilder: (ct) {
return [
PopupMenuItem(
value: 'value1',
child: InkWell(
onTap: () => showDialog(
barrierDismissible: true,
context: context,
builder: (context) => ReportUser(
currentUser: widget.sender,
seconduser: widget.second,
)).then((value) => Navigator.pop(ct)),
child: Container(
width: 100,
height: 30,
child: Text(
"Report",
)),
),
),
我用过这段代码,使用图标参数
PopupMenuButton(
icon: Icon(Icons.more_vert,color: Colors.white), // add this line
itemBuilder: (_) => <PopupMenuItem<String>>[
new PopupMenuItem<String>(
child: Container(
width: 100,
// height: 30,
child: Text(
"Report",
style: TextStyle(color: Colors.red),
)), value: 'report'),
],
onSelected: (index) async {
switch (index) {
case 'report':
// showDialog(
// barrierDismissible: true,
// context: context,
// builder: (context) => ReportUser(
// currentUser: widget.sender,
// seconduser: widget.second,
// )).then((value) => Navigator.pop(ct))
break;
}
})
希望这对你有用。
我在使用 flutter 的菜单中有应用栏,问题是我不知道我想要给它特定颜色的 3 点图标在哪里,谢谢大家的帮助
PopupMenuButton(itemBuilder: (ct) {
return [
PopupMenuItem(
value: 'value1',
child: InkWell(
onTap: () => showDialog(
barrierDismissible: true,
context: context,
builder: (context) => ReportUser(
currentUser: widget.sender,
seconduser: widget.second,
)).then((value) => Navigator.pop(ct)),
child: Container(
width: 100,
height: 30,
child: Text(
"Report",
)),
),
),
我用过这段代码,使用图标参数
PopupMenuButton(
icon: Icon(Icons.more_vert,color: Colors.white), // add this line
itemBuilder: (_) => <PopupMenuItem<String>>[
new PopupMenuItem<String>(
child: Container(
width: 100,
// height: 30,
child: Text(
"Report",
style: TextStyle(color: Colors.red),
)), value: 'report'),
],
onSelected: (index) async {
switch (index) {
case 'report':
// showDialog(
// barrierDismissible: true,
// context: context,
// builder: (context) => ReportUser(
// currentUser: widget.sender,
// seconduser: widget.second,
// )).then((value) => Navigator.pop(ct))
break;
}
})
希望这对你有用。