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

패키지 상세v0.4.8

swipeable_page_route

뒤로 돌아가려면 스와이프하고 아름답게 변형되는 위젯을 감상하세요

AndroidiOSmacOSWindowsLinux
30일 다운로드
1.4만
좋아요
320
Pub 점수
160

패키지 설치

flutter pub add swipeable_page_route

패키지 개요

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

SwipeablePageRoute는 Flutter 패키지로, 페이지에서 직관적인 스와이프 뒤로 이동 제스처를 가능하게 하여 화면 간 부드럽고 변형되는 전환 효과를 통해 사용자 경험을 향상시킵니다. 표준 PageRoute를 확장하여 사용자 지정 가능한 애니메이션과 기존 네비게이션 흐름에 원활하게 통합할 수 있도록 제공합니다. 유연하고 상호작용적인 네비게이션을 중시하는 앱에 적합하며, Android, iOS, macOS, Windows 및 Linux 등 여러 플랫폼을 지원합니다. 이 패키지는 가볍고 Flutter의 라우팅 시스템과 쉽게 작동하도록 설계되었습니다.

사용 사례

  • 모바일 앱에서 스와이프 백 탐색 구현
  • 애니메이션 전환을 통해 몰입형 사용자 경험 만들기
  • 제스처 기반 탐색을 통한 앱 상호작용 향상
  • 다양한 플랫폼 간에 일관된 탐색 패턴 구축
  • 화면 전환에 시각적 마무리 추가

주요 기능

  • 부드러운 스와이프 뒤로 가기 제스처 지원
  • 사용자 정의 전환 애니메이션
  • 크로스 플랫폼 호환성
  • 기존 루트와의 간편한 통합
  • 내비게이션 중 모핑 위젯 전환

적합한 대상

  • 제스처 기반 탐색을 찾는 개발자
  • 사용자 참여 및 UX에 중점을 둔 앱
  • 다중 플랫폼을 대상으로 하는 Flutter 프로젝트
  • 풍부한 애니메이션을 갖춘 디자인에 신경 쓴 애플리케이션
  • 고급 탐색을 위한 최소한의 설정을 원하는 팀

고려 사항

  • 복잡한 전환을 위해 추가 스타일링이 필요할 수 있습니다
  • 애니메이션 중에 무거운 위젯을 사용했을 때의 성능 영향
  • 기본 스와이프 동작을 넘어서는 사용자 정의가 제한되어 있음
  • 간단하고 정적인 탐색 흐름에 적합하지 않음
  • 중첩된 탐색 시나리오에서는 주의 깊은 조작이 필요합니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

🔙 Swipe to navigate back and admire beautifully morphing widgets.

swipeable_page_route demo

SwipeablePageRoute

SwipeablePageRoute is a specialized CupertinoPageRoute that allows your users to go back by swiping anywhere on the current page. Use it instead of MaterialPageRoute or CupertinoPageRoute:

Navigator.of(context).push(SwipeablePageRoute(
  builder: (BuildContext context) => MyPageContent(),
));

If your page contains horizontally scrollable content, you can limit SwipeablePageRoute to only react on drags from the start (left in LTR, right in RTL) screen edge — just like CupertinoPageRoute:

Navigator.of(context).push(SwipeablePageRoute(
  canOnlySwipeFromEdge: true,
  builder: (BuildContext context) => MyHorizontallyScrollablePageContent(),
));

You can get the SwipeablePageRoute wrapping your current page using context.getSwipeablePageRoute<T>().

To use swipeable pages with a PageTransitionsTheme, use SwipeablePageTransitionsBuilder.

⚠️ SwipeablePageTransitionsBuilder must be set for TargetPlatform.iOS. For all other platforms, you can decide whether you want to use it. This is because PageTransitionsTheme uses the builder for iOS whenever a pop gesture is in progress.

Usage with Go Router

To use swipeable pages with Flutter's Go Router, use SwipeablePage and the pageBuilder parameter in GoRoute instead of builder:

// Before, without swipeable pages:
GoRoute(
  builder: (context, state) => const MyScreen(),
  // ...
)

// After, with swipeable pages:
GoRoute(
  pageBuilder: (context, state) => SwipeablePage(
    builder: (context) => MyScreen(),
  ),
  // ...
)

MorphingAppBar & MorphingSliverAppBar

As you can see in the demo above, there's a beautiful animation happening to the app bar. That's a MorphingAppBar!

You can construct MorphingAppBar (corresponds to AppBar) and MorphingSliverAppBar (corresponds to SliverAppBar) just like the originals:

MorphingAppBar(
  backgroundColor: Colors.green,
  title: Text('My Page'),
  actions: [
    IconButton(
      key: ValueKey('play'),
      icon: Icon(Icons.play_arrow),
      onPressed: () {},
    ),
    IconButton(
      key: ValueKey('favorite'),
      icon: Icon(Icons.favorite),
      onPressed: () {},
    ),
    PopupMenuButton<void>(
      key: ValueKey('overflow'),
      itemBuilder: (context) => [
        PopupMenuItem<void>(child: Text('Overflow action 1')),
        PopupMenuItem<void>(child: Text('Overflow action 2')),
      ],
    ),
  ],
  bottom: TabBar(tabs: [
    Tab(text: 'Tab 1'),
    Tab(text: 'Tab 2'),
    Tab(text: 'Tab 3'),
  ]),
)

Both MorphingAppBars internally use Heros, so if you're not navigating directly inside a MaterialApp, you have to add a HeroController to your Navigator:

Navigator(
  observers: [HeroController()],
  onGenerateRoute: // ...
)

To animate additions, removals, and constants in your AppBars actions, we compare them using Widget.canUpdate(Widget old, Widget new). It compares Widgets based on their type and key, so it's recommended to give every action Widget a key (that you reuse across pages) for correct animations.

카테고리

의존성

의존성 목록 3 개

소스 저장소

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

아직 데이터가 없습니다.