setup golden toolkit

This commit is contained in:
Vadim 2024-04-10 23:34:22 +02:00
parent 2f8bb983d5
commit 56942255e2
2 changed files with 34 additions and 0 deletions

View file

@ -49,6 +49,7 @@ dev_dependencies:
flutter_native_splash: 2.3.5
flutter_test:
sdk: flutter
golden_toolkit: 0.15.0
google_fonts: 3.0.1
integration_test:
sdk: flutter

View file

@ -0,0 +1,33 @@
import 'dart:async';
import 'package:flutter/widgets.dart';
import 'package:golden_toolkit/golden_toolkit.dart';
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
return GoldenToolkit.runWithConfiguration(
() async {
await loadAppFonts();
await testMain();
},
config: GoldenToolkitConfiguration(defaultDevices: _defaultDevices),
);
}
const _defaultDevices = <Device>[
Device(
name: 'iPhone 8',
size: Size(375, 667),
devicePixelRatio: 2.0,
),
Device(
name: 'iPhone 13 Pro',
size: Size(390, 844),
devicePixelRatio: 3.0,
safeArea: EdgeInsets.only(top: 44, bottom: 34),
),
Device(
name: 'iPhone 15 Pro Max',
size: Size(430, 932),
devicePixelRatio: 3.0,
safeArea: EdgeInsets.only(top: 44, bottom: 34),
),
];