搜索插件、代码仓与 APP 分类

icon_decoration 封面
插件详情v2.1.0

icon_decoration

为 Icon 小部件添加边框和渐变的装饰功能。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2760
喜欢数
97
Pub 分数
150

安装插件

flutter pub add icon_decoration

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

IconDecoration 通过启用边框和渐变等装饰功能,增强了 Icon 小部件,使 Flutter 应用中的图标更具视觉吸引力。它扩展了标准的 Icon 小部件,提供可自定义的样式选项,无需复杂的自定义绘图即可轻松应用高级视觉效果。适用于需要精致 UI 元素的应用程序,该包支持所有主要平台,包括移动、网页和桌面。

适合场景

  • 为图标添加样式边框
  • 为图标应用渐变填充
  • 创建视觉丰富的图标设计
  • 增强跨平台的UI一致性
  • 设计交互式图标状态

主要特点

  • 图标边框自定义
  • 图标上的渐变支持
  • 与现有 Icon 小部件的简单集成
  • 跨平台兼容性
  • 轻量且高效

适合对象

  • 寻求视觉精致的UI设计师
  • 开发品牌化界面的开发者
  • 图标密集型导航的应用
  • 需要一致图标样式的项目
  • 使用 Flutter 开发多平台应用的团队

使用建议

  • 仅限基本装饰功能
  • 可能需要额外的样式来实现复杂效果
  • 不适用于高度动态的图标动画
  • 依赖于 Flutter 的渲染性能
  • 最好与静态或半静态的图标设计配合使用

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

icon_decoration

Pub Version Test workflow Coverage Status

Add decoration capabilities to the Icon widget with borders and gradients. This new DecoratedIcon widget overlap itself with the base Icon widget to provide a more complete decoration system through a IconDecoration property.

Table of contents

Add to your project

Add dependency to your pubspec.yaml
icon_decoration: any
Import the package
import 'package:icon_decoration/icon_decoration.dart';

How to use

Add borders to icons
DecoratedIcon(
    icon: Icon(Icons.favorite, color: Colors.green),
    decoration: IconDecoration(border: IconBorder()),
)
Add gradients to icons

Gradients are supported on Flutter Web only with the canvaskit renderer

DecoratedIcon(
    icon: Icon(Icons.all_inbox),
    decoration: IconDecoration(
        gradient: rainbowGradient,
    ),
)
Mix them all together
DecoratedIcon(
    icon: Icon(
        Icons.all_inbox,
        shadows: [
            Shadow(
                color: Colors.red,
                blurRadius: 3,
                offset: Offset(0, 2),
            ),
        ],
    ),
    decoration: IconDecoration(
        gradient: _rainbowGradient,
        border: IconBorder(),
    ),
)

Migration Guide

v2.0.0
  • Removed IconDecoration.shadows, use Icon.shadows instead.

Before

DecoratedIcon(
    icon: Icon(Icons.all_inbox),
    decoration: IconDecoration(
        shadows: [
            Shadow(
                color: Colors.red,
                blurRadius: 3,
                offset: Offset(0, 2),
            ),
        ],
    ),
)

After

Icon(
    Icons.all_inbox,
    shadows: [
        Shadow(
            color: Colors.red,
            blurRadius: 3,
            offset: Offset(0, 2),
        ),
    ],
),

所属分类

源码仓库

使用此插件的项目