提交 980871be authored 作者: ritheshSalyan's avatar ritheshSalyan

update README

上级 d03e0095
## [0.3.0] - 10/02/2021
* breaking change capture method returns Uint8List instead of File.
* support for web and windows
## [0.2.0] - 10/06/2020 ## [0.2.0] - 10/06/2020
* Add captureAsUiImage method * Add captureAsUiImage method
......
...@@ -15,7 +15,7 @@ This handy plugin can be used to capture any Widget including full screen screen ...@@ -15,7 +15,7 @@ This handy plugin can be used to capture any Widget including full screen screen
```dart ```dart
class _MyHomePageState extends State<MyHomePage> { class _MyHomePageState extends State<MyHomePage> {
int _counter = 0; int _counter = 0;
File _imageFile; Uint8List _imageFile;
//Create an instance of ScreenshotController //Create an instance of ScreenshotController
ScreenshotController screenshotController = ScreenshotController(); ScreenshotController screenshotController = ScreenshotController();
...@@ -40,7 +40,7 @@ Screenshot( ...@@ -40,7 +40,7 @@ Screenshot(
3) Take the screenshot by calling capture method. This will return a File 3) Take the screenshot by calling capture method. This will return a File
```dart ```dart
screenshotController.capture().then((File image) { screenshotController.capture().then((Uint8List image) {
//Capture Done //Capture Done
setState(() { setState(() {
_imageFile = image; _imageFile = image;
...@@ -76,7 +76,7 @@ Example: ...@@ -76,7 +76,7 @@ Example:
], ],
), ),
), ),
_imageFile != null ? Image.file(_imageFile) : Container(), _imageFile != null ? Image.memory(_imageFile) : Container(),
], ],
), ),
), ),
...@@ -87,13 +87,13 @@ Example: ...@@ -87,13 +87,13 @@ Example:
_imageFile = null; _imageFile = null;
screenshotController screenshotController
.capture() .capture()
.then((File image) async { .then((Uint8List image) async {
//print("Capture Done"); //print("Capture Done");
setState(() { setState(() {
_imageFile = image; _imageFile = image;
}); });
final result = final result =
await ImageGallerySaver.save(image.readAsBytesSync()); // Save image to gallery, Needs plugin https://pub.dev/packages/image_gallery_saver await ImageGallerySaver.save(image); // Save image to gallery, Needs plugin https://pub.dev/packages/image_gallery_saver
print("File Saved to Gallery"); print("File Saved to Gallery");
}).catchError((onError) { }).catchError((onError) {
print(onError); print(onError);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论