### CMake Installation Rules for Windows Executable and Assets Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/CMakeLists.txt Configures the installation process for the Windows build, specifying destinations for the executable, runtime data, libraries, bundled plugin libraries, native assets, and Flutter 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) 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 FlNodes Package Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/README.md This snippet shows how to add the FlNodes package to your Flutter project's pubspec.yaml file and then run the package get command. ```yaml dependencies: fl_nodes: ^latest_version ``` ```bash flutter pub get ``` -------------------------------- ### Flutter Linux GTK Build Setup Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/linux/flutter/CMakeLists.txt Configures the Flutter library for Linux GTK builds. It finds necessary packages (PkgConfig, GTK, GLIB, GIO), sets library paths and headers, and defines an interface library for Flutter. ```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) ``` -------------------------------- ### CMake Project Setup and Executable Definition Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/runner/CMakeLists.txt Initializes the CMake project and defines the main executable target for the Flutter application. It includes source files, resource files, and manifest files required for the Windows build. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) 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" ) ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/linux/CMakeLists.txt This snippet installs the Flutter asset directory. It first removes any existing directory at the installation path and then copies the new directory. ```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 Project Setup and Configuration Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/CMakeLists.txt Initializes the CMake project, sets the minimum required version, defines the project name, and configures build-related variables like the binary name and generator compatibility. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) set(BINARY_NAME "example") cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Flutter Linux Application CMake Configuration Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/linux/CMakeLists.txt This snippet covers the main CMakeLists.txt file for a Flutter Linux application. It sets up the project, defines build configurations, integrates GTK, and manages installation. ```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() 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() 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" ) 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) ``` -------------------------------- ### Install FlNodes Dependency Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart This snippet shows how to add the FlNodes package as a dependency in your Flutter project's pubspec.yaml file and then run the command to fetch the package. ```yaml dependencies: fl_nodes: ^latest_version ``` ```bash flutter pub get ``` -------------------------------- ### Flutter Node Editor Setup with FlNodeEditorController Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Sets up a Flutter application with FlNodes, demonstrating the initialization of FlNodeEditorController. It includes custom logic for saving projects to a JSON file and loading projects using the file_picker package, with handling for unsaved changes and web compatibility. ```dart import 'dart:convert'; import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:file_picker/file_picker.dart'; import 'package:fl_nodes/fl_nodes.dart'; void main() { // Ensures Flutter bindings are initialized before running the app WidgetsFlutterBinding.ensureInitialized(); // Launch the Node Editor Example app runApp(const NodeEditorExampleApp()); } class NodeEditorExampleApp extends StatelessWidget { const NodeEditorExampleApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Node Editor Example', theme: ThemeData.dark(), // Use a dark theme for the app home: const NodeEditorExampleScreen(), debugShowCheckedModeBanner: kDebugMode, // Show debug banner only in debug mode ); } } class NodeEditorExampleScreen extends StatefulWidget { const NodeEditorExampleScreen({super.key}); @override State createState() => NodeEditorExampleScreenState(); } class NodeEditorExampleScreenState extends State { late final FlNodeEditorController _nodeEditorController; // Controller for managing the node editor @override void initState() { super.initState(); // Initialize the node editor controller with project management functionality _nodeEditorController = FlNodeEditorController( projectSaver: (jsonData) async { if (kIsWeb) return false; // Skip file saving on web (not supported by file_picker) // Open a save file dialog to allow the user to save the project as JSON final String? outputPath = await FilePicker.platform.saveFile( dialogTitle: 'Save Project', fileName: 'node_project.json', type: FileType.custom, allowedExtensions: ['json'], ); // If a file path is selected, write the project data to the file if (outputPath != null) { final File file = File(outputPath); await file.writeAsString(jsonEncode(jsonData)); return true; } else { return false; // Return false if saving was canceled } }, projectLoader: (isSaved) async { // If there are unsaved changes, confirm whether the user wants to proceed if (!isSaved) { final bool? proceed = await showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: const Text('Unsaved Changes'), content: const Text( 'You have unsaved changes. Do you want to proceed without saving?', ), actions: [ TextButton( onPressed: () => Navigator.of(context).pop(false), child: const Text('Cancel'), ), TextButton( onPressed: () => Navigator.of(context).pop(true), child: const Text('Proceed'), ), ], ); }, ); if (proceed != true) return null; // Cancel loading if user chooses not to proceed } // Open file picker to select a JSON project file final FilePickerResult? result = await FilePicker.platform.pickFiles( type: FileType.custom, allowedExtensions: ['json'], ); if (result == null) return null; // Return null if no file was selected late final String fileContent; // Handle file reading differently for web vs other platforms if (kIsWeb) { final byteData = result.files.single.bytes!; fileContent = utf8.decode(byteData.buffer.asUint8List()); } else { final File file = File(result.files.single.path!); fileContent = await file.readAsString(); } return jsonDecode(fileContent); // Return the parsed JSON data }, projectCreator: (isSaved) async { // If the project is not saved, ask the user whether to proceed if (isSaved) return true; final bool? proceed = await showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: const Text('Unsaved Changes'), content: const Text( 'You have unsaved changes. Do you want to proceed without saving?', ), actions: [ TextButton( onPressed: () => Navigator.of(context).pop(false), child: const Text('Cancel'), ), ``` -------------------------------- ### Install AOT Library (Non-Debug) Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/linux/CMakeLists.txt This snippet conditionally installs the AOT (Ahead-Of-Time compilation) library. The library is only installed if the CMake build type is not 'Debug'. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Import FlNodes in Dart Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/README.md This snippet demonstrates how to import the FlNodes package into your Dart file to start using its functionalities. ```dart import 'package:fl_nodes/fl_nodes.dart'; ``` -------------------------------- ### Linking Libraries and Include Directories Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/runner/CMakeLists.txt Specifies the libraries and include directories required for the application. This includes Flutter-specific libraries (`flutter`, `flutter_wrapper_app`) and Windows system libraries (`dwmapi.lib`). ```cmake 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}") ``` -------------------------------- ### Flutter Tool Backend Integration Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/flutter/CMakeLists.txt Sets up a custom command to execute the Flutter tool backend, which is responsible for generating build artifacts. It uses a phony output to ensure the command runs on every build and defines dependencies for the flutter_assemble target. ```cmake set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### Custom 'For Each Loop' Node Registration Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Demonstrates registering a custom 'For Each Loop' node prototype with specific styling, input/output ports, and a description. This includes defining custom port styles and node header styles. ```dart // Define a custom style for the output data port final FlPortStyle outputDataPortStyle = FlPortStyle( color: Colors.orange, // Set port color to orange shape: FlPortShape.circle, // Use a circular port shape linkStyleBuilder: (state) => const FlLinkStyle( gradient: LinearGradient( colors: [Colors.orange, Colors.purple], // Gradient color for links begin: Alignment.centerLeft, end: Alignment.centerRight, ), lineWidth: 3.0, // Set the link width drawMode: FlLinkDrawMode.solid, // Use solid line style curveType: FlLinkCurveType.bezier, // Use a smooth bezier curve ), ); // Register a new node prototype in the node editor controller.registerNodePrototype( NodePrototype( idName: 'forEachLoop', // Unique identifier for this node type displayName: 'For Each Loop', // User-friendly name description: 'Executes a loop for a specified number of iterations.', // Description for UI // Define node style (partially overriding the default) styleBuilder: (state) => FlNodeStyle( decoration: defaultNodeStyle(state).decoration, // Keep default decoration headerStyleBuilder: (state) => defaultNodeHeaderStyle(state).copyWith( decoration: BoxDecoration( color: Colors.teal, // Set header background color to teal borderRadius: BorderRadius.only( topLeft: const Radius.circular(7), topRight: const Radius.circular(7), // Adjust bottom radius based on collapse state bottomLeft: Radius.circular(state.isCollapsed ? 7 : 0), bottomRight: Radius.circular(state.isCollapsed ? 7 : 0), ), ), ), ), // Define the input and output ports for this node ports: [ ControlInputPortPrototype( idName: 'exec', // Control input to trigger execution displayName: 'Exec', style: controlInputPortStyle, ), DataInputPortPrototype( idName: 'list', // Data input port for the list to iterate over displayName: 'List', dataType: dynamic, // Accepts any type style: inputDataPortStyle, ), ControlOutputPortPrototype( ``` -------------------------------- ### C++ Wrapper for Plugins Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/flutter/CMakeLists.txt Builds a static C++ library for Flutter plugins, including core and plugin-specific wrapper sources. It sets independent code properties, visibility, links against the Flutter library, and includes necessary directories. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 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) ``` -------------------------------- ### C++ Wrapper for Runner Application Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/flutter/CMakeLists.txt Builds a static C++ library for the Flutter runner application, incorporating core and application-specific wrapper sources. It links against the Flutter library and includes necessary directories. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 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) ``` -------------------------------- ### Import fl_nodes Package Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Demonstrates how to import the fl_nodes package into your Dart project for use in Flutter applications. ```dart import 'package:fl_nodes/fl_nodes.dart'; ``` -------------------------------- ### Flutter Tool Build Dependency Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/runner/CMakeLists.txt Ensures that the Flutter tool's assembly process (`flutter_assemble`) is completed before the application target is built. This is a critical step for Flutter projects. ```cmake add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Applying Standard Build Settings and Definitions Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/runner/CMakeLists.txt Applies standard build settings to the application target and defines preprocessor macros for Flutter version information (major, minor, patch, build). It also disables Windows macros that might conflict with C++ standard library functions. ```cmake apply_standard_settings(${BINARY_NAME}) 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}") target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") ``` -------------------------------- ### Flutter Library Configuration Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/flutter/CMakeLists.txt Configures the Flutter library by setting its path, including header files, and linking against the Flutter library. It also defines dependencies for the assembly process. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" 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) ``` -------------------------------- ### Flutter Tool Backend Custom Command Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/linux/flutter/CMakeLists.txt Defines a custom CMake command to execute the Flutter tool backend script. This command is responsible for generating the Flutter library and headers, and it's designed to run every time due to the use of a phony output file. ```cmake # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### CMake List Prepend Function Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/linux/flutter/CMakeLists.txt Defines a CMake function `list_prepend` to add a prefix to each element of a list. This is a workaround for older CMake versions (pre-3.10) that lack the `list(TRANSFORM ... PREPEND ...)` command. ```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() ``` -------------------------------- ### FlNodeStyle Properties Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Details the properties for FlNodeStyle, governing the overall styling of nodes, including default decoration and customizable header styles. ```APIDOC FlNodeStyle (Node Appearance) Controls the styling of nodes: - decoration: Default node appearance. - headerStyleBuilder: Customizable header style for different node states. ``` -------------------------------- ### CMake Flutter Integration and Subdirectories Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/CMakeLists.txt Includes the Flutter managed directory and the runner subdirectory, essential for integrating Flutter's build system and application runner into the main project. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) add_subdirectory("runner") include(flutter/generated_plugins.cmake) ``` -------------------------------- ### CMake Standard Compilation Settings Function Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/CMakeLists.txt Defines a reusable function `APPLY_STANDARD_SETTINGS` to apply common compilation features, options, and definitions to a target, promoting consistency across build targets. ```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() ``` -------------------------------- ### FlPortStyle Properties Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Outlines the properties for FlPortStyle, which controls the appearance of ports, including shape, color, and dynamic link style generation. ```APIDOC FlPortStyle (Port Appearance) Controls how ports look: - shape: The shape of the port (`circle` or `triangle`). - color: Defines port colors based on type and direction (e.g., input/output). - linkStyleBuilder: Function to dynamically generate link styles based on state. ``` -------------------------------- ### Loop Body Execution Logic Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Demonstrates the onExecute function for a node that iterates through a list. It manages the iteration state, outputs the current list element and index, and triggers control outputs for the loop body and completion. ```dart ControlOutputPortPrototype( idName: 'loopBody', displayName: 'Loop Body', style: controlOutputPortStyle, ), ControlOutputPortPrototype( idName: 'completed', displayName: 'Completed', style: controlOutputPortStyle, ), DataOutputPortPrototype( idName: 'listElem', displayName: 'List Element', dataType: dynamic, style: outputDataPortStyle, ), DataOutputPortPrototype( idName: 'listIdx', displayName: 'List Index', dataType: int, style: outputDataPortStyle, ), ], // Define execution behavior of the node onExecute: (ports, fields, state, f, p) async { // Retrieve the list from the input port final List list = ports['list']! as List; late int i; // Check if this node has a stored iteration state, otherwise initialize it if (!state.containsKey('iteration')) { i = state['iteration'] = 0; } else { i = state['iteration'] as int; } // If there are still elements to iterate over if (i < list.length) { // Send the current element and index to the output ports p({('listElem', list[i]), ('listIdx', i)}); // Increment iteration counter and store it in node state state['iteration'] = ++i; // Trigger the loop body control output await f({'loopBody'}); } else { // If iteration is complete, trigger the "completed" output unawaited(f({('completed')})); } }, ), ); ``` -------------------------------- ### FlLinkDrawMode Options Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Specifies the visual styles for drawing links, including solid, dashed, and dotted line patterns. ```APIDOC FlLinkDrawMode (Link Visual Style) Determines how links appear: - solid: A continuous line. - dashed: A segmented dashed line. - dotted: A series of small dots. ``` -------------------------------- ### CMake Build Configuration Management Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/windows/CMakeLists.txt Manages build configurations (Debug, Profile, Release) based on whether the generator supports multi-configuration builds. It sets default build types and defines specific linker and compiler flags for the Profile build mode. ```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() 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}") ``` -------------------------------- ### FlLinkStyle Properties Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Details the properties of FlLinkStyle, used for visually styling links, including gradient, line width, draw mode, and curve type. ```APIDOC FlLinkStyle (Link Appearance) Defines how links are visually styled: - gradient: The color gradient of the link. - lineWidth: Thickness of the link. - drawMode: Drawing style (solid, dashed, dotted). - curveType: Curve style (straight, Bezier, 90-degree). ``` -------------------------------- ### FlNodeHeaderStyle Properties Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Specifies the styling attributes for node headers, including padding, background decoration, text style, and collapse/expand icons. ```APIDOC FlNodeHeaderStyle (Node Header Styling) Defines how the header of a node looks: - padding: Internal spacing inside the header. - decoration: Background style. - textStyle: Font style for the header text. - icon: Icon indicating collapse/expand state. ``` -------------------------------- ### Flutter Node Editor UI Layout Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Builds the main UI for the node editor, including a sidebar for hierarchy and the main editor canvas. It uses `Scaffold`, `Row`, and `Expanded` widgets to structure the layout and attaches the `FlNodeEditorController` to the `FlNodeEditorWidget`. ```dart @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Row( mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, children: [ // Sidebar widget to show node hierarchy, collapsible for convenience HierarchyWidget( controller: _nodeEditorController, isCollapsed: isHierarchyCollapsed, ), Expanded( child: FlNodeEditorWidget( controller: _nodeEditorController, // Attach the controller to the editor expandToParent: true, // Ensure the editor fills its parent style: const FlNodeEditorStyle(), // Use default styles // Overlay widgets for additional UI elements overlay: () { return [ FlOverlayData( top: 0, right: 0, child: Padding( padding: const EdgeInsets.all(8), child: Container( decoration: BoxDecoration( color: Colors.blue, borderRadius: BorderRadius.circular(8), ), child: IconButton( onPressed: () => _nodeEditorController.runner.executeGraph(), // Execute the node graph icon: const Icon( Icons.play_arrow, size: 32, color: Colors.white, ), ), ), ), ), ]; }, ), ), ], ), ), ); } ``` -------------------------------- ### FlGridStyle Properties Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Defines the properties for FlGridStyle, which controls the visual appearance of the grid in the node editor, including spacing, line thickness, color, and visibility. ```APIDOC FlGridStyle (Grid Appearance) Controls how the grid looks in the node editor: - gridSpacingX: Horizontal spacing between grid lines. - gridSpacingY: Vertical spacing between grid lines. - lineWidth: Thickness of grid lines. - lineColor: Color of grid lines. - intersectionColor: Color of grid intersection points. - intersectionRadius: Size of the intersection points. - showGrid: Whether the grid is visible. ``` -------------------------------- ### Customize Launch Screen Assets in Flutter Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md Replace image files in the `ios/Runner/Assets.xcassets` directory to customize the launch screen. Alternatively, open the Xcode project (`ios/Runner.xcworkspace`), select `Runner/Assets.xcassets`, and drag and drop new images. ```bash open ios/Runner.xcworkspace ``` -------------------------------- ### FlFieldStyle Properties Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Defines the styling properties for fields within nodes, such as background decoration and internal padding. ```APIDOC FlFieldStyle (Field Appearance) Defines the appearance of fields inside nodes: - decoration: Background styling. - padding: Internal spacing inside the field. ``` -------------------------------- ### FlLinkCurveType Options Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Lists the available options for FlLinkCurveType, which determines the style of curves used for drawing links between nodes. ```APIDOC FlLinkCurveType (Link Curve Style) Defines how links between nodes are drawn: - straight: Direct straight-line connections. - bezier: Smooth, flowing Bezier curves. - ninetyDegree: Right-angle (90°) connections. ``` -------------------------------- ### Flutter Node Editor Initialization and Disposal Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Initializes and disposes of the `FlNodeEditorController` within a Flutter widget. The controller manages the node editor's state, including registering data handlers and custom node prototypes. ```dart final FlNodeEditorController _nodeEditorController = FlNodeEditorController(); @override void initState() { super.initState(); // Register data handlers and custom node definitions for the editor registerDataHandlers(_nodeEditorController); registerNodes(context, _nodeEditorController); } @override void dispose() { _nodeEditorController.dispose(); // Dispose of the controller to free resources super.dispose(); } ``` -------------------------------- ### Disable Browser Interactions for Web Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Provides HTML and JavaScript code to disable common browser interactions on web platforms, such as pinch-to-zoom, right-click context menus, and developer tool shortcuts, to improve the user experience within a Flutter web application. ```html example ``` -------------------------------- ### Disable Touch Gestures and Right-Click Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/web/index.html This snippet disables touch gestures like pinch-to-zoom and prevents the default right-click context menu using JavaScript event listeners. It also includes CSS to disable touch actions and overscroll behavior. ```css html, body { touch-action: none; overscroll-behavior: none; } ``` ```javascript // Prevent pinch-to-zoom document.addEventListener('gesturestart', function (e) { e.preventDefault(); }); document.addEventListener('gesturechange', function (e) { e.preventDefault(); }); document.addEventListener('gestureend', function (e) { e.preventDefault(); }); // Disable right-click document.addEventListener("contextmenu", function (e) { e.preventDefault(); }); ``` -------------------------------- ### Data Handler Registration for Enum Serialization Source: https://github.com/williamkaroldicioccio/fl_nodes/wiki/Quickstart Shows how to register a data handler for a custom enum type 'Operator'. It defines methods to convert enum instances to JSON strings and vice versa, focusing on extracting the enum name. ```dart controller.project.registerDataHandler( // Converts an Operator enum instance to a JSON-compatible string // by extracting the last part of its toString() value (i.e., the enum name). toJson: (data) => data.toString().split('.').last, // Converts a JSON string back into an Operator enum instance by // finding the matching enum value based on its name. fromJson: (json) => Operator.values.firstWhere( (e) => e.toString().split('.').last == json, ), ); ``` -------------------------------- ### Block Keyboard Shortcuts Source: https://github.com/williamkaroldicioccio/fl_nodes/blob/main/example/web/index.html This JavaScript code snippet prevents specific keyboard shortcuts from being executed, including refresh (Ctrl+R), and opening developer tools (F12, Ctrl+Shift+I). ```javascript // Block certain keyboard shortcuts document.addEventListener("keydown", function (e) { if (e.ctrlKey && (e.key === "r" || e.key === "R")) { e.preventDefault(); } if (e.key === "F12" || (e.ctrlKey && e.shiftKey && e.key === "I")) { e.preventDefault(); // Prevent DevTools opening } }); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.