Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions example/default_example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,15 @@ flutter_launcher_icons:
macos:
generate: true
image_path: "assets/images/icon-1024x1024.png"
linux:
generate: true
image_path: "assets/images/icon-logo.png"

dev_dependencies:
flutter_test:
sdk: flutter

flutter:
uses-material-design: true
assets:
- assets/images/icon-logo.png
4 changes: 4 additions & 0 deletions lib/abs/icon_generator.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:flutter_launcher_icons/config/config.dart';
import 'package:flutter_launcher_icons/config/linux_config.dart';
import 'package:flutter_launcher_icons/config/macos_config.dart';
import 'package:flutter_launcher_icons/config/web_config.dart';
import 'package:flutter_launcher_icons/config/windows_config.dart';
Expand Down Expand Up @@ -64,6 +65,9 @@ class IconGeneratorContext {

/// Shortcut for `config.macOSConfig`
MacOSConfig? get macOSConfig => config.macOSConfig;

/// Shortcut for `config.linuxConfig`
LinuxConfig? get linuxConfig => config.linuxConfig;
}

/// Generates Icon for given platforms
Expand Down
12 changes: 11 additions & 1 deletion lib/config/config.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:checked_yaml/checked_yaml.dart' as yaml;
import 'package:flutter_launcher_icons/config/linux_config.dart';
import 'package:flutter_launcher_icons/config/macos_config.dart';
import 'package:flutter_launcher_icons/config/web_config.dart';
import 'package:flutter_launcher_icons/config/windows_config.dart';
Expand Down Expand Up @@ -38,6 +39,7 @@ class Config {
this.webConfig,
this.windowsConfig,
this.macOSConfig,
this.linuxConfig,
});

/// Creates [Config] for given [flavor] and [prefixPath]
Expand Down Expand Up @@ -173,6 +175,10 @@ class Config {
@JsonKey(name: 'macos')
final MacOSConfig? macOSConfig;

/// Linux platform config
@JsonKey(name: 'linux')
final LinuxConfig? linuxConfig;

/// Creates [Config] icons from [json]
factory Config.fromJson(Map json) => _$ConfigFromJson(json);

Expand All @@ -193,7 +199,8 @@ class Config {
android != false ||
webConfig != null ||
windowsConfig != null ||
macOSConfig != null;
macOSConfig != null ||
linuxConfig != null;
}

/// Whether or not configuration for generating Web icons exist
Expand All @@ -205,6 +212,9 @@ class Config {
/// Whether or not configuration for generating MacOS icons exists
bool get hasMacOSConfig => macOSConfig != null;

/// Whether or not configuration for generating Linux icons exists
bool get hasLinuxConfig => linuxConfig != 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
6 changes: 5 additions & 1 deletion lib/config/config.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions lib/config/linux_config.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'package:json_annotation/json_annotation.dart';

part 'linux_config.g.dart';

/// The flutter_launcher_icons configuration set for Linux
@JsonSerializable(
anyMap: true,
checked: true,
)
class LinuxConfig {
/// Specifies whether to generate icons for Linux
final bool generate;

/// Image path for Linux
@JsonKey(name: 'image_path')
final String? imagePath;

/// Creates a instance of [LinuxConfig]
const LinuxConfig({
this.generate = false,
this.imagePath,
});

/// Creates [LinuxConfig] from [json]
factory LinuxConfig.fromJson(Map json) => _$LinuxConfigFromJson(json);

/// Creates [Map] from [LinuxConfig]
Map toJson() => _$LinuxConfigToJson(this);

@override
String toString() => 'LinuxConfig: ${toJson()}';
}
26 changes: 26 additions & 0 deletions lib/config/linux_config.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ final macOSIconsDirPath =
/// Relative path to macos contents.json
final macOSContentsFilePath = path.join(macOSIconsDirPath, 'Contents.json');

// Linux

/// Relative path to linux directory
String linuxDirPath = path.join('linux');

/// Relative path to linux my_application.cc file
String linuxMyApplicationFile = path.join(linuxDirPath, 'runner', 'my_application.cc');

const String errorMissingImagePath =
'Missing "image_path" or "image_path_android" + "image_path_ios" within configuration';
const String errorMissingPlatform =
Expand Down
Loading