Skip to content
pubscout

universal_back_gesture

2.1.0, released 2 years ago by thela.space

Universal and customizable back gesture for any custom page transitions in Flutter.

WASM-ready
$ flutter pub add universal_back_gesture
Source repository

What it does

Provides a configurable edge swipe back gesture that works with custom page transitions and standard routers like GoRouter. Allows customization of detection areas, velocity thresholds, swipe distance, and animation curves.

AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to add an interactive swipe-to-pop gesture to custom page transitions
  • You need fine-grained control over swipe sensitivity, thresholds, and animation curves for going back

Skip it when

  • You are satisfied with the default platform-specific back gestures provided by Flutter
  • Your navigation setup does not use custom page transitions or standard PageTransitionsTheme builders

Strengths

  • Highly customizable gesture parameters including swipe area, range, and velocity thresholds
  • Compatible with PopScope and GoRouter
  • Works across multiple platforms (Android, iOS, Web, Windows, macOS, Linux)

Weaknesses

  • Requires manual configuration for custom route setups
  • Not a drop-in replacement for standard routing without setting up PageTransitionsTheme or custom Page routes

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
MaterialApp(
  theme: ThemeData(
    pageTransitionsTheme: PageTransitionsTheme(
      builders: {
        for (final platform in TargetPlatform.values)
          platform: BackGesturePageTransitionsBuilder(
            parentTransitionBuilder: const FadeForwardsPageTransitionsBuilder(),
            config: BackGestureConfig(),
          ),
      },
    ),
  ),
);

Alternatives

Packages that do the same job and could replace universal_back_gesture.

  • go_router

    If you are looking for a complete declarative routing and deep linking solution rather than just back gesture handling.

  • auto_route

    If you need strongly typed route generation and advanced navigation features.