ios_insecure_screen_detector 0.0.2 copy "ios_insecure_screen_detector: ^0.0.2" to clipboard
ios_insecure_screen_detector: ^0.0.2 copied to clipboard

A flutter plugin to detect the screenshot and screen recording on iOS.

example/lib/main.dart

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

void main() {
  runApp(MaterialApp(home: MyApp()));
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WidgetsBindingObserver {

  IosInsecureScreenDetector _insecureScreenDetector = IosInsecureScreenDetector();
  bool _isCaptured = false;

  @override
  void initState() {
    super.initState();
    _insecureScreenDetector.initialize();
    _insecureScreenDetector.addListener(
      () {
        showDialog(
          context: context,
          barrierDismissible: true,
          builder: (context) {
            return Center(
              child: Text('screenshot taken', textAlign: TextAlign.center, style: TextStyle(fontSize: 16),)
            );
          }
        );
      },
      (isCaptured) {
        setState(() {
          _isCaptured = isCaptured;
        });
      }
    );

    /// Check if current screen is captured.
    isCaptured();
  }

  isCaptured() async {
    _isCaptured = await _insecureScreenDetector.isCaptured();
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Insecure Screen Detector'),
      ),
      body: Center(
        child: Text('Captured: ${_isCaptured ? 'YES' : 'NO'}'),
      )
    );
  }
}
15
likes
150
pub points
92%
popularity

Publisher

unverified uploader

A flutter plugin to detect the screenshot and screen recording on iOS.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on ios_insecure_screen_detector