### CMake Project and Version Setup Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Initializes the CMake build system, specifies the minimum required version, and declares the project name and supported languages. This is a standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) ``` -------------------------------- ### Define Installation Directories Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Defines the installation directories for bundle data and libraries. These paths are relative to the installation prefix and organize the installed application files. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Install Application Executable Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Installs the main application executable to the runtime destination. It is assigned the 'Runtime' component for installation purposes. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Installs any bundled plugin libraries required by the application. This ensures that all necessary plugin dependencies are present at runtime. ```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/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Installs the main Flutter library file to the bundle library directory. This is a core component required for the Flutter application's runtime. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install AOT Library (Profile and Release) Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Installs the Ahead-of-Time (AOT) compiled library 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) ``` -------------------------------- ### Install Flutter Assets Directory Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Removes the existing Flutter assets directory and then copies the latest assets from the build directory to the installation destination. This ensures that assets are always up-to-date. ```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) ``` -------------------------------- ### Set Installation Prefix for VS Compatibility Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Configures the installation prefix to be adjacent to the executable for Visual Studio compatibility, allowing the application to run in place. This is crucial for in-place execution and debugging. ```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() ``` -------------------------------- ### CMake Installation Rules for Application Bundle Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/linux/CMakeLists.txt Configures the installation process to create a relocatable application bundle. It specifies destinations for the executable, ICU data, Flutter library, bundled plugins, and assets, ensuring all components are correctly placed within the bundle. ```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) ``` -------------------------------- ### Flutter Managed Directory Setup Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Sets the path to the Flutter managed directory within the project. This directory likely contains Flutter-specific build artifacts or configurations. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") ``` -------------------------------- ### Flutter Stack Dropdown Menu with Customization Source: https://context7.com/windows7lake/ll_dropdown_menu/llms.txt Implements a customizable dropdown menu within a Stack layout using Flutter's DropDownHeader and DropDownView. This example shows how to define headers, views, and items, including styling options and multi-choice limits. ```dart import 'package:flutter/material.dart'; import 'package:ll_dropdown_menu/ll_dropdown_menu.dart'; class StackDropDownExample extends StatefulWidget { @override State createState() => _StackDropDownExampleState(); } class _StackDropDownExampleState extends State { final DropDownController dropDownController = DropDownController(); @override void dispose() { dropDownController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text("Stack Drop-Down Menu")), body: Column( children: [ DropDownHeader( controller: dropDownController, itemStyle: DropDownItemStyle( activeIconColor: Colors.blue, activeTextStyle: TextStyle(color: Colors.blue), ), items: [ DropDownItem( text: "Filter 1", icon: Icon(Icons.arrow_drop_down), activeIcon: Icon(Icons.arrow_drop_up), ), DropDownItem( text: "Filter 2", icon: Icon(Icons.arrow_drop_down), activeIcon: Icon(Icons.arrow_drop_up), ), ], ), Expanded( child: Stack( children: [ // Your main content Container( color: Colors.grey[200], child: Center(child: Text("Main Content")), ), // Drop-down overlay DropDownView( controller: dropDownController, builders: [ DropDownListView( controller: dropDownController, items: List.generate( 6, (index) => DropDownItem( text: "Item $index", data: index, ), ), ), DropDownListView( controller: dropDownController, items: List.generate( 8, (index) => DropDownItem( text: "Option $index", data: index, ), ), maxMultiChoiceSize: 3, ), ], ), ], ), ), ], ), ); } } ``` -------------------------------- ### Install Flutter ICU Data File Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Installs the Flutter ICU data file to the bundle data directory. This file is essential for internationalization and localization features within the Flutter application. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Dropdown Menu Overlay Implementation with CustomScrollView (Dart) Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/README.md Implements a dropdown menu within a Flutter CustomScrollView using SliverPersistentHeader. This example demonstrates how to configure the dropdown's appearance, items, and behavior, including different view builders for list and grid layouts with single or multi-choice options. ```dart Widget usingOverlay() { return CustomScrollView( slivers: [ SliverToBoxAdapter( child: Container( height: 100, color: Colors.blue, alignment: Alignment.center, child: const Text( "Using Overlay", style: TextStyle(color: Colors.white, fontSize: 20), ), ), ), SliverPersistentHeader( pinned: true, delegate: SliverPersistentHeaderBuilder( height: dropDownMenuHeight, builder: (context, offset) { return DropDownMenu( key: dropDownMenuKey, controller: dropDownController, disposeController: dropDownDisposeController, headerBoxStyle: DropDownBoxStyle( height: dropDownMenuHeight, backgroundColor: Colors.white, ), headerItemStyle: const DropDownItemStyle( activeIconColor: Colors.blue, activeTextStyle: TextStyle(color: Colors.blue), ), headerItems: List.generate( 4, (index) => DropDownItem( text: "Tab $index", icon: const Icon(Icons.arrow_drop_down), activeIcon: const Icon(Icons.arrow_drop_up), ), ), onHeaderItemTap: (index, item) { dropDownController.toggle( index, offsetY: dropDownViewOffsetY, ); }, viewOffsetY: MediaQuery.of(context).padding.top + // statusBar 55 + // appBar 100 + // blue Container dropDownMenuHeight, viewBuilders: [ DropDownListView( controller: dropDownController, items: List.generate( 6, (index) => DropDownItem( text: "Single Item $index", data: index, ), ), ), DropDownListView( controller: dropDownController, items: List.generate( 8, (index) => DropDownItem( text: "Multi Item $index", data: index, ), ), maxMultiChoiceSize: 2, ), DropDownGridView( crossAxisCount: 3, boxStyle: const DropDownBoxStyle( padding: EdgeInsets.all(16), ), itemStyle: DropDownItemStyle( activeBackgroundColor: const Color(0xFFF5F5F5), activeIconColor: Colors.blue, activeTextStyle: const TextStyle(color: Colors.blue), activeBorderRadius: BorderRadius.circular(6), ), controller: dropDownController, items: List.generate( 10, (index) => DropDownItem( text: "Single Item $index", icon: const Icon(Icons.ac_unit), activeIcon: const Icon( Icons.ac_unit, color: Colors.white, ), data: index, ), ), ), DropDownGridView( crossAxisCount: 3, boxStyle: const DropDownBoxStyle( padding: EdgeInsets.all(16), ), itemStyle: DropDownItemStyle( activeBackgroundColor: const Color(0xFFF5F5F5), activeIconColor: Colors.blue, activeTextStyle: const TextStyle(color: Colors.blue), activeBorderRadius: BorderRadius.circular(6), ), controller: dropDownController, items: List.generate( 12, (index) => DropDownItem( text: "Multi Item $index", data: index, ), ), maxMultiChoiceSize: 2, ), ], ); }, ), ), SliverList.builder( ``` -------------------------------- ### Apply Standard Build Settings (CMake) Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/runner/CMakeLists.txt This command applies a standard set of build settings to the defined executable target. This is a convenience function that can simplify the CMake configuration for applications that do not require highly customized build environments. It should be used unless specific alternative build settings are needed. ```cmake # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Configure Flutter Web Entrypoint Loader Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/web/index.html Initializes the Flutter engine by loading the main.dart.js entrypoint. It sets up the service worker if provided and handles the engine initialization and application run. The `serviceWorkerVersion` is injected during the build process. ```javascript const serviceWorkerVersion = null; window.addEventListener('load', function(ev) { // Download main.dart.js _flutter.loader.loadEntrypoint({ serviceWorker: { serviceWorkerVersion: serviceWorkerVersion, }, onEntrypointLoaded: function(engineInitializer) { engineInitializer.initializeEngine().then(function(appRunner) { appRunner.runApp(); }); } }); }); ``` -------------------------------- ### Conditional AOT Library Installation (CMake) Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/linux/CMakeLists.txt This CMake code snippet installs the AOT library to the specified destination directory but only if the CMAKE_BUILD_TYPE is not set to 'Debug'. This is useful for optimizing release builds by excluding debug-specific libraries. ```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() ``` -------------------------------- ### Add ll_dropdown_menu Dependency to pubspec.yaml Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/README.md This snippet shows how to add the ll_dropdown_menu package as a dependency in your Flutter project's pubspec.yaml file. After adding the dependency, run `flutter packages get` to fetch the package. ```yaml ll_dropdown_menu: ^0.5.0 ``` -------------------------------- ### Profile Build Mode Linker and Compiler Flags Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Sets linker and compiler flags for the 'Profile' build configuration to match those of the 'Release' configuration. 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}") ``` -------------------------------- ### DropDownGridView Component Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/README.md Details the parameters available for configuring the DropDownGridView component, including its controller, items, styling, and various callback events for selection and interaction. ```APIDOC ## DropDownGridView ### Description `DropDownGridView` is the basic implementation of the drop-down menu. It is implemented internally using `GridView` and supports single-selection and multi-selection operations. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Widget Parameters - **controller** (DropDownController) - Required - Controller of the drop-down menu. - **items** (List) - Required - Data of the drop-down menu content body. - **headerIndex** (int?) - Optional - Index of the drop-down menu header component. - **crossAxisCount** (int) - Optional - The number of columns of the sub-items of the drop-down menu content body. - **mainAxisSpacing** (double) - Optional - The line spacing of the sub-items of the drop-down menu content body. - **crossAxisSpacing** (double) - Optional - Column spacing of the sub-items of the drop-down menu content body. - **boxStyle** (DropDownBoxStyle) - Optional - Style of the drop-down menu grid. - **itemStyle** (DropDownItemStyle) - Optional - Style of the drop-down menu grid item. - **itemBuilder** (IndexedWidgetBuilder?) - Optional - Builder for the sub-items of the drop-down menu content body, used to customize Item. - **onDropDownItemTap** (OnDropDownItemTap?) - Optional - Click event for the child item of the drop-down menu content body. - **onDropDownItemChanged** (OnDropDownItemChanged?) - Optional - The selected state change event of the child item of the drop-down menu content body. - **maxMultiChoiceSize** (int?) - Optional - The maximum number of multiple choices for the sub-items of the drop-down menu content body. - **onDropDownItemLimitExceeded** (OnDropDownItemLimitExceeded?) - Optional - Callback event triggered when the number of multiple selections for the sub-items of the drop-down menu content body exceeds the maximum value. - **btnWidget** (Widget?) - Optional - Button component of the drop-down menu content body in the multi-select state. - **resetWidget** (Widget?) - Optional - The reset button component of the drop-down menu content body in the multi-select state. - **confirmWidget** (Widget?) - Optional - The confirmation button component of the drop-down menu content body in the multi-select state. - **buttonStyle** (DropDownButtonStyle) - Optional - The style of button component of the drop-down menu content body in the multi-select state. - **onDropDownItemsReset** (OnDropDownItemsReset?) - Optional - The click event of the reset button component of the drop-down menu content body in the multi-select state. - **onDropDownItemsConfirm** (OnDropDownItemsConfirm?) - Optional - Click event of the confirmation button component of the drop-down menu content body in the multi-select state. - **onDropDownHeaderUpdate** (OnDropDownHeaderUpdate?) - Optional - Callback event triggered after the drop-down menu selection is confirmed, used to update the text of the header component by the return value of the callback (headerIndex should not be null when using this callback). ### Request Example None (This is a widget configuration, not an API endpoint request) ### Response None (This is a widget configuration, not an API endpoint response) ``` -------------------------------- ### Link Libraries and Include Directories (CMake) Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/runner/CMakeLists.txt This section configures the dependencies for the application executable. It links against the Flutter runtime library (`flutter`), a Flutter wrapper library (`flutter_wrapper_app`), and the Windows Desktop Window Manager API library (`dwmapi.lib`). It also specifies include directories, making headers from the current source directory available during compilation. This ensures all necessary components are linked for the application to run. ```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}") ``` -------------------------------- ### Manage Dropdown Menu State with DropDownController in Flutter Source: https://context7.com/windows7lake/ll_dropdown_menu/llms.txt Demonstrates how to use the DropDownController from the ll_dropdown_menu package to manage the visibility and state of drop-down menus in a Flutter application. This includes showing, hiding, and toggling the menu, as well as updating its header status. ```dart import 'package:ll_dropdown_menu/ll_dropdown_menu.dart'; class MyDropDownScreen extends StatefulWidget { @override State createState() => _MyDropDownScreenState(); } class _MyDropDownScreenState extends State { final DropDownController dropDownController = DropDownController(); @override void dispose() { dropDownController.dispose(); super.dispose(); } void showMenu() { // Show drop-down at index 0 dropDownController.show(0, offset: Offset(0, 100)); } void hideMenu() { // Hide drop-down with updated header text dropDownController.hide( index: 0, status: DropDownHeaderStatus( text: "Selected Item", highlight: true, ), ); } void toggleMenu() { // Toggle drop-down visibility dropDownController.toggle(0, offset: Offset(0, 100)); } @override Widget build(BuildContext context) { return Scaffold( body: Column( children: [ ElevatedButton( onPressed: showMenu, child: Text("Show Menu"), ), ], ), ); } } ``` -------------------------------- ### Add Runner Subdirectory Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Includes the build rules from the 'runner' subdirectory. This likely contains the main application's build configuration specific to the runner environment. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Unicode Support Definition Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Adds preprocessor definitions to enable Unicode support in the project. This is important for handling international characters correctly. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Configure DropDownView Parameters Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/README.md Defines the parameters for the DropDownView component, which displays the main content of the dropdown menu. It includes properties for the controller, builders for content, background color, mask color, animation duration, and vertical offset. ```dart /// Controller of the drop-down menu final DropDownController controller; /// Data for the body component of the drop-down menu final List builders; /// Background color of the drop-down menu body component final Color? viewColor; /// Color of the mask layer of the drop-down menu final Color? maskColor; /// Animation duration of the drop-down menu body component final Duration animationDuration; /// Y-axis offset of the drop-down menu body component final double offsetY; ``` -------------------------------- ### Build Configuration Types (Multi-Config Generators) Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Defines the available build configurations (Debug, Profile, Release) for multi-configuration CMake generators. The FORCE option overwrites any existing setting. ```cmake 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() ``` -------------------------------- ### Flutter DropDownMenu with Overlay Implementation Source: https://context7.com/windows7lake/ll_dropdown_menu/llms.txt This Dart code snippet showcases a Flutter `DropDownMenu` widget that utilizes `Overlay` for flexible positioning. It includes custom controllers (`DropDownController`, `DropDownDisposeController`), styling options, and integrates `DropDownListView` and `DropDownGridView` for different menu item displays. The implementation handles header updates and multi-choice selections. ```dart import 'package:flutter/material.dart'; import 'package:ll_dropdown_menu/ll_dropdown_menu.dart'; class OverlayDropDownExample extends StatefulWidget { @override State createState() => _OverlayDropDownExampleState(); } class _OverlayDropDownExampleState extends State { final DropDownController dropDownController = DropDownController(); final DropDownDisposeController dropDownDisposeController = DropDownDisposeController(); @override void dispose() { dropDownController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Overlay Drop-Down Menu"), leading: BackButton( onPressed: dropDownDisposeController.hideMenuThenPop, ), ), body: Column( children: [ DropDownMenu( controller: dropDownController, disposeController: dropDownDisposeController, maskFullScreen: true, maskColor: Colors.black.withOpacity(0.1), headerBoxStyle: DropDownBoxStyle( height: 50, backgroundColor: Colors.white, ), headerItemStyle: DropDownItemStyle( activeIconColor: Colors.blue, activeTextStyle: TextStyle(color: Colors.blue), ), headerItems: [ DropDownItem( text: "Category", icon: Icon(Icons.arrow_drop_down), activeIcon: Icon(Icons.arrow_drop_up), ), DropDownItem( text: "Price Range", icon: Icon(Icons.arrow_drop_down), activeIcon: Icon(Icons.arrow_drop_up), ), ], viewOffset: Offset(0, MediaQuery.of(context).padding.top + 56), viewBuilders: [ DropDownListView( controller: dropDownController, headerIndex: 0, items: List.generate( 6, (index) => DropDownItem( text: "Category $index", data: index, ), ), onDropDownHeaderUpdate: (List checkedItems) { return DropDownHeaderStatus( text: checkedItems.map((e) => e.text).join(", "), highlight: checkedItems.isNotEmpty, ); }, ), DropDownGridView( controller: dropDownController, headerIndex: 1, crossAxisCount: 3, items: List.generate( 12, (index) => DropDownItem( text: "Price $index", data: index, ), ), maxMultiChoiceSize: 2, ), ], ), ], ), ); } } ``` -------------------------------- ### Integrate Flutter Tool Backend (CMake) Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/flutter/CMakeLists.txt Configures a custom command to run the Flutter tool backend for building artifacts like DLLs and headers. A phony output file ensures the command runs every time. ```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} ) ``` -------------------------------- ### Apply Standard Compiler Settings Function Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Defines a reusable function to apply common compilation features and options to targets. This promotes consistency in build settings across the project. ```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 CMake Rules Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Includes CMake rules generated for plugins. These rules manage the building of plugins and their integration into the main application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Dropdown List View: Single and Multi-Selection with Dart Source: https://context7.com/windows7lake/ll_dropdown_menu/llms.txt Demonstrates how to use DropDownListView for both single and multi-selection scenarios in Flutter. It supports customization of item styles, header updates, and selection confirmation. ```dart import 'package:flutter/material.dart'; import 'package:ll_dropdown_menu/ll_dropdown_menu.dart'; class ListViewDropDownExample extends StatefulWidget { @override State createState() => _ListViewDropDownExampleState(); } class _ListViewDropDownExampleState extends State { final DropDownController dropDownController = DropDownController(); @override Widget build(BuildContext context) { return Column( children: [ // Single selection example DropDownListView( controller: dropDownController, headerIndex: 0, boxStyle: DropDownBoxStyle( padding: EdgeInsets.all(16), backgroundColor: Colors.white, ), itemStyle: DropDownItemStyle( height: 50, activeTextStyle: TextStyle(color: Colors.blue), activeIconColor: Colors.blue, ), items: List.generate( 10, (index) => DropDownItem( text: "Single Choice $index", data: index, ), ), onDropDownItemTap: (index, item) { print("Tapped: ${item.text}"); }, onDropDownItemChanged: (index, items) { print("Selected items: ${items.map((e) => e.text).toList()}"); }, onDropDownHeaderUpdate: (List checkedItems) { return DropDownHeaderStatus( text: checkedItems.first.text ?? "", highlight: true, ); }, ), // Multi-selection example with custom buttons DropDownListView( controller: dropDownController, headerIndex: 1, items: List.generate( 15, (index) => DropDownItem( text: "Multi Choice $index", data: index, ), ), maxMultiChoiceSize: 5, buttonStyle: DropDownButtonStyle( resetText: "Clear", confirmText: "Apply", resetTextStyle: TextStyle(fontSize: 14, color: Colors.black), confirmTextStyle: TextStyle(fontSize: 14, color: Colors.white), resetBackgroundColor: Color(0xFFEEEEEE), confirmBackgroundColor: Colors.blue, ), onDropDownItemLimitExceeded: (items) { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text("Maximum 5 items can be selected")), ); }, onDropDownItemsReset: (items) { print("Reset all selections"); }, onDropDownItemsConfirm: (checkedItems) { print("Confirmed: ${checkedItems.map((e) => e.text).toList()}"); }, ), ], ); } } ``` -------------------------------- ### Dropdown Grid View: Grid Layout Selection with Dart Source: https://context7.com/windows7lake/ll_dropdown_menu/llms.txt Illustrates the use of DropDownGridView for creating grid-based selection menus in Flutter. This widget allows for compact layouts and supports customization of grid spacing and item appearance. ```dart import 'package:flutter/material.dart'; import 'package:ll_dropdown_menu/ll_dropdown_menu.dart'; class GridViewDropDownExample extends StatefulWidget { @override State createState() => _GridViewDropDownExampleState(); } class _GridViewDropDownExampleState extends State { final DropDownController dropDownController = DropDownController(); @override Widget build(BuildContext context) { return DropDownGridView( controller: dropDownController, headerIndex: 0, crossAxisCount: 3, mainAxisSpacing: 10, crossAxisSpacing: 10, boxStyle: DropDownBoxStyle( padding: EdgeInsets.all(16), backgroundColor: Colors.white, ), itemStyle: DropDownItemStyle( height: 80, textStyle: TextStyle(fontSize: 14, color: Colors.black), activeTextStyle: TextStyle(fontSize: 14, color: Colors.blue), activeBackgroundColor: Color(0xFFF5F5F5), activeIconColor: Colors.blue, activeBorderRadius: BorderRadius.circular(6), iconPosition: IconPosition.top, gap: 8, ), items: List.generate( 18, (index) => DropDownItem( text: "Grid $index", icon: Icon(Icons.category), activeIcon: Icon(Icons.category), data: index, ), ), maxMultiChoiceSize: 3, onDropDownItemChanged: (index, items) { print("Selected: ${items.length} items"); }, onDropDownHeaderUpdate: (List checkedItems) { return DropDownHeaderStatus( text: "${checkedItems.length} selected", highlight: checkedItems.isNotEmpty, ); }, ); } } ``` -------------------------------- ### CMake Policy Modernization Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Explicitly opts into modern CMake behaviors within a specified version range. This helps avoid potential warnings and ensures compatibility with newer CMake features. ```cmake cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Configure Dropdown Item Styles (Dart) Source: https://context7.com/windows7lake/ll_dropdown_menu/llms.txt Define comprehensive styling for dropdown items across different states: normal, active, and highlight. This includes text styles, icons, background colors, borders, and layout properties. It enables fine-grained control over the visual representation of each selectable item. ```dart import 'package:flutter/material.dart'; import 'package:ll_dropdown_menu/ll_dropdown_menu.dart'; // Example: Advanced item styling with three states final DropDownItemStyle advancedItemStyle = DropDownItemStyle( width: double.infinity, height: 50, // Normal state textStyle: TextStyle(fontSize: 14, color: Colors.black87), icon: Icon(Icons.circle_outlined), iconSize: 20, iconColor: Colors.grey, backgroundColor: Colors.transparent, borderSide: BorderSide.none, borderRadius: BorderRadius.zero, // Active state (when dropdown is open and item is being selected) activeTextStyle: TextStyle(fontSize: 14, color: Colors.blue, fontWeight: FontWeight.w600), activeIcon: Icon(Icons.check_circle), activeIconSize: 22, activeIconColor: Colors.blue, activeBackgroundColor: Color(0xFFE3F2FD), activeBorderSide: BorderSide(color: Colors.blue, width: 1), activeBorderRadius: BorderRadius.circular(8), // Highlight state (header item after selection is confirmed) highlightTextStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold), highlightIcon: Icon(Icons.star), highlightIconSize: 20, highlightIconColor: Colors.orange, highlightBackgroundColor: Color(0xFFFFF3E0), highlightBorderSide: BorderSide(color: Colors.orange, width: 1), highlightBorderRadius: BorderRadius.circular(8), // Layout properties padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8), margin: EdgeInsets.symmetric(vertical: 2), alignment: Alignment.centerLeft, iconPosition: IconPosition.right, gap: 12, elevation: 0, ); ``` -------------------------------- ### Configure Flutter Library and Headers (CMake) Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/flutter/CMakeLists.txt Sets up the Flutter library path, ICU data file, and header files. It defines interface libraries for Flutter and includes necessary directories. ```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) ``` -------------------------------- ### Define Dropdown Container Styles (Dart) Source: https://context7.com/windows7lake/ll_dropdown_menu/llms.txt Configure the styling for the header and content areas of the dropdown menu container. This includes dimensions, background colors, borders, padding, and margins. It allows for distinct styling of the top and content sections. ```dart import 'package:flutter/material.dart'; import 'package:ll_dropdown_menu/ll_dropdown_menu.dart'; // Example: Custom box styling for header and content areas final DropDownBoxStyle headerBoxStyle = DropDownBoxStyle( width: double.infinity, height: 60, backgroundColor: Colors.white, border: Border( bottom: BorderSide(color: Colors.grey[300]!, width: 1), ), padding: EdgeInsets.symmetric(horizontal: 16), margin: EdgeInsets.zero, expand: true, ); final DropDownBoxStyle contentBoxStyle = DropDownBoxStyle( height: 400, backgroundColor: Colors.white, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.vertical(bottom: Radius.circular(12)), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.1), blurRadius: 10, offset: Offset(0, 4), ), ], ), padding: EdgeInsets.all(16), ); ``` -------------------------------- ### DropDownCascadeList Component Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/README.md This section details the parameters available for the DropDownCascadeList component, enabling customization of its behavior and appearance. ```APIDOC ## DropDownCascadeList ### Description `DropDownCascadeList` is the basic implementation of a drop-down menu and cascading list, supporting single-selection and multi-selection operations. ### Method Not Applicable (Widget Definition) ### Endpoint Not Applicable (Widget Definition) ### Parameters #### Widget Parameters - **controller** (DropDownController) - Required - Controller of the drop-down menu. - **dataController** (DropDownCascadeListDataController?) - Optional - Data controller of the drop-down menu content body. - **items** (List>>) - Required - The data of the drop-down menu content body. - **headerIndex** (int?) - Optional - Index of the drop-down menu header component. - **boxStyle** (DropDownBoxStyle) - Required - Style of the drop-down menu list. - **firstFloorItemStyle** (DropDownItemStyle) - Required - Style of the first-level sub-items of the drop-down menu content body. - **firstFloorItemBuilder** (IndexedWidgetBuilder?) - Optional - Builder for the first-level sub-items of the drop-down menu content body, used to customize Item. - **onFirstFloorItemTap** (OnDropDownItemTap?) - Optional - Click event for the first-level sub-item of the drop-down menu content body. - **secondFloorItemStyle** (DropDownItemStyle) - Required - Style of the second-level sub-items of the drop-down menu content body. - **secondFloorItemBuilder** (IndexedWidgetBuilder?) - Optional - Builder for the second-level sub-items of the drop-down menu content body, used to customize Item. - **onSecondFloorItemTap** (OnDropDownItemTap?) - Optional - Click event for the second-level sub-item of the drop-down menu content body. - **onSecondFloorItemChanged** (OnDropDownItemChanged?) - Optional - Selected state change event of the second-level sub-item of the drop-down menu content body. - **maxMultiChoiceSize** (int?) - Optional - The maximum number of multiple choices for the second-level sub-items of the drop-down menu content body. - **onDropDownItemLimitExceeded** (OnDropDownItemLimitExceeded?) - Optional - Callback event triggered when the number of multiple selections for the second-level sub-items exceeds the maximum value. - **btnWidget** (Widget?) - Optional - Button component of the drop-down menu content body in the multi-select state. - **resetWidget** (Widget?) - Optional - The reset button component of the drop-down menu content body in the multi-select state. - **confirmWidget** (Widget?) - Optional - The confirmation button component of the drop-down menu content body in the multi-select state. - **buttonStyle** (DropDownButtonStyle) - Required - The style of button component of the drop-down menu content body in the multi-select state. - **onDropDownItemsReset** (OnDropDownItemsReset?) - Optional - The click event of the reset button component of the drop-down menu content body in the multi-select state. - **onDropDownItemsConfirm** (OnDropDownItemsConfirm?) - Optional - Click event of the confirmation button component of the drop-down menu content body in the multi-select state. - **onDropDownHeaderUpdate** (OnDropDownHeaderUpdate?) - Optional - Callback event triggered after the drop-down menu selection is confirmed, used to update the text of the header component by the return value of the callback (headerIndex should not be null when using this callback). ### Request Example Not Applicable (Widget Definition) ### Response #### Success Response (Widget Rendered) - **Rendered UI** - The drop-down menu or cascading list as defined by the provided parameters. #### Response Example Not Applicable (Widget Definition) ``` -------------------------------- ### Executable Binary Name Configuration Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/windows/CMakeLists.txt Sets the name for the final executable file. This variable can be modified to change the on-disk name of the application. ```cmake set(BINARY_NAME "example") ``` -------------------------------- ### CMake Flutter and GTK Integration Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/example/linux/CMakeLists.txt Includes the Flutter managed directory and finds PkgConfig modules for GTK+ 3.0. It also defines the application ID as a preprocessor macro for the C++ code. ```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}") ``` -------------------------------- ### Implement Drop-down Menu with Stack in Dart Source: https://github.com/windows7lake/ll_dropdown_menu/blob/main/README.md This Dart code snippet demonstrates how to implement a dynamic drop-down menu using Flutter's Stack widget. It configures a DropDownHeader and DropDownView with various list and grid item types, supporting single and multi-selection. Dependencies include the Flutter material library and potentially a custom drop-down package. ```dart Column(children: [ DropDownHeader( controller: dropDownController, itemStyle: const DropDownItemStyle( activeIconColor: Colors.blue, activeTextStyle: TextStyle(color: Colors.blue), ), items: List.generate( 4, (index) => DropDownItem( text: "Tab $index", icon: const Icon(Icons.arrow_drop_down), activeIcon: const Icon(Icons.arrow_drop_up), ), ), ), Expanded( child: Stack( children: [ Container( color: Colors.blue[200], ), DropDownView( controller: dropDownController, builders: [ DropDownListView( controller: dropDownController, items: List.generate( 6, (index) => DropDownItem( text: "Single Item $index", data: index, ), ), ), DropDownListView( controller: dropDownController, items: List.generate( 8, (index) => DropDownItem( text: "Multi Item $index", data: index, ), ), maxMultiChoiceSize: 2, ), DropDownGridView( controller: dropDownController, crossAxisCount: 3, boxStyle: const DropDownBoxStyle( padding: EdgeInsets.all(16), ), itemStyle: DropDownItemStyle( activeBackgroundColor: const Color(0xFFF5F5F5), activeIconColor: Colors.blue, activeTextStyle: const TextStyle(color: Colors.blue), activeBorderRadius: BorderRadius.circular(6), ), items: List.generate( 10, (index) => DropDownItem( text: "Single Item $index", icon: const Icon(Icons.ac_unit), activeIcon: const Icon(Icons.ac_unit), data: index, ), ), ), DropDownGridView( controller: dropDownController, crossAxisCount: 3, boxStyle: const DropDownBoxStyle( padding: EdgeInsets.all(16), ), itemStyle: DropDownItemStyle( activeBackgroundColor: const Color(0xFFF5F5F5), activeIconColor: Colors.blue, activeTextStyle: const TextStyle(color: Colors.blue), activeBorderRadius: BorderRadius.circular(6), ), items: List.generate( 12, (index) => DropDownItem( text: "Multi Item $index", data: index, ), ), maxMultiChoiceSize: 2, ), ], ), ], ), ), ]), ```