prevent_app_screen 0.1.0
prevent_app_screen: ^0.1.0 copied to clipboard
A Flutter plugin to prevent screenshots and screen recordings on Android and iOS.
🛡️ Prevent App Screen #
A powerful, high-performance Flutter plugin designed to protect your application from Screenshots and Screen Recordings. Ideal for FinTech, Healthcare, and Privacy-focused applications.
✨ Key Features #
- 🚀 Global Protection: Secure your entire app with a single initialization.
- 📱 Screen-Level Security: Apply protection to specific routes or pages.
- 🌫️ Granular Blur (Smart Masking): Protect specific UI components while keeping the rest of the app functional.
- 🔄 App Switcher Blur: Automatically hides app content in the recent apps/multitasking view.
- 🛠️ Proactive Window Locking: Automatically blocks screenshots when sensitive widgets are on screen.
- 🎥 Recording Detection: Real-time detection and response to screen recordings and mirroring.
🌟 Three Levels of Protection #
1️⃣ Global Protection (App-Wide) #
Best for banking or high-security apps where the entire experience must be private.
void main() {
WidgetsFlutterBinding.ensureInitialized();
// Enable protection for every screen in the app
PreventAppScreen.initialize(true);
runApp(const MyApp());
}
2️⃣ Full Screen Guard #
Wrap specific screens to prevent captures only while that screen is visible.
@override
Widget build(BuildContext context) {
return FullScreenProtection(
prevent: true, // Auto-blocks screenshots for this window
child: Scaffold(
appBar: AppBar(title: Text("Secret Settings")),
body: MyPrivateProfile(),
),
);
}
3️⃣ Specific Widget Protection (Flexible) #
Protect specific items (like QR codes or Credit Cards). This mode supports Blurring or showing a Placeholder.
SpecificWidgetProtection(
protectWindow: true, // Proactive: Blocks screenshots for the whole app ONLY while this is visible
blurAmount: 15.0, // Customize the blur intensity
placeholder: MyLockIcon(), // Optional: Show a custom widget instead of blurring
child: CreditCardWidget(),
)
| Parameter | Description |
|---|---|
protectWindow |
Proactive Mode: Blocks the whole app screenshot as long as this widget is on screen. |
prevent |
Detection Mode: Blurs/Hides the widget automatically if a recording starts. |
forceBlur |
Privacy Mode: Manually triggers the blur regardless of capture status. |
placeholder |
A custom widget to show instead of the blurred child (e.g., a Black Box). |
🔍 Platform Support & Behavior #
| Feature | Android | iOS | Behavior Description |
|---|---|---|---|
| Screenshot Blocking | ✅ | ✅ | Android shows a black screen; iOS shows a custom secure overlay. |
| Recording Prevention | ✅ | ✅ | Prevents recording of the secure window content. |
| App Switcher Blur | ✅ | ✅ | Hides app preview in the multitasking menu. |
| Capture Detection | ✅ | ✅ | Notifies the app through onCapturedChanged listener. |
Note: For Screenshots, the OS typically captures the frame before notifying the app. To reliably block a screenshot file, use
FullScreenProtectionor theprotectWindowflag inSpecificWidgetProtection.
📦 Installation #
Add this to your pubspec.yaml:
dependencies:
prevent_app_screen: ^0.1.0
💬 Aliases (Legacy Support) #
The plugin provides these aliases to match your preferred naming style:
SecureWidget->SpecificWidgetProtectionPreventWidget->FullScreenProtectionPreventScreen->FullScreenProtection
📝 License #
This project is licensed under the MIT License - see the LICENSE file for details.