Skip to main content

adaptive_will_pop 1.0.0 copy "adaptive_will_pop: ^1.0.0" to clipboard
adaptive_will_pop: ^1.0.0 copied to clipboard

Custom will pop scope widget to allow Apple user (iOS, iPad and macOs) uses the back gesture

Adaptive will pop a custom will pop to allow apple user back with back gesture

Currently the will pop scope widget will disabled the back gesture for apple user, you can find out the issue on this link https://github.com/flutter/flutter/issues/14203

Preview #

iOS Android
[assets/adaptive-will-pop-ios.gif] [assets/adaptive-will-pop-and.gif]

Getting started #

Add the adaptive_will_pop lib to your pubspec.yaml then run the flutter pub get

dependencies:
  adaptive_will_pop:

import the lib by adding this line code

import 'package:adaptive_will_pop/adaptive_will_pop.dart';

Usage #

Adaptive Will Pop adds two optional params swapWidth to determines the maximum width that user can swipe (by default it was assigned to the screen width) and swipeThreshold to indicates the onWillPop will be called if the user swipe over this value (by default it was assigned to half of the swapWidth).

bool get _width => MediaQuery.of(buildContext).size.width;

@override
  Widget build(BuildContext context) => AdaptiveWillPop(
        onWillPop: () async => true,
        width: _width,
        swipeThreshold: _width / 2,
        child: Scaffold(
          appBar: AppBar(
            title: const Text('Second Page'),
            backgroundColor: Theme.of(context).colorScheme.inversePrimary,
          ),
          body: const Center(child: Text('Hello World')),
        ),
      );
0
likes
140
points
53
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Custom will pop scope widget to allow Apple user (iOS, iPad and macOs) uses the back gesture

Repository (GitHub)

License

BSD-2-Clause (license)

Dependencies

flutter

More

Packages that depend on adaptive_will_pop