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

Flutter plugin to secure recent-app snapshots on Android (FLAG_SECURE) and to react to iOS screenshot/screen-recording events with optional masking overlays.

example/lib/main.dart

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

void main() => runApp(const DemoApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'pkb_secure_snapshot example',
      home:PkbSecureSnapshot(
        maskStyle: PkbMaskStyle.black,
        autoMaskOnIOSScreenshot: true,          // พรางเมื่อมีการแคปจอ
        iosScreenshotMaskDuration: Duration(seconds: 3),
        autoMaskOnIOSRecording: true,           // พรางเมื่ออัดจอ
        onIOSScreenshot: () => debugPrint("Screenshot detected"),
        onIOSRecordingChanged: (active) => debugPrint("Recording: $active"),
        child:  HomePage(),
      )


      // PkbSecureSnapshot(
      //   mode: PkbSecureMode.onlyWhenBackground,
      //   maskStyle: PkbMaskStyle.logo,
      //   logoWidget: Column(
      //     mainAxisSize: MainAxisSize.min,
      //     children: const [
      //       Icon(Icons.account_balance, size: 100, color: Colors.white70),
      //       SizedBox(height: 12),
      //       Text('Secured by PKB', style: TextStyle(color: Colors.white60)),
      //     ],
      //   ),
      //   onIOSScreenshot: () => debugPrint('[PKB] iOS screenshot detected'),
      //   onIOSRecordingChanged: (active) =>
      //       debugPrint('[PKB] iOS recording: $active'),
      //   child: const HomePage(),
      // ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    final controller =
    TextEditingController(text: '1234-5678-9012-3456 (Sensitive)');
    return Scaffold(
      appBar: AppBar(title: const Text('Secure Snapshot Demo')),
      body: ListView(
        padding: const EdgeInsets.all(16),
        children: [
          const Text('Demo: Sensitive field'),
          const SizedBox(height: 8),
          TextField(controller: controller),
          const SizedBox(height: 24),
          const Text(
            'Try switching apps or recording screen.\n'
                'Android (8.0+): Recent is masked.\n'
                'Android strict: no screenshots/recording.\n'
                'iOS: reacts to screenshot/recording events.',
          ),
        ],
      ),
    );
  }
}
0
likes
160
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin to secure recent-app snapshots on Android (FLAG_SECURE) and to react to iOS screenshot/screen-recording events with optional masking overlays.

Repository (GitHub)
View/report issues

Topics

#flutter-plugin #security #privacy #screenshot #ios

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on pkb_secure_snapshot

Packages that implement pkb_secure_snapshot