### CMake Project Setup and Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground_navigator2/linux/CMakeLists.txt Initializes the CMake project, defines the executable and application ID, sets up policies for modern CMake, and configures installation paths for bundled libraries. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "playground_navigator2") set(APPLICATION_ID "com.example.playground_navigator2") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 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() 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() ``` -------------------------------- ### CMake Target Properties and Installation Setup Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground/linux/CMakeLists.txt Configures runtime output directory for the executable and sets up installation rules. It ensures a clean build bundle directory, installs the executable, Flutter data, libraries, and bundled plugin libraries to their respective destinations. ```cmake # Only the install-generated bundle's copy of the executable will launch # correctly, since the resources must in the right relative locations. To avoid # people trying to run the unbundled copy, put it in a subdirectory instead of # the default top-level location. set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.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) # Fully re-copy the assets directory on each build to avoid having stale files ``` -------------------------------- ### CMake Installation Rules for Application Bundle Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground_navigator2/windows/CMakeLists.txt Configures the installation process for the application bundle. It sets the installation prefix to be next to the executable, makes the 'install' step default for Visual Studio builds, and defines directories for runtime data and libraries. It installs the main executable, ICU data file, Flutter library, and any bundled plugin libraries. ```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}") 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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### CMake Installation Rules for Runtime Components Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker/windows/CMakeLists.txt Configures the installation process for the application's runtime components. This includes setting the installation prefix, defining directories for data and libraries, and installing the main executable, Flutter data, libraries, and bundled plugin libraries. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. 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}") 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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### CMake Installation Rules for Application Bundle Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground/windows/CMakeLists.txt Configures the installation of the application bundle, including setting the install prefix to be adjacent to the executable for in-place running. It defines directories for data and libraries within the bundle and sets the 'install' step as default for Visual Studio builds. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. 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}") ``` -------------------------------- ### CMake Installation Rules Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/widgetbook/linux/CMakeLists.txt Defines rules for installing the application bundle, including cleaning the build directory, installing the executable, ICU data, Flutter library, bundled libraries, and native assets. It sets up destinations for data and libraries within the installation prefix. ```cmake include(flutter/generated_plugins.cmake) 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() 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) set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground/linux/CMakeLists.txt Initializes the CMake build system, sets the project name and languages, defines the executable name and application ID, and configures modern CMake behaviors. It also sets the installation rpath for bundled libraries. ```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 "playground") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "com.wolt_modal_sheet.playground.playground") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. cmake_policy(SET CMP0063 NEW) # Load bundled libraries from the lib/ directory relative to the binary. set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### CMake Install Targets and Components Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground/windows/CMakeLists.txt Installs the main executable, ICU data file, Flutter library, and bundled plugin libraries to their respective destinations within the installation bundle. These components are marked with the 'Runtime' component for installation. ```cmake 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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Installation Rules for Application Bundle (CMake) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground_navigator2/linux/CMakeLists.txt Configures the installation process to create a relocatable bundle. It cleans the build bundle directory, installs the executable, Flutter ICU data, Flutter library, and any bundled plugin libraries to their respective locations within the installation prefix. ```cmake 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() 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) ``` -------------------------------- ### CMake Installation Rules for Application Bundle Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/example/linux/CMakeLists.txt Defines the installation process for creating a relocatable application bundle. This includes clearing the build bundle directory, installing the executable, data files, libraries, and assets. ```cmake # === Installation === 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() 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) 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) ``` -------------------------------- ### Installation Rules for Runtime Components Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/widgetbook/windows/CMakeLists.txt Configures the installation process for the application's runtime components, including the executable, ICU data, Flutter library, bundled plugin libraries, and native assets. It ensures files are placed correctly for the application to run. ```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}") 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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### ValueState Initialization Examples (Dart) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/packages/wolt_state_management/README.md Illustrates the creation of different ValueState instances in Dart: Idle, Loading (with and without last known value), and Error (with and without last known value). ```dart ValueState state = ValueState.idle(42); ValueState loadingState = ValueState.loading(lastKnownValue: 42); ValueState loadingState = ValueState.loading(); ValueState errorState = ValueState.error(Exception('An error occurred'), 42); ValueState errorState = ValueState.error(Exception('An error occurred')); ``` -------------------------------- ### CMake Installation Rules Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker/linux/CMakeLists.txt Defines rules for installing the application bundle. It cleans the build bundle directory, installs the executable, Flutter ICU data, Flutter library, and any bundled plugin libraries. It also handles copying the Flutter assets directory. ```cmake 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() 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) 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) ``` -------------------------------- ### Asset Directory Installation with Cleanup Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/widgetbook/windows/CMakeLists.txt Installs the Flutter assets directory. It first removes any existing assets to prevent stale files and then copies the new assets. This ensures the application has the latest assets. ```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) ``` -------------------------------- ### CMake Installation Rules for Application Bundle Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/linux/CMakeLists.txt Defines the installation rules for creating a relocatable application bundle. It cleans the bundle directory, installs the executable, Flutter ICU data, Flutter library, bundled plugin libraries, and native assets. ```cmake 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() 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) set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### AOT Library Installation for Non-Debug Builds Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/widgetbook/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library, but only for Profile and Release build configurations. This optimizes performance for production builds. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/linux/CMakeLists.txt Initializes the CMake project, sets the minimum required version, project name, executable name, and application ID. It also enforces modern CMake behaviors and configures runtime paths. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "coffee_maker_navigator_2") set(APPLICATION_ID "com.wolt_modal_sheet.coffee_maker_navigator_2") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/example/linux/CMakeLists.txt Initializes the CMake project, sets the minimum required version, defines the project name and supported languages, and configures application-specific identifiers and build behaviors. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "example") set(APPLICATION_ID "com.example.example") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 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() 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() ``` -------------------------------- ### Install Flutter Assets - CMake Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/linux/CMakeLists.txt Installs Flutter assets by first removing any existing directory and then copying the new assets. This ensures the latest assets are always deployed. It uses CMake's install command for directory management. ```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) ``` -------------------------------- ### CMake Installation Rule for AOT Library Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library, but only for 'Profile' and 'Release' build configurations. This optimizes runtime performance for non-debug builds. ```cmake # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker/windows/CMakeLists.txt Initializes the CMake project, sets the minimum version, defines the project name and languages, and configures build options like executable name and modern CMake behaviors. It also handles multi-configuration generator settings and defines default build types. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) set(BINARY_NAME "example") cmake_policy(SET CMP0063 NEW) get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() 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() endif() ``` -------------------------------- ### Install Application Runtime Components Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/example/windows/CMakeLists.txt Configures the installation of the main application executable, Flutter ICU data, the main Flutter library, and bundled plugin libraries. It ensures these components are placed correctly for the application to run, including handling assets and AOT libraries for specific build configurations. ```cmake 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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() 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) install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install Flutter Assets using CMake Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground/linux/CMakeLists.txt Installs the Flutter assets directory to the application bundle. It first removes any existing directory to ensure a clean installation and then copies the new assets. This is crucial for applications using Flutter for their UI. ```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 ) ``` -------------------------------- ### CMake Installation Rule for Flutter Assets Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker/windows/CMakeLists.txt Installs the Flutter assets directory by first removing any existing directory and then copying the new assets. This ensures that the deployed application has the latest asset files. ```cmake # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. 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) ``` -------------------------------- ### Install Flutter Assets and AOT Library (CMake) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground_navigator2/linux/CMakeLists.txt Configures the installation of Flutter assets and the AOT library. It removes previous asset directories, installs new ones, and conditionally installs the AOT library for non-debug builds. This ensures the correct assets and runtime libraries are deployed with the application. ```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) # Install the AOT library on non-Debug builds only. if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker/linux/CMakeLists.txt Initializes the CMake project, sets the project name, and defines variables for the executable name and GTK application ID. It also sets modern CMake policies and specifies runtime library search paths. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "example") set(APPLICATION_ID "com.wolt.wolt_modal_sheet.example") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 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() 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() ``` -------------------------------- ### CMake Project and Version Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/widgetbook/windows/CMakeLists.txt Sets the minimum required CMake version and defines the project name and supported languages. This is a standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 3.14) project(widgetbook LANGUAGES CXX) ``` -------------------------------- ### Installing Flutter Assets and AOT Library in CMake Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/windows/CMakeLists.txt Manages the installation of Flutter assets and the Ahead-Of-Time (AOT) compilation library. It ensures assets are correctly copied and the AOT library is installed only for non-Debug builds. ```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) install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground/windows/CMakeLists.txt Sets the minimum CMake version, project name, and executable name. It also enables modern CMake behaviors and defines build configuration options for multi-configuration generators and single-configuration generators. ```cmake cmake_minimum_required(VERSION 3.14) project(playground LANGUAGES CXX) set(BINARY_NAME "playground") cmake_policy(SET CMP0063 NEW) get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() 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() endif() ``` -------------------------------- ### Install WoltModalSheet using Flutter CLI Source: https://context7.com/woltapp/wolt_modal_sheet/llms.txt This command adds the WoltModalSheet package as a dependency to your Flutter project. Ensure you are in your project's root directory when running this command. ```bash flutter pub add wolt_modal_sheet ``` -------------------------------- ### WoltModalSheetPage for Simple Widget Content (Dart) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/README.md This example demonstrates the basic usage of `WoltModalSheetPage` for creating straightforward modal sheet pages that display a single widget. It's suitable for content that doesn't require slivers or lazy building, using Dart. ```dart WoltModalSheetPage( child: MyCustomContentWidget(), pageTitle: Text('My Page Title'), // Other properties... ) ``` -------------------------------- ### Flutter Library Setup in CMake Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/windows/flutter/CMakeLists.txt Configures the Flutter library by defining its header files and linking the necessary DLL. It sets include directories and dependencies for the Flutter library, making it available for other targets. ```cmake set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # === Flutter Library === 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) 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) ``` -------------------------------- ### CounterViewModel with StatefulValueNotifier (Dart) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/packages/wolt_state_management/README.md An example ViewModel in Dart demonstrating how to use StatefulValueNotifier to manage a counter's state, including incrementing and handling errors asynchronously. ```dart class CounterViewModel { final StatefulValueNotifier _counterNotifier = StatefulValueNotifier(0); StatefulValueListenable get counter => _counterNotifier; void increment() { _counterNotifier.setLoading(); Future.delayed(Duration(seconds: 1), () { _counterNotifier.setIdle((_counterNotifier.currentValue ?? 0) + 1); }); } void causeError() { _counterNotifier.setError(Exception('An error occurred')); } } ``` -------------------------------- ### Apply Modal Level Decoration with Decorators (Dart) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/README.md This example shows how to apply decorations at the modal instance level using `pageContentDecorator` and `modalDecorator` when calling `WoltModalSheet.show`. It includes wrapping content with `Align` and `ClipRRect`, and providing a `ChangeNotifierProvider` for state management, using Dart. ```dart WoltModalSheet.show( context: context, pageContentDecorator: (widget) => Align( alignment: Alignment.bottomCenter, child: ClipRRect( ..., // Your clipRRect properties child: BackdropFilter( ..., // Your backdrop filter properties child: widget, ), ), ), modalDecorator: (child) { // Wrap the modal with `ChangeNotifierProvider` to manage the state of // the entire pages in the modal. return ChangeNotifierProvider( builder: (_, __) => StoreOnlineViewModel(), child: child, ); }, pageListBuilder: (context) { final viewModel = context.read(); return [ WoltModalSheetPage( child: FirstPageContent(viewModel.data), pageTitle: Text('First Page Title'), // Other properties... ), WoltModalSheetPage( child: SecondPageContent(viewModel.data), pageTitle: Text('Second Page Title'), // Other properties... ), ]; }, ); ``` -------------------------------- ### Install AOT Library on Non-Debug Builds (CMake) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker/linux/CMakeLists.txt This CMake script conditionally installs the AOT library. The installation occurs only when the CMAKE_BUILD_TYPE is not 'Debug'. It specifies the source file, destination directory, and component for the installation. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### CMake Build Rules for Flutter and Dependencies Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/widgetbook/linux/CMakeLists.txt Includes Flutter build rules, finds PkgConfig and GTK, defines the application ID as a preprocessor macro, and defines the main executable target with its source files and dependencies. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Install AOT Library Conditionally using CMake Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/playground/linux/CMakeLists.txt Installs the AOT (Ahead-of-Time) compiled library on non-Debug builds only. This optimization is applied to release or non-debug configurations to ensure better performance by using pre-compiled code. It specifies the source file and the destination directory for the library. ```cmake # Install the AOT library on non-Debug builds only. if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime ) endif() ``` -------------------------------- ### Basic Starter App with Wolt Modal Sheet (Dart) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/README.md A complete Flutter application demonstrating the basic usage of the wolt_modal_sheet library. It sets up a home page with a button that triggers the display of a modal sheet containing a scrollable list. ```dart import 'package:flutter/material.dart'; import 'package:wolt_modal_sheet/wolt_modal_sheet.dart'; void main() { runApp( const WoltModalSheetApp(), ); } class WoltModalSheetApp extends StatelessWidget { const WoltModalSheetApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( home: WoltModalSheetHomePage(), ); } } class WoltModalSheetHomePage extends StatelessWidget { const WoltModalSheetHomePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Wolt Modal Bottom Sheet Sample'), ), floatingActionButton: FloatingActionButton.extended( onPressed: () { WoltModalSheet.show( context: context, pageListBuilder: (bottomSheetContext) => [ SliverWoltModalSheetPage( mainContentSliversBuilder: (context) => [ SliverList.builder( itemBuilder: (context, index) { return ListTile( title: Text('Index is $index'), onTap: Navigator.of(bottomSheetContext).pop, ); }, ), ], ) ], ); }, label: const Text('Trigger Wolt Sheet'), ), ); } } ``` -------------------------------- ### StatefulValueListenableBuilder Widget Configuration (Dart) Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/packages/wolt_state_management/README.md Provides an example of how to use the StatefulValueListenableBuilder widget in Flutter to reactively update the UI based on the state of a StatefulValueListenable. ```dart StatefulValueListenableBuilder( valueListenable: listenable, idleBuilder: (context, value, child) => Text('Value: $value'), loadingBuilder: (context, lastKnownValue, child) => CircularProgressIndicator(), errorBuilder: (context, error, lastKnownValue, child) => Text('Error: $error'), ); ``` -------------------------------- ### Customize WoltModalSheet Bottom Sheet Type Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/README.md Demonstrates how to create a custom bottom sheet type by extending WoltBottomSheetType. This example customizes the shape border and disables the drag handle and barrier dismissal. ```dart class MyCustomBottomSheetType extends WoltBottomSheetType { const MyCustomBottomSheetType() : super( shapeBorder: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(24))), showDragHandle: false, barrierDismissible: false, ); } ``` -------------------------------- ### CMake Project Configuration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/widgetbook/linux/CMakeLists.txt Defines the minimum required CMake version, project name, languages, executable name, and application ID. It also sets modern CMake policies and specifies the runtime library search path. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "widgetbook") set(APPLICATION_ID "com.example.widgetbook") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 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() 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 and GTK Integration Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker/linux/CMakeLists.txt Includes the Flutter managed directory and finds the GTK 3.0 library using PkgConfig. It also defines the application ID as a preprocessor macro and links the Flutter library and GTK to the main executable target. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Project and Build Configuration in CMake Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/windows/CMakeLists.txt Initializes the CMake project, sets the minimum required version, defines the project name, and specifies the executable binary name. It also configures build types and compiler flags for different build modes. ```cmake cmake_minimum_required(VERSION 3.14) project(coffee_maker_navigator_2 LANGUAGES CXX) set(BINARY_NAME "coffee_maker_navigator_2") cmake_policy(VERSION 3.14...3.25) get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() 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() endif() 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}") add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Implement Custom Modal Type (Dart) Source: https://context7.com/woltapp/wolt_modal_sheet/llms.txt Shows how to create a completely custom modal type by extending `WoltModalType`. This example defines a `TopNotificationSheetType` for notifications appearing from the top. It customizes layout, positioning, and transitions. ```dart import 'dart:math'; import 'dart:ui'; class TopNotificationSheetType extends WoltModalType { final EdgeInsetsDirectional padding; const TopNotificationSheetType({ this.padding = const EdgeInsetsDirectional.all(32.0), }) : super( shapeBorder: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(24)), ), dismissDirection: WoltModalDismissDirection.up, showDragHandle: false, closeProgressThreshold: 0.8, barrierDismissible: false, ); @override String routeLabel(BuildContext context) { final MaterialLocalizations localizations = MaterialLocalizations.of(context); return localizations.dialogLabel; } @override BoxConstraints layoutModal(Size availableSize) { final availableWidth = availableSize.width; double width = availableWidth > 523.0 ? 312.0 : availableWidth - padding.end; return BoxConstraints( minWidth: width, maxWidth: width, minHeight: 0, maxHeight: availableSize.height * 0.6, ); } @override Offset positionModal( Size availableSize, Size modalContentSize, TextDirection textDirection, ) { final xOffset = max(0.0, (availableSize.width - modalContentSize.width) / 2); final yOffset = padding.top; return Offset(xOffset, yOffset); } @override Widget buildTransitions( BuildContext context, Animation animation, Animation secondaryAnimation, Widget child, ) { final alphaAnimation = Tween( begin: 0.0, end: 1.0, ).animate(CurvedAnimation( parent: animation, curve: const Interval(0.0, 100.0 / 300.0, curve: Curves.linear), reverseCurve: const Interval(100.0 / 250.0, 1.0, curve: Curves.linear), )); return FadeTransition( opacity: alphaAnimation, child: SlideTransition( position: animation.drive( Tween( begin: const Offset(0.0, -1.0), end: Offset.zero, ).chain(CurveTween(curve: Curves.easeOutQuad)), ), child: child, ), ); } } // Usage void showCustomTypeModal(BuildContext context) { WoltModalSheet.show( context: context, modalTypeBuilder: (_) => const TopNotificationSheetType(), pageListBuilder: (context) => [ WoltModalSheetPage( child: const Padding( padding: EdgeInsets.all(24.0), child: Text('Notification from top!'), ), ), ], ); } ``` -------------------------------- ### Navigate Between Pages: Basic Transitions Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/README.md Facilitates direct navigation within the modal stack. `showNext` moves to the subsequent page, and `showPrevious` navigates to the preceding page. These methods return a boolean indicating whether the navigation was successful. ```dart // Move to the next page bool movedNext = WoltModalSheet.of(context).showNext(); // Move to the previous page bool movedPrevious = WoltModalSheet.of(context).showPrevious(); ``` -------------------------------- ### Profile Build Mode Linker and Compiler Flags Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/examples/coffee_maker_navigator_2/widgetbook/windows/CMakeLists.txt Configures linker and compiler flags for the Profile build mode by inheriting settings from the Release build 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}") ``` -------------------------------- ### Show WoltModalSheet with Custom Bottom Sheet Type Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/README.md Illustrates how to display a modal sheet using WoltModalSheet.show, specifying a custom modal type. The example uses the `copyWith` method to modify the default bottom sheet type, setting `barrierDismissible` to false. ```dart WoltModalSheet.show( context: context, modalTypeBuilder: (_) => WoltModalType.bottomSheet().copyWith(barrierDismissible: false), ); ``` -------------------------------- ### Create Flutter Interface Library and Link Dependencies Source: https://github.com/woltapp/wolt_modal_sheet/blob/main/example/linux/flutter/CMakeLists.txt Creates an INTERFACE library target named 'flutter' and configures its include directories and link libraries. This includes the ephemeral directory, the Flutter library, and the PkgConfig modules (GTK, GLIB, GIO). ```cmake 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) ```