gpt4 book ai didi

colors - Flutter PopupMenu 更改图标颜色

转载 作者:IT王子 更新时间:2023-10-29 07:21:51 27 4
gpt4 key购买 nike

如何更改 PopupMenuButton 上的图标颜色,我将 Theme 与 iconTheme 一起使用,但它不会影响 CheckedPopupMenuItem 或 PopupMenuItem 上的图标。

Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
elevation: 0.0,
backgroundColor: Colors.transparent,
actions: <Widget>[
Theme(
data: Theme.of(context).copyWith(
cardColor: Colors.indigo,
iconTheme: IconThemeData(color: Colors.white),
),
child: ListTileTheme(
iconColor: Colors.white,
child: PopupMenuButton<String>(
onSelected: _showCheckedMenuSelections,
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
CheckedPopupMenuItem<String>(
value: _checkedValue1,
checked: _showRoles,
child: Text(_checkedValue1, style: Theme.of(context).textTheme.body1),
),
const PopupMenuDivider(),
PopupMenuItem<String>(
value: 'Get Link',
child: ListTile(
leading: Icon(Icons.phonelink),
title: Text('Get link', style: Theme.of(context).textTheme.body1),
),
),
],
),
),
),
],
),

结果是这样的: enter image description here

最佳答案

就这样

 appBar: AppBar(
iconTheme: IconThemeData(color: Colors.white, size: 10.0),
elevation: 4.0,
backgroundColor: Colors.black,
)

关于colors - Flutter PopupMenu 更改图标颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55240180/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com