패키지, 저장소 및 앱 카테고리 검색

dismissible_page 표지
패키지 상세v2.1.1

dismissible_page

어떤 방향으로든 페이지를 닫을 수 있는 Flutter 위젯. 지루한 뒤로 가기 버튼과 단순한 전환 효과는 잊어버리세요.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
3.8만
좋아요
694
Pub 점수
160

패키지 설치

flutter pub add dismissible_page

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

사용자가 어느 방향으로든 스와이프하여 페이지를 닫을 수 있도록 해주는 플러터 위젯으로, 전통적인 뒤로 가기 버튼과 기본 전환 효과를 대체합니다. 사용자 정의 가능한 종료 동작과 부드럽고 제스처 기반의 네비게이션을 제공하여 모바일 및 웹 플랫폼에서 사용자 경험을 향상시킵니다. 이 패키지는 안드로이드, iOS, 웹, macOS, 윈도우, 리눅스 등 여러 플랫폼을 지원하며 크로스플랫폼 앱에 유연하게 활용할 수 있습니다. 매끄러운 애니메이션과 직관적인 상호작용을 갖추고 있어 현대적이고 인터랙티브한 UI에 이상적입니다.

사용 사례

  • 스와이프로 닫기 모달
  • 인터랙티브 온보딩 흐름
  • 제스처 기반 탐색
  • 사용자 지정 페이지 닫기
  • 사용자 참여도 향상

주요 기능

  • 방향에 관계없는 스와이프 종료
  • 부드러운 애니메이션 전환
  • 크로스 플랫폼 지원
  • 사용자 지정 가능한 드래그 민감도
  • 내장 에지 탐지
  • Navigator와의 간편한 통합

적합한 대상

  • 현대적인 앱 인터페이스
  • 인터랙티브 튜토리얼
  • 손짓 중심 애플리케이션
  • 디자인 중심의 사용자 경험
  • 모바일 우선 개발

고려 사항

  • 다른 제스처 감지기와 충돌할 수 있습니다
  • 중첩된 탐색을 신중하게 처리해야 합니다
  • 복잡한 탐색 스택에 적합하지 않음
  • 중량 위젯 사용 시 성능 영향
  • 제한된 접근성 지원
  • 모든 대상 플랫폼에서 테스트 필요

원본 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;

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트