### CMake Installation Rules Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/CMakeLists.txt Configures the installation process to create a relocatable application bundle. It cleans the build directory, installs the executable, and copies necessary data and library files. ```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 Project Setup Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/CMakeLists.txt Initializes CMake version, project name, and programming languages. It sets the executable name and the application's unique identifier. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "interactive_bottom_sheet_example") set(APPLICATION_ID "biz.cosee.interactive_bottom_sheet") cmake_policy(SET CMP0063 NEW) set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Install Flutter Assets using CMake Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/CMakeLists.txt This CMake code snippet configures the installation of Flutter assets. It first removes any existing 'flutter_assets' directory from the installation bundle's data directory and then installs the new 'flutter_assets' directory from the project's build directory. This ensures that the latest assets 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) ``` -------------------------------- ### CMake Installation Rules for Application Assets and Libraries Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/windows/CMakeLists.txt This section defines the installation rules for the application's runtime components. It specifies how to copy the executable, Flutter data files, libraries, and assets to the installation directory, ensuring the application can run in place. ```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(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 AOT Library Conditionally with CMake Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/CMakeLists.txt This CMake code snippet handles the conditional installation of the Ahead-Of-Time (AOT) compiled library. The library is only installed for non-debug builds to optimize performance and reduce the size of debug builds. The AOT library is installed into the bundle's library directory. ```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() ``` -------------------------------- ### CMake Executable Target Definition Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/CMakeLists.txt Defines the main executable target for the application, including its source files and application ID. It also applies standard build settings and links necessary libraries. ```cmake 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) ``` -------------------------------- ### CMake Standard Settings Function Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/CMakeLists.txt Defines a reusable function to apply standard compilation settings to targets, including C++ standard, warning levels, optimization, and NDEBUG definition. ```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() ``` -------------------------------- ### CMake Build Configuration Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/CMakeLists.txt Configures build options, including cross-compilation settings and default build types (Debug, Profile, Release). It ensures modern CMake behaviors are enabled. ```cmake 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 Setup and Build Configuration Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/windows/CMakeLists.txt This snippet sets up the basic CMake project, defines the executable name, and configures build modes (Debug, Profile, Release). It handles multi-configuration generators and sets default build types for single-configuration generators. ```cmake cmake_minimum_required(VERSION 3.14) project(interactive_bottom_sheet_example LANGUAGES CXX) set(BINARY_NAME "interactive_bottom_sheet_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() 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}") ``` -------------------------------- ### Basic Interactive Bottom Sheet Implementation (Dart) Source: https://context7.com/cosee/interactive_bottom_sheet/llms.txt Demonstrates the fundamental setup of the Interactive Bottom Sheet. This example shows how to integrate the widget into a basic Flutter application structure, displaying a simple message within the sheet and interactive content in the background. It requires the 'interactive_bottom_sheet' package. ```dart import 'package:flutter/material.dart'; import 'package:interactive_bottom_sheet/interactive_bottom_sheet.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Basic Example'), ), bottomSheet: const InteractiveBottomSheet( options: InteractiveBottomSheetOptions(), child: Center( child: Text( 'This is a basic interactive bottom sheet', style: TextStyle(fontSize: 18), ), ), ), body: Center( child: Text('Background content remains interactive'), ), ), ); } } ``` -------------------------------- ### Basic Interactive Bottom Sheet Usage Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/README.md This example illustrates the fundamental implementation of the InteractiveBottomSheet widget within a Scaffold. It sets a basic child widget for the bottom sheet and uses default options. ```dart Scaffold( bottomSheet: const InteractiveBottomSheet( options: InteractiveBottomSheetOptions(), child: Text( 'Lorem ipsum dolor sit amet.' ), ), ); ``` -------------------------------- ### Interactive Bottom Sheet with Custom Sizing and Snapping (Dart) Source: https://context7.com/cosee/interactive_bottom_sheet/llms.txt Illustrates how to configure custom sizing and snapping behaviors for the Interactive Bottom Sheet. This example defines initial, minimum, and maximum sizes, along with specific snap points. It also includes a scrollable list within the sheet and an interactive button in the background. Dependencies include 'flutter/material.dart' and 'interactive_bottom_sheet/interactive_bottom_sheet.dart'. ```dart import 'package:flutter/material.dart'; import 'package:interactive_bottom_sheet/interactive_bottom_sheet.dart'; class CustomSizingExample extends StatelessWidget { const CustomSizingExample({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Custom Sizing')), bottomSheet: InteractiveBottomSheet( options: const InteractiveBottomSheetOptions( initialSize: 0.3, // Start at 30% of screen height minimumSize: 0.2, // Minimum 20% of screen height maxSize: 0.85, // Maximum 85% of screen height snap: true, // Enable snapping snapList: [0.3, 0.5, 0.85], // Snap to 30%, 50%, or 85% ), child: ListView.builder( padding: const EdgeInsets.all(16), itemCount: 20, itemBuilder: (context, index) => ListTile( title: Text('Item ${index + 1}'), leading: Icon(Icons.star), ), ), ), body: Container( color: Colors.blue.shade100, child: Center( child: ElevatedButton( onPressed: () { print('Background button clicked'); }, child: const Text('Interactive Background'), ), ), ), ); } } ``` -------------------------------- ### Customize Interactive Bottom Sheet Appearance (Dart) Source: https://context7.com/cosee/interactive_bottom_sheet/llms.txt This example demonstrates how to fully customize the appearance of an interactive bottom sheet. It allows control over background color, initial and maximum sizes, snapping behavior, and the appearance of the draggable area, including its height, border radius, and shadow. The child content within the sheet is also styled. ```dart import 'package:flutter/material.dart'; import 'package:interactive_bottom_sheet/interactive_bottom_sheet.dart'; class CustomAppearanceExample extends StatelessWidget { const CustomAppearanceExample({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Custom Appearance')), bottomSheet: InteractiveBottomSheet( options: const InteractiveBottomSheetOptions( backgroundColor: Color(0xFF1E88E5), // Custom blue background initialSize: 0.4, maxSize: 0.9, snap: true, snapList: [0.4, 0.7, 0.9], ), draggableAreaOptions: const DraggableAreaOptions( topBorderRadius: 20, // Rounded top corners height: 80, // Tall draggable area backgroundColor: Color(0xFF1565C0), // Darker blue for handle indicatorColor: Colors.white, // White indicator indicatorWidth: 60, // Wide indicator indicatorHeight: 6, // Thick indicator indicatorRadius: 3, // Rounded indicator shadows: [ BoxShadow( color: Colors.black26, blurRadius: 8, offset: Offset(0, -2), ), ], ), child: Container( padding: const EdgeInsets.all(20), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Custom Styled Bottom Sheet', style: TextStyle( fontSize: 24, fontWeight: FontWeight.bold, color: Colors.white, ), ), const SizedBox(height: 16), Expanded( child: ListView( children: List.generate( 10, (index) => Card( color: Colors.white.withOpacity(0.9), child: ListTile( title: Text('Item ${index + 1}'), trailing: Icon(Icons.chevron_right), ), ), ), ), ), ], ), ), ), body: Container( decoration: BoxDecoration( gradient: LinearGradient( colors: [Colors.purple.shade300, Colors.blue.shade300], ), ), ), ); } } ``` -------------------------------- ### Rounded Top Borders with Transparent Background (Dart) Source: https://context7.com/cosee/interactive_bottom_sheet/llms.txt This example demonstrates how to achieve rounded top borders for the interactive bottom sheet by making the `bottomSheetTheme` background transparent. It uses `Theme.of(context).copyWith` to apply a transparent background to the `BottomSheetThemeData`, allowing the `topBorderRadius` set in `DraggableAreaOptions` to be visible. The draggable area is also customized for a clean look. ```dart import 'package:flutter/material.dart'; import 'package:interactive_bottom_sheet/interactive_bottom_sheet.dart'; class RoundedBordersExample extends StatelessWidget { const RoundedBordersExample({super.key}); @override Widget build(BuildContext context) { return Theme( // Required: Make bottomSheetTheme transparent to show rounded corners data: Theme.of(context).copyWith( bottomSheetTheme: const BottomSheetThemeData( backgroundColor: Colors.transparent, ), ), child: Scaffold( appBar: AppBar(title: const Text('Rounded Borders')), bottomSheet: const InteractiveBottomSheet( options: InteractiveBottomSheetOptions( backgroundColor: Colors.white, initialSize: 0.35, maxSize: 0.8, ), draggableAreaOptions: DraggableAreaOptions( topBorderRadius: 25, // Large border radius for iOS-like appearance height: 60, backgroundColor: Colors.white, indicatorColor: Colors.grey, indicatorWidth: 50, indicatorHeight: 5, indicatorRadius: 2.5, ), child: Padding( padding: EdgeInsets.all(20), child: Text( 'This bottom sheet has rounded top corners visible ' 'because the bottomSheetTheme background is transparent.', style: TextStyle(fontSize: 16), ), ), ), body: Center( child: Text('Background Content'), ), ), ); } } ``` -------------------------------- ### Define C++ Wrapper Library for Plugins (CMake) Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/windows/flutter/CMakeLists.txt This CMake code defines a static C++ library for Flutter plugins. It includes core wrapper sources and plugin-specific sources, applies standard build settings, and links against the Flutter library. It also sets up visibility and include directories. ```cmake # === Wrapper === 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) ``` -------------------------------- ### Flutter Linux GTK Build Configuration Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/flutter/CMakeLists.txt Configures the Flutter library for Linux GTK, including finding required system packages (PkgConfig, GTK, GLIB, GIO), setting library paths, and defining include directories and link libraries for the Flutter interface target. It also adds dependencies on `flutter_assemble`. ```cmake cmake_minimum_required(VERSION 3.10) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # === Flutter Library === # System-level dependencies. 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) 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) # === Flutter tool backend === # _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} ) ``` -------------------------------- ### CMake Function for Standard Compilation Settings Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/windows/CMakeLists.txt This CMake function, APPLY_STANDARD_SETTINGS, applies common compilation features and options to a given target. It includes setting the C++ standard to C++17, applying specific warning levels, and defining preprocessor macros. ```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() ``` -------------------------------- ### Configure Flutter Tool Backend Command (CMake) Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/windows/flutter/CMakeLists.txt This CMake configuration sets up a custom command to execute the Flutter tool backend. It's designed to run every time by using a phony output file. This command is responsible for generating necessary Flutter assets and libraries for the build. ```cmake # === Flutter tool backend === # _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" windows-x64 $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Define C++ Wrapper Library for App Runner (CMake) Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/windows/flutter/CMakeLists.txt This CMake code defines a static C++ library for the Flutter application runner. It includes core wrapper sources and application-specific sources, links against the Flutter library, and sets up include directories. It uses standard build settings. ```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) ``` -------------------------------- ### Define Flutter Library and Headers (CMake) Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/windows/flutter/CMakeLists.txt This section defines the Flutter library and its associated header files. It sets the path to the Flutter DLL and includes necessary header files for Flutter integration. The `flutter` target is an INTERFACE library used for linking. ```cmake cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") # Configuration provided via flutter tool. include(${EPHEMERAL_DIR}/generated_config.cmake) # TODO: Move the rest of this into files in ephemeral. See # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") # === 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) ``` -------------------------------- ### Configure Flutter Runner Project with CMake Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/windows/runner/CMakeLists.txt This CMake snippet configures a Flutter runner project, setting up the executable target, adding source files, and linking necessary libraries. It also defines preprocessor definitions for versioning and disables conflicting Windows macros. The project requires CMake version 3.14 or higher. ```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" ) # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) # 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}") # Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Custom CMake List Prepend Function Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/example/linux/flutter/CMakeLists.txt Defines a custom CMake function `list_prepend` to prepend a prefix to each element in a list. This is used as a fallback for older CMake versions that do not support `list(TRANSFORM ... PREPEND ...)`. It takes the list name and the prefix as arguments and modifies the list in place. ```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() ``` -------------------------------- ### Import Interactive Bottom Sheet Package Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/README.md Demonstrates the necessary import statement to use the 'InteractiveBottomSheet' widget and its related classes in your Dart code. This makes the package's functionality available for use. ```dart import 'package:interactive_bottom_sheet/interactive_bottom_sheet.dart'; ``` -------------------------------- ### Flutter Map Integration with Interactive Bottom Sheet Source: https://context7.com/cosee/interactive_bottom_sheet/llms.txt Integrates an interactive bottom sheet with a Flutter map. The bottom sheet displays location details and provides a button, while the map shows a tile layer and a location marker. Dependencies include flutter_map, interactive_bottom_sheet, and latlong2. ```dart import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:interactive_bottom_sheet/interactive_bottom_sheet.dart'; import 'package:latlong2/latlong.dart'; class MapWithBottomSheetExample extends StatelessWidget { const MapWithBottomSheetExample({super.key}); static const LatLng _initialPosition = LatLng(51.5074, -0.1278); // London @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Map with Interactive Sheet'), ), bottomSheet: InteractiveBottomSheet( options: const InteractiveBottomSheetOptions( initialSize: 0.25, maxSize: 0.75, snapList: [0.25, 0.5, 0.75], backgroundColor: Colors.white, ), draggableAreaOptions: const DraggableAreaOptions( topBorderRadius: 15, height: 60, indicatorWidth: 50, indicatorHeight: 5, ), child: ListView( padding: const EdgeInsets.all(16), children: [ const Text( 'Location Details', style: TextStyle(fontSize: 22, fontWeight: FontWeight.bold), ), const SizedBox(height: 12), const Text('Latitude: 51.5074'), const Text('Longitude: -0.1278'), const SizedBox(height: 20), ElevatedButton( onPressed: () { print('Navigate to location'); }, child: const Text('Get Directions'), ), ], ), ), body: FlutterMap( options: const MapOptions( initialCenter: _initialPosition, initialZoom: 13.0, ), children: [ TileLayer( urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', userAgentPackageName: 'com.example.app', ), const MarkerLayer( markers: [ Marker( point: _initialPosition, child: Icon( Icons.location_pin, size: 40, color: Colors.red, ), ), ], ), ], ), ); } } ``` -------------------------------- ### Configure InteractiveBottomSheetOptions in Flutter Source: https://context7.com/cosee/interactive_bottom_sheet/llms.txt Customize the behavior and appearance of an interactive bottom sheet. Options include background color, snapping behavior, expandability, initial, minimum, and maximum sizes, and snap positions. These settings control how the bottom sheet behaves during user interaction. ```dart import 'package:flutter/material.dart'; import 'package:interactive_bottom_sheet/interactive_bottom_sheet.dart'; // All available InteractiveBottomSheetOptions parameters const options = InteractiveBottomSheetOptions( // Background color of the entire bottom sheet backgroundColor: Colors.white, // Whether to snap to positions when user stops dragging snap: true, // Whether the sheet should expand to fill available space expand: false, // Initial height as fraction of screen (0.0 to 1.0) // Values below 0.1 may make dragging difficult initialSize: 0.25, // Minimum height as fraction of screen // Must be <= initialSize minimumSize: 0.25, // Maximum height as fraction of screen maxSize: 1.0, // List of snap positions (0.0 to 1.0) // Only used when snap: true snapList: [0.5], ); // Example demonstrating constraint relationships class OptionsExample extends StatelessWidget { const OptionsExample({super.key}); @override Widget build(BuildContext context) { return const Scaffold( bottomSheet: InteractiveBottomSheet( options: InteractiveBottomSheetOptions( initialSize: 0.3, // Starts at 30% minimumSize: 0.1, // Can shrink to 10% maxSize: 0.95, // Can expand to 95% snapList: [0.3, 0.6, 0.95], // Snaps to these positions snap: true, ), child: Center(child: Text('Drag me!')), ), ); } } ``` -------------------------------- ### Customizing Interactive Bottom Sheet Options Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/README.md This code snippet showcases advanced customization of the InteractiveBottomSheet, including setting maximum size, background color, snap points, and detailed configurations for the draggable area. ```dart Scaffold( bottomSheet: const Scaffold( bottomSheet: InteractiveBottomSheet( options: InteractiveBottomSheetOptions( maxSize: 0.75, backgroundColor: Colors.green, snapList: [0.25, 0.5], ), draggableAreaOptions: DraggableAreaOptions( topBorderRadius: 10, height: 75, backgroundColor: Colors.grey, indicatorColor: Colors.grey, indicatorWidth: 50, indicatorHeight: 50, indicatorRadius: 10, ), ), child: Text('Lorem ipsum dolor sit amet.'), ), ); ``` -------------------------------- ### Add Interactive Bottom Sheet Dependency Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/README.md This code snippet shows how to add the 'interactive_bottom_sheet' package as a dependency to your Flutter project's pubspec.yaml file. Ensure you are using a compatible version. ```yaml dependencies: interactive_bottom_sheet: ^1.0.0 ``` -------------------------------- ### Customize DraggableAreaOptions in Flutter Source: https://context7.com/cosee/interactive_bottom_sheet/llms.txt Style the draggable handle area of the interactive bottom sheet. Customize border radius, height, background color, and the appearance of the drag indicator, including its color, dimensions, radius, and any shadows. This allows for fine-grained control over the user interaction area. ```dart import 'package:flutter/material.dart'; import 'package:interactive_bottom_sheet/interactive_bottom_sheet.dart'; // All available DraggableAreaOptions parameters const draggableOptions = DraggableAreaOptions( // Top border radius (requires transparent bottomSheetTheme to be visible) topBorderRadius: 0.0, // Height of the draggable handle area height: 50.0, // Background color of the draggable area backgroundColor: Colors.white, // Color of the drag indicator indicatorColor: Colors.black, // Width of the drag indicator indicatorWidth: 60.0, // Height of the drag indicator indicatorHeight: 5.0, // Border radius of the drag indicator indicatorRadius: 5.0, // Shadow below the draggable area shadows: [BoxShadow(color: Colors.grey, blurRadius: 1)], ); // Example with custom draggable area styling class DraggableAreaExample extends StatelessWidget { const DraggableAreaExample({super.key}); @override Widget build(BuildContext context) { return const Scaffold( bottomSheet: InteractiveBottomSheet( draggableAreaOptions: DraggableAreaOptions( height: 70, backgroundColor: Color(0xFFF5F5F5), topBorderRadius: 15, indicatorColor: Color(0xFF666666), indicatorWidth: 40, indicatorHeight: 4, indicatorRadius: 2, shadows: [ BoxShadow( color: Colors.black12, blurRadius: 5, offset: Offset(0, -1), ), ], ), child: Center(child: Text('Custom Handle Area')), ), ); } } ``` -------------------------------- ### Setting Top Border Radius for Bottom Sheet Source: https://github.com/cosee/interactive_bottom_sheet/blob/main/README.md This Dart code demonstrates how to achieve rounded top borders for the InteractiveBottomSheet by overriding the 'bottomSheetTheme' within a Theme widget. This is often used for iOS-style UIs. ```dart Theme( data: Theme.of(context).copyWith( bottomSheetTheme: const BottomSheetThemeData( backgroundColor: Colors.transparent ), ), child: const Scaffold( bottomSheet: InteractiveBottomSheet( child: Text('Lorem ipsum dolor sit amet.'), ), ), ); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.