### Install application binary Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Installs the application executable to the install prefix with the Runtime component. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Fetch dependencies with flutter pub get Source: https://github.com/belovance/quickalert/blob/master/README.md Runs the Flutter command to fetch and install the dependencies declared in pubspec.yaml. ```command $ flutter pub get ``` -------------------------------- ### Clean build bundle directory before install Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Removes the entire build bundle directory at the start of installation to ensure a clean state. ```cmake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Set install prefix to build bundle directory Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt By default, 'installing' creates a relocatable bundle in the build directory. This sets the install prefix to the bundle directory if it hasn't been explicitly set. ```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 Flutter library Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Installs the Flutter library to the lib directory within the bundle. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install bundled plugin libraries Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Iterates over all plugin bundled libraries and installs each to the lib directory within the bundle. ```cmake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### Define install bundle data and lib directories Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Sets the destination directories for data and library files within the install bundle. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Loading alert with title and text Source: https://github.com/belovance/quickalert/blob/master/README.md Displays a loading alert with a title and text message. This example is from the example project. ```dart QuickAlert.show( context: context, type: QuickAlertType.loading, title: 'Loading', text: 'Fetching your data', ); ``` -------------------------------- ### Info alert with text Source: https://github.com/belovance/quickalert/blob/master/README.md Displays an info alert with a custom text message. This example is from the example project. ```dart QuickAlert.show( context: context, type: QuickAlertType.info, text: 'Buy two, get one free', ); ``` -------------------------------- ### Install Flutter assets and AOT library in CMake Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Configures installation of Flutter assets and the AOT library for Linux builds. Removes stale assets before copying, and installs the AOT library only for non-Debug builds. ```cmake # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. 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 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() ``` -------------------------------- ### Warning alert with text Source: https://github.com/belovance/quickalert/blob/master/README.md Displays a warning alert with a custom text message. This example is from the example project. ```dart QuickAlert.show( context: context, type: QuickAlertType.warning, text: 'You just broke protocol', ); ``` -------------------------------- ### Success alert with text Source: https://github.com/belovance/quickalert/blob/master/README.md Displays a success alert with a custom text message. This example is from the example project. ```dart QuickAlert.show( context: context, type: QuickAlertType.success, text: 'Transaction Completed Successfully!', ); ``` -------------------------------- ### Install Flutter ICU data file Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Installs the Flutter ICU data file to the data directory within the bundle. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Error alert with title and text Source: https://github.com/belovance/quickalert/blob/master/README.md Displays an error alert with a title and text message. This example is from the example project. ```dart QuickAlert.show( context: context, type: QuickAlertType.error, title: 'Oops...', text: 'Sorry, something went wrong', ); ``` -------------------------------- ### Custom alert with widget and async actions Source: https://github.com/belovance/quickalert/blob/master/README.md Displays a custom alert with a TextFormField widget, custom asset, and asynchronous confirm button handler. This example is from the example project. ```dart QuickAlert.show( context: context, type: QuickAlertType.custom, barrierDismissible: true, confirmBtnText: 'Save', customAsset: 'assets/custom.gif', widget: TextFormField( decoration: const InputDecoration( alignLabelWithHint: true, hintText: 'Enter Phone Number', prefixIcon: Icon( Icons.phone_outlined, ), ), textInputAction: TextInputAction.next, keyboardType: TextInputType.phone, onChanged: (value) => message = value, ), onConfirmBtnTap: () async { if (message.length < 5) { await QuickAlert.show( context: context, type: QuickAlertType.error, text: 'Please input something', ); return; } Navigator.pop(context); await Future.delayed(const Duration(milliseconds: 1000)); await QuickAlert.show( context: context, type: QuickAlertType.success, text: "Phone number '$message' has been saved!.", ); }, ); }, title: 'Custom', text: 'Custom Widget Alert', leadingImage: 'assets/custom.gif', ); ``` -------------------------------- ### Confirm alert with custom buttons Source: https://github.com/belovance/quickalert/blob/master/README.md Displays a confirmation alert with custom button text and color. This example is from the example project. ```dart QuickAlert.show( context: context, type: QuickAlertType.confirm, text: 'Do you want to logout', confirmBtnText: 'Yes', cancelBtnText: 'No', confirmBtnColor: Colors.green, ); ``` -------------------------------- ### QuickAlert Class Options Source: https://github.com/belovance/quickalert/blob/master/README.md This snippet documents the configurable options for the QuickAlert dialog class. Each option is a parameter that can be passed to the QuickAlert constructor to customize the dialog's appearance and behavior. ```APIDOC ## QuickAlert Options ### Description These are the options available in the QuickAlert class. Each option is a parameter that can be passed to the QuickAlert constructor to customize the dialog's appearance and behavior. ### Parameters | Attribute | Data type | Description | Default Value | |-----------|-----------|-------------|---------------| | context | BuildContext | @required BuildContext | N/A | | type | QuickAlertType | @required - Type of alert dialog, ex: QuickAlertType.success for success dialogs | NULL | | title | String | Set a custom title for dialog | Based on the QuickAlertType selected | | text | String | Set the description text of the dialog. | NULL | | widget | Widget | Set custom widget of the dialog. | NULL | | confirmBtnText | String | Text of confirm button | 'Okay' | | onConfirmBtnTap | Function | Function that handle click of confirm button | () => Navigator.pop(context) | | confirmBtnColor | Color | Color of confirm Button | Colors.blue | | showCancelBtn | bool | Determines if cancel button is shown or not | false | | showConfirmBtn | bool | Determines if confirm button is shown or not | true | | cancelBtnText | String | Text of cancel button | 'Cancel' | | onCancelBtnTap | Function | Function that handle click of cancel button | () => Navigator.pop(context) | | barrierDismissible | bool | Dismiss dialog on touch overlay | true | | animType | QuickAlertAnimType | Type of dialogue enter animation | QuickAlertAnimType.scale | | confirmBtnTextStyle | TextStyle | Confirm button text theme | TextStyle(color: Colors.white, fontWeight:FontWeight.w600,fontSize: 18.0) | | cancelBtnTextStyle | TextStyle | Cancel button text theme | TextStyle(color: Colors.grey, fontWeight:FontWeight.w600,fontSize: 18.0) | | backgroundColor | Color | Color of dialog background | Colors.white | | headerBackgroundColor | Color | Background Color of dialog Header Background | Colors.white | | titleColor | Color | Color of title | Colors.black | | textColor | Color | Color of text | Colors.black | | barrierColor | Color | Color of Barrier | NULL | | customAsset | String | Asset path of your custom asset | NULL | | autoCloseDuration | Duration | Determines how long the dialog stays open for before closing | NULL | | width | double | Dialog width | MediaQuery.of(context).size.shortestSide | | titleAlignment | TextAlign | Title Alignment of the dialog | NULL | | textAlignment | TextAlign | Text Alignment of the dialog | NULL | | borderRadius | double | Dialog's border radius | 15.0 | | disableBackBtn | bool | Determines if the dialog should be closed when back button is pressed | false | ``` -------------------------------- ### Add QuickAlert dependency to pubspec.yaml Source: https://github.com/belovance/quickalert/wiki/QuickAlert Add the QuickAlert package as a dependency in your project's pubspec.yaml file. Replace with the current version number. ```yaml dependencies: QuickAlert: ``` -------------------------------- ### Display a basic success alert Source: https://github.com/belovance/quickalert/blob/master/README.md Shows the simplest usage of QuickAlert.show() with a success type. This is the minimal code to display an alert; other properties can be added for customization. ```dart QuickAlert.show( context: context, type: QuickAlertType.success, ); // That's it to display an alert, use other properties to customize. ``` -------------------------------- ### Apply standard settings to the executable target Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Calls the apply_standard_settings function on the executable target to apply the standard build settings. ```cmake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Define executable target for the application Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Creates the executable target for the application, including main.cc, my_application.cc, and the generated plugin registrant. The target name is set by BINARY_NAME. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) ``` -------------------------------- ### Include generated plugin build rules Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Includes the generated CMake file that manages building plugins and adding them to the application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Import quickalert package Source: https://github.com/belovance/quickalert/blob/master/README.md Imports the quickalert package into your Dart code to use its alert functionality. ```dart import 'package:quickalert/quickalert.dart'; ``` -------------------------------- ### Find GTK package using PkgConfig Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Finds the PkgConfig package and uses it to locate the GTK+ 3.0 library as an imported target. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) ``` -------------------------------- ### Add quickalert dependency to pubspec.yaml Source: https://github.com/belovance/quickalert/blob/master/README.md Adds the quickalert package as a dependency in your Flutter project's pubspec.yaml file. Replace with the current version number. ```yaml dependencies: quickalert: ``` -------------------------------- ### Link dependencies to the executable target Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Links the Flutter library and the GTK imported target to the executable target. ```cmake target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) ``` -------------------------------- ### QuickAlert Class Source: https://github.com/belovance/quickalert/wiki/QuickAlert QuickAlert is a Flutter package that provides customizable alert dialogs. This class is used to display various types of alert dialogs (success, error, warning, info, confirm, custom, loading) with configurable options. ```APIDOC ## QuickAlert Class ### Description QuickAlert is a Flutter package that provides customizable alert dialogs. This class is used to display various types of alert dialogs (success, error, warning, info, confirm, custom, loading) with configurable options. ### Constructor `QuickAlert({required BuildContext context, required QuickAlertType type, String? title, String? text, Widget? widget, String? confirmBtnText, Function? confirmBtnTap, Color? confirmBtnColor, bool? showCancelBtn, String? cancelBtnText, Function? cancelBtnTap, bool? barrierDismissible, QuickAlertAnimType? animType, TextStyle? confirmBtnTextStyle, TextStyle? cancelBtnTextStyle, String? customAsset, Duration? autoCloseDuration, double? width})` ### Parameters - **context** (BuildContext) - Required - The BuildContext of the widget tree. - **type** (QuickAlertType) - Required - The type of alert dialog, e.g., QuickAlertType.success for success dialogs. - **title** (String) - Optional - Custom title for the dialog. Defaults to a title based on the QuickAlertType selected. - **text** (String) - Optional - Description text of the dialog. Defaults to null. - **widget** (Widget) - Optional - Custom widget of the dialog. Defaults to null. - **confirmBtnText** (String) - Optional - Text of the confirm button. Defaults to 'Okay'. - **confirmBtnTap** (Function) - Optional - Function that handles click of confirm button. Defaults to () => Navigator.pop(context). - **confirmBtnColor** (Color) - Optional - Color of the confirm button. Defaults to Colors.blue. - **showCancelBtn** (bool) - Optional - Determines if cancel button is shown or not. Defaults to false. - **cancelBtnText** (String) - Optional - Text of the cancel button. Defaults to 'Cancel'. - **cancelBtnTap** (Function) - Optional - Function that handles click of cancel button. Defaults to () => Navigator.pop(context). - **barrierDismissible** (bool) - Optional - Dismiss dialog on touch overlay. Defaults to true. - **animType** (QuickAlertAnimType) - Optional - Type of dialog enter animation. Defaults to QuickAlertAnimType.scale. - **confirmBtnTextStyle** (TextStyle) - Optional - Confirm button text theme. Defaults to TextStyle(color: Colors.white, fontWeight: FontWeight.w600, fontSize: 18.0). - **cancelBtnTextStyle** (TextStyle) - Optional - Cancel button text theme. Defaults to TextStyle(color: Colors.grey, fontWeight: FontWeight.w600, fontSize: 18.0). - **customAsset** (String) - Optional - Asset path of your custom asset. Defaults to null. - **autoCloseDuration** (Duration) - Optional - Determines how long the dialog stays open for before closing. Defaults to null. - **width** (double) - Optional - Dialog width. Defaults to MediaQuery.of(context).size.shortestSide. ### Usage Example ```dart QuickAlert.show( context: context, type: QuickAlertType.success, title: 'Success', text: 'Operation completed successfully', ); ``` ### Notes - The QuickAlert class is used to display alert dialogs in Flutter applications. - The type parameter is required and determines the default appearance and behavior of the dialog. - All other parameters are optional and can be used to customize the dialog. ``` -------------------------------- ### Set runtime output directory to intermediates_do_not_run Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Configures the CMake build to place the application binary in a subdirectory named 'intermediates_do_not_run' to prevent users from running the unbundled copy. This ensures resources are in the correct relative locations. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Set Flutter managed directory and add subdirectory Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Sets the Flutter managed directory path and adds it as a subdirectory to include Flutter library and tool build rules. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Add APPLICATION_ID definition Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Adds a compile definition for the application ID using the APPLICATION_ID variable. ```cmake add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Define apply_standard_settings function for compile options Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Defines a CMake function that applies standard compile settings to a target, including C++14 standard, warnings as errors, and optimization flags for non-Debug configurations. ```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() ``` -------------------------------- ### Configure Windows runner build with CMake Source: https://github.com/belovance/quickalert/blob/master/example/windows/runner/CMakeLists.txt Defines the Windows application target for the Flutter runner, including source files, build settings, and dependencies. Must not be removed or modified except for adding new source files. ```cmake cmake_minimum_required(VERSION 3.14) project(runner LANGUAGES CXX) # Define the application target. To change its name, change BINARY_NAME in the # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer # work. # # Any new source files that you add to the application should be added here. add_executable(${BINARY_NAME} WIN32 "flutter_window.cpp" "main.cpp" "utils.cpp" "win32_window.cpp" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" "Runner.rc" "runner.exe.manifest" ) # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) # Disable Windows macros that collide with C++ standard library functions. target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") # Add dependency libraries and include directories. Add any application-specific # dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Add dependency on flutter_assemble Source: https://github.com/belovance/quickalert/blob/master/example/linux/CMakeLists.txt Adds a build dependency on the flutter_assemble target to run the Flutter tool portions of the build. ```cmake add_dependencies(${BINARY_NAME} flutter_assemble) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.