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

gradient_elevated_button のカバー
パッケージ詳細v1.2.0

gradient_elevated_button

視覚的に魅力的なUI用のグラデーション背景を持つカスタムFlutterボタン。

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

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

flutter pub add gradient_elevated_button

パッケージ概要

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

グラデーション背景を備えたカスタマイズ可能なFlutterボタンで、UIの美しさを向上させることを目的としています。標準のElevatedButtonをスムーズなグラデーションフィル、影効果、応答性のフィードバックで拡張しています。機能性を損なわず、視覚的に魅力的なボタンが必要な現代的なアプリインターフェースに最適です。このパッケージはAndroid、iOS、Web、macOS、Windows、Linuxなどすべての主要プラットフォームをサポートしており、デバイス間で一貫した外観を保証します。

用途

  • 目を引くコール・トゥ・アクションボタンの作成
  • ログインまたはサインアップ画面の向上
  • モダンなモバイルおよびウェブインターフェースの設計
  • フォームとダッシュボードにビジュアルな魅力を加える
  • 動的ビジュアルを通じたユーザー参加の向上

主な機能

  • グラデーション背景のサポート
  • 組み込みのエレベーションとシャドウ効果
  • カスタマイズ可能な色とストップポイント
  • 応答性のあるタッチフィードバック
  • クロスプラットフォーム互換性
  • 既存のFlutterコードとの簡単な統合

適している対象

  • 視覚的な洗練を求めるUIデザイナー
  • 現代アプリを開発する開発者
  • 美的魅力に重点を置いたプロジェクト
  • 複数のプラットフォームをターゲットにするアプリ
  • フルスタック開発にFlutterを使用するチーム

注意事項

  • アクセシビリティのための追加のスタイリングが必要になる場合があります
  • 複雑なグラデーションのパフォーマンスへの影響
  • グラデーションとエレベーション以外のカスタマイズは限られている
  • ミニマリズムデザインパターンには適していません
  • 読みやすさのために、コントラストの高いテキストと併用するのが最適です

元の README

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

GradientElevatedButton

Package Version License Likes Points Popularity

Git Issues

Buy Me a Coffee

A customizable elevated button with gradient support for your Flutter applications. This package allows you to create buttons with gradient backgrounds, custom foreground colors, and various other customizable properties using the GradientElevatedButton widget.

Features

  • Gradient Background: Easily apply gradients to your button backgrounds.
  • Customizable Style: Customize text color, shape, padding, and more.
  • Integration with Theme: Use GradientButtonThemeExtension (via ThemeExtension) to apply a consistent style across your app. (Old: GradientButtonThemeData is deprecated)

Demo

Usage

1. Theming with ThemeExtension (Recommended)

The recommended way to theme all gradient buttons is to use GradientButtonThemeExtension with ThemeData.extensions:

MaterialApp(
  theme: ThemeData(
    extensions: <ThemeExtension<dynamic>>[
      GradientButtonThemeExtension(
        style: GradientElevatedButton.styleFrom(
          backgroundGradient: const LinearGradient(
            colors: [Colors.blue, Colors.green],
            begin: Alignment.centerLeft,
            end: Alignment.centerRight,
          ),
          foregroundColor: Colors.black,
        ),
      ),
    ],
  ),
  home: ...,
)

Then use GradientElevatedButton as usual:

GradientElevatedButton(
  onPressed: () {},
  child: Text('Themed Gradient Button'),
)
2. [DEPRECATED] Using GradientButtonThemeData

GradientButtonThemeData is deprecated and will be removed in a future release. Migrate to ThemeExtension as shown above.

// Deprecated usage:
GradientButtonThemeData(
  data: GradientElevatedButton.styleFrom(
    backgroundGradient: const LinearGradient(
      colors: [Colors.blue, Colors.green],
      begin: Alignment.centerLeft,
      end: Alignment.centerRight,
    ),
    foregroundColor: Colors.black,
  ),
  child: MaterialApp(
    // ...
  ),
)
3. Using GradientElevatedButton.styleFrom

Alternatively, you can style the GradientElevatedButton directly using GradientElevatedButton.styleFrom to define the button's gradient, shape, and other properties:


Widget gradientWidget = GradientElevatedButton(
  onPressed: () {

  },
  style: GradientElevatedButton.styleFrom(
    gradient: const LinearGradient(colors: [
      Color.fromARGB(255, 166, 206, 57),
      Color.fromARGB(255, 0, 175, 173),
    ],
      disabledGradient: const LinearGradient(colors: [
        Colors.grey.withAlpha(200),
        Colors.grey,
        Colors.grey.withAlpha(200),
      ],
        begin: Alignment.topCenter,
        end: Alignment.bottomCenter,
      ),
    ),
  ),
  child: const Text("This is Gradient Elevated Button"),
);

Customization

You can fully customize the GradientElevatedButton using the following properties:

  • backgroundGradient: A LinearGradient (or other types) that defines the background gradient.
  • foregroundColor: The color of the text and icon on the button.
  • disabledBackgroundGradient: A LinearGradient (or other types) that defines the disabled background gradient.
  • disabledForegroundColor: The color of the text and icon on the disabled button.
  • padding: Padding inside the button.
  • shape: Define the button’s shape with a ShapeBorder like RoundedRectangleBorder or StadiumBorder.
  • elevation: Controls the button's elevation (default: 2).
  • onPressed: The callback function that is called when the button is pressed.

Migration Guide

To migrate from GradientButtonThemeData to the new ThemeExtension approach:

  1. Remove GradientButtonThemeData from your widget tree.
  2. Add GradientButtonThemeExtension to your ThemeData.extensions.
  3. Use GradientButtonThemeExtension.of(context) to access the style if needed.
  4. All GradientElevatedButton widgets will now use the theme from the extension.

See the example and code comments for more details.

Example

click here for example

Issues and Feedback

Please file any issues or provide feedback by visiting the Issues and Feedback for this repository.

For suggestions or further feedback, feel free to send an email to chegz.dev@gmail.com, and we'd be happy to hear from you!

Contributors thanks

contributors

カテゴリー

ソースリポジトリ

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

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