FLUTTER ECOSYSTEM

AWarmHug/widget_screenshot

Captura de tela para widget, suporte a capturas longas como ListView

Capa do projeto widget_screenshot
Stars
3
Forks
8
Último push (UTC)
10 de nov. de 2023
Status do projeto
Ativo
bingo GitHub avatar
GITHUB User

bingo ↗

我们不是代码的搬运工,而是代码的学习者。

LinguagensDartKotlinSwiftRubyObjective-C

Tópicos técnicos

Pacotes publicados por este repositório

Dependências usadas

Lista de dependências 4 itens
  • flutter{"sdk":"flutter"}
  • plugin_platform_interface^2.0.2
  • flutter_testDesenvolvimento{"sdk":"flutter"}
  • flutter_lintsDesenvolvimento^2.0.0

README original

Texto original em inglês. Visite o GitHub para a versão atual.

Expandir / recolher README

widget_screenshot

Widget截屏,支持长截图,如:ListView

Screenshot for widget,support long screenshot like ListView,

Support

  • backgroundColor
  • format (png, jpeg)
  • quality (0~100)
  • extraImage (like header, footer or watermark)

Usage

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

Display

https://raw.githubusercontent.com/AWarmHug/widget_screenshot/main/display/shot.webp shoting-> https://raw.githubusercontent.com/AWarmHug/widget_screenshot/main/display/shoting.gif result-> https://raw.githubusercontent.com/AWarmHug/widget_screenshot/main/display/shoted.webp