Orientação gerada a partir de informações públicas. Apenas para referência.
Screenshot Modes é um pacote Flutter que oferece uma maneira fácil e automática de tirar capturas de tela dentro do seu aplicativo. Projetado como um plugin para o pacote device_preview, permite que os desenvolvedores capturem e gerenciem capturas de tela de forma integrada durante o desenvolvimento e testes. Ele melhora o fluxo de trabalho ao integrar diretamente a funcionalidade de captura de tela no ambiente de visualização, permitindo feedback visual instantâneo sem intervenção manual. Ideal para testes de UI e validação de design, ele simplifica o processo de documentar estados do aplicativo em diferentes dispositivos e orientações.
Casos de uso
Testes de interface
Validação de design
Visualização em vários dispositivos
Captura automática de tela
Depuração de desenvolvimento
Principais recursos
Integração com device_preview
Captura automática de tela
Suporte para múltiplos modos de dispositivo
Configuração simples por meio do pub
Instantâneos de visualização em tempo real
Indicado para
Desenvolvedores Flutter
designers de UI/UX
Engenheiros de automação de testes
equipes de prototipagem de aplicativos
testadores de garantia de qualidade
Considerações
Requer o device_preview para funcionar
Limitado ao ambiente de desenvolvimento
Sem capacidade de captura de tela em tempo de execução
Não destinado ao uso em produção
Dependente das atualizações do device_preview
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
screenshot_modes
easy screenshot take for your app
screenshot_modes is a flutter package that work as a plugin for device preview package, take automatics screenshots for pages app
setup this plugin
0- you will need to setup device preview package first before using this plugin. it is just a few step.
simple mode :
simple mode you will just select device frame you want and function navigate to page and the plugin will make it work ,
will take screenshot for all your page in all frames in dark and light mode.
3- define saveScreenShot function this response for saving the image or upload it to some server or that ever you want to do with the image example to save the image in desktop
Future<String> saveScreenShot(DeviceScreenshotWithLabel screen) async {
String name = screen.label.join('/');
final path = join(Directory.current.path, 'screenshot', '$name.png');
final imageFile = File(path);
await imageFile.create(recursive: true);
await imageFile.writeAsBytes(screen.deviceScreenshot.bytes);
return'$path saved'; // message printed to device preview plugins windows;
}
you could benefid from DevicePreviewHelper class to change device , theme and other helper function
5- click the new button(screenshot mode) in device preview tabs
_______
what is ItemScreenMode :
it is represents every screenshot we will take
function parameter is a function that called before take screen
we must navigate to the page you want take screenshot for it
maybe also get some data from database or api before navigate
label parameter is string helps for naming the image inside processor (saveScreenShot)
modes parameter is another list of ItemScreenMode used if we have nested mode
like light/dark for all pages and change frame for all pages
like in above example
could i set function parameter for ItemScreenMode to null ?
yes when you don't need to do any things before first shot taken maybe when you already inside home page (defalut page) and in right themes mode
tips : don't do that if you have multi nested page
why we must use DirectPageRouteBuilder for navigation
you must use DirectPageRouteBuilder for navigation like this
because the MaterialPageRoute have 500ms Duration for animations
this will cause as a problem with screenshot
so we must either use DirectPageRouteBuilder or await 500ms Duration after Navigation inside ItemScreenMode function
we prefers to use this plugin on desktop
TODO :
resizing the image for every mode ( so we could resized to the size required by google play or app store) ( now could done in saveScreenShot function )