Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Command Line Path To Config File #180

Merged
merged 4 commits into from Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -111,6 +111,12 @@ flutter pub run flutter_native_splash:create

When the package finishes running, your splash screen is ready.

To specify the yaml file location just add --path with the command in the terminal:

```
flutter pub run flutter_native_splash:create --path=path/to/my/file.yaml
```

# Recommendations
## Secondary splash screen:
The native splash screen is displayed while the native app loads the Flutter framework. Once Flutter loads, there may still be resources that need to be loaded before your app is ready. For this reason, you should consider implementing a Flutter splash screen that is displayed while these resources load. Here is a code example of a secondary Flutter splash screen, or use a package from [pub.dev](https://pub.dev).
Expand Down
8 changes: 6 additions & 2 deletions bin/create.dart
@@ -1,6 +1,10 @@
import 'package:args/args.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart'
as flutter_native_splash;

void main(List<String> arguments) {
flutter_native_splash.createSplash();
void main(List<String> args) {
var parser = ArgParser();
parser.addOption('path',
callback: (path) => {flutter_native_splash.createSplash(path)});
parser.parse(args);
}
8 changes: 6 additions & 2 deletions bin/remove.dart
@@ -1,6 +1,10 @@
import 'package:args/args.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart'
as flutter_native_splash;

void main(List<String> arguments) {
flutter_native_splash.removeSplash();
void main(List<String> args) {
var parser = ArgParser();
parser.addOption('path',
callback: (path) => {flutter_native_splash.removeSplash(path)});
parser.parse(args);
}
8 changes: 4 additions & 4 deletions lib/flutter_native_splash.dart
Expand Up @@ -16,8 +16,8 @@ part 'templates.dart';
part 'web.dart';

/// Create splash screens for Android and iOS
void createSplash() {
var config = getConfig();
void createSplash(String? path) {
var config = getConfig(configFile: path);
checkConfig(config);
createSplashByConfig(config);
}
Expand Down Expand Up @@ -83,9 +83,9 @@ void createSplashByConfig(Map<String, dynamic> config) {
}

/// Remove any splash screen by setting the default white splash
void removeSplash() {
void removeSplash(String? path) {
print('Restoring Flutter\'s default white native splash screen...');
var config = getConfig();
var config = getConfig(configFile: path);

var removeConfig = <String, dynamic>{'color': '#ffffff'};
if (config.containsKey('android')) {
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Expand Up @@ -7,6 +7,7 @@ environment:
sdk: '>=2.12.0 <3.0.0'

dependencies:
args: ^2.0.0
image: ^3.0.2
meta: ^1.3.0
path: ^1.8.0
Expand Down