Screenshot Modes는 앱 내에서 스크린샷을 쉽게 자동으로 찍을 수 있도록 해주는 Flutter 패키지입니다. device_preview 패키지용 플러그인으로 설계되어 개발 및 테스트 중에 스크린샷을 원활하게 캡처하고 관리할 수 있게 합니다. 미리보기 환경에 스크린샷 기능을 직접 통합함으로써 수동 개입 없이 즉시 시각적 피드백을 제공하여 작업 흐름을 향상시킵니다. UI 테스트 및 디자인 검증에 이상적이며, 다양한 기기와 방향에서 앱 상태를 문서화하는 과정을 간소화합니다.
사용 사례
UI 테스트
디자인 검증
다기기 미리보기
자동 스크린샷 캡처
개발 디버깅
주요 기능
device_preview와의 통합
자동 스크린샷 캡처
다중 장치 모드 지원
pub를 통한 간단한 설정
실시간 미리보기 스냅샷
적합한 대상
Flutter 개발자
UI/UX 디자이너
테스트 자동화 엔지니어
앱 프로토타이핑 팀
품질 보증 테스터
고려 사항
기능을 사용하려면 device_preview가 필요합니다
개발 환경에 한정
런타임 스크린샷 기능 없음
생산 사용을 위한 것이 아님
device_preview 업데이트에 의존
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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 )