0 purchases
snapshot widget
snapshot_widget #
A Flutter library to Snapshot Widget to Uint8List image.
Features #
Snapshot Widget
final _controller = SnapshotsController();
SnapshotsWidget(
controller: _controller,
child: Container(),
)
copied to clipboard
Snapshot widget to Uint8List
final imageBytes = await _controller.value(pixelRatio: 16 / 9);
copied to clipboard
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.1"
copied to clipboard
Usage #
class _MyAppState extends State<MyApp> {
final _controller = SnapshotsController();
Uint8List _image = Uint8List.fromList([]);
@override
Widget build(BuildContext context) {
return Column(
children: [
SnapshotsWidget(
controller: _controller,
child: const SmartCardWidget(),
),
OutlinedButton(
onPressed: _SnapshotsWidget,
child: const Text('Snapshot'),
),
const Divider(),
if (_image.isNotEmpty)
Image.memory(_image),
],
);
}
void _SnapshotsWidget() async {
final imageBytes = await _controller.value(pixelRatio: 16 / 9);
setState(() {
_image = imageBytes;
});
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.