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

Flutter plugin to handle backgound the app on pressing back button instead of quitting app.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:background_on_back/background_on_back.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return PopScope(
        canPop: false,
        onPopInvokedWithResult: (didPop, result) {
          if (didPop) return;
          BackgroundOnBack.pop();
        },
        child: Scaffold(
          appBar: AppBar(title: const Text('Homepage')),
          body: Center(child: Text('Hassle free solution for android BACK press')),
        ),
      );
  }
}
1
likes
160
points
45
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin to handle backgound the app on pressing back button instead of quitting app.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on background_on_back

Packages that implement background_on_back