{"id":23589024,"url":"https://github.com/thecodedaniel/screenshot_guard","last_synced_at":"2025-11-03T21:30:29.198Z","repository":{"id":269488808,"uuid":"907573274","full_name":"TheCodeDaniel/screenshot_guard","owner":"TheCodeDaniel","description":"Screenshot Guard is a Flutter plugin that provides platform-specific functionality to detect and restrict screenshots and screen recording in your Flutter applications","archived":false,"fork":false,"pushed_at":"2025-01-22T20:04:50.000Z","size":79,"stargazers_count":29,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2025-01-22T20:30:05.358Z","etag":null,"topics":["dart","flutter","package"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/screenshot_guard","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheCodeDaniel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-23T22:47:45.000Z","updated_at":"2025-01-22T20:04:49.000Z","dependencies_parsed_at":"2024-12-25T00:50:24.156Z","dependency_job_id":null,"html_url":"https://github.com/TheCodeDaniel/screenshot_guard","commit_stats":null,"previous_names":["thecodedaniel/screenshot_guard"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Fscreenshot_guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Fscreenshot_guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Fscreenshot_guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeDaniel%2Fscreenshot_guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheCodeDaniel","download_url":"https://codeload.github.com/TheCodeDaniel/screenshot_guard/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239419435,"owners_count":19635388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter","package"],"created_at":"2024-12-27T06:12:19.338Z","updated_at":"2025-11-03T21:30:29.166Z","avatar_url":"https://github.com/TheCodeDaniel.png","language":"C++","readme":"# Screenshot Guard\n\n`Screenshot Guard` is a Flutter plugin that provides platform-specific functionality to detect and restrict screenshots or screen recording in your Flutter applications.\n\n## Features\n\n- 🚫 Prevent users from taking screenshots.\n- 📹 Detect and react to screen recording activity.\n- 📱 Supports both Android and iOS platforms.\n- 💻 Supports Windows desktop platform.\n\n---\n\n## Installation\n\n1. Add the package to your `pubspec.yaml` file:\n\n   ```yaml\n   dependencies:\n     screenshot_guard: ^\u003clatest\u003e\n   ```\n\n2. Run the `flutter pub get` to fetch the package.\n\n## Usage\n\n### Import the Package\n\nAdd the following import statement at the top of your Dart file:\n\n```dart\nimport 'package:screenshot_guard/screenshot_guard.dart';\n\n\nimport 'package:flutter/material.dart';\nimport 'package:screenshot_guard/screenshot_guard.dart';\n\nvoid main() {\n  runApp(MyApp());\n}\n\nclass MyApp extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      home: ScreenshotGuardExample(),\n    );\n  }\n}\n\nclass ScreenshotGuardExample extends StatefulWidget {\n  @override\n  _ScreenshotGuardExampleState createState() =\u003e _ScreenshotGuardExampleState();\n}\n\nclass _ScreenshotGuardExampleState extends State\u003cScreenshotGuardExample\u003e {\n  bool isProtected = false;\n  final _screenshotGuardPlugin = ScreenshotGuard();\n\n  void toggleProtection() async {\n    if (isProtected) {\n      _screenshotGuardPlugin.enableSecureFlag(false);\n    } else {\n      _screenshotGuardPlugin.enableSecureFlag(true);\n    }\n    setState(() {\n      isProtected = !isProtected;\n    });\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(title: Text('Screenshot Guard Example')),\n      body: Center(\n        child: ElevatedButton(\n          onPressed: toggleProtection,\n          child: Text(isProtected ? 'Disable Protection' : 'Enable Protection'),\n        ),\n      ),\n    );\n  }\n}\n```\n\n## Platform Specific Details\n\n### Android\n\n- The plugin uses Android's `FLAG_SECURE` to prevent screenshots and screen recordings\n- Ensure you have the necessary permissions in your `AndroidManifest.xml`.\n\n### IOS\n\n- The plugin uses iOS system notifications to detect screenshot and screen recording activities.\n\n### Windows\n\n- The plugin uses the Windows SetWindowDisplayAffinity API to prevent screen capture and video recording.\n- The `SetWindowDisplayAffinity` API is specific to windows with the `WS_OVERLAPPEDWINDOW` style. Make sure your window meets this requirement.\n- In case of failure, the error returned can be checked in the logs to diagnose issues related to display affinity.\n\n## API Reference\n\n### Methods\n\n`enableSecureFlag(bool enable)`\n\n- Description: Enables or disables the secure flag to control screenshot and screen recording\n- Parameters:\n  `enable`: A boolean (`true` to enable protection, `false` to disable it).\n- Returns: A `Future\u003cvoid\u003e`\n\n# Contributions\n\nContributions are welcome! Feel free to create issues or submit pull requests to improve this plugin.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedaniel%2Fscreenshot_guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodedaniel%2Fscreenshot_guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedaniel%2Fscreenshot_guard/lists"}