zo_screenshot 0.0.3 copy "zo_screenshot: ^0.0.3" to clipboard
zo_screenshot: ^0.0.3 copied to clipboard

zo_screenshot is a Flutter plugin that allows you to enable, disable, toggle, or stream screenshot events in your application.

zo_screenshot #

pub package pub points License: MIT

The zo_screenshot plugin helps restrict screenshots and screen recording in Flutter apps, enhancing security and privacy by preventing unauthorized screen captures.

✅ Key Features #

✔️ Enable or disable screenshot capturing
✔️ Detect and stream screenshot events in real time
✔️ Secure sensitive pages like login, payments, and chat
✔️ Prevent screen recording on protected screens

🔐 Protect your Flutter app from unauthorized screenshots today!

Table of contents #

Getting started #

First, add zo_screenshot as a dependency in your pubspec.yaml file

dependencies:
  flutter:
    sdk: flutter
  zo_screenshot : ^[version]

Import the package #

import 'package:zo_screenshot/zo_screenshot.dart';

Usage #

Disabling ScreenShot #

final _zoScreenshotPlugin = ZoScreenshot();
_zoScreenshotPlugin.disableScreenShot();

Enabling Screenshot #

final _zoScreenshotPlugin = ZoScreenshot();
_zoScreenshotPlugin.enableScreenshot();

Listen To Screenshot Event #

final _zoScreenshotPlugin = ZoScreenshot();

_zoScreenshotPlugin.startScreenshotListner(
  screenShotcallback: () {
    print("Screenshot taken");
  },
);

Secure Specific Routes #

Financial apps like Google Pay (GPay) prevent sensitive screens from being recorded or captured. You can implement similar security measures in your app by blocking screenshots and screen recordings on specific routes. The approach depends on your navigation style—whether you're using named routes or class-based navigation.

SecureRoute

For Named Route

return MaterialApp(
  navigatorObservers: [
    ZoNavigatorObserver(
      navigationStyle: NavigationStyle.namedRoute,
      secureNamedRouteList: ["/secureRoute"],
    ),
  ],
  routes: {
    "/secureRoute": (context) => const SecureRoute(),
    "/nonSecureRoute": (context) => NonSecure(),
  },
  home: Scaffold(
    appBar: AppBar(
      centerTitle: true,
      title: const Text('Zo Screenshot Example'),
    ),
    body: Example(),
  ),
);

For Class Route

return MaterialApp(
  navigatorObservers: [
    ZoNavigatorObserver(
      navigationStyle: NavigationStyle.classRoute,
      secureClassRouteList: [SecureRoute],
    ),
  ],
  home: Scaffold(
    appBar: AppBar(
      centerTitle: true,
      title: const Text('Zo Screenshot Example'),
    ),
    body: Example(),
  ),
);

Show Preview While App is in Background #

BackgroundPreview

Wrap with ZoScreenShotWrapper

ZoScreenShotWrapper(
  disableScreenShot: true,
  backgroundPreviewWidget: Container(
    decoration: BoxDecoration(
      gradient: LinearGradient(
        begin: Alignment.topCenter,
        end: Alignment.bottomCenter,
        colors:[Colors.grey[300]!, Colors.grey],
      ),
    ),
    width: double.infinity,
    height: double.infinity,
    child: Center(
    child: Icon(Icons.lock, size: 50, color: Colors.white),
    ),
  ),
  child: Scaffold(
    appBar: AppBar(
      title: const Text('Plugin example app'),
    ),
    body: Example(),
  ),
);

Properties Description
backgroundPreviewWidget Add Your own custom preview widget
disableScreenShot set to true to disable screenshot
showBackgroundPreview set to false to disable background preview

Feel free to post a feature requests or report a bug here.

My Other packages #

  • zo_animated_border: A package that provides a modern way to create gradient borders with animation in Flutter
  • connectivity_watcher: A Flutter package to monitor internet connectivity with subsecond response times, even on mobile networks.
  • ultimate_extension: Enhances Dart collections and objects with utilities for advanced data manipulation and simpler coding.
  • theme_manager_plus: Allows customization of your app's theme with your own theme class, eliminating the need for traditional
  • date_util_plus: A powerful Dart API designed to augment and simplify date and time handling in your Dart projects.
  • pick_color: A Flutter package that allows you to extract colors and hex codes from images with a simple touch.
1
likes
150
points
100
downloads

Publisher

verified publisherthezerone.com

Weekly Downloads

zo_screenshot is a Flutter plugin that allows you to enable, disable, toggle, or stream screenshot events in your application.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on zo_screenshot