flutter package double back to close app
a flutter package that allows android users to press the back-button twice to close the app.
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.
Comments are closed.