{"id":19273059,"url":"https://github.com/fluttercandies/ff_native_screenshot","last_synced_at":"2025-04-21T22:32:30.668Z","repository":{"id":46141570,"uuid":"514524137","full_name":"fluttercandies/ff_native_screenshot","owner":"fluttercandies","description":"A Flutter plugin to take or listen screenshot(support Platform Views) for Android and iOS with native code.","archived":false,"fork":false,"pushed_at":"2025-04-20T12:20:59.000Z","size":115,"stargazers_count":11,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-20T13:29:51.259Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","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/fluttercandies.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"liberapay":"zmtzawqlp","custom":"http://zmtzawqlp.gitee.io/my_images/images/qrcode.png"}},"created_at":"2022-07-16T08:40:49.000Z","updated_at":"2025-04-20T12:21:03.000Z","dependencies_parsed_at":"2024-06-28T07:15:48.149Z","dependency_job_id":null,"html_url":"https://github.com/fluttercandies/ff_native_screenshot","commit_stats":{"total_commits":8,"total_committers":2,"mean_commits":4.0,"dds":0.125,"last_synced_commit":"614917930ad75e258efe9da1b94faeb5dad8e612"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fff_native_screenshot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fff_native_screenshot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fff_native_screenshot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fff_native_screenshot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercandies","download_url":"https://codeload.github.com/fluttercandies/ff_native_screenshot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250144508,"owners_count":21382236,"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":[],"created_at":"2024-11-09T20:40:39.822Z","updated_at":"2025-04-21T22:32:25.655Z","avatar_url":"https://github.com/fluttercandies.png","language":"Java","funding_links":["https://liberapay.com/zmtzawqlp","http://zmtzawqlp.gitee.io/my_images/images/qrcode.png"],"categories":[],"sub_categories":[],"readme":"# ff_native_screenshot\n\nA Flutter plugin to take or listen screenshot(support Platform Views) for Android and iOS with native code.\n\nIt's a workaround for the issue [RepaintBoundary can't take screenshot of Platform Views](https://github.com/flutter/flutter/issues/102866) .\n\n[![pub package](https://img.shields.io/pub/v/ff_native_screenshot.svg)](https://pub.dartlang.org/packages/ff_native_screenshot) [![GitHub stars](https://img.shields.io/github/stars/fluttercandies/ff_native_screenshot)](https://github.com/fluttercandies/ff_native_screenshot/stargazers) [![GitHub forks](https://img.shields.io/github/forks/fluttercandies/ff_native_screenshot)](https://github.com/fluttercandies/ff_native_screenshot/network) [![GitHub license](https://img.shields.io/github/license/fluttercandies/ff_native_screenshot)](https://github.com/fluttercandies/ff_native_screenshot/blob/master/LICENSE) [![GitHub issues](https://img.shields.io/github/issues/fluttercandies/ff_native_screenshot)](https://github.com/fluttercandies/ff_native_screenshot/issues) \u003ca target=\"_blank\" href=\"https://jq.qq.com/?_wv=1027\u0026k=5bcc0gy\"\u003e\u003cimg border=\"0\" src=\"https://pub.idqqimg.com/wpa/images/group.png\" alt=\"flutter-candies\" title=\"flutter-candies\"\u003e\u003c/a\u003e\n\n## Usage\n\n``` yaml\ndependencies:\n  ff_native_screenshot: any\n  # only for android\n  permission_handler: any\n```\n\n## Take Screenshot\n\n``` dart\nUint8List? data = await FfNativeScreenshot().takeScreenshot();\n```\n\n## Listen Screenshot\n\n``` dart\n\n  @override\n  void initState() {\n    super.initState();\n    init();\n  }\n\n  Future\u003cvoid\u003e init() async {\n    if (Platform.isAndroid) {\n      await Permission.storage.request();\n    }\n    FfNativeScreenshot().setup(ScreenshotFlutterApiImplements(context));\n    await FfNativeScreenshot().startListeningScreenshot();\n\n    if (mounted) {\n      setState(() {});\n    }\n  }\n\n  @override\n  void dispose() {\n    FfNativeScreenshot().stopListeningScreenshot();\n    super.dispose();\n  }\n\n  bool? listening;\n  @override\n  void didChangeAppLifecycleState(AppLifecycleState state) {\n    super.didChangeAppLifecycleState(state);\n    switch (state) {\n      case AppLifecycleState.resumed:\n        if (listening == true \u0026\u0026 !FfNativeScreenshot().listening) {\n          FfNativeScreenshot().startListeningScreenshot();\n        }\n        break;\n      case AppLifecycleState.paused:\n        listening = FfNativeScreenshot().listening;\n        if (listening == true) {\n          FfNativeScreenshot().stopListeningScreenshot();\n        }\n\n        break;\n      default:\n    }\n  }\n\n  class ScreenshotFlutterApiImplements extends ScreenshotFlutterApi {\n    ScreenshotFlutterApiImplements();\n    @override\n    Future\u003cvoid\u003e onTakeScreenshot(Uint8List? data) async {\n     // if it has something error\n     // you can call takeScreenshot \n     data ??= await FfNativeScreenshot().takeScreenshot();\n    }\n  }\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fff_native_screenshot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercandies%2Fff_native_screenshot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fff_native_screenshot/lists"}