You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter如何修改Awesome Notifications通知图标背景颜色

修改Awesome Notifications通知图标背景色的方法

针对你要修改通知图标绿色背景的需求,有两种常用方案:

1. 自定义单个通知的样式

在调用通知时添加customClass参数,然后通过CSS覆盖对应样式:

调用示例(Vue版本)

this.$notification.success({
  title: '操作成功',
  message: '内容已保存',
  customClass: 'custom-success-notification'
})

对应CSS

.custom-success-notification .an-icon-wrapper {
  background-color: #your-target-color; /* 替换为你需要的颜色值 */
}

2. 全局修改所有同类型通知的样式

如果要统一修改所有成功类型(success)通知的图标背景,直接覆盖默认类选择器:

.an-notification.an-success .an-icon-wrapper {
  background-color: #your-target-color;
}

注意事项

  • 确保你的CSS代码加载顺序在Awesome Notifications的默认样式之后,避免被覆盖
  • 如果样式优先级不够,可以增加选择器的特异性(比如加上父容器类),尽量避免使用!important

内容的提问来源于stack exchange,提问作者Mat Koffman

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 23:05:27