https://github.com/edufolly/widget_to_png
https://github.com/edufolly/widget_to_png
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/edufolly/widget_to_png
- Owner: edufolly
- Created: 2022-10-16T13:22:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-16T17:01:37.000Z (over 2 years ago)
- Last Synced: 2025-01-13T03:32:49.526Z (5 months ago)
- Language: CMake
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# widget_to_png
Simple example:
```dart
WidgetImageRenderer(
controller: _controller,/// Render widget
builder: (BuildContext context, String? value, _) {
return Card(
color: Colors.deepOrange,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(value ?? ''),
),
);
},/// Callback with image bytes.
callback: (ByteData data, String? value) {
DateTime now = DateTime.now();File file = File('test_${now.millisecond}.png');
file.writeAsBytesSync(data.buffer
.asUint8List(data.offsetInBytes, data.lengthInBytes));
},
)
```