### Installation Bundle Setup Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Configures the installation process to create a relocatable bundle in the build directory, ensuring the application and its dependencies can be packaged and deployed correctly. ```cmake # === Installation === # By default, "installing" just makes a relocatable bundle in the build # directory. set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Installation Prefix Configuration Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Configures the installation prefix to be adjacent to the executable for in-place running, and sets the install step as default for Visual Studio builds. ```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 Application Executable Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Installs the main application executable to the specified runtime destination. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Basic Quill Editor Setup Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/customizing_shortcuts.md Initializes a basic Quill editor with an empty list of character shortcut events. This serves as the starting point before implementing custom shortcuts. ```dart import 'package:flutter_quill/flutter_quill.dart'; import 'package:flutter/material.dart'; class AsteriskToItalicStyle extends StatelessWidget { const AsteriskToItalicStyle({super.key}); @override Widget build(BuildContext context) { return QuillEditor.basic( controller: , config: QuillEditorConfig( characterShortcutEvents: [], ), ); } } ``` -------------------------------- ### Installing Flutter Library and Bundled Libraries Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Installs the main Flutter library and any bundled plugin libraries to the designated library directory within the installation bundle, making them available at runtime. ```cmake 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) ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Installs any bundled plugin libraries to the library directory within the application bundle. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install Native Assets Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Installs native assets provided by build.dart from all packages to the library directory. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Flutter Library Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Installs the main Flutter library file to the library directory within the application bundle. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Native Assets Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Copies native assets provided by the build process to the installation bundle's library directory, ensuring that any required native resources are included in the final package. ```cmake # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files ``` -------------------------------- ### Install AOT Library Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compilation library to the data directory, but only for Profile and Release build configurations. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Full QuillEditor Test Example Source: https://github.com/singerdmx/flutter-quill/blob/master/flutter_quill_test/README.md A comprehensive example demonstrating the use of various flutter_quill_test utilities within a Flutter widget test. ```dart import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_quill/flutter_quill.dart'; import 'package:flutter_quill_test/flutter_quill_test.dart'; void main() { testWidgets('Example QuillEditor test', (WidgetTester tester) async { final QuillController controller = QuillController.basic(); await tester.pumpWidget( MaterialApp( home: QuillEditor.basic( controller: controller, config: const QuillEditorConfig(), ), ), ); await tester.tap(find.byType(QuillEditor)); await tester.quillEnterText(find.byType(QuillEditor), 'Hello, World!\n'); expect(controller.document.toPlainText(), 'Hello, World!\n'); await tester.quillMoveCursorTo(find.byType(QuillEditor), 12); await tester.quillExpandSelectionTo(find.byType(QuillEditor), 13); await tester.quillReplaceText(find.byType(QuillEditor), ' and hi, World!'); expect(controller.document.toPlainText(), 'Hello, World and hi, World!\n'); await tester.quillMoveCursorTo(find.byType(QuillEditor), 0); await tester.quillExpandSelectionTo(find.byType(QuillEditor), 7); await tester.quillRemoveTextInSelection(find.byType(QuillEditor)); expect(controller.document.toPlainText(), 'World and hi, World!\n'); }); } ``` -------------------------------- ### Example Delta Operations Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/delta_introduction.md Demonstrates a sequence of Delta operations including insert, retain with attributes, and delete. ```json [ // Adds the text "Hello" to the editor's content { "insert": "Hello" }, // Retains the first 5 characters of the existing content, // and applies the "bold" attribute to those characters. { "retain": 5, "attributes": { "bold": true } }, // Deletes 2 characters starting from the current position in the editor's content. { "delete": 2 } ] ``` -------------------------------- ### Installing Application Target and ICU Data Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Installs the application executable to the bundle's root and the ICU data file to the data directory, ensuring the application has its core components and necessary data for internationalization. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Document Format Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Shows the format method for applying styles or attributes to a portion of the document. This is essential for rich text editing. ```dart format ``` -------------------------------- ### Install ICU Data File Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Installs the ICU data file to the data directory within the application bundle. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Flutter and System Dependency Setup Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Includes the Flutter managed directory and checks for GTK+ 3.0 using PkgConfig, setting up essential build components and system libraries. ```cmake # Flutter library and tool build rules. set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Run Pub Get Script Source: https://github.com/singerdmx/flutter-quill/blob/master/scripts/README.md Executes the pub get command using the dart script. Ensure you are in the root project folder when running. ```shell dart ./scripts/pub_get.dart ``` -------------------------------- ### Install AOT Library (Non-Debug) Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library to the runtime library directory. This is conditionally executed only for non-Debug build types. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Removes the existing Flutter assets directory and then copies the new assets from the build directory to the data directory. This ensures assets are 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) ``` -------------------------------- ### Basic Delete Operation Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/delta_introduction.md Shows how to retain specific characters and then delete a subsequent portion of text. ```dart Delta() ..retain(6) ..delete(7); ``` -------------------------------- ### Document To Delta Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Shows the toDelta method for converting the current document state into a Delta format. This is useful for saving or transmitting document changes. ```dart toDelta ``` -------------------------------- ### Document Undo/Redo Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Illustrates the undo and redo methods for managing document history. The hasUndo and hasRedo methods check if these operations are available. ```dart undo, hasUndo ``` ```dart redo, hasRedo ``` -------------------------------- ### Document To Plain Text Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Demonstrates the toPlainText method for converting the document's content into a plain string. This is useful for simple text display or export. ```dart toPlainText ``` -------------------------------- ### Default Bold Attribute Implementation Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/attribute_introduction.md An example of a default inline attribute for applying bold formatting to text. ```dart class BoldAttribute extends Attribute { const BoldAttribute() : super('bold', AttributeScope.inline, true); } ``` -------------------------------- ### Render Paragraph Proxy Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Demonstrates the use of RenderParagraphProxy, which mimics its children's behavior. This is useful for creating custom render objects that need to inherit most properties from their child. ```dart RenderParagraphProxy - RenderProxyBox - Mimics it's children ``` -------------------------------- ### Delta Diff Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Illustrates the diff method for calculating the differences between two Delta objects. This is useful for understanding changes or for implementing undo/redo functionality. ```dart diff ``` -------------------------------- ### Example Usage of Custom Buttons in QuillSimpleToolbar Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/configurations/custom_buttons.md Demonstrates how to integrate custom buttons into the QuillSimpleToolbar configuration. Each button is defined with an icon and a distinct onPressed callback. ```dart QuillSimpleToolbar( controller: _controller, config: QuillSimpleToolbarConfig( customButtons: [ QuillToolbarCustomButtonOptions( icon: const Icon(Icons.ac_unit), onPressed: () { debugPrint('snowflake1'); }, ), QuillToolbarCustomButtonOptions( icon: const Icon(Icons.ac_unit), onPressed: () { debugPrint('snowflake2'); }, ), QuillToolbarCustomButtonOptions( icon: const Icon(Icons.ac_unit), onPressed: () { debugPrint('snowflake3'); }, ), ], ), ), ``` -------------------------------- ### Delta Slice Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Highlights the slice method for splitting Delta documents. This can be very useful for segmenting or processing parts of a document. ```dart slice - This might be super useful for splitting docs ``` -------------------------------- ### Add Flutter Quill Dependency Source: https://github.com/singerdmx/flutter-quill/blob/master/README.md Install the flutter_quill package using Flutter's package manager. ```shell flutter pub add flutter_quill ``` -------------------------------- ### Document Set Custom Rules Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Highlights the setCustomRules method, which allows for custom business logic to be applied to operations and delta modifications. This is extremely useful for advanced editing behaviors. ```dart setCustomRules -→ Could be extremely useful because we can edit the text editor each time something outstanding happens ``` -------------------------------- ### Default Header Attribute Implementation Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/attribute_introduction.md An example of a default block attribute for applying header formatting with a specified level. ```dart class HeaderAttribute extends Attribute { const HeaderAttribute({int? level}) : super('header', AttributeScope.block, level); } ``` -------------------------------- ### Delta Concat Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Demonstrates the concat method for combining Delta objects. This is useful for merging or appending changes to a document. ```dart concat ``` -------------------------------- ### Delta Insert Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Shows how to use the insert method on a Delta object to add text or embeddable content. It can also be used to replace selected text. ```dart insert → Can insert embeddable, Can replace selected text ``` -------------------------------- ### Delta Retain Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Shows how to use the retain method to keep a specified number of characters from the current position in a Delta. This is a fundamental operation for manipulating deltas. ```dart Delta()..retain - Retain [count] of characters from current position. ``` -------------------------------- ### Insert Operation Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/delta_introduction.md Creates a Delta with text insertions, including one with bold attributes, and a subsequent deletion. ```dart import 'package:flutter_quill/quill_delta.dart'; void main() { // Create a Delta with a text insertion final delta = Delta() ..insert('Hello, world!\n') ..insert('This is an example.\n', {'bold': true}) ..delete(10); // Remove the first 10 characters print(delta); // Output: [{insert: "Hello, world!\n"}, {insert: "This is an example.\n", attributes: {bold: true}}, {delete: 10}] ``` -------------------------------- ### Document Replace Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Demonstrates the replace method for modifying the document content. This method can be used to replace selected text with new content, including embeddables. ```dart replace ``` -------------------------------- ### Get Boxes For Selection Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Illustrates the getBoxesForSelection method, which is used to convert a TextSelection into a list of TextBox coordinates. This code is utilized from the Flutter framework. ```dart getBoxesForSelection() ``` -------------------------------- ### Flutter App Localization Setup with FlutterQuillLocalizations Source: https://github.com/singerdmx/flutter-quill/blob/master/README.md Integrate FlutterQuillLocalizations delegate into your MaterialApp to support localization within the Quill editor. This ensures proper display of UI elements across different languages. ```dart import 'package:flutter_quill/flutter_quill.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; MaterialApp( localizationsDelegates: const [ GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, GlobalWidgetsLocalizations.delegate, FlutterQuillLocalizations.delegate, ], ); ``` -------------------------------- ### Find System Dependencies Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/flutter/CMakeLists.txt Uses PkgConfig to find and check for required system libraries: GTK, GLIB, and GIO. These are essential for Flutter's Linux desktop integration. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/runner/CMakeLists.txt Applies a standard set of build settings to the executable target. This can be removed if the application requires custom build configurations. ```cmake # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Custom Toolbar Implementation Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/custom_toolbar.md This snippet demonstrates how to build a custom toolbar using `QuillController` and various `QuillToolbar` widgets. It includes buttons for undo/redo, text styling (bold, italic, underline), clearing formatting, media insertion (image, camera, video), color selection, header styles, line height, checklist, blockquotes, indentation, and link insertion. Use this for a fully customizable toolbar layout. ```dart SingleChildScrollView( scrollDirection: Axis.horizontal, child: Wrap( children: [ IconButton( onPressed: () => context.read().updateSettings( state.copyWith(useCustomQuillToolbar: false)), icon: const Icon( Icons.width_normal, ), ), QuillToolbarHistoryButton( isUndo: true, controller: controller, ), QuillToolbarHistoryButton( isUndo: false, controller: controller, ), QuillToolbarToggleStyleButton( options: const QuillToolbarToggleStyleButtonOptions(), controller: controller, attribute: Attribute.bold, ), QuillToolbarToggleStyleButton( options: const QuillToolbarToggleStyleButtonOptions(), controller: controller, attribute: Attribute.italic, ), QuillToolbarToggleStyleButton( controller: controller, attribute: Attribute.underline, ), QuillToolbarClearFormatButton( controller: controller, ), const VerticalDivider(), QuillToolbarImageButton( controller: controller, ), QuillToolbarCameraButton( controller: controller, ), QuillToolbarVideoButton( controller: controller, ), const VerticalDivider(), QuillToolbarColorButton( controller: controller, isBackground: false, ), QuillToolbarColorButton( controller: controller, isBackground: true, ), const VerticalDivider(), QuillToolbarSelectHeaderStyleDropdownButton( controller: controller, ), const VerticalDivider(), QuillToolbarSelectLineHeightStyleDropdownButton( controller: controller, ), const VerticalDivider(), QuillToolbarToggleCheckListButton( controller: controller, ), QuillToolbarToggleStyleButton( controller: controller, attribute: Attribute.ol, ), QuillToolbarToggleStyleButton( controller: controller, attribute: Attribute.ul, ), QuillToolbarToggleStyleButton( controller: controller, attribute: Attribute.inlineCode, ), QuillToolbarToggleStyleButton( controller: controller, attribute: Attribute.blockQuote, ), QuillToolbarIndentButton( controller: controller, isIncrease: true, ), QuillToolbarIndentButton( controller: controller, isIncrease: false, ), const VerticalDivider(), QuillToolbarLinkStyleButton(controller: controller) ], ), ) ``` -------------------------------- ### Delta Insert Newline Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Shows how to insert a newline character '\n' into a Delta. This can be used to add a new line or potentially to split deltas. ```dart delta.insert('\n' - used to add new character → Could be used to split our deltas ``` -------------------------------- ### Project and Executable Configuration Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Sets the minimum CMake version, project name, executable name, and application ID. This configures the basic identity and build requirements for the application. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "flutter_quill_example") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "dev.flutterquill.flutter_quill_example") ``` -------------------------------- ### Link Libraries and Include Directories Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/runner/CMakeLists.txt Links necessary libraries (flutter, flutter_wrapper_app, dwmapi.lib) and adds the source directory to the include paths for the executable target. Application-specific dependencies should be added here. ```cmake # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Enable and Configure Font Size Options Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/configurations/font_size.md Enables the font size dropdown in the toolbar and sets custom font size options. Use this to define the available font sizes for users. ```dart QuillSimpleToolbar( config: const QuillSimpleToolbarConfig( buttonOptions: QuillSimpleToolbarButtonOptions( fontSize: QuillToolbarFontSizeButtonOptions( items: {'Small': '8', 'Medium': '24.5', 'Large': '46'}, ), ), ), ); ``` -------------------------------- ### Basic Quill Controller Initialization Source: https://github.com/singerdmx/flutter-quill/blob/master/README.md Instantiate a basic QuillController to manage the rich text editor's content and state. This controller is essential for binding to QuillEditor and QuillSimpleToolbar widgets. ```dart QuillController _controller = QuillController.basic(); ``` -------------------------------- ### Delta Iterator Skip Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md Demonstrates using DeltaIterator to skip a specified number of characters in a source delta. This is useful for navigating or processing parts of a delta. ```dart DeltaIterator(document)..skip(index) - Skips [length] characters in source delta. ``` -------------------------------- ### Runtime Output Directory Configuration Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Sets the runtime output directory for the executable to a subdirectory within the build directory. This prevents accidental execution of unbundled copies and ensures correct resource loading. ```cmake # Only the install-generated bundle's copy of the executable will launch # correctly, since the resources must in the right relative locations. To avoid # people trying to run the unbundled copy, put it in a subdirectory instead of # the default top-level location. set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Using Delta Class for Retain Operation Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/delta_introduction.md Demonstrates how to use the Delta class to create a retain operation and apply it to a Quill controller. ```dart import 'package:flutter_quill/flutter_quill.dart'; import 'package:flutter_quill/quill_delta.dart'; void main() { // Create a Delta that retains 10 characters QuillController _quillController = QuillController( document: Document.fromJson([{'insert': 'Hello, world!'}]) , selection: TextSelection.collapsed(offset: 0), ); // Create a delta with the retain and delete operations final delta = Delta() ..retain(6) // Retain "Hello, " // Apply the delta to update the content of the editor _quillController.compose(delta, ChangeSource.local); } ``` -------------------------------- ### Export Flutter Library and ICU Data Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Exports variables for the Flutter library and ICU data file to the parent scope. This makes them available for installation and other build steps. ```cmake set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) ``` -------------------------------- ### Import Flutter Quill Test Utilities Source: https://github.com/singerdmx/flutter-quill/blob/master/flutter_quill_test/README.md Import the necessary test utilities into your test file. ```dart import 'package:flutter_quill_test/flutter_quill_test.dart'; ``` -------------------------------- ### Include Generated Plugins Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Includes CMake scripts to manage the building and integration of generated plugins into the application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Configure Flutter Tool Backend Custom Command Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Sets up a custom command to execute the Flutter tool backend. This command is responsible for generating build artifacts like DLLs and headers. A phony output file is used to ensure the command runs on every build. ```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 ) ``` -------------------------------- ### Complex Delta Transformation Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/delta_introduction.md Illustrates a complex Delta transformation where one Delta retains content and deletes a segment, while another inserts new content, resulting in a combined Delta. ```dart import 'package:flutter_quill/quill_delta.dart' as quill; void main() { // Defining Delta A final deltaA = quill.Delta() ..insert('Hello World'); // Defining Delta B final deltaB = quill.Delta() ..retain(6) // retain: 'Hello ' ..delete(5) // delete: 'World' ..insert('Flutter'); // Applying transformations final result = deltaA.transform(deltaB); print(result.toJson()); // output: [{insert: "Hello Flutter"}] } ``` -------------------------------- ### Preserve Line Style On Split Rule Example Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/code_introduction.md This rule is part of the business logic for handling operations and delta modifications. It specifically focuses on preserving the style of a line when a split operation occurs. ```dart PreserveLineStyleOnSplitRule - Preserves the style to the split line ``` -------------------------------- ### Configure Image Assets in Quill Editor Source: https://github.com/singerdmx/flutter-quill/blob/master/flutter_quill_extensions/README.md Configure the QuillEditor to support loading image assets by providing a custom imageProviderBuilder. ```dart FlutterQuillEmbeds.editorBuilders( imageEmbedConfig: QuillEditorImageEmbedConfig( imageProviderBuilder: (context, imageUrl) { if (imageUrl.startsWith('assets/')) { return AssetImage(imageUrl); } return null; }, ), ) ``` -------------------------------- ### Create an Embed Builder for Custom Blocks Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/custom_embed_blocks.md Builds a widget for the 'notes' embed type. It displays a ListTile with a preview of the note and an onTap function to edit it. ```dart class NotesEmbedBuilder extends EmbedBuilder { NotesEmbedBuilder({required this.addEditNote}); Future Function(BuildContext context, {Document? document}) addEditNote; @override String get key => 'notes'; @override Widget build( BuildContext context, EmbedContext embedContext, ) { final notes = NotesBlockEmbed(embedContext.node.value.data).document; return Material( color: Colors.transparent, child: ListTile( title: Text( notes.toPlainText().replaceAll('\n', ' '), maxLines: 3, overflow: TextOverflow.ellipsis, ), leading: const Icon(Icons.notes), onTap: () => addEditNote(context, document: notes), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), side: const BorderSide(color: Colors.grey), ), ), ); } } ``` -------------------------------- ### Application Executable Definition Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Defines the main executable target for the application, listing its source files and applying standard build settings. This is crucial for linking and building the final application binary. ```cmake # Define the application target. To change its name, change BINARY_NAME above, # not the value here, or `flutter run` will no longer work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Alternative Translation Generation Commands Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/translation.md If the primary script cannot be run, these commands can be used as an alternative to generate and format translation files. ```bash flutter gen-l10n dart fix --apply ./lib/src/l10n/generated dart format ./lib/src/l10n/generated ``` -------------------------------- ### Create Static Library for Flutter Wrapper Plugin Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Builds a static library for the Flutter C++ wrapper intended for plugins. It includes core and plugin-specific sources and links against the Flutter library. ```cmake 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) ``` -------------------------------- ### Project and Minimum CMake Version Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Sets the minimum required CMake version and defines the project name and languages. ```cmake cmake_minimum_required(VERSION 3.14) project(flutter_quill_example LANGUAGES CXX) ``` -------------------------------- ### Define C++ Wrapper Core Sources Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Lists the core source files for the C++ client wrapper. These files contain fundamental implementations for Flutter integration. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") ``` -------------------------------- ### Define C++ Wrapper Plugin Sources Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Lists the source files specific to the C++ wrapper's plugin registrar functionality. This enables plugins to interact with the Flutter engine. ```cmake list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") ``` -------------------------------- ### Standard Build Settings Function Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Defines a reusable function to apply common compilation features, options, and definitions to targets, promoting consistency across the project. ```cmake # Compilation settings that should be applied to most targets. # # Be cautious about adding new options here, as plugins use this function by # default. In most cases, you should add new options to specific targets instead # of modifying this function. 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() ``` -------------------------------- ### Enter Text into QuillEditor Source: https://github.com/singerdmx/flutter-quill/blob/master/flutter_quill_test/README.md Use quillEnterText to input text into the QuillEditor. Ensure the editor is found using a Finder. ```dart await tester.quillEnterText(find.byType(QuillEditor), 'test\n'); ``` -------------------------------- ### Profile Build Mode Settings Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Defines linker and compiler flags for the Profile build mode, typically mirroring Release settings. ```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}") ``` -------------------------------- ### Linking Dependencies Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Links the application executable against the Flutter library and GTK+ 3.0, ensuring all necessary runtime components are available. ```cmake # Add dependency libraries. Add any application-specific dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) ``` -------------------------------- ### Set Wrapper Root Directory Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Defines the root directory for C++ client wrapper sources. This is used for organizing and referencing wrapper code. ```cmake set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") ``` -------------------------------- ### Add Flutter Quill from Git Source: https://github.com/singerdmx/flutter-quill/blob/master/README.md Alternatively, add the flutter_quill package directly from its Git repository, specifying a version tag. ```yaml dependencies: flutter_quill: git: url: https://github.com/singerdmx/flutter-quill.git ref: v ``` -------------------------------- ### Modern CMake Policy Opt-in Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Explicitly opts into modern CMake behaviors to avoid warnings with recent CMake versions. ```cmake cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Unicode Support Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Adds definitions to enable Unicode support for all projects. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Create Static Library for Flutter Wrapper App Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Builds a static library for the Flutter C++ wrapper used by the application runner. It includes core and application-specific sources and links against the Flutter library. ```cmake 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) ``` -------------------------------- ### Build Configuration Types Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Defines the available build configurations (Debug, Profile, Release) based on whether the generator is multi-config. ```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() ``` -------------------------------- ### Implement Add/Edit Note Functionality Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/custom_embed_blocks.md Handles showing a dialog with a QuillEditor for adding or editing notes. Updates the editor with the modified note block. ```dart Future _addEditNote(BuildContext context, {Document? document}) async { final isEditing = document != null; final controller = QuillController( document: document ?? Document(), selection: const TextSelection.collapsed(offset: 0), ); await showDialog( context: context, builder: (context) => AlertDialog( titlePadding: const EdgeInsets.only(left: 16, top: 8), title: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('${isEditing ? 'Edit' : 'Add'} note'), IconButton( onPressed: () => Navigator.of(context).pop(), icon: const Icon(Icons.close), ) ], ), content: QuillEditor.basic( controller: controller, config: const QuillEditorConfig(), ), ), ); if (controller.document.isEmpty()) return; final block = BlockEmbed.custom( NotesBlockEmbed.fromDocument(controller.document), ); final controller = _controller!; final index = controller.selection.baseOffset; final length = controller.selection.extentOffset - index; if (isEditing) { final offset = getEmbedNode(controller, controller.selection.start).offset; controller.replaceText( offset, 1, block, TextSelection.collapsed(offset: offset)); } else { controller.replaceText(index, length, block, null); } } ``` -------------------------------- ### Import Delta and Operation Classes Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/delta_introduction.md Import the necessary Delta and Operation classes from the flutter_quill package. ```dart import 'package:flutter_quill/quill_delta.dart'; ``` -------------------------------- ### Add Runner Subdirectory Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Includes the runner subdirectory, which contains the application's main build rules. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Quill Editor and Toolbar Integration Source: https://github.com/singerdmx/flutter-quill/blob/master/README.md Use QuillEditor.basic and QuillSimpleToolbar widgets, linking them to a QuillController. Ensure the controller is disposed of properly in the widget's dispose method to prevent memory leaks. ```dart QuillSimpleToolbar( controller: _controller, config: const QuillSimpleToolbarConfig(), ), Expanded( child: QuillEditor.basic( controller: _controller, config: const QuillEditorConfig(), ), ) ``` -------------------------------- ### Update QuillClipboardConfig.onClipboardPaste to onUnprocessedPaste Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/migration/10_to_11.md Migrate from the fallback `onClipboardPaste` to the new `onUnprocessedPaste` callback in `QuillControllerConfig` to override default paste handling. ```diff - QuillControllerConfig( - onClipboardPaste: () {} - ) + QuillControllerConfig( + clipboardConfig: QuillClipboardConfig( + onUnprocessedPaste: () {} + ) + ) ``` -------------------------------- ### Apply Standard Compilation Settings Function Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt A function to apply common compilation features and options to a target, including C++17 standard, warning levels, and exception handling. ```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() ``` -------------------------------- ### Add flutter_quill_extensions via Git Source: https://github.com/singerdmx/flutter-quill/blob/master/flutter_quill_extensions/README.md Alternatively, add the flutter_quill_extensions dependency by specifying a Git repository URL and a specific reference or path. ```yaml dependencies: flutter_quill_extensions: git: url: https://github.com/singerdmx/flutter-quill.git ref: v path: flutter_quill_extensions ``` -------------------------------- ### Define C++ Wrapper App Sources Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Lists the source files for the C++ wrapper related to the Flutter application runner. These are essential for launching and managing the Flutter engine. ```cmake list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") ``` -------------------------------- ### Apply Delete Operation using QuillController Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/delta_introduction.md Demonstrates how to apply a Delta containing retain and delete operations to a QuillController to modify editor content. ```dart import 'package:flutter_quill/flutter_quill.dart'; import 'package:flutter_quill/quill_delta.dart'; QuillController _quillController = QuillController( document: Document.fromJson([{'insert': 'Hello, world!'}]) , selection: TextSelection.collapsed(offset: 0), ); // Create a delta with the retain and delete operations final delta = Delta() ..retain(6) // Retain "Hello, " ..delete(7); // Delete "world!" // Apply the delta to update the content of the editor _quillController.compose(delta, ChangeSource.local); ``` -------------------------------- ### Apply Custom Rules to Quill Controller Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/rules_introduction.md Demonstrates how to apply a list of custom rules to the Flutter Quill editor's document. This is typically done after initializing the `QuillController`. ```dart quillController.document.setCustomRules([const AutoFormatItalicRule()]); ``` -------------------------------- ### Include Generated Configuration Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Includes a CMake configuration file generated by the Flutter tool. This file provides project-specific settings and configurations. ```cmake include(${EPHEMERAL_DIR}/generated_config.cmake) ``` -------------------------------- ### Add Flutter Subdirectory Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Includes the Flutter managed directory, which contains Flutter-specific build rules. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Add Preprocessor Definitions for Build Version Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/runner/CMakeLists.txt Adds preprocessor definitions to the build configuration to include Flutter version information. This allows the application to access version details at compile time. ```cmake # Add preprocessor definitions for the build version. target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") ``` -------------------------------- ### Add Flutter Test Dependencies Source: https://github.com/singerdmx/flutter-quill/blob/master/flutter_quill_test/README.md Add the flutter_test and flutter_quill_test dependencies to your project. ```shell flutter pub add 'dev:flutter_test:{"sdk":"flutter"}' flutter pub add dev:flutter_quill_test ``` -------------------------------- ### QuillEditor constructor change diff Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/migration/10_to_11.md This diff highlights the change in how the controller is passed to the QuillEditor.basic constructor. ```diff QuillEditor.basic( + controller: _controller, config: QuillEditorConfig( - controller: _controller, ), ) ``` -------------------------------- ### Android Manifest Configuration for FileProvider Source: https://github.com/singerdmx/flutter-quill/blob/master/README.md Add this XML to your AndroidManifest.xml to enable image copying to the clipboard for inter-app access. It configures a FileProvider for secure URI sharing. ```xml ... ... ``` -------------------------------- ### Configure Quill Editor with Embed Builders Source: https://github.com/singerdmx/flutter-quill/blob/master/flutter_quill_extensions/README.md Configure the QuillEditor to use embed builders for web or non-web platforms. ```dart Expanded( child: QuillEditor.basic( config: QuillEditorConfig( embedBuilders: kIsWeb ? FlutterQuillEmbeds.editorWebBuilders() : FlutterQuillEmbeds.editorBuilders(), ), ), ) ``` -------------------------------- ### Integrating Custom Attribute with QuillEditorConfig Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/attribute_introduction.md Shows how to use QuillEditorConfig's customStyleBuilder to apply custom text styles for attributes like HighlightAttr. ```dart QuillEditor.basic( controller: controller, config: QuillEditorConfig( customStyleBuilder: (Attribute attribute) { if (attribute.key.equals(highlightKey)) { return TextStyle(color: Colors.black, backgroundColor: Colors.yellow); } //default paragraph style return TextStyle(); }, ), ); ``` -------------------------------- ### Executable Name Configuration Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/CMakeLists.txt Sets the name of the executable for the application. This can be changed to modify the on-disk name. ```cmake set(BINARY_NAME "flutter_quill_example") ``` -------------------------------- ### Modern CMake Policy and RPATH Configuration Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Enables modern CMake behaviors and sets the runtime search path for libraries, ensuring bundled libraries are found correctly. ```cmake # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. cmake_policy(SET CMP0063 NEW) # Load bundled libraries from the lib/ directory relative to the binary. set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") ``` -------------------------------- ### Cross-Building Sysroot Configuration Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Configures CMake for cross-compilation by setting the sysroot and adjusting search path modes for executables, packages, libraries, and includes. ```cmake # Root filesystem for cross-building. if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() ``` -------------------------------- ### Export Project Build Directory and AOT Library Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/flutter/CMakeLists.txt Exports the project's build directory and the Ahead-Of-Time (AOT) compiled library path. These are crucial for linking and deployment. ```cmake set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) ``` -------------------------------- ### Add Flutter Tool Dependencies Source: https://github.com/singerdmx/flutter-quill/blob/master/example/windows/runner/CMakeLists.txt Ensures that the Flutter tool's assembly process is a dependency for the main executable target. This step is crucial for the Flutter build system integration and must not be removed. ```cmake # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Add Custom Button with Icon Source: https://github.com/singerdmx/flutter-quill/blob/master/doc/configurations/custom_buttons.md Defines the options for a custom toolbar button, including its icon, tooltip, and the action to perform when pressed. ```dart QuillToolbarCustomButtonOptions( icon: const Icon(Icons.ac_unit), tooltip: 'Tooltip', onPressed: () {}, ), ``` -------------------------------- ### Flutter Tool Backend Custom Command Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/flutter/CMakeLists.txt Defines a custom CMake command to invoke the Flutter tool backend script. This command is responsible for generating the Flutter library and headers, and it's set to run every time due to the use of a dummy output file '_phony_'. ```cmake 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 ) ``` -------------------------------- ### Build Type Configuration Source: https://github.com/singerdmx/flutter-quill/blob/master/example/linux/CMakeLists.txt Sets the default build type to 'Debug' if not already defined, ensuring a consistent build mode for the project. ```cmake # Define build configuration options. if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() ```