### Flavor Configuration File Examples Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md These filenames indicate how to structure configuration files for different app flavors, allowing for distinct splash screen setups. ```text flutter_native_splash-production.yaml flutter_native_splash-staging.yaml flutter_native_splash-dev.yaml ``` -------------------------------- ### Build Time CLI Example Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md Demonstrates the build-time CLI command used to generate native platform code for the splash screen. ```bash dart run flutter_native_splash:create ``` -------------------------------- ### Flutter Build Integration Example Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Demonstrates how Flutter automatically runs package plugins like flutter_native_splash during the build process. ```bash # Flutter automatically runs pub.dev plugins' bin scripts during build flutter run # Equivalent to (for development): dart run flutter_native_splash:create flutter run ``` -------------------------------- ### Example Flavor Configuration Content Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Each flavor configuration file uses the same structure as the default, with a 'flutter_native_splash:' section. This example shows settings for a production flavor. ```yaml flutter_native_splash: color: "#FF0000" # Production red image: assets/splash-prod.png android_gravity: center # ... other configuration parameters ``` -------------------------------- ### Runtime API Example Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md Illustrates the runtime Dart API calls for controlling splash screen visibility during application startup. ```dart FlutterNativeSplash.preserve(...); FlutterNativeSplash.remove(); ``` -------------------------------- ### Build App with a Specific Flavor Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Example commands for building an Android APK for a specific flavor, specifying the flavor name and the main entry point. ```bash # Build app with flavor flutter build apk --flavor free --target lib/main_free.dart flutter build apk --flavor premium --target lib/main_premium.dart ``` -------------------------------- ### Platform-Specific Overrides Example Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/INDEX.md Demonstrates how to use platform-specific overrides for parameters like 'color' to customize splash screens for different platforms and modes. ```yaml flutter_native_splash: color: "#42a5f5" # All platforms, light mode color_android: "#1e88e5" # Override for Android only color_dark: "#042a49" # All platforms, dark mode color_dark_web: "#1e1e1e" # Override for Web, dark mode ``` -------------------------------- ### Example Output for Discovering All Flavors Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md This output shows the process of discovering flavor configurations and creating splash screens for each, indicating successful completion for production, staging, and dev flavors. ```text Found 3 flavor configurations: [production, staging, dev] Setting up flavors! ===> Setting up the production flavor. ✅ Native splash complete. ===> Setting up the staging flavor. ✅ Native splash complete. ===> Setting up the dev flavor. ✅ Native splash complete. ``` -------------------------------- ### CLI Quick Start Commands Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md These bash commands demonstrate how to use the flutter_native_splash CLI for creating, managing flavors, removing splash screens, and accessing help. ```bash # Create default splash screen dart run flutter_native_splash:create # Create for production flavor dart run flutter_native_splash:create -f production # Create for multiple flavors dart run flutter_native_splash:create -F production,staging,dev # Create all discovered flavors dart run flutter_native_splash:create -A # Remove splash screen (restore default) dart run flutter_native_splash:remove # Show help dart run flutter_native_splash:create --help ``` -------------------------------- ### Minimal Configuration for Splash Screen Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md Example of the minimal configuration required in `pubspec.yaml` or `flutter_native_splash.yaml` to set up a basic splash screen with a color and an image. ```yaml flutter_native_splash: color: "#42a5f5" image: assets/splash.png ``` -------------------------------- ### Basic Configuration Structure Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/INDEX.md This is a comprehensive example of the flutter_native_splash configuration structure, showing options for different platforms, color modes, images, and branding. ```yaml flutter_native_splash: # Platform control android: true ios: true web: true # Colors (light and dark modes) color: "#42a5f5" color_dark: "#042a49" # Images image: assets/splash.png image_dark: assets/splash-invert.png # Background background_image: assets/background.png background_image_dark: assets/dark-background.png # Branding branding: assets/branding.png branding_mode: bottom branding_bottom_padding: 64 # Android-specific android_gravity: center android_screen_orientation: portrait android_min_sdk: 16 # iOS-specific ios_content_mode: center info_plist_files: [ios/Runner/Info.plist] # Web-specific web_image_mode: center # Layout fullscreen: false # Android 12+ specific android_12: image: assets/android12_splash.png color: "#2196f3" icon_background_color: "#ffffff" ``` -------------------------------- ### Web Animated Splash Configuration Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/web-platform.md Configuration example for using an animated GIF as the web splash image. This enables animated splash screens on the web platform. ```yaml flutter_native_splash: image_web: assets/splash-animated.gif ``` -------------------------------- ### Remove Command Help Option Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Examples of how to display the help message for the remove command using short or long flags. ```bash dart run flutter_native_splash:remove --help dart run flutter_native_splash:remove -h ``` -------------------------------- ### Remove Command Path Option Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Examples of specifying a custom path to the configuration file for the remove command. ```bash dart run flutter_native_splash:remove --path config/my_splash.yaml dart run flutter_native_splash:remove -p ../other-project/flutter_native_splash.yaml ``` -------------------------------- ### Production Flavor Configuration Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Example of a flavor-specific configuration file. Note that it overrides default settings and does not inherit properties like `android_gravity` unless explicitly defined. ```yaml flutter_native_splash: color: "#FF0000" image: assets/splash-prod.png # Does NOT inherit android_gravity from default ``` -------------------------------- ### Runtime API Quick Start Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md This Dart snippet shows how to use the flutter_native_splash runtime API to preserve the splash screen during initialization and remove it when the app is ready. ```dart import 'package:flutter/widgets.dart'; import 'package:flutter_native_splash/flutter_native_splash.dart'; void main() { // Preserve splash while initializing final binding = WidgetsFlutterBinding.ensureInitialized(); FlutterNativeSplash.preserve(widgetsBinding: binding); // Do initialization work initializeApp().then((_) { // Remove splash when ready FlutterNativeSplash.remove(); }); runApp(const MyApp()); } Future initializeApp() async { // Your async initialization code here } ``` -------------------------------- ### CLI Argument Validation Example Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/helper-utils.md Demonstrates how to use `validateFlavorArgs` within a CLI entry point to parse and validate command-line arguments before processing them. This ensures that the application receives valid flavor configurations. ```dart import 'package:args/args.dart'; import 'package:flutter_native_splash/helper_utils.dart'; import 'package:flutter_native_splash/cli_commands.dart'; void main(List args) { final parser = ArgParser() ..addOption('flavor', abbr: 'f') ..addOption('flavors', abbr: 'F') ..addFlag('all-flavors', abbr: 'A'); final parsedArgs = parser.parse(args); final flavorArg = parsedArgs['flavor']?.toString(); final flavorsArg = parsedArgs['flavors']?.toString(); final allFlavorsArg = parsedArgs['all-flavors'] as bool?; // Validate that only one flavor option is used HelperUtils.validateFlavorArgs( flavorArg: flavorArg, flavorsArg: flavorsArg, allFlavorsArg: allFlavorsArg, ); // Process based on which option was provided if (flavorArg != null) { createSplash(path: null, flavor: flavorArg); } else if (flavorsArg != null) { for (final flavor in flavorsArg.split(',')) { createSplash(path: null, flavor: flavor); } } else if (allFlavorsArg == true) { // Process all discovered flavors } } ``` -------------------------------- ### Production Splash Screen Configuration Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Example of a production-specific splash screen configuration, including color, image, and branding assets. This is useful for defining unique visual elements for production builds. ```yaml # flutter_native_splash-production.yaml # Production splash screen with red branding flutter_native_splash: color: "#FF0000" # Production red image: assets/splash-prod.png branding: assets/branding-prod.png ``` -------------------------------- ### Flavor Configuration File Location Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Place flavor configuration files in the project root directory, alongside pubspec.yaml. This example shows the default config and flavor-specific files. ```treeview my_flutter_app/ ├── pubspec.yaml ├── flutter_native_splash.yaml (default config) ├── flutter_native_splash-production.yaml ├── flutter_native_splash-staging.yaml ├── flutter_native_splash-dev.yaml ├── android/ ├── ios/ └── web/ ``` -------------------------------- ### Default Flutter Native Splash Configuration Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Example of a default configuration file for flutter_native_splash. This sets basic properties like color and image. ```yaml flutter_native_splash: color: "#42a5f5" image: assets/splash.png android_gravity: center ``` -------------------------------- ### CLI Commands for Splash Screen Management Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/INDEX.md Commands for managing splash screens via the command line. Includes options for creating, removing, and getting configuration, with support for specific paths and flavors. ```bash # Create splash screens dart run flutter_native_splash:create [--path ] [--flavor ] [--flavors ] [--all-flavors] # Remove splash screens dart run flutter_native_splash:remove [--path ] [--flavor ] # Help dart run flutter_native_splash:create --help dart run flutter_native_splash:remove --help ``` -------------------------------- ### CLI Functions Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md Command-line interface functions for managing splash screen generation and configuration. These commands allow you to create, remove, and get splash screen configurations. ```APIDOC ## CLI Functions (lib/cli_commands.dart) ### Description Command-line interface functions for managing splash screen generation and configuration. These commands allow you to create, remove, and get splash screen configurations. ### Functions #### `createSplash({required String? path, required String? flavor})` - **Description**: Creates the splash screen assets. - **Parameters**: - `path` (String?) - Optional - The path to the splash screen configuration file or image. - `flavor` (String?) - Optional - The build flavor to apply the splash screen to. #### `removeSplash({required String? path, required String? flavor})` - **Description**: Removes the splash screen assets. - **Parameters**: - `path` (String?) - Optional - The path to the splash screen configuration file or image. - `flavor` (String?) - Optional - The build flavor from which to remove the splash screen. #### `getConfig({required String? configFile, required String? flavor})` - **Description**: Retrieves the splash screen configuration. - **Parameters**: - `configFile` (String?) - Optional - The path to the configuration file. - `flavor` (String?) - Optional - The build flavor for which to get the configuration. - **Returns**: A map containing the splash screen configuration. #### `createBackgroundImage({required String imageDestination, required String imageSource})` - **Description**: Creates a background image for the splash screen. - **Parameters**: - `imageDestination` (String) - Required - The destination path for the generated image. - `imageSource` (String) - Required - The source image path. #### `parseColor(dynamic color)` - **Description**: Parses a color value. - **Parameters**: - `color` (dynamic) - Required - The color value to parse. - **Returns**: A string representation of the parsed color, or null if parsing fails. ``` -------------------------------- ### Troubleshoot 'module flutter_native_splash' not found Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md If you encounter the 'module flutter_native_splash' not found error, run `pod install` in your `ios` folder to resolve dependency issues. ```bash pod install ``` -------------------------------- ### Android Multiple Flavor Resource Structure Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md When using multiple flavors, each flavor will have its own dedicated resource directory under 'android/app/src/'. This example shows directories for production, staging, and dev flavors. ```treeview android/app/src/ ├── main/ ├── production/ ├── staging/ └── dev/ ``` -------------------------------- ### Flavor Configuration File Naming Convention Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Flavor configuration files must follow the pattern 'flutter_native_splash-{flavor-name}.yaml'. Examples include production, staging, and development flavors. ```yaml flutter_native_splash-production.yaml flutter_native_splash-staging.yaml flutter_native_splash-development.yaml flutter_native_splash-dev.yaml ``` -------------------------------- ### Create Command Full CLI Help Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/enums.md Displays the complete help text for the `create` command, listing all available flags and options with their descriptions. ```text --help, -h Show help --path, -p Path to the flutter project, if the project is not in it's default location. --flavor, -f Flavor to create the splash for. The flavor must match the pattern flutter_native_splash-*.yaml --flavors, -F Comma separated list of flavors to create the splash screens for. --all-flavors, -A Create the splash screens for all flavors that match the pattern flutter_native_splash-*.yaml ``` -------------------------------- ### Remove Command Flavor Option Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Examples of removing the splash screen for a specific flavor using the remove command. ```bash dart run flutter_native_splash:remove --flavor production dart run flutter_native_splash:remove -f dev ``` -------------------------------- ### Display Help Message Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Use the --help or -h flag to display the help message for the create command. ```bash dart run flutter_native_splash:create --help ``` ```bash dart run flutter_native_splash:create -h ``` -------------------------------- ### Combined CLI Options Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Use custom paths and flavor options together for more specific splash screen management. ```bash # Custom path + specific flavor dart run flutter_native_splash:create -p config/prod.yaml -f production # Custom path + all flavors dart run flutter_native_splash:create -p config/ -A ``` -------------------------------- ### CLI Help Commands Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Access help information for the create and remove commands to understand all available options. ```bash dart run flutter_native_splash:create -h dart run flutter_native_splash:remove --help ``` -------------------------------- ### Generate All Splash Screens for Multiple Flavors Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/INDEX.md Use the -A flag with the create command to generate splash screens for all defined flavors simultaneously. ```bash dart run flutter_native_splash:create -A ``` -------------------------------- ### Create Command Entry Point Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Use this command to generate native splash screens for your Flutter project. ```bash dart run flutter_native_splash:create [options] ``` -------------------------------- ### Running CLI Commands for Flavors Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-commands.md Demonstrates how to run the flutter_native_splash CLI to generate splash screens for specific app flavors. ```bash dart run flutter_native_splash:create -f production ``` ```bash dart run flutter_native_splash:create -F production,staging,dev ``` ```bash dart run flutter_native_splash:create -A # all flavors ``` -------------------------------- ### Example Usage of removeSplashFromWeb in Dart Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/web-platform.md This code demonstrates how to call the removeSplashFromWeb() function from Dart, typically scheduled on the next frame callback to avoid white flashes. ```dart SchedulerBinding.instance.addPostFrameCallback((_) { try { removeSplashFromWeb(); } catch (e) { throw Exception('Could not run the JS command removeSplashFromWeb()'); } }); ``` -------------------------------- ### Create Splash Screens for Multiple Flavors Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Use the --flavors or -F option to create splash screens for multiple flavors simultaneously. Flavors are provided as a comma-separated list. ```bash dart run flutter_native_splash:create --flavors production,staging,dev ``` ```bash dart run flutter_native_splash:create -F prod,stage ``` -------------------------------- ### Generate Native Splash Screen Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/example/README.md Commands to fetch dependencies and generate the splash screen using the default configuration. ```bash flutter pub get dart run flutter_native_splash:create ``` -------------------------------- ### Discover and Process All Flavors Programmatically Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Find all flavor configuration files in the current directory, extract their names, and then create splash screens for each discovered flavor. ```dart import 'dart:io'; import 'package:flutter_native_splash/helper_utils.dart'; import 'package:flutter_native_splash/cli_commands.dart'; void main() { // Find all flavor configurations final flavors = Directory.current .listSync() .whereType() .map((file) => file.path.split(Platform.pathSeparator).last) .where(HelperUtils.isValidFlavorConfigFileName) .map(HelperUtils.getFlavorNameFromFileName) .toList(); print('Creating splash screens for: $flavors'); // Process each flavor for (final flavor in flavors) { createSplash(path: null, flavor: flavor); } } ``` -------------------------------- ### Discover and Create All Flavors (CLI) Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md The 'dart run flutter_native_splash:create -A' command automatically discovers all 'flutter_native_splash-*.yaml' files, creates splash screens for each, and prints the list of found flavors. ```bash dart run flutter_native_splash:create -A dart run flutter_native_splash:create --all-flavors ``` -------------------------------- ### Android Flavor-Specific Resource Structure Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Flavor-specific resources for Android are created in flavor directories under 'android/app/src/'. This example shows the structure for a production flavor overriding main resources. ```treeview android/app/src/ ├── main/ │ ├── res/ │ │ ├── drawable/ │ │ ├── drawable-night/ │ │ ├── values/ │ │ └── values-night/ └── production/ └── res/ ├── drawable/ (overrides main/res/drawable) ├── drawable-night/ (overrides main/res/drawable-night) ├── values/ (overrides main/res/values) └── values-night/ (overrides main/res/values-night) ``` -------------------------------- ### Generate Native Splash Screen with Custom Config Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/example/README.md Commands to fetch dependencies and generate the splash screen using a specific configuration file path. ```bash flutter pub get dart run flutter_native_splash:create --path=red.yaml ``` -------------------------------- ### Create Splash Screen for a Local Development Flavor Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md Use this command to generate a splash screen for a local development flavor. The flavor name 'development' should correspond to your configuration. ```bash dart run flutter_native_splash:create --flavor development ``` -------------------------------- ### Create Command Signature Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md This is the general signature for the create command, showing all available options. ```bash dart run flutter_native_splash:create \ [--help|-h] \ [--path|-p ] \ [--flavor|-f ] \ [--flavors|-F ] \ [--all-flavors|-A] ``` -------------------------------- ### Create Splash Screens for All Discovered Flavors Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Use the --all-flavors or -A option to automatically discover and create splash screens for all flavor configuration files matching the pattern `flutter_native_splash-*.yaml` in the current directory. ```bash dart run flutter_native_splash:create --all-flavors ``` ```bash dart run flutter_native_splash:create -A ``` -------------------------------- ### Create Splash Screen with Custom Path Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md Use this command when your configuration is in a separate YAML file, specifying the path to the configuration file. ```bash dart run flutter_native_splash:create --path=path/to/my/file.yaml ``` -------------------------------- ### Basic YAML Configuration Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-commands.md Defines the basic parameters for the native splash screen, such as color and image. ```yaml flutter_native_splash: color: "#42a5f5" image: assets/splash.png android_gravity: center ios_content_mode: center fullscreen: false ``` -------------------------------- ### Flutter Native Splash Web Import Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/web-platform.md Example import statement for the Flutter Native Splash web platform channel implementation. This is typically handled automatically and does not require manual import in most usage scenarios. ```dart import 'package:flutter_native_splash/flutter_native_splash_web.dart'; ``` -------------------------------- ### Create Splash Screen for a Specific Flavor Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md Use this command to generate a splash screen for a flavor named 'acceptance'. Ensure the flavor name matches your configuration. ```bash dart run flutter_native_splash:create --flavor acceptance ``` -------------------------------- ### All Flavors Argument Enum Case Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/enums.md Represents the '--all-flavors' or '-A' argument to automatically discover and process all flavor configurations present in the current project directory. This simplifies handling projects with numerous flavor setups. ```dart ArgEnums.allFlavors(name: 'all-flavors', abbr: 'A') ``` -------------------------------- ### Custom Configuration Path Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Specify a custom YAML file for configuration when creating or removing splash screens. ```bash dart run flutter_native_splash:create -p assets/config/splash.yaml dart run flutter_native_splash:remove -p assets/config/splash.yaml ``` -------------------------------- ### Remove Command Full CLI Help Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/enums.md Displays the complete help text for the `remove` command, detailing its supported flags and options. ```text --help, -h Show help --path, -p Path to the flutter project, if the project is not in it's default location. --flavor, -f Flavor to remove the splash for. ``` -------------------------------- ### Load Flutter Native Splash Configurations Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-commands.md Demonstrates loading default, flavor-specific, and custom configuration files using the `getConfig` function. Ensure the `flutter_native_splash` package is imported. ```dart import 'package:flutter_native_splash/cli_commands.dart'; void main() { // Load default configuration final config = getConfig(configFile: null, flavor: null); print('Color: ${config['color']}'); // Load flavor-specific configuration final prodConfig = getConfig(configFile: null, flavor: 'production'); print('Android gravity: ${prodConfig['android_gravity']}'); // Load custom file final customConfig = getConfig(configFile: 'assets/splash-config.yaml', flavor: null); } ``` -------------------------------- ### Configuration Resolution Order Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md The package resolves splash screen configurations by checking explicitly specified files first, then flavor-specific files, default config, and finally package metadata. ```text Search for production flavor: flutter_native_splash-production.yaml → pubspec.yaml (if file not found) Search with explicit path: /custom/path/config.yaml (stop here, use this file) Search with default flavor: pubspec.yaml (flutter_native_splash section) ``` -------------------------------- ### Find Flavor Config Files in Directory Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/helper-utils.md Demonstrates how to use `isValidFlavorConfigFileName` to find all flavor configuration files within the current directory. ```dart import 'dart:io'; import 'package:flutter_native_splash/helper_utils.dart'; void main() { // Find all flavor configurations in current directory final flavorConfigs = Directory.current .listSync() .whereType() .map((file) => file.path.split(Platform.pathSeparator).last) .where(HelperUtils.isValidFlavorConfigFileName) .toList(); print('Found flavor configs: $flavorConfigs'); } ``` -------------------------------- ### Create Splash Screens (CLI) Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-commands.md Execute these commands in your terminal to generate splash screens. Options include specifying configuration files, flavors, or all available flavors. ```bash # Default configuration dart run flutter_native_splash:create ``` ```bash # Custom configuration file dart run flutter_native_splash:create -p config/my_splash.yaml ``` ```bash # Specific flavor dart run flutter_native_splash:create -f production ``` ```bash # Multiple flavors dart run flutter_native_splash:create -F production,staging,dev ``` ```bash # All flavors dart run flutter_native_splash:create -A ``` -------------------------------- ### Platform-Specific Configuration Override Pattern Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/configuration.md Demonstrates the consistent pattern for platform-specific overrides and dark mode variants in configuration. This pattern applies to various parameters like color and image. ```yaml flutter_native_splash: # General color color: "#42a5f5" # Platform-specific colors (override general) color_android: "#1e88e5" color_ios: "#0d47a1" # Dark mode colors color_dark: "#042a49" color_dark_android: "#000000" color_dark_ios: "#1a1a1a" ``` -------------------------------- ### Specify Custom Configuration Path Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Use the --path or -p option to specify a custom path to the configuration file. This is useful for monorepos or non-standard project structures. ```bash dart run flutter_native_splash:create --path config/my_splash.yaml ``` ```bash dart run flutter_native_splash:create -p ../other-project/flutter_native_splash.yaml ``` -------------------------------- ### Create Splash for Multiple Flavors using CLI Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Command-line interface command to create splash screens for a specific flavor, using the `-f` or `--flavor` flag. ```bash # Create splash for premium flavor dart run flutter_native_splash:create -f premium ``` -------------------------------- ### Success Output for Create Command Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md This is the success message displayed after the native splash screen is created. ```text ✅ Native splash complete. Now go finish building something awesome! 💪 You rock! 🤘🤩 Like the package? Please give it a 👍 here: https://pub.dev/packages/flutter_native_splash ``` -------------------------------- ### Package Structure Overview Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md This overview details the directory structure of the flutter_native_splash package, highlighting key files and their purposes within the library. ```text flutter_native_splash/ ├── lib/ │ ├── flutter_native_splash.dart # Main runtime API │ ├── cli_commands.dart # CLI functions │ ├── enums.dart # CLI argument enums │ ├── helper_utils.dart # Utility functions │ ├── flutter_native_splash_web.dart # Web platform implementation │ ├── remove_splash_from_web.dart # Web JS interop │ ├── android.dart # Android generation (internal) │ ├── ios.dart # iOS generation (internal) │ ├── web.dart # Web generation (internal) │ ├── flavor_helper.dart # Flavor support (internal) │ ├── templates.dart # Code templates (internal) │ └── constants.dart # Constants (internal) ├── bin/ │ ├── create.dart # Create command entry point │ └── remove.dart # Remove command entry point └── pubspec.yaml # Package definition ``` -------------------------------- ### Discover and Process All Flavor Configurations Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/helper-utils.md Combines `isValidFlavorConfigFileName` and `getFlavorNameFromFileName` to find all flavor configuration files and then process them using `createSplash`. ```dart import 'dart:io'; import 'package:flutter_native_splash/helper_utils.dart'; import 'package:flutter_native_splash/cli_commands.dart'; void main() { // Find all flavor configurations and process them final flavorConfigs = Directory.current .listSync() .whereType() .map((file) => file.path.split(Platform.pathSeparator).last) .where(HelperUtils.isValidFlavorConfigFileName) .map(HelperUtils.getFlavorNameFromFileName) .toList(); print('Creating splash screens for flavors: $flavorConfigs'); for (final flavor in flavorConfigs) { createSplash(path: null, flavor: flavor); } } ``` -------------------------------- ### Basic CLI Commands Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Use these commands to create or remove the default splash screen based on your pubspec.yaml or flutter_native_splash.yaml configuration file. ```bash dart run flutter_native_splash:create dart run flutter_native_splash:remove ``` -------------------------------- ### Production Flavor Splash Screen Configuration Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md Configuration for the production environment's splash screen, similar to acceptance but with production-specific assets. ```yaml # flutter_native_splash-production.yaml flutter_native_splash: color: "#ffffff" image: assets/logo-production.png branding: assets/branding-production.png branding_bottom_padding: 24 color_dark: "#121212" image_dark: assets/logo-production.png branding_dark: assets/branding-production.png android_12: image: assets/logo-production.png icon_background_color: "#ffffff" image_dark: assets/logo-production.png icon_background_color_dark: "#121212" web: false ``` -------------------------------- ### Create Splash for a Specific Flavor using CLI Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Command-line interface command to create splash screens for a specific flavor, using the `-f` or `--flavor` flag. ```bash # Create splash for free flavor dart run flutter_native_splash:create -f free ``` -------------------------------- ### getConfig Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-commands.md Reads and parses a YAML configuration file for splash screen settings. It supports custom file paths and flavor-specific configurations, searching in a predefined order if no specific path is given. It validates the configuration and returns a parsed map. ```APIDOC ## Function: getConfig Reads and parses a YAML configuration file, validates its structure, converts YamlMap to a regular Dart Map, and returns the configuration. Sets up flavor helper for subsequent operations. Searches for configuration files in order: specified path → flavor-specific file → `flutter_native_splash.yaml` → `pubspec.yaml`. ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | configFile | String? | No | null | Custom path to the configuration file. If not provided, searches for flavor-specific config, then `flutter_native_splash.yaml`, then `pubspec.yaml`. | | flavor | String? | No | null | The flavor name to load configuration for. Used to construct the filename pattern `flutter_native_splash-*.yaml`. | ### Return Type `Map` - Parsed configuration map with all splash screen parameters and their values. ### Throws | Error Type | Condition | |-----------|-----------| | Exception | Configuration file is empty or malformed YAML | | Exception | Configuration file does not contain a `flutter_native_splash` section | ### Example ```dart import 'package:flutter_native_splash/cli_commands.dart'; void main() { // Load default configuration final config = getConfig(configFile: null, flavor: null); print('Color: ${config['color']}'); // Load flavor-specific configuration final prodConfig = getConfig(configFile: null, flavor: 'production'); print('Android gravity: ${prodConfig['android_gravity']}'); // Load custom file final customConfig = getConfig(configFile: 'assets/splash-config.yaml', flavor: null); } ``` ``` -------------------------------- ### Flavor Support for Splash Screens Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Manage splash screens for single or multiple flavors using the -f, -F, or -A flags. ```bash # Single flavor dart run flutter_native_splash:create -f production dart run flutter_native_splash:remove -f production # Multiple flavors dart run flutter_native_splash:create -F production,staging,dev # All flavors dart run flutter_native_splash:create -A ``` -------------------------------- ### Create Splash Screens for Multiple Flavors (CLI) Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Use the 'dart run flutter_native_splash:create -F ' command to create splash screens for multiple flavors sequentially. Each flavor's configuration is processed independently. ```bash dart run flutter_native_splash:create -F production,staging,dev dart run flutter_native_splash:create --flavors production,staging,dev ``` -------------------------------- ### Testing Flavor Splash Screens Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Commands to test splash screen creation and application runs for specific flavors. Use these to validate that your flavor-specific configurations are applied correctly. ```bash dart run flutter_native_splash:create -f production flutter run --flavor production dart run flutter_native_splash:create -f staging flutter run --flavor staging ``` -------------------------------- ### Error Message: Image not found Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Displayed when the image file specified in the configuration is not found. ```text The file "assets/splash.png" set as the parameter "image" was not found. ``` -------------------------------- ### Enable Web Splash Screen Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/configuration.md Set to `true` to enable splash screen generation for the Web platform. If set to `false`, the Web splash screen will not be updated. ```yaml flutter_native_splash: web: true ``` -------------------------------- ### CLI API: Functions Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/INDEX.md Functions available for use via the command-line interface to manage splash screens. ```APIDOC ## CLI API Functions ### Description Functions exposed for command-line operations related to splash screen management. ### Functions #### createSplash() ##### Description Creates the native splash screen. ##### Method Function call. ##### Endpoint `createSplash()` #### removeSplash() ##### Description Removes the native splash screen. ##### Method Function call. ##### Endpoint `removeSplash()` #### getConfig() ##### Description Retrieves the splash screen configuration. ##### Method Function call. ##### Endpoint `getConfig()` #### createBackgroundImage() ##### Description Creates a background image for the splash screen. ##### Method Function call. ##### Endpoint `createBackgroundImage()` #### parseColor() ##### Description Parses a color value. ##### Method Function call. ##### Endpoint `parseColor()` ``` -------------------------------- ### Documentation Navigation Structure Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md This markdown code block illustrates the hierarchical structure of the documentation for the flutter_native_splash project. It shows the main entry point and the relationship to other documents covering specific aspects of the package. ```markdown INDEX.md (Start here) ├── flutter-native-splash-class.md (Runtime API) ├── cli-commands.md (CLI functions) ├── cli-structure.md (CLI arguments) ├── configuration.md (All config options) ├── flavor-system.md (Multi-variant builds) ├── enums.md (CLI argument types) ├── helper-utils.md (Utility functions) └── web-platform.md (Web implementation) ``` -------------------------------- ### Acceptance Flavor Splash Screen Configuration Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md Configuration for the acceptance environment's splash screen, including branding bottom padding and dark mode settings. ```yaml # flutter_native_splash-acceptance.yaml flutter_native_splash: color: "#ffffff" image: assets/logo-acceptance.png branding: assets/branding-acceptance.png branding_bottom_padding: 24 color_dark: "#121212" image_dark: assets/logo-acceptance.png branding_dark: assets/branding-acceptance.png android_12: image: assets/logo-acceptance.png icon_background_color: "#ffffff" image_dark: assets/logo-acceptance.png icon_background_color_dark: "#121212" web: false ``` -------------------------------- ### Create Command Arguments Parser Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/enums.md Defines the command-line arguments for the `create` command using `ArgParser`. This includes flags and options for help, project path, and flavor management. ```dart final parser = ArgParser(); parser ..addFlag(ArgEnums.help.name, abbr: ArgEnums.help.abbr, help: 'Show help') ..addOption(ArgEnums.path.name, abbr: ArgEnums.path.abbr, help: '...') ..addOption(ArgEnums.flavor.name, abbr: ArgEnums.flavor.abbr, help: '...') ..addOption(ArgEnums.flavors.name, abbr: ArgEnums.flavors.abbr, help: '...') ..addFlag(ArgEnums.allFlavors.name, abbr: ArgEnums.allFlavors.abbr, help: '...'); ``` -------------------------------- ### Set Full-Screen Background Image Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/configuration.md Configure a full-screen background image for the splash screen in light mode. This image fills the entire splash screen and applies to all platforms unless overridden. ```yaml flutter_native_splash: background_image: assets/background.png ``` -------------------------------- ### Create and Copy Background Images Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-commands.md Demonstrates using `createBackgroundImage` to copy images to their destination, converting non-PNG formats to PNG. The function creates necessary directories and handles image processing. ```dart import 'package:flutter_native_splash/cli_commands.dart'; void main() { // Copy PNG directly createBackgroundImage( imageSource: 'assets/splash.png', imageDestination: 'android/app/src/main/res/drawable/splash.png', ); // Convert and copy JPEG createBackgroundImage( imageSource: 'assets/splash.jpg', imageDestination: 'android/app/src/main/res/drawable/splash.png', ); } ``` -------------------------------- ### Helper Utilities Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md Utility functions for validating flavor configuration file names and extracting flavor names. These are primarily used internally by the CLI. ```APIDOC ## Utilities (lib/helper_utils.dart) ### Description Utility functions for validating flavor configuration file names and extracting flavor names. These are primarily used internally by the CLI. ### Class: HelperUtils #### `static bool isValidFlavorConfigFileName(String fileName)` - **Description**: Checks if a file name is a valid flavor configuration file name. - **Parameters**: - `fileName` (String) - Required - The name of the file to validate. - **Returns**: `true` if the file name is valid, `false` otherwise. #### `static String getFlavorNameFromFileName(String fileName)` - **Description**: Extracts the flavor name from a valid flavor configuration file name. - **Parameters**: - `fileName` (String) - Required - The name of the file. - **Returns**: The extracted flavor name. #### `static void validateFlavorArgs({required String? flavorArg, required String? flavorsArg, required bool? allFlavorsArg})` - **Description**: Validates the command-line arguments related to flavors. - **Parameters**: - `flavorArg` (String?) - Optional - The flavor argument. - `flavorsArg` (String?) - Optional - The flavors argument. - `allFlavorsArg` (bool?) - Optional - The all-flavors argument. ``` -------------------------------- ### Error Message: Multiple flavor options Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Displayed when multiple flavor options are used simultaneously in the command. ```text Exception: Cannot use multiple flavor options together. Please use only one of: --flavor, --flavors, or --all-flavors. ``` -------------------------------- ### Create Command ArgParser Configuration Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Configures the ArgParser with options specific to the create command. ```dart parser ..addFlag(ArgEnums.help.name, abbr: ArgEnums.help.abbr, help: 'Show help') ..addOption(ArgEnums.path.name, abbr: ArgEnums.path.abbr, help: '...') ..addOption(ArgEnums.flavor.name, abbr: ArgEnums.flavor.abbr, help: '...') ..addOption(ArgEnums.flavors.name, abbr: ArgEnums.flavors.abbr, help: '...') ..addFlag(ArgEnums.allFlavors.name, abbr: ArgEnums.allFlavors.abbr, help: '...'); ``` -------------------------------- ### Set Web Branding Image (Light Mode) Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/configuration.md Define `branding_web` for a web-specific branding image in light mode. It uses the general `branding` setting as a default. ```yaml flutter_native_splash: branding: assets/branding.png branding_web: assets/branding-web.png ``` -------------------------------- ### Web Platform API Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/README.md Provides methods for integrating the splash screen functionality with the web platform, including registration and method call handling. ```APIDOC ## Web Platform API (lib/flutter_native_splash_web.dart) ### Description Provides methods for integrating the splash screen functionality with the web platform, including registration and method call handling. ### Class: FlutterNativeSplashWeb #### `static void registerWith(Registrar registrar)` - **Description**: Registers the web implementation with the Flutter plugin registrar. - **Parameters**: - `registrar` (Registrar) - Required - The plugin registrar. #### `Future handleMethodCall(MethodCall call)` - **Description**: Handles method calls from the Flutter engine on the web platform. - **Parameters**: - `call` (MethodCall) - Required - The method call object. - **Returns**: A future that resolves with the result of the method call. ## External Function (lib/remove_splash_from_web.dart) #### `external void removeSplashFromWeb()` - **Description**: Removes the splash screen specifically from the web view. ``` -------------------------------- ### Create Splash Screen for Single Flavor (CLI) Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Use the 'dart run flutter_native_splash:create -f ' command to create a splash screen using a specific flavor's configuration file. ```bash dart run flutter_native_splash:create -f production dart run flutter_native_splash:create --flavor production ``` -------------------------------- ### Set Branding Image Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/configuration.md Add a branding image, such as a logo, at the bottom of the splash screen using the `branding` parameter. This is for light mode by default. ```yaml flutter_native_splash: image: assets/splash.png branding: assets/branding.png ``` -------------------------------- ### Create Splash for Multiple Flavors Programmatically Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/flavor-system.md Iterate through a list of flavor names and call `createSplash` for each to generate splash screens for multiple flavors. ```dart import 'package:flutter_native_splash/cli_commands.dart'; void main() { // Create splash for multiple flavors programmatically for (final flavor in ['production', 'staging', 'dev']) { createSplash(path: null, flavor: flavor); } } ``` -------------------------------- ### Build Flutter App with a Specific Flavor Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/INDEX.md When building or running your Flutter application, specify the desired flavor using the --flavor flag. ```bash flutter run --flavor production ``` -------------------------------- ### Generate Splash Screen for a Specific Flavor Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/README.md Command to generate native splash screens for a single, specified flavor, useful for testing or targeted builds. ```bash # If you have a flavor called production you would do this: dart run flutter_native_splash:create --flavor production ``` -------------------------------- ### Specify Info.plist Files for iOS Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/configuration.md Provides paths to Info.plist files that need modification, useful for projects with multiple targets or custom Info.plist locations. ```yaml flutter_native_splash: info_plist_files: - ios/Runner/Info.plist - ios/NotificationExtension/Info.plist ``` -------------------------------- ### ArgParser Initialization Source: https://github.com/jonbhanson/flutter_native_splash/blob/master/_autodocs/cli-structure.md Initializes an ArgParser instance for command-line argument parsing. ```dart final parser = ArgParser(); ```