### Install Application Bundle Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Configures the installation process to create a relocatable application bundle. It cleans the bundle directory, installs the executable, and copies necessary data and libraries. ```cmake # === Installation === # By default, "installing" just makes a relocatable bundle in the build # directory. set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files ``` -------------------------------- ### Install Application Target Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Installs the main application executable to the specified runtime destination. This makes the application available for execution. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Installs any bundled plugin libraries to the application's library directory. This ensures that plugins are correctly deployed with the application. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install Flutter Library Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Installs the main Flutter library file to the application's root directory. This is a core component required for Flutter applications. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Set Installation Directory for Runtime Components Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Configures the installation directory for runtime components, placing them next to the executable. This allows the application to run directly from the build directory. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Sets the minimum CMake version and project name. The executable name and GTK application ID are defined here. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "example") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "com.example.example") ``` -------------------------------- ### Install AOT Library for Release/Profile Builds Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library to the data directory, but only for 'Profile' and 'Release' configurations. This optimizes performance for non-debug builds. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install Flutter Assets Directory Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Installs the Flutter assets directory, ensuring it's copied to the correct location within the application bundle. The directory is removed and re-copied on each build to prevent stale files. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Custom Progress Indicator Example Source: https://context7.com/java-james/loading_overlay/llms.txt Demonstrates how to use a custom widget for the progress indicator, including text and icons. Ensure the `LoadingOverlay` widget is properly integrated into your widget tree. ```dart import 'package:flutter/material.dart'; import 'package:loading_overlay/loading_overlay.dart'; class CustomLoaderExample extends StatefulWidget { @override _CustomLoaderExampleState createState() => _CustomLoaderExampleState(); } class _CustomLoaderExampleState extends State { bool _isProcessing = false; Future _processPayment() async { setState(() => _isProcessing = true); await Future.delayed(const Duration(seconds: 4)); setState(() => _isProcessing = false); } @override Widget build(BuildContext context) { return Scaffold( body: LoadingOverlay( isLoading: _isProcessing, color: Colors.black87, // Custom progress indicator with text and icon progressIndicator: Container( padding: const EdgeInsets.all(24), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(12), ), child: const Column( mainAxisSize: MainAxisSize.min, children: [ CircularProgressIndicator(color: Colors.green), SizedBox(height: 16), Text( 'Processing Payment...', style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black87, ), ), SizedBox(height: 8), Text( 'Please do not close this screen', style: TextStyle(fontSize: 12, color: Colors.grey), ), ], ), ), child: Center( child: ElevatedButton( onPressed: _processPayment, child: const Text('Pay $99.99'), ), ), ), ); } } ``` -------------------------------- ### Install Native Assets Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Copies native assets provided by build.dart from all packages into the application's library directory. This ensures all necessary native code is included. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install ICU Data File Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Installs the ICU data file to the data directory within the application bundle. This file is necessary for internationalization support. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install AOT Library Conditionally Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Installs the AOT (Ahead-Of-Time) library on non-Debug builds only. This is typically used to include performance-optimized libraries when not in a debug configuration. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Set Minimum CMake Version and Project Name Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Specifies the minimum required CMake version and defines the project name. This is a standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) ``` -------------------------------- ### Set Flutter Library Path Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/flutter/CMakeLists.txt Defines the path to the Flutter Windows DLL. This is published to the parent scope for use in the install step. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) ``` -------------------------------- ### Configure Flutter GTK Library Dependencies in CMake Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/flutter/CMakeLists.txt Configures system-level dependencies for the Flutter GTK library using PkgConfig. It checks for GTK, GLIB, and GIO, and sets up interface targets for the Flutter library, including include directories and linked libraries. Ensure PkgConfig is installed and the required libraries are available. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) ``` ```cmake list(APPEND FLUTTER_LIBRARY_HEADERS "fl_basic_message_channel.h" "fl_binary_codec.h" "fl_binary_messenger.h" "fl_dart_project.h" "fl_engine.h" "fl_json_message_codec.h" "fl_json_method_codec.h" "fl_message_codec.h" "fl_method_call.h" "fl_method_channel.h" "fl_method_codec.h" "fl_method_response.h" "fl_plugin_registrar.h" "fl_plugin_registry.h" "fl_standard_message_codec.h" "fl_standard_method_codec.h" "fl_string_codec.h" "fl_value.h" "fl_view.h" "flutter_linux.h" ) list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO ) add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Import and Basic Usage Source: https://context7.com/java-james/loading_overlay/llms.txt Import the package in your Dart file and wrap your content with the `LoadingOverlay` widget. Control the overlay's visibility using the `isLoading` boolean. ```dart // Import in your Dart file import 'package:loading_overlay/loading_overlay.dart'; // Basic usage wrapping a Scaffold body @override Widget build(BuildContext context) { return Scaffold( body: LoadingOverlay( isLoading: _isLoading, child: YourContentWidget(), ), ); } ``` -------------------------------- ### Add Dependencies and Include Directories Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/runner/CMakeLists.txt Links necessary libraries (flutter, flutter_wrapper_app, dwmapi.lib) and specifies include directories for the application target. Add any application-specific dependencies here. ```cmake # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Define Application Executable and Dependencies Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Defines the main executable target, lists its source files, applies standard build settings, and links necessary libraries like Flutter and GTK. ```cmake # Define the application target. To change its name, change BINARY_NAME above, # not the value here, or `flutter run` will no longer work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) # Add dependency libraries. Add any application-specific dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Find PkgConfig and GTK Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Finds the PkgConfig module and checks for the GTK 3.0 library, making its imported target available for linking. ```cmake # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/runner/CMakeLists.txt Applies a standard set of build settings to the application target. This can be removed or modified for applications requiring different build configurations. ```cmake # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### LoadingOverlay.withFuture Constructor Source: https://github.com/java-james/loading_overlay/blob/master/README.md Defines the parameters for the LoadingOverlay.withFuture constructor, which manages overlay visibility based on a Future's completion. ```dart // New: show overlay until a Future completes LoadingOverlay.withFuture({ required Future future, required Widget child, Widget progressIndicator = const CircularProgressIndicator(), Color? color, }); ``` -------------------------------- ### Configure Runtime Output Directory Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Sets the runtime output directory for the executable to a subdirectory. This is to prevent users from running the unbundled copy, ensuring correct resource loading. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Enable Unicode Support Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Adds preprocessor definitions to enable Unicode support in the project. This is crucial for handling international characters correctly. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Configure Flutter Tool Backend Command in CMake Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/flutter/CMakeLists.txt Sets up a custom command to execute the Flutter tool backend script for building the Flutter library and headers. This command is designed to run every time due to the use of a phony output file. Ensure the `FLUTTER_TOOL_ENVIRONMENT` and `FLUTTER_ROOT` variables are correctly set. ```cmake # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### Add Package Dependency Source: https://context7.com/java-james/loading_overlay/llms.txt To use the loading_overlay package, add it to your project's pubspec.yaml file under dependencies. ```yaml # pubspec.yaml dependencies: flutter: sdk: flutter loading_overlay: ^0.5.0 ``` -------------------------------- ### Apply Standard Compilation Settings Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Configures standard compilation features, options, and definitions for a target. It enables C++14, sets warning levels, and optimizes non-debug builds. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE "<$>:-O3>") target_compile_definitions(${TARGET} PRIVATE "<$>:NDEBUG>") endfunction() ``` -------------------------------- ### Import LoadingOverlay Library Source: https://github.com/java-james/loading_overlay/blob/master/README.md Import the loading_overlay library into your Dart widget file before using its components. ```dart import 'package:loading_overlay/loading_overlay.dart'; ``` -------------------------------- ### Cross-Building Root Filesystem Configuration Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Configures CMake's sysroot and find root path settings when cross-building, ensuring that the correct system root and search paths are used for libraries and headers. ```cmake # Root filesystem for cross-building. if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() ``` -------------------------------- ### Integrate Flutter Tool Build Steps Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/runner/CMakeLists.txt Ensures that the Flutter tool's build steps, specifically `flutter_assemble`, are executed as part of the application's build process. This is a mandatory step and should not be removed. ```cmake # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Load Bundled Libraries Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Sets the RPATH for the executable to include the 'lib' directory relative to the binary. This ensures that bundled libraries can be found at runtime. ```cmake # Load bundled libraries from the lib/ directory relative to the binary. set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Apply Standard Compilation Settings to a Target Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Defines a function to apply common compilation settings like C++ standard, warning levels, and exception handling to a given target. Use with caution for plugins. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() ``` -------------------------------- ### Include Generated Plugin Build Rules Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Includes CMake rules for building generated plugins. This ensures that all necessary plugins are compiled and linked into the application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Define Flutter Wrapper App Library Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/flutter/CMakeLists.txt Configures and builds a static library for the Flutter wrapper application, including core and app-specific sources. It links against the Flutter library and sets include directories. ```cmake # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### Flutter Tool Backend Custom Command Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/flutter/CMakeLists.txt Defines a custom command to execute the Flutter tool backend script. It uses a phony output file to ensure the command runs every time and sets up environment variables. ```cmake # _phony_ is a non-existent file to force this command to run every time, since currently there's no way to get a full input/output list from the flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) ``` -------------------------------- ### Define Profile Build Mode Linker and Compiler Flags Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Sets linker and compiler flags for the 'Profile' build mode, typically by copying settings from the 'Release' mode. This ensures consistent performance tuning. ```cmake set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") ``` -------------------------------- ### LoadingOverlay Constructor Source: https://github.com/java-james/loading_overlay/blob/master/README.md Defines the parameters available for the standard LoadingOverlay constructor, including isLoading, child, progressIndicator, and color. ```dart LoadingOverlay({ required bool isLoading, required Widget child, Widget progressIndicator = const CircularProgressIndicator(), Color? color, }); ``` -------------------------------- ### Show Overlay Until Future Completes Source: https://github.com/java-james/loading_overlay/blob/master/README.md Use LoadingOverlay.withFuture to automatically display the overlay until a provided Future completes. This is useful for managing asynchronous operations. ```dart // Start an async operation final saveFuture = _saveFormAsync(); return LoadingOverlay.withFuture( future: saveFuture, color: Colors.black.withOpacity(0.5), child: Form(...), ); ``` -------------------------------- ### Define Flutter Wrapper Plugin Library Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/flutter/CMakeLists.txt Configures and builds a static library for the Flutter wrapper plugin, including core and plugin-specific sources. It sets properties like POSITION_INDEPENDENT_CODE and CXX_VISIBILITY_PRESET. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) ``` -------------------------------- ### Add Preprocessor Definitions for Build Version Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/runner/CMakeLists.txt Adds preprocessor definitions to the build configuration to include Flutter version information. This allows the application to access version details at compile time. ```cmake # Add preprocessor definitions for the build version. target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") ``` -------------------------------- ### Include Runner Application Build Rules Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Includes the CMake build rules for the runner application. This directs CMake to build the main application executable. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Implement Loading Overlay with Boolean State Source: https://context7.com/java-james/loading_overlay/llms.txt Use this snippet to wrap your content with LoadingOverlay, controlling its visibility via the `isLoading` boolean. This is suitable for manual state management of the overlay. ```dart import 'package:flutter/material.dart'; import 'package:loading_overlay/loading_overlay.dart'; class LoginPage extends StatefulWidget { @override _LoginPageState createState() => _LoginPageState(); } class _LoginPageState extends State { bool _isLoading = false; Future _submitForm() async { setState(() { _isLoading = true; }); try { // Simulate async operation (API call, database write, etc.) await Future.delayed(const Duration(seconds: 2)); print('Form submitted successfully!'); } finally { setState(() { _isLoading = false; }); } } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Login')), body: LoadingOverlay( isLoading: _isLoading, color: Colors.black.withOpacity(0.5), progressIndicator: const CircularProgressIndicator( valueColor: AlwaysStoppedAnimation(Colors.white), ), child: Padding( padding: const EdgeInsets.all(16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ const TextField( decoration: InputDecoration(labelText: 'Username'), ), const SizedBox(height: 16), const TextField( decoration: InputDecoration(labelText: 'Password'), obscureText: true, ), const SizedBox(height: 24), ElevatedButton( onPressed: _submitForm, child: const Text('Login'), ), ], ), ), ), ); } } ``` -------------------------------- ### Configure Flutter Library Headers Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/flutter/CMakeLists.txt Appends Flutter library header files to a list and sets their include directory. It also links the Flutter library. ```cmake list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Configure Build Types for Multi-Config Generators Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Sets the available build configurations (Debug, Profile, Release) when using a multi-configuration CMake generator. This ensures consistent build options. ```cmake set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) ``` -------------------------------- ### Set Executable Binary Name Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Defines the on-disk name for the application's executable. Change this variable to alter the application's filename. ```cmake set(BINARY_NAME "example") ``` -------------------------------- ### Define Executable Target Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/runner/CMakeLists.txt Defines the main executable target for the Windows application, including all necessary source files and resources. Ensure BINARY_NAME is consistent with the top-level CMakeLists.txt for `flutter run` compatibility. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) # Define the application target. To change its name, change BINARY_NAME in the # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer # work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) ``` -------------------------------- ### Opt-in to Modern CMake Behaviors Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Explicitly enables modern CMake behaviors to suppress warnings in newer CMake versions. It's recommended to use a specific version range. ```cmake cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Wrap Widget with LoadingOverlay Source: https://github.com/java-james/loading_overlay/blob/master/README.md Wrap your target widget, typically a form, with LoadingOverlay. Manage the overlay's visibility using a boolean state variable. ```dart bool _isSaving_ = false ... @override Widget build(BuildContext context) { return Scaffold( body: LoadingOverlay( color: Colors.black.withOpacity(0.5), child: Container( Form(...) ), isLoading: _isSaving_ ), ); } ``` -------------------------------- ### Define List Prepend Function in CMake Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/flutter/CMakeLists.txt Defines a custom CMake function `list_prepend` to add a prefix to each element of a list. This is used as a fallback for older CMake versions that do not support `list(TRANSFORM ... PREPEND ...)`. Ensure the list name and prefix are correctly provided. ```cmake function(list_prepend LIST_NAME PREFIX) set(NEW_LIST "") foreach(element ${${LIST_NAME}}) list(APPEND NEW_LIST "${PREFIX}${element}") endforeach(element) set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) endfunction() ``` -------------------------------- ### Include Generated Plugin Registrant Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Includes the CMake file responsible for registering generated plugins, which is essential for Flutter plugin functionality. ```cmake # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Set Build Configuration Mode Source: https://github.com/java-james/loading_overlay/blob/master/example/linux/CMakeLists.txt Sets the default build type to 'Debug' if not already specified. It also restricts the allowed build types to 'Debug', 'Profile', and 'Release'. ```cmake # Define build configuration options. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() ``` -------------------------------- ### Add Dependency to pubspec.yml Source: https://github.com/java-james/loading_overlay/blob/master/README.md Add this package to your pubspec.yml file to include it in your project dependencies. ```yaml dependencies: loading_overlay: ^0.4.0 ``` -------------------------------- ### Include Flutter Managed Directory Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Adds the Flutter managed directory as a subdirectory to the CMake project. This is essential for integrating Flutter's build system. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Set Default Build Type if Not Specified Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/CMakeLists.txt Sets the default build type to 'Debug' if it's not already defined and no configurations are specified. This ensures a default build mode is always active. ```cmake if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() ``` -------------------------------- ### Flutter Assemble Custom Target Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/flutter/CMakeLists.txt Creates a custom target named 'flutter_assemble' that depends on the Flutter library, headers, and wrapper source files. This target ensures these components are built. ```cmake add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Disable Conflicting Windows Macros Source: https://github.com/java-james/loading_overlay/blob/master/example/windows/runner/CMakeLists.txt Disables Windows-specific macros (NOMINMAX) that might conflict with C++ standard library functions, preventing potential compilation errors. ```cmake # Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.