### Start Flutter Intro Guide Source: https://github.com/minaxorg/flutter_intro/blob/master/README_V2.md Shows the simple method call to initiate the feature introduction or user guide sequence after the Intro object has been configured and GlobalKeys have been bound to the relevant widgets. ```Dart intro.start(context); ``` -------------------------------- ### Start Flutter Intro Sequence Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Initiates the feature introduction sequence programmatically by calling the 'start' method on the Intro controller obtained via 'Intro.of(context)'. ```Dart Intro.of(context).start(); ``` -------------------------------- ### Initialize Flutter Intro Guide Source: https://github.com/minaxorg/flutter_intro/blob/master/README_V2.md Demonstrates how to initialize the Intro class with various configuration options such as animation, step count, closability, padding, border radius, and a custom widget builder for the guide pages. It also shows how to use the default theme with custom texts and button labels. ```Dart import 'package:flutter/material.dart'; import 'package:flutter_intro/flutter_intro.dart'; // ... inside a widget or stateful widget Intro intro = Intro( /// You can set it true to disable animation noAnimation: false, /// The total number of guide pages, must be passed stepCount: 4, /// Click on whether the mask is allowed to be closed. maskClosable: true, /// When highlight widget is tapped. onHighlightWidgetTap: (introStatus) { print(introStatus); }, /// The padding of the highlighted area and the widget padding: EdgeInsets.all(8), /// Border radius of the highlighted area borderRadius: BorderRadius.all(Radius.circular(4)), /// Use the default useDefaultTheme provided by the library to quickly build a guide page /// Need to customize the style and content of the guide page, implement the widgetBuilder method yourself /// * Above version 2.3.0, you can use useAdvancedTheme to have more control over the style of the widget /// * Please see https://github.com/minaxorg/flutter_intro/issues/26 widgetBuilder: StepWidgetBuilder.useDefaultTheme( /// Guide page text texts: [ 'Hello, I\'m Flutter Intro.', 'I can help you quickly implement the Step By Step guide in the Flutter project.', 'My usage is also very simple, you can quickly learn and use it through example and api documentation.', 'In order to quickly implement the guidance, I also provide a set of out-of-the-box themes, I wish you all a happy use, goodbye!', ], /// Button text buttonTextBuilder: (curr, total) { return curr < total - 1 ? 'Next' : 'Finish'; }, ), ); ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/CMakeLists.txt Configures the minimum CMake version, project name, executable name, and application ID. It also sets up CMake policies and defines installation paths for libraries and resources. ```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() ``` -------------------------------- ### Advanced Custom Overlay for Intro Steps Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Allows for highly customized guide overlay content by using the 'overlayBuilder' property within IntroStepBuilder, providing access to step parameters for dynamic content generation. ```Dart IntroStepBuilder( order: 2, /// Create a customized guide widget overlayBuilder: (StepWidgetParams params) { return YourCustomOverlay(); }, ) ``` -------------------------------- ### Add Guided Widget with IntroStepBuilder Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Wraps individual widgets that need guidance with IntroStepBuilder. Requires a unique 'order' property for step sequencing and uses a 'builder' function to provide the widget and its key. ```Dart IntroStepBuilder( /// Required: use unique int for each step to set guide order order: 1, /// Use either `text` or `overlayBuilder` to create guide content (see "Advanced Usage" for latter /// example). /// Use text to quickly add leading text text: 'Use this widget to...', /// Required: provide function that returns a `Widget` with the key builder: (BuildContext context, GlobalKey key) => NeedGuideWidget( /// Bind the key to whatever is returned key: key, ), ) ``` -------------------------------- ### Manually Disposing Flutter Intro Guide Source: https://github.com/minaxorg/flutter_intro/blob/master/README_V2.md Explains how to programmatically close the flutter_intro guide, for instance, when the user presses the back button. It involves using `WillPopScope` and calling the `dispose` method on the intro instance, optionally checking the intro's status first. ```Dart WillPopScope( child: Scaffold(...), onWillPop: () async { // sometimes you need get current status to make some judgements IntroStatus introStatus = intro.getStatus(); if (introStatus.isOpen) { // destroy guide page when tap back key intro.dispose(); return false; } return true; }, ) ``` -------------------------------- ### Flutter Asset Installation Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/CMakeLists.txt Installs Flutter assets by removing any previous installation and then copying the new assets to the designated directory. This ensures a clean installation of project assets. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Flutter Intro Web Environment Usage Source: https://github.com/minaxorg/flutter_intro/blob/master/README_V2.md Addresses the usage of flutter_intro in web environments. It notes a temporary lack of support due to a Flutter bug, but mentions that it works in Flutter 2.0+. ```Dart // Due to [this bug](https://github.com/flutter/flutter/issues/69849) in Flutter, it is temporarily not supported for use on the Web.(Update: It works in Flutter 2.0+) ``` -------------------------------- ### Bind GlobalKey to Widgets for Flutter Intro Source: https://github.com/minaxorg/flutter_intro/blob/master/README_V2.md Explains how to associate GlobalKeys with widgets that need to be highlighted by the intro guide. The `intro.keys` array, which has a length equal to `stepCount`, should have its GlobalKeys assigned to the respective widgets. ```Dart Placeholder( /// the first guide page is the first item in the binding keys key: intro.keys[0] ) ``` -------------------------------- ### Initialize Flutter Intro Package Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Wraps the application root with the Intro widget to enable the feature introduction functionality. Allows setting global properties like padding, border radius, mask color, animation, and custom button builders. ```Dart import 'package:flutter_intro/flutter_intro.dart'; Intro( /// Padding of the highlighted area and the widget padding: const EdgeInsets.all(8), /// Border radius of the highlighted area borderRadius: BorderRadius.all(Radius.circular(4)), /// The mask color of step page maskColor: const Color.fromRGBO(0, 0, 0, .6); /// Toggle animation noAnimation: false; /// Toggle whether the mask can be closed maskClosable: false; /// Build custom button buttonBuilder: (order) { return IntroButtonConfig( text: order == 3 ? 'Custom Button Text' : 'Next', height: order == 3 ? 48 : null, fontSize: order == 3 ? 24 : null, style: order == 3 ? OutlinedButton.styleFrom( backgroundColor: Colors.red, ) : null, ); }, /// High-level widget child: const YourApp(), ) ``` -------------------------------- ### Installation Bundle Configuration Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/CMakeLists.txt Configures the installation process to create a relocatable bundle, defining destinations for executable, data, and libraries. It also handles copying bundled libraries and native assets. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### AOT Library Installation Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/CMakeLists.txt Installs the Ahead-of-Time (AOT) compiled library for the project. This installation is conditional and only occurs on non-Debug builds to optimize performance. ```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() ``` -------------------------------- ### Configuring Individual Steps in Flutter Intro Source: https://github.com/minaxorg/flutter_intro/blob/master/README_V2.md Shows how to apply specific configurations, such as padding and border radius, to individual steps or multiple steps using `setStepConfig` and `setStepsConfig` methods in flutter_intro. ```Dart intro.setStepConfig( 1, padding: EdgeInsets.symmetric( vertical: -5, horizontal: -8, ), ); intro.setStepsConfig( [0, 1], borderRadius: BorderRadius.all( Radius.circular( 16, ), ), ); ``` -------------------------------- ### Configure IntroStepBuilder with Custom Padding and Border Radius Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Demonstrates how to set specific configurations for an `IntroStepBuilder`, including order, padding, border radius, and a custom builder widget. This allows for fine-grained control over the appearance and behavior of each introduction step. ```dart IntroStepBuilder( order: 3, padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 5), borderRadius: const BorderRadius.all(Radius.circular(64)), builder: (context, key) => YourWidget(), ) ``` -------------------------------- ### Custom WidgetBuilder Parameters for Flutter Intro Source: https://github.com/minaxorg/flutter_intro/blob/master/README_V2.md Details the `StepWidgetParams` class used when implementing a custom `widgetBuilder`. This class provides essential information for rendering each step of the guide, including navigation callbacks, current step index, total steps, screen size, and the size and offset of the highlighted component. ```APIDOC class StepWidgetParams { /// Return to the previous guide page method, or null if there is none final VoidCallback onPrev; /// Enter the next guide page method, or null if there is no final VoidCallback onNext; /// End all guide page methods final VoidCallback onFinish; /// Which guide page is currently displayed, starting from 0 final int currentStepIndex; /// Total number of guide pages final int stepCount; /// The width and height of the screen final Size screenSize; /// The width and height of the highlighted component final Size size; /// The coordinates of the upper left corner of the highlighted component final Offset offset; } ``` -------------------------------- ### Adjusting Padding in Flutter Intro Source: https://github.com/minaxorg/flutter_intro/blob/master/README_V2.md Demonstrates how to modify the default 8px padding around highlighted areas in the flutter_intro guide. Setting padding to EdgeInsets.zero removes all padding, while negative values can make the highlight area smaller. ```Dart intro = Intro( ..., /// Set it to zero padding: EdgeInsets.zero, ); ``` ```Dart intro.setStepConfig( 1, padding: EdgeInsets.symmetric( vertical: -10, horizontal: -8, ), ); ``` -------------------------------- ### Reduce Highlight Area Size with Negative Padding Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Shows how to make the highlight area smaller than the widget it's highlighting by applying negative padding to the `IntroStepBuilder`. This is useful for precise visual adjustments. ```dart IntroStepBuilder( order: 4, /// Reduce highlight size further padding: const EdgeInsets.symmetric( vertical: -5, horizontal: -5, ), builder: (context, key) => YourWidget(), ) ``` -------------------------------- ### Modern Back Press Handling with PopScope and ValueNotifier Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Demonstrates the modern approach to handling back presses using `PopScope` and `ValueNotifier` as introduced in v3.1.0. This method allows disabling the pop behavior when the intro is open and disposing of the intro instance accordingly. ```dart ValueListenableBuilder( valueListenable: intro.statusNotifier, builder: (context, value, child) { return PopScope( canPop: !value.isOpen, onPopInvoked: (didPop) { if (!didPop) { intro.dispose(); } }, child: Scaffold(...), ); }, ) ``` -------------------------------- ### Adjust Highlight Padding in Flutter Intro Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Demonstrates how to modify the default 8px padding around highlighted areas by setting the 'padding' property within the Intro widget. Setting it to EdgeInsets.zero removes the padding. ```Dart Intro( /// Set padding to zero (or negative) to reduce highlight size padding: EdgeInsets.zero, child: const YourApp(), ); ``` -------------------------------- ### Handle Back Press Exception with WillPopScope Source: https://github.com/minaxorg/flutter_intro/blob/master/README.md Provides a solution to prevent exceptions when the user presses the back button or uses gestures while an intro is open. It uses `WillPopScope` to intercept the back navigation and calls the `dispose` method of the intro instance if it's open. ```dart WillPopScope( child: Scaffold(...), onWillPop: () async { final Intro intro = Intro.of(context); if (intro.status.isOpen == true) { intro.dispose(); return false; } return true; }, ) ``` -------------------------------- ### CMake Build Configuration for Flutter Linux GTK Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/flutter/CMakeLists.txt This snippet outlines the CMake configuration for a Flutter Linux GTK project. It sets up minimum CMake version, defines ephemeral directories, includes generated configuration, and defines a helper function `list_prepend` for manipulating lists. It also checks for PkgConfig modules like GTK, GLIB, and GIO, sets Flutter library paths, and defines interface libraries with include directories and linked libraries. ```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) # TODO: Move the rest of this into files in ephemeral. See # https://github.com/flutter/flutter/issues/57146. # Serves the same purpose as list(TRANSFORM ... PREPEND ...), # which isn't available in 3.10. 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() # === Flutter Library === # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) list(APPEND FLUTTER_LIBRARY_HEADERS "fl_basic_message_channel.h" "fl_binary_codec.h" "fl_binary_messenger.h" "fl_dart_project.h" "fl_engine.h" "fl_json_message_codec.h" "fl_json_method_codec.h" "fl_message_codec.h" "fl_method_call.h" "fl_method_channel.h" "fl_method_codec.h" "fl_method_response.h" "fl_plugin_registrar.h" "fl_plugin_registry.h" "fl_standard_message_codec.h" "fl_standard_method_codec.h" "fl_string_codec.h" "fl_value.h" "fl_view.h" "flutter_linux.h" ) list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO ) add_dependencies(flutter flutter_assemble) # === Flutter tool backend === # _phony_ is a non-existent file to force this command to run every time, # since currently there's no way to get a full input/output list from the # flutter tool. add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### Flutter Integration and System Dependencies Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/CMakeLists.txt Integrates Flutter's build rules by adding its directory as a subdirectory and finds system-level dependencies like GTK using PkgConfig. ```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}") ``` -------------------------------- ### Application Target Definition and Linking Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/CMakeLists.txt Defines the main executable target for the application, including source files and linking against Flutter and GTK libraries. It also sets runtime output properties. ```cmake 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" ) ``` -------------------------------- ### Generated Plugin Build Rules Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/CMakeLists.txt Includes the CMake script responsible for managing the build of Flutter plugins and integrating them into the application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Standard Compilation Settings Function Source: https://github.com/minaxorg/flutter_intro/blob/master/example/linux/CMakeLists.txt Defines a CMake function to apply standard compilation features and options to targets, including C++14 standard, warning flags, optimization levels, and NDEBUG definition. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE "$<\$>:-O3>") target_compile_definitions(${TARGET} PRIVATE "$<\$>:NDEBUG>") endfunction() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.