anti_screenshot 1.0.5
anti_screenshot: ^1.0.5 copied to clipboard
A Flutter package to prevent screenshots and screen recording on Android & iOS, ensuring complete privacy.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:anti_screenshot/anti_screenshot.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Anti Screenshot Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
ProtectionMode _mode = ProtectionMode.black;
@override
Widget build(BuildContext context) {
return AntiScreenshot(
mode: _mode,
child: Scaffold(
appBar: AppBar(
title: const Text('Anti Screenshot Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'This is sensitive content that cannot be captured!',
style: TextStyle(fontSize: 18),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
const Text(
'Try taking a screenshot or screen recording!',
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 40),
SegmentedButton<ProtectionMode>(
segments: const [
ButtonSegment(
value: ProtectionMode.black,
label: Text('Black'),
),
ButtonSegment(
value: ProtectionMode.blur,
label: Text('Blur'),
),
ButtonSegment(
value: ProtectionMode.block,
label: Text('Block'),
),
],
selected: {_mode},
onSelectionChanged: (Set<ProtectionMode> modes) {
setState(() {
_mode = modes.first;
});
},
),
],
),
),
),
);
}
}