widget_screenshot_plus 0.0.9 copy "widget_screenshot_plus: ^0.0.9" to clipboard
widget_screenshot_plus: ^0.0.9 copied to clipboard

Capture Flutter widgets as images with scrollable content support. Export to PNG/JPEG with custom backgrounds. Perfect for sharing UI states or generating previews.

Widget Screenshot Plus - Flutter Package #

Pub Version License

This package is a Fork of widget_screenshot updated to the lasted version of flutter and dart.

A Flutter package for capturing widgets as images, including scrollable content and complex layouts. Perfect for sharing app content, creating previews, or saving widget states.

Features #

  • 📸 Capture any widget as an image
  • 🖼️ Handle scrollable content (ListView, CustomScrollView, etc.)
  • 🎨 Customize output format (PNG/JPEG) and quality
  • 🖌️ Add background colors to screenshots
  • 📱 Support for high DPI screens with pixel ratio control
  • 🧩 Merge multiple images into one composition

Android #

list_scroll_android single_widget_android

IOS #

list_scroll_ios single_widget_ios

Installation #

Add to your pubspec.yaml:

dependencies:
  widget_screenshot_plus: ^latest_version

Basic Usage #

1. Wrap your widget #

WidgetShotPlus(
  key: _screenshotKey,
  child: YourWidget(),
)

2. Capture the screenshot #

final boundary = _screenshotKey.currentContext?.findRenderObject()
        as WidgetShotPlusRenderRepaintBoundary?;

final imageBytes = await boundary?.screenshot(
  format: ShotFormat.png,
  quality: 100,
);

Examples #

Simple Widget Capture #

// Wrap your widget
WidgetShotPlus(
  key: _screenshotKey,
  child: Container(
    color: Colors.blue,
    child: Text('Capture me!'),
  ),
)

// Capture it
final imageBytes = await boundary.screenshot();

Scrollable Content #

// Use with scroll controller
final _scrollController = ScrollController();

WidgetShotPlus(
  key: _screenshotKey,
  child: ListView(
    controller: _scrollController,
    children: [...],
  ),
)

// Capture entire scrollable content
final imageBytes = await boundary.screenshot(
  scrollController: _scrollController,
);

Save and Share #

// Save to file
final dir = await getApplicationDocumentsDirectory();
final imageFile = File('${dir.path}/screenshot.png');
await imageFile.writeAsBytes(imageBytes!);

// Share using share_plus
await Share.shareXFiles([XFile(imageFile.path)]);

Advanced Options #

Parameter Description Default
format Output format (PNG/JPEG) ShotFormat.png
quality Image quality (0-100) 100
pixelRatio Device pixel ratio Device default
backgroundColor Background color for the screenshot null (transparent)
scrollController For capturing scrollable content null
maxHeight Maximum height for scroll capture 10000

FAQ #

Q: Can I capture widgets that are not currently visible on screen?
A: Yes! The package can capture the entire widget tree regardless of visibility.

Q: How does it handle platform differences?
A: The package uses a platform interface with method channel implementation, ensuring consistent behavior across iOS and Android.

Limitations #

  • Very large captures may cause memory issues (consider splitting extremely long content)

Compatibility #

Plugin version Flutter Dart Notes
>=0.0.9 >=3.44.0 ^3.12.0 Current modern line. Built-in Kotlin, AGP 9, modern Color API. Validated on Flutter 3.47.2 (Android + iOS).
0.0.8 >=3.27.0 >=3.6.0 Support line for older Flutter, branch 3.27.x (this is the 0.0.8 published on pub.flutter-io.cn).
<=0.0.7 >=3.22.0 >=3.0.0 Legacy, kept for reference.

On Flutter 3.27.x use version 0.0.8. Breaking changes in >=0.0.9 that prevent it:

  • pubspec.yaml requires Dart ^3.12.0 / Flutter >=3.44.0, so flutter pub get fails version resolution on 3.27.x (Dart 3.6).
  • Android requires AGP 9.1.0, Kotlin 2.4.0, Java 17 and Built-in Kotlin (kotlin.compilerOptions, no kotlin-android apply). Flutter 3.27 tooling predates AGP 9 support (added in 3.44), so the Gradle build fails.
  • iOS deployment target is 13.0, above the iOS 12 baseline of the 3.27 era.
  • The example app requires Gradle 9.3.1 and share_plus 13.x.

Contributing #

Contributions are welcome! Please open issues or pull requests for any bugs or feature suggestions.

License #

MIT - See LICENSE for details.

5
likes
160
points
329
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Capture Flutter widgets as images with scrollable content support. Export to PNG/JPEG with custom backgrounds. Perfect for sharing UI states or generating previews.

Repository (GitHub)
View/report issues

Topics

#screenshot #widget #image #share

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on widget_screenshot_plus

Packages that implement widget_screenshot_plus