v0.0.9
widget_screenshot
用於元件的截圖,支援長截圖(如ListView),支援背景色、格式(png、jpeg)、品質(0~100),合併額外影像(如頁首、頁尾或水印)
21喜歡 64近 30 天下載130Pub 分數
AndroidiOS
小部件的截圖,支援像 ListView 這樣的長截圖
{"sdk":"flutter"}^2.0.2{"sdk":"flutter"}^2.0.0以下為英文專案原文快照,最新內容請造訪 GitHub。
Widget截屏,支持长截图,如:ListView
Screenshot for widget,support long screenshot like ListView,
dependencies:
widget_screenshot:x.y.z
// Like RepaintBoundary
WidgetShot(
key: _shotKey,
child: ListView.separated(
controller: _scrollController,
itemBuilder: (context, index) {
return Container(
color: Color.fromARGB(
Random().nextInt(255), Random().nextInt(255), Random().nextInt(255), Random().nextInt(255)),
height: 160,
child: Center(
child: Text(
"测试文案测试文案测试文案测试文案 ${index}",
style: const TextStyle(fontSize: 32),
),
),
);
},
separatorBuilder: (context, index) {
return const Divider(
height: 1,
color: Colors.grey,
);
},
itemCount: 30),
)
WidgetShotRenderRepaintBoundary repaintBoundary =
_shotKey.currentContext!.findRenderObject() as WidgetShotRenderRepaintBoundary;
//
var resultImage = await repaintBoundary.screenshot(scrollController: _scrollController,pixelRatio: 1);