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

dismissible_page のカバー
パッケージ詳細v2.1.1

dismissible_page

任意の方向にページを閉じることができるFlutterウィジェット。退屈な戻るボタンや単調な遷移を忘れましょう。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
3.8万
いいね数
694
Pub ポイント
160

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

flutter pub add dismissible_page

パッケージ概要

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

Flutterウィジェットで、ユーザーが任意の方向にスワイプすることでページを閉じられるようにし、従来の戻るボタンや基本的な遷移を置き換えます。カスタマイズ可能な終了動作と滑らかなジェスチャー駆動型ナビゲーションを提供し、モバイルおよびウェブプラットフォームでのユーザーエクスペリエンスを向上させます。このパッケージはAndroid、iOS、Web、macOS、Windows、Linuxなど複数のプラットフォームをサポートしており、クロスプラットフォームアプリに適しています。滑らかなアニメーションと直感的な操作を備えており、現代的なインタラクティブUIに最適です。

用途

  • スワイプで消去するモーダル
  • インタラクティブなオンボーディングフロー
  • ジェスチャーによるナビゲーション
  • カスタムページの非表示
  • ユーザー参加の向上

主な機能

  • 方向に依存しないスワイプによる非表示
  • スムーズなアニメーション遷移
  • クロスプラットフォーム対応
  • カスタマイズ可能なドラッグ感度
  • 組み込みエッジ検出
  • Navigator との簡単な統合

適している対象

  • モダンなアプリインターフェース
  • インタラクティブなチュートリアル
  • ジェスチャー中心のアプリケーション
  • デザインを重視したUX
  • モバイルファースト開発

注意事項

  • 他のジェスチャーディテクタと競合する可能性があります
  • ネストされたナビゲーションの取り扱いに注意が必要です
  • 複雑なナビゲーションスタックには適していない
  • 重いウィジェットを使用した際のパフォーマンスへの影響
  • 制限されたアクセシビリティ対応
  • すべてのターゲットプラットフォームでテストが必要です

元の README

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

Flutter Dismissible Page From Tornike

Pub package Github starts style: effective dart pub package

Flutter widget that allows you to dismiss page to any direction, forget the boring back button and plain transitions.

Features:

  • Dismiss to any direction
  • Works with nested list view
  • Animating border
  • Animating background
  • Animating scale

Support

PRs Welcome
Discord Channel
Don't forget to give it a star ⭐

Demo

Live Demo Multi Direction Vertical

Getting Started


const imageUrl =
    'https://user-images.githubusercontent.com/26390946/155666045-aa93bf48-f8e7-407c-bb19-bc247d9e12bd.png';

class FirstPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color.fromRGBO(228, 217, 236, 1),
      body: GestureDetector(
        onTap: () {
          // Use extension method to use [TransparentRoute]
          // This will push page without route background
          context.pushTransparentRoute(SecondPage());
        },
        child: Center(
          child: SizedBox(
            width: 200,
            // Hero widget is needed to animate page transition
            child: Hero(
              tag: 'Unique tag',
              child: Image.network(
                imageUrl,
                fit: BoxFit.cover,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

class SecondPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DismissiblePage(
      onDismissed: () {
        Navigator.of(context).pop();
      },
      // Note that scrollable widget inside DismissiblePage might limit the functionality
      // If scroll direction matches DismissiblePage direction
      direction: DismissiblePageDismissDirection.multi,
      isFullScreen: false,
      child: Hero(
        tag: 'Unique tag',
        child: Image.network(
          imageUrl,
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}

Properties

  const DismissiblePage({
    required this.child,
    required this.onDismissed,
    this.onDragStart,
    this.onDragEnd,
    this.onDragUpdate,
    this.isFullScreen = true,
    this.disabled = false,
    this.backgroundColor = Colors.black,
    this.direction = DismissiblePageDismissDirection.vertical,
    this.dismissThresholds = const <DismissiblePageDismissDirection, double>{},
    this.dragStartBehavior = DragStartBehavior.down,
    this.dragSensitivity = 0.7,
    this.minRadius = 7,
    this.minScale = .85,
    this.maxRadius = 30,
    this.maxTransformValue = .4,
    this.startingOpacity = 1,
    this.hitTestBehavior = HitTestBehavior.opaque,
    this.reverseDuration = const Duration(milliseconds: 200),
    Key? key,
  }) : super(key: key);

  /// Called when the widget has been dismissed.
  final VoidCallback onDismissed;

  /// Called when the user starts dragging the widget.
  final VoidCallback? onDragStart;

  /// Called when the user ends dragging the widget.
  final VoidCallback? onDragEnd;

  /// Called when the widget has been dragged. (0.0 - 1.0)
  final ValueChanged<DismissiblePageDragUpdateDetails>? onDragUpdate;

  /// If true widget will ignore device padding
  /// [MediaQuery.of(context).padding]
  final bool isFullScreen;

  /// The minimum amount of scale widget can have while dragging
  /// Note that scale decreases as user drags
  final double minScale;

  /// The minimum amount fo border radius widget can have
  final double minRadius;

  /// The maximum amount of border radius widget can have while dragging
  /// Note that radius increases as user drags
  final double maxRadius;

  /// The amount of distance widget is able to drag. value (0.0 - 1.0)
  final double maxTransformValue;

  /// If true the widget will ignore gestures
  final bool disabled;

  /// Widget that should be dismissed
  final Widget child;

  /// Background color of [DismissiblePage]
  final Color backgroundColor;

  /// The amount of opacity [backgroundColor] will have when start dragging the widget.
  final double startingOpacity;

  /// The direction in which the widget can be dismissed.
  final DismissiblePageDismissDirection direction;

  /// The offset threshold the item has to be dragged in order to be considered
  /// dismissed. default is [_kDismissThreshold], value (0.0 - 1.0)
  final Map<DismissiblePageDismissDirection, double> dismissThresholds;

  /// Represents how much responsive dragging the widget will be
  /// Doesn't work on [DismissiblePageDismissDirection.multi]
  final double dragSensitivity;

  /// Determines the way that drag start behavior is handled.
  final DragStartBehavior dragStartBehavior;

  /// The amount of time the widget will spend returning to initial position if widget is not dismissed after drag
  final Duration reverseDuration;

  /// How to behave during hit tests.
  ///
  /// This defaults to [HitTestBehavior.opaque].
  final HitTestBehavior hitTestBehavior;

カテゴリー

ソースリポジトリ

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