An open API service indexing awesome lists of open source software.

https://github.com/edufolly/widget_to_png


https://github.com/edufolly/widget_to_png

Last synced: 4 months ago
JSON representation

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));
},
)
```