FLUTTER ECOSYSTEM

benPesso/flutter_decorated_icon

Flutter用のウィジェットで、アイコンに影効果を追加できます

flutter_decorated_icon のプロジェクト画像
Stars
11
Forks
5
最終プッシュ(UTC)
2021/07/04
プロジェクト状態
公開中
benPesso GitHub avatar
GITHUB User

benPesso ↗

言語DartSwiftKotlinObjective-C

技術トピック

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 2 件
  • flutter{"sdk":"flutter"}
  • flutter_test開発用{"sdk":"flutter"}

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

pub package

Decorated Icon

The best-performing shadowed icon widget for Flutter!

DecoratedIcon is a super lightweight Icon that supports shadow decorations.

No complicated hacks or multiple widgets, just List<Shadow> shadows like a TextStyle!

This widget is able to achieve the most efficient implementation of an icon with a shadow because it is uses a single Text widget to display the icon and apply the shadows.

It even supports debugging and Semantics.

One thing to keep in mind when using multiple shadows is the order of stacking by Flutter: the first shadow in the list will be painted at the bottom. (Similar to how the Stack widget draws its children.)

Also note that due to Flutter's current limitation, achieving an "outer glow" effect is not currently possible. You can read more here.

Usage

To use this package, add decorated_icon as a dependency in your pubspec.yaml file.

Example

snapshot

Import the library.

import 'package:decorated_icon/decorated_icon.dart';

Then use DecoratedIcon as you would an Icon:

final decoratedIcons = Row(
  mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  children: const [
    DecoratedIcon(
      Icons.android,
      color: Colors.purple,
      size: 60.0,
      shadows: [
        BoxShadow(
          blurRadius: 42.0,
          color: Colors.purpleAccent,
        ),
        BoxShadow(
          blurRadius: 12.0,
          color: Colors.white,
        ),
      ],
    ),
    DecoratedIcon(
      Icons.favorite,
      color: Colors.lightBlue.shade50,
      size: 60.0,
      shadows: [
        BoxShadow(
          blurRadius: 12.0,
          color: Colors.blue,
        ),
        BoxShadow(
          blurRadius: 12.0,
          color: Colors.green,
          offset: Offset(0, 6.0),
        ),
      ],
    ),
    DecoratedIcon(
      Icons.fingerprint,
      color: Colors.orange,
      size: 60.0,
      shadows: [
        BoxShadow(
          color: Colors.black,
          offset: Offset(3.0, 3.0),
        ),
      ],
    ),
  ],
);