A flutter package which allows Flutter apps to wrap up some widgets with a SecureWidget which can stop user from screen recording or screenshot the widget. Works on both Android & iOS, and is in development.
Android (screen recording) | iOS (screenshot) | iOS (screen recording) | iOS (app switcher) |
---|---|---|---|
https://user-images.githubusercontent.com/60510869/154502746-830d9198-8f11-46ba-9246-784def00f610.mp4 | https://github.com/user-attachments/assets/0b4e10ac-d592-4b5b-92bf-72f51b2cf570 | https://github.com/user-attachments/assets/b6ef5914-eb3a-4e17-be0c-2f00538cffec |
The package allows your app to protect content shown on screen and on recent apps screen. It shows a black color on iOS, and on Android it blocks screenshot, and shows black in screen recording. This package is in development, and more features will be added soon.
Add this to your package's pubspec.yaml
file:
dependencies:
secure_content: ^1.0.0
You can install packages from the command line:
with pub
:
pub get
with Flutter
:
flutter pub get
Now in your Dart
code, you can use:
import 'package:secure_content/secure_content.dart';
import 'package:flutter/material.dart';
import 'package:secure_content/secure_content.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Secure Content Example'),
),
body: SecureWidget(
isSecure: true,
builder: (context, onInit, onDispose) => Center(
child: Text('This is a secure widget'),
),
),
),
);
}
}
Note: The SecureWidget should be the root widget of your app, or the widget which you want to protect. See the example for more details.
If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull request are also welcome.
See Contributing.md.