パッケージ、リポジトリ、アプリカテゴリを検索

rotated_corner_decoration のカバー
パッケージ詳細v2.1.0+1

rotated_corner_decoration

RotatedCornerDecorationパッケージは、コーナーバッジの作成と適用のために開発されました。TextSpansの自動回転を提供します。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
118
いいね数
113
Pub ポイント
150

パッケージをインストール

flutter pub add rotated_corner_decoration

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

RotatedCornerDecoration は、自動テキスト回転を備えたコーナーバッジを作成および適用することを目的とした Flutter パッケージです。開発者がウィジェットにリボンやバッジなどの装飾的なコーナーエレメントを簡単に追加できるようにし、隅に配置された場合でもテキストラベルが適切な方向を保つことを可能にします。『新着』や『セール』タグのような UI の強化に最適で、Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームをサポートしています。TextSpan の自動回転機能により、回転したコンテナ内のテキストの整列プロセスを簡素化しています。

用途

  • 装飾的なコーナーベゼルの追加
  • 動的リボンラベルの作成
  • 視覚的インジケーターによるUIの向上
  • コーナーにステータスタグを表示する
  • ウィジェットのコーナー装飾のカスタマイズ
  • プロモーションバナーの作成

主な機能

  • 自動回転テキストスパン
  • 複数のプラットフォームをサポートしています
  • 既存のウィジェットとの簡単な統合
  • 柔軟なコーナー位置決め
  • 最小限のボイラープレートコード
  • クロスプラットフォーム互換性

適している対象

  • 視覚的な魅力を求めるUIデザイナー
  • eコマースアプリを開発する開発者
  • ダッシュボードインターフェースを作成するチーム
  • ステータスインジケーターが必要なアプリ
  • カスタムバッジ要件を持つプロジェクト

注意事項

  • TextSpan レイアウトの理解が必要です
  • 複雑なレイアウトには微調整が必要になる場合があります
  • コーナー装飾用途に限定
  • フルスクリーンのオーバーレイには適していません
  • シンプルなテキストコンテンツと併用するのが最適です

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Pay attention!

If you need a regular (not rotated) text at the corner of widgets please consider to use Stack with Containers and Text widgets.
This package was developed to provide auto rotation of TextSpans.

Example

Take a look at the provided example application for how to use the CornerDecoration.

How to use

screenshot1678647469887

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Color(0xffffd700),
    badgeSize: Size(16, 16),
  ),
),

screenshot1678647470825

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.red,
    spanBaselineShift: 4,
    badgeSize: Size(64, 64),
    badgeCornerRadius: Radius.circular(8),
    badgePosition: BadgePosition.topStart,
    textSpan: TextSpan(
      text: 'OMG',
      style: TextStyle(
        color: Colors.white,
        fontSize: 12,
        letterSpacing: 1,
        fontWeight: FontWeight.bold,
        shadows: [
          BoxShadow(color: Colors.yellowAccent, blurRadius: 8),
        ],
      ),
    ),
  ),
),

screenshot1678647471437

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.blue,
    badgeSize: Size(64, 64),
    textSpan: TextSpan(
      text: 'Multiline\nbadge',
      style: TextStyle(fontSize: 10),
    ),
  ),
),

screenshot1678647472293

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.black87,
    badgeSize: Size(64, 64),
    spanBaselineShift: 2,
    textSpan: TextSpan(
      children: [
        TextSpan(
          text: 'LOREM\n',
          style: TextStyle(
            fontSize: 10,
            fontWeight: FontWeight.bold,
            color: Colors.redAccent,
          ),
        ),
        TextSpan(
          text: 'IPSUM',
          style: TextStyle(
            fontSize: 7,
            fontStyle: FontStyle.italic,
            letterSpacing: 5,
            color: Colors.yellow,
          ),
        ),
      ],
    ),
  ),
),

screenshot1678647473029

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.brown,
    badgeSize: Size(112, 56),
    textSpan: TextSpan(
      text: 'WEIRD BADGE',
      style: TextStyle(fontSize: 10),
    ),
  ),
),

screenshot1678647473739

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.blueGrey,
    badgeSize: Size(64, 64),
    textSpan: TextSpan(
      text: 'WOW',
      style: TextStyle(fontSize: 10),
    ),
    spanHorizontalOffset: -12,
  ),
),

screenshot1678647478380

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.green,
    badgeSize: Size(64, 64),
    textSpan: TextSpan(
      text: 'SHIFT 1',
      style: TextStyle(fontSize: 10, backgroundColor: Colors.black),
    ),
  ),
),

screenshot1678647479092

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.green,
    badgeSize: Size(64, 64),
    spanBaselineShift: 3,
    textSpan: TextSpan(
      text: 'SHIFT 4',
      style: TextStyle(fontSize: 10, backgroundColor: Colors.black),
    ),
  ),
),

screenshot1678647479917

Container(
  foregroundDecoration: RotatedCornerDecoration.withGradient(
    gradient: LinearGradient(
      begin: Alignment.topRight,
      end: Alignment.bottomLeft,
      colors: [Colors.blue, Colors.lightGreenAccent],
    ),
    badgeSize: Size(64, 64),
  ),
  decoration: RotatedCornerDecoration.withGradient(
    badgePosition: BadgePosition.topStart,
    gradient: LinearGradient(
      begin: Alignment.topLeft,
      end: Alignment.topRight,
      stops: [0, 0.5, 1],
      colors: [
        Colors.purpleAccent,
        Colors.amber,
        Colors.blue,
      ],
    ),
    badgeSize: Size(64, 64),
  ),
),

screenshot1678647480605

Container(
  foregroundDecoration: RotatedCornerDecoration.withGradient(
    gradient: RadialGradient(
      center: Alignment.topRight,
      radius: 1.5,
      stops: const [0, 0.25, 0.5],
      colors: [
        Colors.redAccent,
        Colors.redAccent.withOpacity(0.5),
        Colors.redAccent.withOpacity(0),
      ],
    ),
    badgeSize: const Size(64, 64),
  ),
  decoration: RotatedCornerDecoration.withGradient(
    badgePosition: BadgePosition.topStart,
    gradient: SweepGradient(
      center: const FractionalOffset(0.27, -0.65),
      colors: List.generate(360, _generator),
    ),
    badgeSize: const Size(64, 64),
  ),
),

screenshot1678647483564

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.lightBlue,
    badgeSize: Size(64, 64),
    badgeShadow: BadgeShadow(color: Colors.black, elevation: 4),
  ),
),

screenshot1678647484300

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.indigo,
    badgeSize: Size(64, 64),
    badgePosition: BadgePosition.bottomStart,
    textDirection: TextDirection.ltr,
  ),
),

screenshot1678647485147

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.indigo,
    badgeSize: Size(64, 64),
    badgePosition: BadgePosition.bottomStart,
    textDirection: TextDirection.rtl,
  ),
),

EXPERIMENTAL FEATURE!

use isEmoji: true to disable span rotating
you can shift span position with spanHorizontalOffset and TextStyle.height parameters screenshot1678649657350

Container(
  foregroundDecoration: RotatedCornerDecoration.withColor(
    color: Colors.purple,
    badgeSize: Size(64, 64),
    isEmoji: true,
    textSpan: TextSpan(
      text: '🤮',
      style: TextStyle(fontSize: 20, height: 1.7),
    ),
  ),
),

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。