snapshot_widget 1.0.0 icon indicating copy to clipboard operation
snapshot_widget: ^1.0.0 copied to clipboard

A Flutter library to Snapshot Widget to Uint8List image

snapshot_widget #

pub package

A Flutter library to Snapshot Widget to Uint8List image.

Features #

  • Snapshot Widget
final _controller = SnapshotController();

SnapshotWidget(
  controller: _controller,
  child: Container(),
)
  • Snapshot widget to Uint8List
final imageBytes = await _controller.value(pixelRatio: 16 / 9);

Getting started #

It is really easy to use! You should ensure that you add the snapshot_widget as a dependency in your flutter project.

snapshot_widget: "^1.0.0"

Usage #

class _MyAppState extends State<MyApp> {
  final _controller = SnapshotController();
  Uint8List _image = Uint8List.fromList([]);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        SnapshotWidget(
          controller: _controller,
          child: const SmartCardWidget(),
        ),
        OutlinedButton(
          onPressed: _snapshotWidget,
          child: const Text('Snapshot'),
        ),
        const Divider(),
        if (_image.isNotEmpty)
          Image.memory(_image),
      ],
    );
  }

  void _snapshotWidget() async {
    final imageBytes = await _controller.value(pixelRatio: 16 / 9);
    setState(() {
      _image = imageBytes;
    });
  }
}
0
likes
110
pub points
16%
popularity

Publisher

unverified uploader

A Flutter library to Snapshot Widget to Uint8List image

Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on snapshot_widget