Skip to content

Commit 32ee1c0

Browse files
authored
feat: add support for specific platforms in flame_game (#1382)
1 parent 2b7f7b1 commit 32ee1c0

File tree

6 files changed

+88
-468
lines changed

6 files changed

+88
-468
lines changed

e2e/test/commands/create/flame_game/flame_game_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void main() {
5151
['coverage/lcov.info', '-o', 'coverage'],
5252
workingDirectory: workingDirectory,
5353
);
54-
expect(testCoverageResult.stdout, contains('lines......: 97.8%'));
54+
expect(testCoverageResult.stdout, matches(RegExp('lines(.+) 100.0%')));
5555
}),
5656
);
5757
}

lib/src/commands/create/commands/flame_game.dart

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,23 @@ class CreateFlameGame extends CreateSubCommand with OrgName {
1010
required super.logger,
1111
required super.generatorFromBundle,
1212
required super.generatorFromBrick,
13-
});
13+
}) {
14+
argParser.addMultiOption(
15+
'platforms',
16+
help:
17+
'The platforms supported by the game. By default, all platforms '
18+
'are enabled. Example: --platforms=android,ios',
19+
defaultsTo: ['android', 'ios', 'web', 'macos', 'windows'],
20+
allowed: ['android', 'ios', 'web', 'macos', 'windows'],
21+
allowedHelp: {
22+
'android': 'The game supports the Android platform.',
23+
'ios': 'The game supports the iOS platform.',
24+
'web': 'The game supports the Web platform.',
25+
'macos': 'The game supports the macOS platform.',
26+
'windows': 'The game supports the Windows platform.',
27+
},
28+
);
29+
}
1430

1531
@override
1632
String get name => 'flame_game';
@@ -20,4 +36,15 @@ class CreateFlameGame extends CreateSubCommand with OrgName {
2036

2137
@override
2238
Template get template => VeryGoodFlameGameTemplate();
39+
40+
@override
41+
Map<String, dynamic> getTemplateVars() {
42+
final vars = super.getTemplateVars();
43+
44+
final platforms = argResults['platforms'] as List<String>;
45+
46+
vars['platforms'] = platforms;
47+
48+
return vars;
49+
}
2350
}

lib/src/commands/create/templates/very_good_core/very_good_core_bundle.dart

Lines changed: 17 additions & 449 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)