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);