Skip to content

Commit

Permalink
fix: no longer printing creating icons message for unused platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkOSullivan94 committed Apr 15, 2023
1 parent 8394fd6 commit 683575e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
7 changes: 7 additions & 0 deletions lib/flutter_launcher_icons_config.dart
Expand Up @@ -97,6 +97,13 @@ class FlutterLauncherIconsConfig {
macOSConfig != null;
}

/// Whether or not configuration for generating Web icons exist
bool get hasWebConfig => webConfig != null;
/// Whether or not configuration for generating Windows icons exist
bool get hasWindowsConfig => windowsConfig != null;
/// Whether or not configuration for generating MacOS icons exists
bool get hasMacOSConfig => macOSConfig != null;

/// Check to see if specified Android config is a string or bool
/// String - Generate new launcher icon with the string specified
/// bool - override the default flutter project icon
Expand Down
20 changes: 14 additions & 6 deletions lib/main.dart
Expand Up @@ -12,6 +12,7 @@ import 'package:flutter_launcher_icons/flutter_launcher_icons_config.dart';
import 'package:flutter_launcher_icons/ios.dart' as ios_launcher_icons;
import 'package:flutter_launcher_icons/logger.dart';
import 'package:flutter_launcher_icons/macos/macos_icon_generator.dart';
import 'package:flutter_launcher_icons/macos/macos_icon_template.dart';
import 'package:flutter_launcher_icons/web/web_icon_generator.dart';
import 'package:flutter_launcher_icons/windows/windows_icon_generator.dart';
import 'package:path/path.dart' as path;
Expand Down Expand Up @@ -151,12 +152,19 @@ Future<void> createIconsFromConfig(
logger: logger,
prefixPath: prefixPath,
flavor: flavor,
platforms: (context) => [
WebIconGenerator(context),
WindowsIconGenerator(context),
MacOSIconGenerator(context),
// TODO(RatakondalaArun): add other platforms
],
platforms: (context) {
final platforms = <IconGenerator>[];
if (flutterConfigs.hasWebConfig) {
platforms.add(WebIconGenerator(context));
}
if (flutterConfigs.hasWindowsConfig) {
platforms.add(WindowsIconGenerator(context));
}
if (flutterConfigs.hasMacOSConfig) {
platforms.add(MacOSIconGenerator(context));
}
return platforms;
},
);
}

Expand Down

0 comments on commit 683575e

Please sign in to comment.