### Installation Bundle Configuration Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Configures the installation prefix and cleans the build bundle directory before installation. ```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 Bundle Configuration Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/CMakeLists.txt Sets up the installation prefix to create a relocatable bundle. Cleans the bundle directory before installation and defines data and library directories. ```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") ``` -------------------------------- ### Installing Application Executable Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/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) ``` -------------------------------- ### Installing Flutter Library Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Installs the main Flutter library file to the bundle library directory. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Application Executable and Data Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/CMakeLists.txt Installs the main executable to the bundle's root and installs Flutter's ICU data file to the data directory. ```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) ``` -------------------------------- ### Defining Installation Directories Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Sets variables for the installation directories of bundle data and libraries. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Installing Application Executable and Data Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Installs the application executable, ICU data, and Flutter library to the bundle. ```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) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Bundled Libraries and Assets Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Installs bundled libraries and the Flutter assets directory to the installation bundle. ```cmake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) # 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) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Initializes CMake, sets the minimum version, and defines the project name and language. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) ``` -------------------------------- ### Installing Bundled Plugin Libraries Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Installs any bundled plugin libraries to the bundle library directory if they exist. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Setting Installation Prefix for Bundle Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Configures the installation prefix to be next to the executable for in-place running, especially 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() ``` -------------------------------- ### Android Manifest with Package Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/README.md An example of an AndroidManifest.xml file including the package attribute. ```xml ``` -------------------------------- ### Installing AOT Library Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library to the bundle data directory, but only for Profile and Release configurations. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter Library and Bundled Plugins Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/CMakeLists.txt Installs the main Flutter library and any bundled plugin libraries into the bundle's lib directory. ```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) ``` -------------------------------- ### Basic Usage Example Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/README.md Demonstrates how to initialize the AppinioSocialShare service and use it within a Flutter widget to share an image to WhatsApp after picking it. ```dart class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override State createState() => _MyAppState(); } class _MyAppState extends State { AppinioSocialShare appinioSocialShare = AppinioSocialShare(); @override Widget build(BuildContext context) { return MaterialApp( title: "Share Feature", home: Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ ElevatedButton( child: const Text("ShareToWhatsapp"), onPressed: () async { FilePickerResult? result = await FilePicker.platform .pickFiles(type: FileType.image, allowMultiple: false); if (result != null && result.paths.isNotEmpty) { shareToWhatsApp( "message", result.paths[0]!); } }, ), ], ), )); } shareToWhatsApp(String message, String filePath) async { await appinioSocialShare.android.shareToSMS(message, filePath); } } ``` -------------------------------- ### Installing ICU Data File Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Installs the ICU data file to the bundle data directory. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installing Flutter Assets Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Removes stale assets and then installs the current Flutter assets directory to the bundle data directory. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Basic Usage Example Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_animated_toggle_tab/README.md Demonstrates how to implement the AppinioAnimatedToggleTab widget with essential parameters like tab texts, dimensions, and basic styling. ```dart class TabsViewer extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoApp( home: AppinioAnimatedToggleTab( callback: (int i) {}, tabTexts: const [ 'make', 'your', 'tabs :)', ], height: 40, width: 300, boxDecoration: BoxDecoration(color: Color(0xFFc3d2db)), animatedBoxDecoration: BoxDecoration( boxShadow: [ BoxShadow( color: const Color(0xFFc3d2db).withOpacity(0.1), spreadRadius: 1, blurRadius: 5, offset: const Offset(2, 2), ), ], color: kDarkBlueColor, borderRadius: const BorderRadius.all( Radius.circular(5), ), border: Border.all( color: Colors.grey, width: 1, ), ), activeStyle: const TextStyle( color: Colors.blue,), inactiveStyle: const TextStyle( color: Colors.black,), ); } } ``` -------------------------------- ### Basic Appinio Swiper Implementation Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_swiper/README.md Demonstrates how to place and configure the AppinioSwiper within a CupertinoPageScaffold. It includes basic setup for card count, swiping callbacks, and card building. ```dart import 'package:appinio_swiper/appinio_swiper.dart'; import 'package:flutter/cupertino.dart'; class Example extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( child: SizedBox( height: MediaQuery .of(context) .size .height * 0.75, child: AppinioSwiper( cardsCount: 10, onSwiping: (AppinioSwiperDirection direction) { print(direction.toString()); }, cardsBuilder: (BuildContext context, int index) { return Container( alignment: Alignment.center, child: const Text(index.toString()), color: CupertinoColors.activeBlue, ); }, ), ), ); } } ``` -------------------------------- ### Configuring Runtime Path and Cross-Building Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/CMakeLists.txt Sets the installation RPATH to load bundled libraries and configures cross-building paths if a target system root is specified. ```cmake 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() ``` -------------------------------- ### Modern CMake Policy and RPATH Setup Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Opts into modern CMake behaviors and sets the RPATH for loading bundled libraries. ```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") ``` -------------------------------- ### Install Appinio Swiper Package Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_swiper/README.md Add the appinio_swiper package to your pubspec.yaml file or run the flutter pub add command. ```yaml flutter pub add appinio_swiper ``` -------------------------------- ### Android Manifest Configuration Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/README.md Add the manifest tag attribute to your AndroidManifest.xml file. This is a basic example. ```xml ``` -------------------------------- ### getInstalledApps Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/README.md Retrieves a map of all installed applications on the device, with a boolean indicating their availability for sharing. ```APIDOC ## getInstalledApps ### Description Get a Map of all the apps with a boolean value. ### Parameters - None ### Platform Support - iOS: Yes - Android: Yes ``` -------------------------------- ### Install AOT Library Conditionally Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/CMakeLists.txt Installs the AOT library to the runtime bundle directory only when the build type is not 'Debug'. This ensures the library is available for release builds. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Basic Timer Countdown Example Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/flutter_timer_countdown/README.md A basic example demonstrating how to use the TimerCountdown widget to display a countdown. It sets the end time and an onEnd callback. This snippet is useful for quickly integrating a countdown timer into your Flutter app. ```dart import 'package:flutter_timer_countdown/flutter_timer_countdown.dart'; import 'package:flutter/cupertino.dart'; class Example extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoPageScaffold( child: TimerCountdown( format: CountDownTimerFormat.daysHoursMinutesSeconds, endTime: DateTime.now().add( Duration( days: 5, hours: 14, minutes: 27, seconds: 34, ), ), onEnd: () { print("Timer finished"); }, ), ); } } ``` -------------------------------- ### iOS AppDelegate Setup for TikTok Sharing Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/README.md Set up the method channel for TikTok sharing in your AppDelegate. This involves initializing a FlutterMethodChannel and handling the 'tiktok_post' method call to share videos. ```swift import UIKit import Flutter import TikTokOpenSDKCore import TikTokOpenShareSDK import Foundation import Photos @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { let cntrl : FlutterViewController = self.window?.rootViewController as! FlutterViewController let tiktok_channel = FlutterMethodChannel(name: "appinio_social_share_tiktok", binaryMessenger: cntrl.binaryMessenger) tiktok_channel.setMethodCallHandler( { (call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in if call.method == "tiktok_post" { let args = call.arguments as? [String: Any?] self.shareVideoToTiktok(args: args!, result: result) }else{ result("Not implemented!") } }) GeneratedPluginRegistrant.register(with: self) if #available(iOS 10.0, *) { UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate } return super.application(application, didFinishLaunchingWithOptions: launchOptions) } override func application(_ app: UIApplication,open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool { ``` -------------------------------- ### Add Dependency Libraries and Include Directories Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/runner/CMakeLists.txt Links necessary libraries and sets include directories for the application target. Application-specific dependencies should also 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_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") ``` -------------------------------- ### Basic OnBoardingSlider Usage Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/flutter_onboarding_slider/README.md Demonstrates the basic implementation of OnBoardingSlider with two pages, custom finish button text and style, skip button, and trailing login button. Includes parallax background images and page-specific content. ```dart import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_onboarding_slider/flutter_onboarding_slider.dart'; class OnBoarding extends StatelessWidget { @override Widget build(BuildContext context) { return CupertinoApp( home: OnBoardingSlider( headerBackgroundColor: Colors.white, finishButtonText: 'Register', finishButtonStyle: FinishButtonStyle( backgroundColor: Colors.black, ), skipTextButton: Text('Skip'), trailing: Text('Login'), background: [ Image.asset('assets/slide_1.png'), Image.asset('assets/slide_2.png'), ], totalPage: 2, speed: 1.8, pageBodies: [ Container( padding: EdgeInsets.symmetric(horizontal: 40), child: Column( children: [ SizedBox( height: 480, ), Text('Description Text 1'), ], ), ), Container( padding: EdgeInsets.symmetric(horizontal: 40), child: Column( children: [ SizedBox( height: 480, ), Text('Description Text 2'), ], ), ), ], ), ); } } ``` -------------------------------- ### Basic CMake Configuration Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/windows/flutter/CMakeLists.txt Sets the minimum CMake version and defines an ephemeral directory for generated files. ```cmake cmake_minimum_required(VERSION 3.14) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") ``` -------------------------------- ### Basic Video Player Usage Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_video_player/README.md Demonstrates how to initialize and use the CustomVideoPlayer widget with a network video source. Ensure the VideoPlayerController is initialized before passing it to the CustomVideoPlayerController. ```dart class _MyHomePageState extends State { late VideoPlayerController videoPlayerController; late CustomVideoPlayerController _customVideoPlayerController; String videoUrl = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"; @override void initState() { super.initState(); videoPlayerController = VideoPlayerController.network(videoUrl) ..initialize().then((value) => setState(() {})); _customVideoPlayerController = CustomVideoPlayerController( context: context, videoPlayerController: videoPlayerController, ); } @override void dispose() { _customVideoPlayerController.dispose(); super.dispose(); } @override Widget build(BuildContext context) { return CupertinoPageScaffold( navigationBar: CupertinoNavigationBar( middle: Text(widget.title), ), child: SafeArea( child: CustomVideoPlayer( customVideoPlayerController: _customVideoPlayerController ), ), ); } } ``` -------------------------------- ### Apply Standard Build Settings Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/runner/CMakeLists.txt Applies a standard set of build settings to the specified target. This can be removed if custom build settings are required. ```cmake # Apply the standard set of build settings. This can be removed for applications # that need different build settings. apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Enabling Unicode Support Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Adds preprocessor definitions to enable Unicode support for all projects. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Flutter Integration and System Dependencies Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/CMakeLists.txt Includes the Flutter managed directory and finds necessary system libraries like GTK using PkgConfig. Defines the application ID as a preprocessor macro. ```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}") ``` -------------------------------- ### Find and check GTK, GLIB, and GIO modules Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/flutter/CMakeLists.txt Uses PkgConfig to find and check for the required GTK, GLIB, and GIO libraries. These are essential system-level dependencies for GTK-based Flutter applications on Linux. ```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) ``` -------------------------------- ### Configuring Build Types (Multi-Config Generators) Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Sets the available build configurations (Debug, Profile, Release) for multi-configuration CMake generators. ```cmake set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) ``` -------------------------------- ### Application Target Definition Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/CMakeLists.txt Defines the main executable target for the application, listing all source files including generated plugin registration. Applies standard build settings. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Flutter and System Dependencies Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Adds the Flutter subdirectory and checks for GTK+ 3.0 using PkgConfig. ```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}") ``` -------------------------------- ### Application Executable Definition Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Defines the main executable for the application, including source files and generated plugin registrant. ```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}) # Add dependency libraries. Add any application-specific dependencies here. target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Cross-Building Configuration Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Configures CMake for cross-building by setting the sysroot and search paths. ```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() ``` -------------------------------- ### Including Generated Plugins Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Includes the CMake script that manages building and adding generated plugins to the application. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Flutter Wrapper Plugin Library Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/windows/flutter/CMakeLists.txt Creates a static library for the Flutter wrapper intended for plugins, linking against the Flutter library and setting visibility. ```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) ``` -------------------------------- ### Importing the Package Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_animated_toggle_tab/README.md Add this import statement to your Dart file to use the AppinioAnimatedToggleTab widget. ```dart import 'package:appinio_animated_toggle_tab/appinio_animated_toggle_tab.dart'; ``` -------------------------------- ### Including Runner Subdirectory Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Includes the 'runner' subdirectory, which contains application-specific build configurations. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Project and Executable Configuration Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Sets the minimum CMake version, project name, executable name, and application ID for a Flutter Linux 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 "example") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "com.example.example") ``` -------------------------------- ### Flutter Wrapper Application Library Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/windows/flutter/CMakeLists.txt Creates a static library for the Flutter wrapper used by the application runner, linking 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) ``` -------------------------------- ### Add Preprocessor Definitions for Build Version Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/windows/runner/CMakeLists.txt Sets preprocessor definitions for the build version, including major, minor, patch, and build numbers. This allows the application to access version information 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}") ``` -------------------------------- ### Setting Runtime Output Directory Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/CMakeLists.txt Configures the runtime output directory for the executable to a subdirectory, preventing direct execution of unbundled copies. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Integrate Flutter Build Process Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/runner/CMakeLists.txt Ensures that the Flutter tool portions of the build are executed. This dependency must not be removed for the Flutter build to function correctly. ```cmake # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Build Type Configuration Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/linux/CMakeLists.txt Sets the default build type to 'Debug' if not already configured. ```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() ``` -------------------------------- ### C++ Wrapper Core Sources Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/windows/flutter/CMakeLists.txt Defines the core C++ wrapper source files needed for both plugin and application builds. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") ``` -------------------------------- ### Flutter Library Headers Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/widget_zoom/example/windows/flutter/CMakeLists.txt Appends Flutter library header files to a list and prepends the ephemeral directory path to each. ```cmake list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") ``` -------------------------------- ### Enabling Modern CMake Behaviors Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/windows/CMakeLists.txt Explicitly opts into modern CMake behaviors to prevent warnings in newer CMake versions. ```cmake cmake_policy(SET CMP0063 NEW) ``` -------------------------------- ### Custom command for Flutter tool backend Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/example/linux/flutter/CMakeLists.txt A custom CMake command to execute the Flutter tool backend script. This command is designed to run every time due to the use of a dummy output file, ensuring the build is always up-to-date with Flutter tool configurations. ```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 ) ``` -------------------------------- ### iOS AppDelegate Configuration for Facebook SDK Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_social_share/README.md Integrate the Facebook SDK by adding these lines to your AppDelegate's application function. Ensure FBSDKCoreKit is imported. ```swift import FBSDKCoreKit // Put these lines in the application function FBSDKCoreKit.ApplicationDelegate.shared.application( application, didFinishLaunchingWithOptions: launchOptions ) ``` -------------------------------- ### Web Service Worker Loading Logic Source: https://github.com/appiniogmbh/flutter_packages/blob/main/packages/appinio_video_player/example/web/index.html This JavaScript code handles the registration and loading of the service worker for the web version of the Appinio Video Player. It includes logic to wait for service worker activation, handle updates, and fall back to a plain script tag if loading fails. ```javascript var serviceWorkerVersion = null; var scriptLoaded = false; function loadMainDartJs() { if (scriptLoaded) { return; } scriptLoaded = true; var scriptTag = document.createElement('script'); scriptTag.src = 'main.dart.js'; scriptTag.type = 'application/javascript'; document.body.append(scriptTag); } if ('serviceWorker' in navigator) { // Service workers are supported. // Use them. window.addEventListener('load', function () { // Wait for registration to finish before dropping the