8000 GitHub - habityou/double_back_to_close_app: A Flutter package that allows Android users to press the back-button twice to close the app.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A Flutter package that allows Android users to press the back-button twice to close the app.

License

Notifications You must be signed in to change notification settings

habityou/double_back_to_close_app

 
 

Repository files navigation

double_back_to_close_app

pub package ci workflow style: effective dart

A Flutter package that allows Android users to press the back-button twice to close the app.

Demo

Usage

Inside a Scaffold that wraps all your Widgets, place the DoubleBackToCloseApp passing a SnackBar:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: DoubleBackToCloseApp(
          child: Home(),
          snackBar: const SnackBar(
            content: Text('Tap back again to leave'),
          ),
        ),
      ),
    );
  }
}

Motivation

I've implemented such solution when I answered this question in Stack Overflow, and since this feature seems to be implemented very often, I decided to extract it in a lightweight library.

About

A Flutter package that allows Android users to press the back-button twice to close the app.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 92.0%
  • Shell 3.3%
  • Swift 2.4%
  • Kotlin 2.1%
  • Objective-C 0.2%
0