搜尋套件、儲存庫與 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),
        ),
    ],
),

所屬分類

原始碼儲存庫

使用此套件的專案