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

パッケージ詳細v1.1.1

awesome_shake_widget

Flutterウィジェットで、振動アニメーションとオプションのバイブレーション効果を提供し、無効なフォームや注意喚起、ユーザーインタラクションフィードバックに最適です。

AndroidiOS
30日間ダウンロード
1050
いいね数
21
Pub ポイント
160

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

flutter pub add awesome_shake_widget

パッケージ概要

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

UI要素にシェイクアニメーションとオプションのバイブレーションフィードバックを追加するFlutterウィジェットです。無効なフォーム入力に注目を引き、ユーザーの行動を促す、またはインタラクティブなフィードバックを提供するのに最適です。簡単に統合でき、AndroidおよびiOSプラットフォームをサポートしています。最小限の設定で視覚的かつハプティックな応答を提供し、ユーザーエクスペリエンスを向上させます。一般的なインタラクションシナリオにおけるシンプルさと効果性を重視して設計されています。

用途

  • フォーム検証アラート
  • ユーザー入力プロンプト
  • インタラクティブなボタンフィードバック
  • エラー状態の通知
  • オンボーディングガイド

主な機能

  • シェイクアニメーション効果
  • オプションのバイブレーションサポート
  • クロスプラットフォーム互換性
  • シンプルな API インテグレーション
  • カスタマイズ可能なアニメーション期間
  • レスポンシブデザインのサポート

適している対象

  • インタラクティブなフォームを構築する開発者
  • UXデザイナーがフィードバックメカニズムを強化する
  • 注目を引くサインが必要なアプリ
  • Android および iOS 向けのモバイルアプリケーション
  • 直感的なユーザー操作に焦点を当てたプロジェクト

注意事項

  • 過度に使用すると、注意力を散漫にする可能性があります
  • 一部のデバイスでは、振動には許可が必要です
  • アニメーションのパフォーマンスはデバイスの能力に依存します
  • アクセシビリティが重要なコンポーネントには適していません
  • UXの明確性を保つために、控えめに使用することをお勧めします

元の README

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

🚀 awesome_shake_widget

A customizable Flutter widget that adds shake animations with haptic and vibration feedback. Perfect for invalid forms, error indicators, or drawing attention to UI components.

Pub Version Platform License


✨ Features

  • Shake any widget on demand
  • Built-in presets: light, medium, heavy
  • Optional vibration (custom or haptic)
  • Fully customizable offset, pattern & intensities
  • Easy to trigger using a GlobalKey

📦 Installation

dependencies:
  awesome_shake_widget: ^1.0.1

Run:

flutter pub get

🧪 Usage

1️⃣ Standard (Shake + Vibration)

By using the built-in presets — light, medium, heavy and custom — you can quickly apply different vibration intensities and patterns, perfectly paired with UI shake animations for a dynamic and responsive user experience.

final shakeKey = GlobalKey<ShakeWidgetState>();

ShakeWidget(
  key: shakeKey,
  preset: ShakePreset.medium,
  child: Text("Tap Me"),
);

// Somewhere else, e.g., on button press:
shakeKey.currentState?.shake();

2️⃣ Shake Only (No Vibration)

If you only want the visual shake effect without vibration, you can set vibrationType to VibrationType.none using the ShakeConfig. To customize the intensity of the shake, adjust the offset value — higher values will produce a stronger visual effect.

ShakeWidget(
  key: shakeKey,
  customConfig: ShakeConfig(
    offset: 20,
    vibrationType: VibrationType.none,
  ),
  child: Icon(Icons.info),
);

3️⃣ Advanced Configuration: Full Control Over Visual and Vibration Effects

You can also create custom vibration patterns by setting vibrationType to VibrationType.custom, and providing your own pattern and intensities. This gives you full control over the vibration behavior.

ShakeWidget(
key: shakeKey,
customConfig: ShakeConfig(
offset: 32,
pattern: [0, 50, 100, 50],
intensities: [255, 0, 255, 0],
vibrationType: VibrationType.custom,
),
child: Text("Custom Shake!"),
);

Trigger it via:

shakeKey.currentState?.shake();

🎥 Demo

This demo shows how you can apply shake animations to:

  • ✅ Buttons
  • 💬 Dialogs
  • 🖼️ Images
  • ✏️ Text fields
  • 📦 Any widget

🧩 API Reference

Enum: ShakePreset
Value Offset Vibration
light 8 Haptic
medium 16 Haptic
heavy 24 Patterned Vibe
custom User-defined Custom

Enum: VibrationType
  • none – no vibration
  • haptic – system haptic feedback
  • custom – vibration with pattern/intensity (Android only)

ShakeConfig
ShakeConfig({
  required double offset,
  List<int>? pattern,
  List<int>? intensities,
  VibrationType vibrationType = VibrationType.haptic,
});

💡 Example App

Clone and run the example:

cd example
flutter run

Example main.dart:

import 'package:flutter/material.dart';
import 'package:awesome_shake_widget/shake_widget.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: ShakeDemo(),
    );
  }
}

class ShakeDemo extends StatelessWidget {
  final shakeKey = GlobalKey<ShakeWidgetState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Shake Demo')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ShakeWidget(
              key: shakeKey,
              preset: ShakePreset.heavy,
              child: const Icon(Icons.warning, size: 64),
            ),
            const SizedBox(height: 32),
            ElevatedButton(
              onPressed: () => shakeKey.currentState?.shake(),
              child: const Text("Shake it!"),
            ),
          ],
        ),
      ),
    );
  }
}

📄 License

MIT © Juanma Del Boca

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

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

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