Closed Alexi-Zemcov closed 2 years ago
Please, add static const List<String> values parameter to the genereted files. It woud be helpful for golden tests, for example:
static const List<String> values
class Images { Images._(); static const List<String> values = [search, home, backArrow]; static const String search = 'assets/search.png'; static const String home = 'assets/home.png'; static const String backArrow = 'assets/back_arrow.png'; }
In such cases, we can easily iterate all images like this:
for (final icon in Images.values) { /*do something cool*/ }
For exapmle, to generate an image with all the possible icons in the application like this:
void main() { testGoldens('Icons golden test', (tester) async { final builder = GoldenBuilder.column(); for (final imagePath in Images.values) { builder.addScenario( iconPath, Image.asset( iconPath, height: 24, width: 24, ), ); } await tester.pumpWidgetBuilder( builder.build(), surfaceSize: const Size(420, 3650), wrapper: materialAppWrapper(theme: AppTheme.defaultTheme), ); await screenMatchesGolden(tester, 'icons'); }); }
Please, add
static const List<String> values
parameter to the genereted files. It woud be helpful for golden tests, for example:In such cases, we can easily iterate all images like this:
For exapmle, to generate an image with all the possible icons in the application like this: