Generate required flutter app screenshots for different devices

sdk: flutter
test: any
screenshots: ^2.1.
pub global activate screenshots
export PATH="/Users/Frankie/Tools/flutter/bin/cache/dart-sdk/bin/:$PATH"
export PATH="/Users/Frankie/.pub-cache/bin/:$PATH"
* Copyright (c) 2020. Frankie Fan.
* All rights reserved.

// app.dart
import 'package:flutter_driver/driver_extension.dart';
import 'package:geofencing/main.dart' as app;

void main() {
// This line enables the extension.

// Call the `main()` function of the app, or call `runApp` with
// any widget you are interested in testing.
* Copyright (c) 2020. Frankie Fan.
* All rights reserved.

// app_test.dart
import 'package:flutter_driver/flutter_driver.dart';
import 'package:screenshots/screenshots.dart';
import 'package:test/test.dart';

void main() {
group('GeoFencing App', () {
final locatingBtnFinder = find.byValueKey('locatingBtn');
final drawerFinder = find.byTooltip('Open navigation menu');

FlutterDriver driver;
Config config;

// Connect to the Flutter driver before running any tests.
setUpAll(() async {
driver = await FlutterDriver.connect();
config = Config();

// Close the connection to the driver after the tests have completed.
tearDownAll(() async {
if (driver != null) {

test('take screenshots', () async {
await driver.waitFor(locatingBtnFinder);
await driver.tap(locatingBtnFinder);
await Future.delayed(Duration(seconds: 5));
await screenshot(driver, config, 'screenshot-map');

await driver.waitFor(drawerFinder);
await driver.tap(drawerFinder);
await screenshot(driver, config, 'screenshot-drawer');
# A list of screen capture tests
# Note: flutter driver expects a pair of files eg, main1.dart and main1_test.dart
- test_driver/app.dart

# Interim location of screenshots from tests
staging: screenshots

# A list of locales supported by the app
- en-US

# A map of devices to emulate
iPhone 8 Plus:
iPhone 11 Pro Max:
iPad Pro (12.9-inch) (3rd generation):
orientation: LandscapeRight
Nexus 5X:
Nexus 9:
orientation: LandscapeRight

# Frame screenshots
frame: true



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store