double_back_to_close_app 0.1.0 copy "double_back_to_close_app: ^0.1.0" to clipboard
double_back_to_close_app: ^0.1.0 copied to clipboard

outdated

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

double_back_to_close_app #

pub package

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

Usage #

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

void main() async => runApp(MyApp());

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.

321
likes
0
pub points
96%
popularity

Publisher

verified publisherhugopassos.dev

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on double_back_to_close_app