├── .fvmrc ├── rich_clipboard ├── example │ ├── linux │ │ ├── .gitignore │ │ ├── main.cc │ │ ├── flutter │ │ │ ├── generated_plugin_registrant.h │ │ │ ├── generated_plugin_registrant.cc │ │ │ ├── generated_plugins.cmake │ │ │ └── CMakeLists.txt │ │ ├── my_application.h │ │ ├── my_application.cc │ │ └── CMakeLists.txt │ ├── ios │ │ ├── Runner │ │ │ ├── Runner-Bridging-Header.h │ │ │ ├── Assets.xcassets │ │ │ │ ├── LaunchImage.imageset │ │ │ │ │ ├── LaunchImage.png │ │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ │ ├── README.md │ │ │ │ │ └── Contents.json │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ │ └── Contents.json │ │ │ ├── AppDelegate.swift │ │ │ ├── Base.lproj │ │ │ │ ├── Main.storyboard │ │ │ │ └── LaunchScreen.storyboard │ │ │ └── Info.plist │ │ ├── Flutter │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ └── AppFrameworkInfo.plist │ │ ├── Runner.xcodeproj │ │ │ ├── project.xcworkspace │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata │ │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── .gitignore │ │ ├── Podfile │ │ └── Podfile.lock │ ├── android │ │ ├── gradle.properties │ │ ├── app │ │ │ ├── src │ │ │ │ ├── main │ │ │ │ │ ├── res │ │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── drawable │ │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── values │ │ │ │ │ │ │ └── styles.xml │ │ │ │ │ │ └── values-night │ │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── kotlin │ │ │ │ │ │ └── com │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ └── profile │ │ │ │ │ └── AndroidManifest.xml │ │ │ └── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ ├── .gitignore │ │ ├── settings.gradle │ │ └── build.gradle │ ├── macos │ │ ├── Runner │ │ │ ├── Configs │ │ │ │ ├── Debug.xcconfig │ │ │ │ ├── Release.xcconfig │ │ │ │ ├── Warnings.xcconfig │ │ │ │ └── AppInfo.xcconfig │ │ │ ├── Assets.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ ├── app_icon_64.png │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ └── Contents.json │ │ │ ├── AppDelegate.swift │ │ │ ├── Release.entitlements │ │ │ ├── DebugProfile.entitlements │ │ │ ├── MainFlutterWindow.swift │ │ │ └── Info.plist │ │ ├── .gitignore │ │ ├── Flutter │ │ │ ├── Flutter-Debug.xcconfig │ │ │ ├── Flutter-Release.xcconfig │ │ │ └── GeneratedPluginRegistrant.swift │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Runner.xcodeproj │ │ │ ├── project.xcworkspace │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Podfile │ │ ├── Podfile.lock │ │ └── RunnerTests │ │ │ └── RunnerTests.swift │ ├── web │ │ ├── favicon.png │ │ ├── icons │ │ │ ├── Icon-192.png │ │ │ ├── Icon-512.png │ │ │ ├── Icon-maskable-192.png │ │ │ └── Icon-maskable-512.png │ │ ├── manifest.json │ │ └── index.html │ ├── windows │ │ ├── runner │ │ │ ├── resources │ │ │ │ └── app_icon.ico │ │ │ ├── resource.h │ │ │ ├── CMakeLists.txt │ │ │ ├── utils.h │ │ │ ├── runner.exe.manifest │ │ │ ├── flutter_window.h │ │ │ ├── main.cpp │ │ │ ├── utils.cpp │ │ │ ├── flutter_window.cpp │ │ │ ├── Runner.rc │ │ │ └── win32_window.h │ │ ├── .gitignore │ │ ├── flutter │ │ │ ├── generated_plugin_registrant.h │ │ │ ├── generated_plugin_registrant.cc │ │ │ ├── generated_plugins.cmake │ │ │ └── CMakeLists.txt │ │ └── CMakeLists.txt │ ├── README.md │ ├── integration_test │ │ └── rich_clipboard_test.dart │ ├── .gitignore │ ├── .metadata │ ├── pubspec.yaml │ ├── lib │ │ ├── pages │ │ │ ├── widgets_from_html.dart │ │ │ └── flutter_clipboard.dart │ │ └── main.dart │ └── analysis_options.yaml ├── CHANGELOG.md ├── pubspec.yaml ├── LICENSE ├── lib │ └── rich_clipboard.dart └── README.md ├── rich_clipboard_ios ├── CHANGELOG.md ├── lib │ └── rich_clipboard_ios.dart ├── README.md ├── pubspec.yaml ├── ios │ ├── rich_clipboard_ios.podspec │ └── Classes │ │ └── RichClipboardPlugin.swift └── LICENSE ├── rich_clipboard_android ├── android │ ├── settings.gradle │ ├── .gitignore │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── src │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ └── kotlin │ │ │ └── com │ │ │ └── bringingfire │ │ │ └── rich_clipboard │ │ │ └── RichClipboardPlugin.kt │ ├── build.gradle │ └── gradlew.bat ├── CHANGELOG.md ├── lib │ └── rich_clipboard_android.dart ├── README.md ├── pubspec.yaml └── LICENSE ├── rich_clipboard_linux ├── .gitignore ├── lib │ ├── src │ │ └── rich_clipboard_linux.dart │ └── rich_clipboard_linux.dart ├── CHANGELOG.md ├── linux │ ├── .gitignore │ ├── CMakeLists.txt │ └── include │ │ └── rich_clipboard_linux │ │ └── rich_clipboard_plugin.h ├── README.md ├── pubspec.yaml └── LICENSE ├── pubspec.yaml ├── analysis_options.yaml ├── rich_clipboard_macos ├── lib │ └── rich_clipboard_macos.dart ├── CHANGELOG.md ├── README.md ├── pubspec.yaml ├── macos │ ├── rich_clipboard_macos.podspec │ └── Classes │ │ └── RichClipboardPlugin.swift └── LICENSE ├── .metadata ├── rich_clipboard_web ├── CHANGELOG.md ├── README.md ├── pubspec.yaml ├── LICENSE └── lib │ └── rich_clipboard_web.dart ├── rich_clipboard_platform_interface ├── CHANGELOG.md ├── pubspec.yaml ├── lib │ ├── src │ │ ├── fallback_rich_clipboard.dart │ │ ├── method_channel_rich_clipboard.dart │ │ └── rich_clipboard_data.dart │ └── rich_clipboard_platform_interface.dart ├── README.md └── LICENSE ├── rich_clipboard_windows ├── CHANGELOG.md ├── README.md ├── pubspec.yaml ├── LICENSE ├── test │ └── html_utilities_test.dart └── lib │ ├── rich_clipboard_windows.dart │ └── src │ └── html_utilities.dart ├── .vscode ├── c_cpp_properties.json └── launch.json ├── README.md ├── .gitignore ├── melos.yaml ├── .github ├── workflows │ └── ci.yml └── actions │ └── setup │ └── action.yml └── LICENSE /.fvmrc: -------------------------------------------------------------------------------- 1 | { 2 | "flutter": "3.19.1" 3 | } -------------------------------------------------------------------------------- /rich_clipboard/example/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /rich_clipboard_ios/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | - Initial release. -------------------------------------------------------------------------------- /rich_clipboard_android/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'rich_clipboard_android' 2 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /rich_clipboard_linux/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .dart_tool/ 3 | 4 | .packages 5 | .pub/ 6 | 7 | build/ 8 | -------------------------------------------------------------------------------- /rich_clipboard_android/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.1 2 | 3 | - Removing Kotlin version dependency. 4 | 5 | ## 1.0.0 6 | 7 | - Initial release. -------------------------------------------------------------------------------- /rich_clipboard/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /rich_clipboard/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/web/favicon.png -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /rich_clipboard/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /rich_clipboard/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /rich_clipboard/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_workspace 2 | publish_to: 'none' 3 | 4 | environment: 5 | sdk: '>=3.0.0 <4.0.0' 6 | 7 | dev_dependencies: 8 | melos: ^4.1.0 9 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /rich_clipboard_android/android/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures -------------------------------------------------------------------------------- /rich_clipboard/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /rich_clipboard/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /rich_clipboard_ios/lib/rich_clipboard_ios.dart: -------------------------------------------------------------------------------- 1 | export 'package:rich_clipboard_platform_interface/rich_clipboard_platform_interface.dart' 2 | show MethodChannelRichClipboard; 3 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /rich_clipboard_android/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard_android/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /rich_clipboard_android/lib/rich_clipboard_android.dart: -------------------------------------------------------------------------------- 1 | export 'package:rich_clipboard_platform_interface/rich_clipboard_platform_interface.dart' 2 | show MethodChannelRichClipboard; 3 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /rich_clipboard_android/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /rich_clipboard/example/linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BringingFire/rich_clipboard/HEAD/rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /rich_clipboard_linux/lib/src/rich_clipboard_linux.dart: -------------------------------------------------------------------------------- 1 | // Re-export the default method channel implementation so flutter code gen can 2 | // find it. 3 | export 'package:rich_clipboard_platform_interface/rich_clipboard_platform_interface.dart' 4 | show MethodChannelRichClipboard; 5 | -------------------------------------------------------------------------------- /rich_clipboard_macos/lib/rich_clipboard_macos.dart: -------------------------------------------------------------------------------- 1 | // Re-export the default method channel implementation so flutter code gen can 2 | // find it. 3 | export 'package:rich_clipboard_platform_interface/rich_clipboard_platform_interface.dart' 4 | show MethodChannelRichClipboard; 5 | -------------------------------------------------------------------------------- /rich_clipboard_android/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /rich_clipboard_linux/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.1 2 | 3 | - Copying with plain text or html set to null no longer causes a crash 4 | - Setting empty data now correctly clears the clipboard 5 | 6 | ## 1.0.0 7 | 8 | - Promoting package to stable with version 1.0.0 9 | 10 | ## 0.0.1 11 | 12 | - Initial release. 13 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rich_clipboard_macos/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.1 2 | 3 | - Fixing a bug where setData would fail if html was unset. 4 | 5 | ## 1.0.0 6 | 7 | - Promoting package to stable with version 1.0.0. 8 | 9 | ## 0.0.2 10 | 11 | - Fixing broken link in readme; no functional changes. 12 | 13 | ## 0.0.1 14 | 15 | - Initial release. -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /rich_clipboard_linux/lib/rich_clipboard_linux.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022, Very Good Ventures 2 | // https://verygood.ventures 3 | // 4 | // Use of this source code is governed by an MIT-style 5 | // license that can be found in the LICENSE file or at 6 | // https://opensource.org/licenses/MIT. 7 | 8 | export 'src/rich_clipboard_linux.dart'; 9 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7e9793dee1b85a243edd0e06cb1658e98b077561 8 | channel: stable 9 | 10 | project_type: plugin 11 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rich_clipboard_web/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.2 2 | 3 | - Fixing compilation in Flutter 3.7.0 / Dart 2.19. 4 | 5 | ## 1.0.1 6 | 7 | - Fixing an issue where copying multibyte characters would place invalid unicode in the clipboard. 8 | 9 | ## 1.0.0 10 | 11 | - Promoting package to stable with version 1.0.0. 12 | 13 | ## 0.0.1 14 | 15 | - Initial release. 16 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /rich_clipboard_linux/linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /rich_clipboard_platform_interface/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Promoting package to stable with version 1.0.0 4 | 5 | - **FIX**: Only return a non-empty array if text data exists in the clipboard in the fallback implementation. 6 | 7 | ## 0.0.1 8 | 9 | - Initial release. 10 | - Includes a default `MethodChannel` implementation and a fallback 11 | implementation that wraps Flutter's built-in `Clipboard`. -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /rich_clipboard/example/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | UrlLauncherWindowsRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 14 | } 15 | -------------------------------------------------------------------------------- /rich_clipboard_windows/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.3 2 | 3 | - Updating win32 dependency to ">=5.0.0" 4 | 5 | ## 1.0.2 6 | 7 | - Updating win32 dependency to ">=2.5.1 <5.0.0" 8 | 9 | ## 1.0.1 10 | 11 | - Updating ffi dependency to ">=1.1.2 <3.0.0" 12 | 13 | ## 1.0.0 14 | 15 | - Promoting package to stable with version 1.0.0 16 | 17 | ## 0.0.2 18 | 19 | - Fixing broken link in readme; no functional changes. 20 | 21 | ## 0.0.1 22 | 23 | - Initial release. -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /rich_clipboard/example/linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /rich_clipboard_ios/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard_ios 2 | 3 | [![Pub Version](https://img.shields.io/pub/v/rich_clipboard_ios)](https://pub.dev/packages/rich_clipboard_ios) 4 | 5 | The iOS implementation of [`rich_clipboard`][1]. 6 | 7 | ## Usage 8 | 9 | This package is [endorsed][2], which means you can just use `rich_clipboard` 10 | normally. This package will be automatically included in your app when you do. 11 | 12 | [1]: https://pub.dev/packages/rich_clipboard 13 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 14 | -------------------------------------------------------------------------------- /rich_clipboard_macos/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard_macos 2 | 3 | [![Pub Version](https://img.shields.io/pub/v/rich_clipboard_macos)](https://pub.dev/packages/rich_clipboard_macos) 4 | 5 | The macOS implementation of [`rich_clipboard`][1]. 6 | 7 | ## Usage 8 | 9 | This package is [endorsed][2], which means you can just use `rich_clipboard` 10 | normally. This package will be automatically included in your app when you do. 11 | 12 | [1]: https://pub.dev/packages/rich_clipboard 13 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin -------------------------------------------------------------------------------- /rich_clipboard_web/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard_web 2 | 3 | [![Pub Version](https://img.shields.io/pub/v/rich_clipboard_web)](https://pub.dev/packages/rich_clipboard_web) 4 | 5 | The web implementation of [`rich_clipboard`][1]. 6 | 7 | ## Usage 8 | 9 | This package is [endorsed][2], which means you can just use `rich_clipboard` 10 | normally. This package will be automatically included in your app when you do. 11 | 12 | [1]: https://pub.dev/packages/rich_clipboard 13 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 14 | -------------------------------------------------------------------------------- /rich_clipboard_linux/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard_linux 2 | 3 | [![Pub Version](https://img.shields.io/pub/v/rich_clipboard_linux)](https://pub.dev/packages/rich_clipboard_linux) 4 | 5 | The Linux implementation of [`rich_clipboard`][1]. 6 | 7 | ## Usage 8 | 9 | This package is [endorsed][2], which means you can simply use `rich_clipboard` 10 | normally. This package will be automatically included in your app when you do. 11 | 12 | [1]: https://pub.dev/packages/rich_clipboard 13 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 14 | -------------------------------------------------------------------------------- /rich_clipboard/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.1 2 | 3 | - Modifying example project pubspec to keep pub's package analysis happy 4 | 5 | ## 1.0.0 6 | 7 | - Promoting package to stable with version 1.0.0 8 | 9 | ## 0.1.1 10 | 11 | - Fixing README, no functional changes. 12 | 13 | ## 0.1.0 14 | 15 | - Adding endorsed web implementation. 16 | 17 | ## 0.0.3 18 | 19 | - Adding endorsed Linux implementation. 20 | 21 | ## 0.0.2 22 | 23 | - Fixing typo in readme file; no functional changes. 24 | 25 | ## 0.0.1 26 | 27 | - Initial release. 28 | - Includes support for plain text and HTML clipboard content. -------------------------------------------------------------------------------- /rich_clipboard_android/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard_android 2 | 3 | [![Pub Version](https://img.shields.io/pub/v/rich_clipboard_android)](https://pub.dev/packages/rich_clipboard_android) 4 | 5 | The Android implementation of [`rich_clipboard`][1]. 6 | 7 | ## Usage 8 | 9 | This package is [endorsed][2], which means you can just use `rich_clipboard` 10 | normally. This package will be automatically included in your app when you do. 11 | 12 | [1]: https://pub.dev/packages/rich_clipboard 13 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 14 | -------------------------------------------------------------------------------- /rich_clipboard_windows/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard_windows 2 | 3 | [![Pub Version](https://img.shields.io/pub/v/rich_clipboard_windows)](https://pub.dev/packages/rich_clipboard_windows) 4 | 5 | The Windows implementation of [`rich_clipboard`][1]. 6 | 7 | ## Usage 8 | 9 | This package is [endorsed][2], which means you can just use `rich_clipboard` 10 | normally. This package will be automatically included in your app when you do. 11 | 12 | [1]: https://pub.dev/packages/rich_clipboard 13 | [2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin 14 | -------------------------------------------------------------------------------- /rich_clipboard_platform_interface/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_platform_interface 2 | description: A common platform interface for the rich_clipboard plugin. 3 | homepage: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_platform_interface 4 | repository: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_platform_interface 5 | version: 1.0.0 6 | 7 | environment: 8 | sdk: ">=2.17.0 <3.0.0" 9 | flutter: ">=2.5.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | plugin_platform_interface: ^2.1.2 15 | 16 | dev_dependencies: 17 | flutter_lints: ^2.0.0 18 | flutter_test: 19 | sdk: flutter -------------------------------------------------------------------------------- /rich_clipboard/example/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard_example 2 | 3 | Demonstrates how to use the rich_clipboard plugin. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "utils.cpp" 8 | "win32_window.cpp" 9 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 10 | "Runner.rc" 11 | "runner.exe.manifest" 12 | ) 13 | apply_standard_settings(${BINARY_NAME}) 14 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 15 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 16 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 17 | add_dependencies(${BINARY_NAME} flutter_assemble) 18 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Linux", 5 | "includePath": [ 6 | "${workspaceFolder}/rich_clipboard/example/linux/flutter/ephemeral/**", 7 | "/usr/include/gtk-3.0/**", 8 | "/usr/include/glib-2.0/**", 9 | "/usr/lib/glib-2.0/include/**", 10 | "/usr/lib/graphene-1.0/include/**" 11 | ], 12 | "defines": [], 13 | "compilerPath": "/usr/bin/clang", 14 | "cStandard": "c17", 15 | "cppStandard": "c++20", 16 | "intelliSenseMode": "linux-clang-x64" 17 | } 18 | ], 19 | "version": 4 20 | } -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = rich_clipboard_example 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.richClipboardExample 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /rich_clipboard_linux/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_linux 2 | description: Linux implementation of the rich_clipboard plugin. 3 | homepage: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_linux 4 | repository: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_linux 5 | version: 1.0.1 6 | 7 | environment: 8 | sdk: ">=2.17.0 <3.0.0" 9 | flutter: ">=2.10.0" 10 | 11 | flutter: 12 | plugin: 13 | implements: rich_clipboard 14 | platforms: 15 | linux: 16 | pluginClass: RichClipboardPlugin 17 | dartPluginClass: MethodChannelRichClipboard 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | rich_clipboard_platform_interface: ^1.0.0 23 | dev_dependencies: 24 | flutter_lints: ^2.0.0 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard 2 | 3 | [![CI](https://github.com/BringingFire/rich_clipboard/actions/workflows/ci.yml/badge.svg)](https://github.com/BringingFire/rich_clipboard/actions/workflows/ci.yml) 4 | 5 | > [!WARNING] 6 | > This plugin is deprecated and no longer maintained. Users should consider switching to [super_clipboard][3]. 7 | 8 | A Flutter plugin providing access to additional data types in the system 9 | clipboard. Please refer to the [rich_clipboard][1] subdirectory for the full 10 | readme. 11 | 12 | This project uses [Melos][2] to make managing multiple packages easier. Please 13 | refer to that tool's documentation for installation instructions. 14 | 15 | [1]: ./rich_clipboard 16 | [2]: https://melos.invertase.dev/ 17 | [3]: https://pub.dev/packages/super_clipboard -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 25 | pubspec.lock 26 | !/pubspec.lock 27 | pubspec_overrides.yaml 28 | **/doc/api/ 29 | .dart_tool/ 30 | .packages 31 | build/ 32 | 33 | # Ignore generated code 34 | *.g.dart 35 | *.mocks.dart 36 | 37 | # FVM Version Cache 38 | .fvm/ -------------------------------------------------------------------------------- /rich_clipboard_linux/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | set(PROJECT_NAME "rich_clipboard_linux") 3 | project(${PROJECT_NAME} LANGUAGES CXX) 4 | 5 | set(PLUGIN_NAME "${PROJECT_NAME}_plugin") 6 | 7 | list(APPEND PLUGIN_SOURCES 8 | "rich_clipboard_linux_plugin.cc" 9 | ) 10 | 11 | add_library(${PLUGIN_NAME} SHARED 12 | ${PLUGIN_SOURCES} 13 | ) 14 | apply_standard_settings(${PLUGIN_NAME}) 15 | set_target_properties(${PLUGIN_NAME} PROPERTIES 16 | CXX_VISIBILITY_PRESET hidden) 17 | target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) 18 | target_include_directories(${PLUGIN_NAME} INTERFACE 19 | "${CMAKE_CURRENT_SOURCE_DIR}/include") 20 | target_link_libraries(${PLUGIN_NAME} PRIVATE flutter) 21 | target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK) 22 | -------------------------------------------------------------------------------- /rich_clipboard_macos/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_macos 2 | description: macOS implementation of the rich_clipboard plugin. 3 | homepage: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_macos 4 | repository: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_macos 5 | version: 1.0.1 6 | 7 | environment: 8 | sdk: ">=2.17.0 <3.0.0" 9 | flutter: ">=2.5.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | rich_clipboard_platform_interface: ^1.0.0 15 | dev_dependencies: 16 | flutter_lints: ^2.0.0 17 | flutter_test: 18 | sdk: flutter 19 | 20 | flutter: 21 | plugin: 22 | implements: rich_clipboard 23 | platforms: 24 | macos: 25 | pluginClass: RichClipboardPlugin 26 | dartPluginClass: MethodChannelRichClipboard -------------------------------------------------------------------------------- /rich_clipboard_ios/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_ios 2 | description: iOS implementation of the rich_clipboard plugin 3 | homepage: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_ios 4 | repository: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_ios 5 | version: 1.0.0 6 | 7 | environment: 8 | sdk: ">=2.17.0 <3.0.0" 9 | flutter: ">=3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | rich_clipboard_platform_interface: ^1.0.0 15 | 16 | dev_dependencies: 17 | flutter_lints: ^2.0.0 18 | flutter_test: 19 | sdk: flutter 20 | plugin_platform_interface: ^2.0.0 21 | 22 | flutter: 23 | plugin: 24 | implements: rich_clipboard 25 | platforms: 26 | ios: 27 | pluginClass: RichClipboardPlugin 28 | dartPluginClass: MethodChannelRichClipboard -------------------------------------------------------------------------------- /melos.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard 2 | repository: https://github.com/BringingFire/rich_clipboard 3 | 4 | packages: 5 | - rich_clipboard 6 | - rich_clipboard/example 7 | - rich_clipboard_platform_interface 8 | - rich_clipboard_macos 9 | - rich_clipboard_windows 10 | - rich_clipboard_linux 11 | - rich_clipboard_web 12 | - rich_clipboard_android 13 | - rich_clipboard_ios 14 | 15 | scripts: 16 | analyze: 17 | exec: dart analyze . 18 | generate: 19 | exec: flutter pub run build_runner build --delete-conflicting-outputs 20 | packageFilters: 21 | dependsOn: build_runner 22 | test: 23 | run: flutter test -r expanded 24 | exec: 25 | fail-fast: true 26 | select-package: 27 | dir-exists: test 28 | 29 | command: 30 | bootstrap: 31 | hooks: 32 | post: dart run melos run generate 33 | -------------------------------------------------------------------------------- /rich_clipboard/example/integration_test/rich_clipboard_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:rich_clipboard/rich_clipboard.dart'; 4 | 5 | void main() { 6 | test('getData works with plain text', () async { 7 | const text = 'Hello there'; 8 | await Clipboard.setData(const ClipboardData(text: text)); 9 | final rcData = await RichClipboard.getData(); 10 | expect(rcData.html, isNull); 11 | expect(rcData.text, text); 12 | }); 13 | 14 | test('setData works with plain text', () async { 15 | const text = 'Hello there'; 16 | await RichClipboard.setData(const RichClipboardData(text: text)); 17 | final data = await Clipboard.getData(Clipboard.kTextPlain); 18 | expect(data, isNotNull); 19 | expect(data!.text, text); 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /rich_clipboard/example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) rich_clipboard_linux_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "RichClipboardPlugin"); 15 | rich_clipboard_plugin_register_with_registrar(rich_clipboard_linux_registrar); 16 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 18 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /rich_clipboard_web/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_web 2 | description: Web implementation of the rich_clipboard plugin. 3 | homepage: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_web 4 | repository: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_web 5 | version: 1.0.2 6 | 7 | environment: 8 | sdk: ">=2.17.0 <3.0.0" 9 | flutter: ">=2.5.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | flutter_web_plugins: 15 | sdk: flutter 16 | js: ^0.6.4 17 | rich_clipboard_platform_interface: ^1.0.0 18 | dev_dependencies: 19 | flutter_lints: ^2.0.0 20 | flutter_test: 21 | sdk: flutter 22 | 23 | flutter: 24 | plugin: 25 | implements: rich_clipboard 26 | platforms: 27 | web: 28 | pluginClass: RichClipboardWeb 29 | fileName: rich_clipboard_web.dart 30 | -------------------------------------------------------------------------------- /rich_clipboard_linux/linux/include/rich_clipboard_linux/rich_clipboard_plugin.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_PLUGIN_MY_PLUGIN_LINUX_PLUGIN_H_ 2 | #define FLUTTER_PLUGIN_MY_PLUGIN_LINUX_PLUGIN_H_ 3 | 4 | #include 5 | 6 | G_BEGIN_DECLS 7 | 8 | #ifdef FLUTTER_PLUGIN_IMPL 9 | #define FLUTTER_PLUGIN_EXPORT __attribute__((visibility("default"))) 10 | #else 11 | #define FLUTTER_PLUGIN_EXPORT 12 | #endif 13 | 14 | G_DECLARE_FINAL_TYPE(FlRichClipboardPlugin, fl_rich_clipboard_plugin, FL, 15 | MY_PLUGIN_PLUGIN, GObject) 16 | 17 | FLUTTER_PLUGIN_EXPORT FlRichClipboardPlugin* fl_rich_clipboard_plugin_new( 18 | FlPluginRegistrar* registrar); 19 | 20 | FLUTTER_PLUGIN_EXPORT void rich_clipboard_plugin_register_with_registrar( 21 | FlPluginRegistrar* registrar); 22 | 23 | G_END_DECLS 24 | 25 | #endif // FLUTTER_PLUGIN_MY_PLUGIN_LINUX_PLUGIN_H_ -------------------------------------------------------------------------------- /rich_clipboard_ios/ios/rich_clipboard_ios.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 3 | # 4 | Pod::Spec.new do |s| 5 | s.name = 'rich_clipboard_ios' 6 | s.version = '0.0.1' 7 | s.summary = 'An iOS implementation of the rich_clipboard plugin.' 8 | s.description = <<-DESC 9 | An iOS implementation of the rich_clipboard plugin. 10 | DESC 11 | s.homepage = 'https://github.com/BringingFire/rich_clipboard' 12 | s.license = { :type => 'BSD', :file => '../LICENSE' } 13 | s.author = { 'Bringing Fire' => 'engineering@bringingfire.com' } 14 | s.source = { :path => '.' } 15 | s.source_files = 'Classes/**/*' 16 | s.dependency 'Flutter' 17 | 18 | s.platform = :ios, '9.0' 19 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 20 | end 21 | -------------------------------------------------------------------------------- /rich_clipboard_android/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_android 2 | description: Android implementation of the rich_clipboard plugin 3 | homepage: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_android 4 | repository: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_android 5 | version: 1.0.1 6 | 7 | environment: 8 | sdk: ">=2.17.0 <3.0.0" 9 | flutter: ">=3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | rich_clipboard_platform_interface: ^1.0.0 15 | dev_dependencies: 16 | flutter_lints: ^2.0.0 17 | flutter_test: 18 | sdk: flutter 19 | plugin_platform_interface: ^2.0.0 20 | 21 | flutter: 22 | plugin: 23 | implements: rich_clipboard 24 | platforms: 25 | android: 26 | package: com.bringingfire.rich_clipboard 27 | pluginClass: RichClipboardPlugin 28 | dartPluginClass: MethodChannelRichClipboard 29 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_windows 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /rich_clipboard_windows/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_windows 2 | description: Windows implementation of the rich_clipboard plugin. 3 | homepage: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_windows 4 | repository: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard_windows 5 | version: 1.0.3 6 | 7 | environment: 8 | sdk: ">=3.0.0 <4.0.0" 9 | flutter: ">=2.5.0" 10 | 11 | dependencies: 12 | collection: ^1.15.0 13 | ffi: ">=1.1.2 <3.0.0" 14 | flutter: 15 | sdk: flutter 16 | rich_clipboard_platform_interface: ^1.0.0 17 | win32: ">=5.0.0" 18 | 19 | dev_dependencies: 20 | build_runner: ^2.1.10 21 | flutter_lints: ^2.0.0 22 | flutter_test: 23 | sdk: flutter 24 | mockito: ^5.1.0 25 | 26 | flutter: 27 | plugin: 28 | implements: rich_clipboard 29 | platforms: 30 | windows: 31 | dartPluginClass: RichClipboardWindows 32 | pluginClass: none 33 | -------------------------------------------------------------------------------- /rich_clipboard/example/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | rich_clipboard_linux 7 | url_launcher_linux 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /rich_clipboard/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /rich_clipboard_platform_interface/lib/src/fallback_rich_clipboard.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | 3 | import '../rich_clipboard_platform_interface.dart'; 4 | 5 | /// A partial implementation of [RichClipboardPlatform] that provides 6 | /// functionality on unsupported platforms. 7 | /// 8 | /// This class uses Flutter's built-in [Clipboard] to provide plain text support 9 | /// and silently discards other content types 10 | class FallbackRichClipboard extends RichClipboardPlatform { 11 | @override 12 | Future> getAvailableTypes() async => 13 | (await Clipboard.getData(Clipboard.kTextPlain))?.text != null 14 | ? [Clipboard.kTextPlain] 15 | : []; 16 | 17 | @override 18 | Future getData() => Clipboard.getData(Clipboard.kTextPlain) 19 | .then((d) => RichClipboardData(text: d?.text)); 20 | 21 | @override 22 | Future setData(RichClipboardData data) => Clipboard.setData(data); 23 | } 24 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /rich_clipboard_macos/macos/rich_clipboard_macos.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. 3 | # Run `pod lib lint rich_clipboard.podspec` to validate before publishing. 4 | # 5 | Pod::Spec.new do |s| 6 | s.name = 'rich_clipboard_macos' 7 | s.version = '0.0.1' 8 | s.summary = 'macOS implementation of the rich_clipboard plugin.' 9 | s.description = <<-DESC 10 | Provides access to additional data types from NSClipboard via a method channel. 11 | DESC 12 | s.homepage = 'http://github.com/BringingFire/rich_clipboard' 13 | s.license = { :file => '../LICENSE' } 14 | s.author = { 'Bringing Fire' => 'engineering@bringingfire.com' } 15 | s.source = { :path => '.' } 16 | s.source_files = 'Classes/**/*' 17 | s.dependency 'FlutterMacOS' 18 | 19 | s.platform = :osx, '10.11' 20 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } 21 | s.swift_version = '5.0' 22 | end 23 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import audio_session 9 | import just_audio 10 | import path_provider_foundation 11 | import rich_clipboard_macos 12 | import sqflite 13 | import url_launcher_macos 14 | import wakelock_macos 15 | 16 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 17 | AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) 18 | JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) 19 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 20 | RichClipboardPlugin.register(with: registry.registrar(forPlugin: "RichClipboardPlugin")) 21 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) 22 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 23 | WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) 24 | } 25 | -------------------------------------------------------------------------------- /rich_clipboard/example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 17 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 18 | - platform: ios 19 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 20 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /rich_clipboard/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /rich_clipboard_android/android/build.gradle: -------------------------------------------------------------------------------- 1 | group 'com.bringingfire.rich_clipboard' 2 | version '0.0.1' 3 | 4 | buildscript { 5 | repositories { 6 | google() 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:4.1.0' 12 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 13 | } 14 | } 15 | 16 | rootProject.allprojects { 17 | repositories { 18 | google() 19 | mavenCentral() 20 | } 21 | } 22 | 23 | apply plugin: 'com.android.library' 24 | apply plugin: 'kotlin-android' 25 | 26 | android { 27 | compileSdkVersion 30 28 | 29 | compileOptions { 30 | sourceCompatibility JavaVersion.VERSION_1_8 31 | targetCompatibility JavaVersion.VERSION_1_8 32 | } 33 | 34 | kotlinOptions { 35 | jvmTarget = '1.8' 36 | } 37 | 38 | sourceSets { 39 | main.java.srcDirs += 'src/main/kotlin' 40 | } 41 | 42 | defaultConfig { 43 | minSdkVersion 16 44 | } 45 | } 46 | 47 | dependencies { 48 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 49 | } -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | env: 4 | FLUTTER_CHANNEL: stable 5 | 6 | on: 7 | push: 8 | branches: [ dev ] 9 | paths: 10 | - 'rich_clipboard*/lib/**/*' 11 | - 'rich_clipboard*/test/**/*' 12 | - '*.yml' 13 | - '*.yaml' 14 | - 'pubspec.lock' 15 | - '.github/**/*' 16 | pull_request: {} 17 | 18 | jobs: 19 | lint: 20 | name: Lint 21 | runs-on: ubuntu-latest 22 | 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v3 26 | 27 | - name: Setup 28 | uses: ./.github/actions/setup 29 | 30 | - name: Verify formatting 31 | run: flutter format --output=none --set-exit-if-changed . 32 | 33 | - name: Analyze code 34 | working-directory: rich_clipboard 35 | run: melos run analyze 36 | 37 | test-windows: 38 | name: Test (Windows) 39 | runs-on: ubuntu-latest 40 | 41 | steps: 42 | - name: Checkout 43 | uses: actions/checkout@v3 44 | 45 | - name: Setup 46 | uses: ./.github/actions/setup 47 | 48 | - name: Run tests 49 | working-directory: rich_clipboard_windows 50 | run: flutter test -------------------------------------------------------------------------------- /rich_clipboard_linux/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Very Good Ventures 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "example", 9 | "cwd": "rich_clipboard/example", 10 | "request": "launch", 11 | "program": "lib/main.dart", 12 | "type": "dart" 13 | }, 14 | { 15 | "name": "example (profile mode)", 16 | "cwd": "rich_clipboard/example", 17 | "request": "launch", 18 | "type": "dart", 19 | "program": "lib/main.dart", 20 | "flutterMode": "profile" 21 | }, 22 | { 23 | "name": "example (release mode)", 24 | "cwd": "rich_clipboard/example", 25 | "request": "launch", 26 | "type": "dart", 27 | "program": "lib/main.dart", 28 | "flutterMode": "release" 29 | }, 30 | { 31 | "name": "Debug Linux native", 32 | "type": "cppdbg", 33 | "request": "launch", 34 | "program": "${workspaceRoot}/rich_clipboard/example/build/linux/x64/debug/bundle/example", 35 | "cwd": "${workspaceFolder}" 36 | } 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /rich_clipboard_platform_interface/lib/src/method_channel_rich_clipboard.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | 3 | import '../rich_clipboard_platform_interface.dart'; 4 | 5 | const MethodChannel _channel = MethodChannel('com.bringingfire.rich_clipboard'); 6 | 7 | /// A default [RichClipboardPlatform] implementation backed by a platform 8 | /// channel. 9 | class MethodChannelRichClipboard extends RichClipboardPlatform { 10 | /// Registers this implementation. 11 | static void registerWith() { 12 | RichClipboardPlatform.instance = MethodChannelRichClipboard(); 13 | } 14 | 15 | @override 16 | Future> getAvailableTypes() async { 17 | final List? result = 18 | await _channel.invokeListMethod('getAvailableTypes'); 19 | return result ?? []; 20 | } 21 | 22 | @override 23 | Future getData() async { 24 | final data = await _channel.invokeMapMethod('getData'); 25 | if (data == null) { 26 | return const RichClipboardData(); 27 | } 28 | 29 | return RichClipboardData.fromMap(data); 30 | } 31 | 32 | @override 33 | Future setData(RichClipboardData data) async { 34 | await _channel.invokeMethod('setData', data.toMap()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /rich_clipboard/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard 2 | description: Flutter plugin for accessing rich text and other data types in the system clipboard. 3 | homepage: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard 4 | repository: https://github.com/BringingFire/rich_clipboard/tree/dev/rich_clipboard 5 | version: 1.0.1 6 | 7 | environment: 8 | sdk: ">=2.17.0 <3.0.0" 9 | flutter: ">=2.5.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | rich_clipboard_macos: ^1.0.0 15 | rich_clipboard_windows: ^1.0.0 16 | rich_clipboard_linux: ^1.0.0 17 | rich_clipboard_web: ^1.0.0 18 | rich_clipboard_android: ^1.0.0 19 | rich_clipboard_ios: ^1.0.0 20 | rich_clipboard_platform_interface: ^1.0.0 21 | dev_dependencies: 22 | flutter_test: 23 | sdk: flutter 24 | flutter_lints: ^2.0.0 25 | 26 | flutter: 27 | plugin: 28 | platforms: 29 | macos: 30 | default_package: rich_clipboard_macos 31 | windows: 32 | default_package: rich_clipboard_windows 33 | linux: 34 | default_package: rich_clipboard_linux 35 | web: 36 | default_package: rich_clipboard_web 37 | android: 38 | default_package: rich_clipboard_android 39 | ios: 40 | default_package: rich_clipboard_ios 41 | -------------------------------------------------------------------------------- /rich_clipboard/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: rich_clipboard_example 2 | description: Demonstrates how to use the rich_clipboard plugin. 3 | publish_to: 'none' 4 | 5 | environment: 6 | sdk: ">=2.17.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | 12 | rich_clipboard: 13 | path: ../ 14 | 15 | gap: ^3.0.1 16 | flutter_widget_from_html: ^0.13.0-alpha.1 17 | super_editor: ^0.2.6 18 | super_editor_markdown: ^0.1.5 19 | markdown: ^4.0.1 20 | html2md: ^1.2.5 21 | 22 | 23 | dev_dependencies: 24 | flutter_test: 25 | sdk: flutter 26 | integration_test: 27 | sdk: flutter 28 | flutter_lints: ^2.0.0 29 | 30 | dependency_overrides: 31 | rich_clipboard_macos: 32 | path: ../../rich_clipboard_macos 33 | rich_clipboard_windows: 34 | path: ../../rich_clipboard_windows 35 | rich_clipboard_linux: 36 | path: ../../rich_clipboard_linux 37 | rich_clipboard_web: 38 | path: ../../rich_clipboard_web 39 | rich_clipboard_android: 40 | path: ../../rich_clipboard_android 41 | rich_clipboard_ios: 42 | path: ../../rich_clipboard_ios 43 | rich_clipboard_platform_interface: 44 | path: ../../rich_clipboard_platform_interface 45 | # TODO: Remove these when upstream dependencies work themselves out 46 | chewie: "^1.5.0" 47 | win32: ">=5.0.0" 48 | 49 | flutter: 50 | uses-material-design: true -------------------------------------------------------------------------------- /rich_clipboard_platform_interface/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard_platform_interface 2 | 3 | [![Pub Version](https://img.shields.io/pub/v/rich_clipboard_platform_interface)](https://pub.dev/packages/rich_clipboard_platform_interface) 4 | 5 | A common platform interface for the [`rich_clipboard`][1] plugin. 6 | 7 | This interface allows platform-specific implementations of the `rich_clipboard` 8 | plugin, as well as the plugin itself, to ensure they are supporting the same 9 | interface. 10 | 11 | ## Usage 12 | 13 | To implement a new platform-specific implementation of `rich_clipboard`, extend 14 | `RichClipboardPlatform`[2] with an implementation that performs the 15 | platform-specific behavior. Within your class, be sure to implement the static 16 | function `registerWith` to register the plugin. See the implementation in 17 | [`rich_clipboard_windows`][3] for an example. 18 | 19 | If you're platform implementation is entirely in native code that will be called 20 | over a platform channel, you can use the default 21 | [`MethodChannelRichClipboard`][4] to register the method channel. See the 22 | implementation in [`rich_clipboard_macos`][5] for an example. 23 | 24 | [1]: ../rich_clipboard 25 | [2]: lib/rich_clipboard_platform_interface.dart 26 | [3]: ../rich_clipboard_windows 27 | [4]: lib/src/method_channel_rich_clipboard.dart 28 | [5]: ../rich_clipboard_macos -------------------------------------------------------------------------------- /rich_clipboard/example/lib/pages/widgets_from_html.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; 3 | import 'package:rich_clipboard/rich_clipboard.dart'; 4 | 5 | class WidgetsFromHtmlPage extends StatefulWidget { 6 | const WidgetsFromHtmlPage({Key? key}) : super(key: key); 7 | 8 | @override 9 | State createState() => _WidgetsFromHtmlPageState(); 10 | } 11 | 12 | class _WidgetsFromHtmlPageState extends State { 13 | String _html = ''; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Padding( 18 | padding: const EdgeInsets.all(16), 19 | child: Column( 20 | children: [ 21 | Expanded( 22 | child: SingleChildScrollView( 23 | child: HtmlWidget( 24 | _html, 25 | ), 26 | ), 27 | ), 28 | Center( 29 | child: ElevatedButton( 30 | onPressed: () async { 31 | final data = await RichClipboard.getData(); 32 | setState(() { 33 | _html = data.html ?? ''; 34 | }); 35 | }, 36 | child: const Text('Paste'), 37 | ), 38 | ), 39 | ], 40 | ), 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /rich_clipboard_platform_interface/lib/src/rich_clipboard_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/services.dart'; 3 | 4 | const _kTextPlain = 'text/plain'; 5 | const _kTextHtml = 'text/html'; 6 | 7 | /// Data from the system clipboard. 8 | @immutable 9 | class RichClipboardData implements ClipboardData { 10 | const RichClipboardData({this.text, this.html}); 11 | RichClipboardData.fromMap(Map map) 12 | : this( 13 | text: map[_kTextPlain], 14 | html: map[_kTextHtml], 15 | ); 16 | 17 | @override 18 | final String? text; 19 | 20 | /// HTML variant of this clipboard data. 21 | final String? html; 22 | 23 | /// Convert this object to a map of MIME types to strings. 24 | /// 25 | /// This is primarily a convenience method for passing [RichClipboardData] 26 | /// instances across a Flutter [MethodChannel]. 27 | Map toMap() => { 28 | _kTextPlain: text, 29 | _kTextHtml: html, 30 | }; 31 | 32 | @override 33 | String toString() => 'RichClipboardData{ text: $text, html: $html }'; 34 | 35 | @override 36 | operator ==(Object other) => 37 | identical(this, other) || 38 | other is RichClipboardData && 39 | runtimeType == other.runtimeType && 40 | text == other.text && 41 | html == other.html; 42 | 43 | @override 44 | int get hashCode => text.hashCode ^ html.hashCode; 45 | } 46 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.15' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /.github/actions/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: Setup 2 | description: Setup the project with Flutter and install dependencies 3 | 4 | inputs: 5 | flutter-channel: 6 | required: false 7 | default: stable 8 | description: The Flutter channel to use. Accepts stable, beta, dev, or master. 9 | skip-compile-deps: 10 | required: false 11 | default: 'false' 12 | description: Whether to skip installing tools such as cmake and ninja. 13 | 14 | runs: 15 | using: composite 16 | steps: 17 | - name: Setup Flutter 18 | uses: subosito/flutter-action@v2 19 | with: 20 | channel: ${{ inputs.flutter-channel }} 21 | cache: true 22 | cache-key: flutter 23 | cache-path: ${{ runner.tool_cache }}/flutter 24 | 25 | - name: Install linux build tools 26 | if: ${{ runner.os == 'Linux' && inputs.skip-compile-deps != 'true' }} 27 | shell: bash 28 | run: | 29 | sudo apt-get update 30 | sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev 31 | 32 | - name: Enable Flutter desktop 33 | shell: bash 34 | run: | 35 | flutter config --enable-linux-desktop 36 | flutter config --enable-windows-desktop 37 | flutter config --enable-macos-desktop 38 | 39 | - name: Install melos 40 | shell: bash 41 | run: flutter pub global activate melos 42 | 43 | - name: Install dependencies 44 | shell: bash 45 | run: melos bs 46 | 47 | - name: Generate code 48 | shell: bash 49 | run: melos run generate 50 | -------------------------------------------------------------------------------- /rich_clipboard/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Bringing Fire, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /rich_clipboard/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Bringing Fire, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /rich_clipboard_android/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Bringing Fire, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /rich_clipboard_ios/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Bringing Fire, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /rich_clipboard_macos/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Bringing Fire, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /rich_clipboard_web/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Bringing Fire, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /rich_clipboard_windows/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Bringing Fire, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /rich_clipboard_platform_interface/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, Bringing Fire, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /rich_clipboard/lib/rich_clipboard.dart: -------------------------------------------------------------------------------- 1 | import 'package:rich_clipboard_platform_interface/rich_clipboard_platform_interface.dart'; 2 | 3 | export 'package:rich_clipboard_platform_interface/rich_clipboard_platform_interface.dart' 4 | show RichClipboardData; 5 | 6 | /// Utility methods for interacting with the system's clipboard with support for 7 | /// various data formats. 8 | class RichClipboard { 9 | RichClipboard._(); 10 | 11 | static RichClipboardPlatform get _platform => RichClipboardPlatform.instance; 12 | 13 | /// Retrieves a list of strings representing the data types available in the 14 | /// system clipboard. 15 | /// 16 | /// This method is primarily useful for debugging as the strings are platform 17 | /// dependent. 18 | /// 19 | /// Returns a future that completes to a list of strings. If no data is 20 | /// available in the system clipboard then the future will complete to an 21 | /// empty list. 22 | static Future> getAvailableTypes() async => 23 | await _platform.getAvailableTypes(); 24 | 25 | /// Retrieves data from the system clipboard in supported formats. 26 | /// 27 | /// Platform code may convert from unsupported formats to provide data when it 28 | /// is not available in a supported format. For example, if no HTML is 29 | /// available in the clipboard but RTF is, some platforms will convert the RTF 30 | /// to HTML which will then be included in the returned data. 31 | /// 32 | /// Returns a future which completes to a [RichClipboardData]. 33 | static Future getData() async => await _platform.getData(); 34 | 35 | /// Stores the provided data in the system clipboard. 36 | /// 37 | /// To clear the clipboard pass an empty [RichClipboardData]. 38 | static Future setData(RichClipboardData data) async => 39 | _platform.setData(data); 40 | } 41 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | Example 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | example 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | $(FLUTTER_BUILD_NUMBER) 27 | LSRequiresIPhoneOS 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIMainStoryboardFile 32 | Main 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | UIViewControllerBasedStatusBarAppearance 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /rich_clipboard_platform_interface/lib/rich_clipboard_platform_interface.dart: -------------------------------------------------------------------------------- 1 | import 'package:plugin_platform_interface/plugin_platform_interface.dart'; 2 | 3 | import 'src/fallback_rich_clipboard.dart'; 4 | import 'src/rich_clipboard_data.dart'; 5 | 6 | export 'src/method_channel_rich_clipboard.dart' show MethodChannelRichClipboard; 7 | export 'src/rich_clipboard_data.dart' show RichClipboardData; 8 | 9 | abstract class RichClipboardPlatform extends PlatformInterface { 10 | RichClipboardPlatform() : super(token: _token); 11 | 12 | static final Object _token = Object(); 13 | 14 | static RichClipboardPlatform _instance = FallbackRichClipboard(); 15 | 16 | static RichClipboardPlatform get instance => _instance; 17 | 18 | static set instance(RichClipboardPlatform instance) { 19 | PlatformInterface.verify(instance, _token); 20 | _instance = instance; 21 | } 22 | 23 | /// Retrieves data from the system clipboard in supported formats. 24 | /// 25 | /// Platform code may convert from unsupported formats to provide data when it 26 | /// is not available in a supported format. For example, if no HTML is 27 | /// available in the clipboard but RTF is, come platforms will convert the RTF 28 | /// to HTML which will then be included in the returned data. 29 | /// 30 | /// Returns a future which completes to a [RichClipboardData]. 31 | Future getData(); 32 | 33 | /// Stores the provided data in the system clipboard. 34 | /// 35 | /// To clear the clipboard pass an empty [RichClipboardData]. 36 | Future setData(RichClipboardData data); 37 | 38 | /// Retrieves a list of strings representing the data types available in the 39 | /// system clipboard. 40 | /// 41 | /// This method is primarily useful for debugging as the strings are platform 42 | /// dependent. 43 | /// 44 | /// Returns a future that completes to a list of strings. If no data is 45 | /// available in the system clipboard then the future will resolve to an empty 46 | /// list. 47 | Future> getAvailableTypes(); 48 | } 49 | -------------------------------------------------------------------------------- /rich_clipboard/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /rich_clipboard/example/lib/pages/flutter_clipboard.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:gap/gap.dart'; 4 | 5 | const _kGapSize = 12.0; 6 | 7 | class FlutterClipboardPage extends StatefulWidget { 8 | const FlutterClipboardPage({Key? key}) : super(key: key); 9 | 10 | @override 11 | State createState() => _FlutterClipboardPageState(); 12 | } 13 | 14 | class _FlutterClipboardPageState extends State { 15 | late TextEditingController _controller; 16 | 17 | @override 18 | void initState() { 19 | super.initState(); 20 | _controller = TextEditingController(); 21 | } 22 | 23 | @override 24 | void dispose() { 25 | _controller.dispose(); 26 | super.dispose(); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | final theme = Theme.of(context); 32 | return SingleChildScrollView( 33 | child: Center( 34 | child: Padding( 35 | padding: const EdgeInsets.all(8.0), 36 | child: Column( 37 | mainAxisAlignment: MainAxisAlignment.start, 38 | crossAxisAlignment: CrossAxisAlignment.center, 39 | children: [ 40 | Text( 41 | 'Clipboard data', 42 | style: theme.textTheme.titleLarge, 43 | ), 44 | const Gap(_kGapSize), 45 | TextField( 46 | controller: _controller, 47 | minLines: 1, 48 | maxLines: 12, 49 | readOnly: true, 50 | style: theme.textTheme.bodyText2! 51 | .copyWith(fontFamily: 'monospace'), 52 | decoration: const InputDecoration( 53 | border: OutlineInputBorder(), 54 | ), 55 | ), 56 | const Gap(_kGapSize), 57 | ElevatedButton( 58 | onPressed: () async { 59 | final data = await Clipboard.getData(Clipboard.kTextPlain); 60 | _controller.text = data?.text ?? ''; 61 | }, 62 | child: const Text('Paste'), 63 | ), 64 | ], 65 | ), 66 | ), 67 | ), 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /rich_clipboard/example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.example" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion 19 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | multiDexEnabled true 55 | } 56 | 57 | buildTypes { 58 | release { 59 | // TODO: Add your own signing config for the release build. 60 | // Signing with the debug keys for now, so `flutter run --release` works. 61 | signingConfig signingConfigs.debug 62 | } 63 | } 64 | } 65 | 66 | flutter { 67 | source '../..' 68 | } 69 | 70 | dependencies { 71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 72 | } 73 | -------------------------------------------------------------------------------- /rich_clipboard/README.md: -------------------------------------------------------------------------------- 1 | # rich_clipboard 2 | 3 | [![CI](https://github.com/BringingFire/rich_clipboard/actions/workflows/ci.yml/badge.svg)](https://github.com/BringingFire/rich_clipboard/actions/workflows/ci.yml) 4 | [![Pub Version](https://img.shields.io/pub/v/rich_clipboard)](https://pub.dev/packages/rich_clipboard) 5 | 6 | A Flutter plugin providing access to additional data types in the system 7 | clipboard. 8 | 9 | ## Platform Support 10 | 11 | macOS | Windows | Linux | Web | Android | iOS 12 | :----:|:-------:|:-----:|:---------------:|:-------:|:---: 13 | ✅ | ✅ | ✅ | ✅ [*](#firefox) | ✅ | ✅ 14 | 15 | ## Unsupported Platforms 16 | 17 | On unsupported platforms this plugin will provide plain text only support 18 | rather than failing. This is done by transparently calling methods on 19 | Flutter's built-in [`Clipboard`][1] where appropriate, or returning mock 20 | empty values where no analogue exists. In these cases some data may be 21 | silently discarded, such as when attempting to write data types other 22 | than plain text to the clipboard. 23 | 24 | ### Firefox 25 | 26 | While "web" is currently a supported platform, support for Firefox is currently 27 | not possible due to its incomplete implementation of the [Clipboard API][2]. 28 | Because of this, the plugin will degrade to plain text only mode in that 29 | browser. Unfortunately, even that does not work in all cases as Flutter's 30 | built-in clipboard support is also broken due to additional restrictions placed 31 | on the Clipboard API by Firefox. You can find the relevant Flutter bug 32 | [here][3]. 33 | 34 | ## Usage 35 | 36 | You can use static methods on the `RichClipboard` class to access data in the 37 | system clipboard. The API is similar to that provided by Flutter's built-in 38 | [`Clipboard`][1] class. 39 | 40 | ```dart 41 | import 'package:rich_clipboard/rich_clipboard.dart'; 42 | ... 43 | final clipboardData = await RichClipboard.getData(); 44 | if (clipboardData.html != null) { 45 | // Do something with HTML 46 | } else if (clipboardData.text != null) { 47 | // Do something with plain text 48 | } 49 | ... 50 | 51 | final plainText = 'Hello there'; 52 | final html = '

$plainText

'; 53 | await RichClipboard.setData(RichClipboardData({ 54 | text: plainText, 55 | html: html, 56 | })); 57 | ``` 58 | 59 | [1]: https://api.flutter.dev/flutter/services/Clipboard-class.html 60 | [2]: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard_API 61 | [3]: https://github.com/flutter/flutter/issues/48581 -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /rich_clipboard_windows/test/html_utilities_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert' show utf8; 2 | 3 | import 'package:flutter_test/flutter_test.dart'; 4 | import 'package:rich_clipboard_windows/src/html_utilities.dart'; 5 | 6 | const kWindowsClipboardHtmlData = ''' 7 | Version:0.9 8 | StartHTML:00000134 9 | EndHTML:00000221 10 | StartFragment:00000168 11 | EndFragment:00000185 12 | SourceURL:https://jmatth.com/about/ 13 | 14 |

About Me

15 | 16 | 17 | '''; 18 | 19 | const kRawHtmlData = ''' 20 | 21 |

About Me

22 | 23 | 24 | '''; 25 | 26 | void main() { 27 | test('stripWin32HtmlDescription', () { 28 | final strippedHtml = 29 | stripWin32HtmlDescription(kWindowsClipboardHtmlData).trim(); 30 | expect(strippedHtml, startsWith('')); 31 | expect(strippedHtml, endsWith('')); 32 | }); 33 | 34 | test('constructWin32HtmlClipboardData', () { 35 | final clipboardHtmlData = constructWin32HtmlClipboardData(kRawHtmlData); 36 | final clipboardHtmlString = utf8.decode(clipboardHtmlData); 37 | 38 | expect(clipboardHtmlString, startsWith('Version:0.9')); 39 | expect(clipboardHtmlString, contains('')); 40 | expect(clipboardHtmlString, contains('')); 41 | 42 | final descriptionKVRegex = RegExp(r'^\w+:.+$'); 43 | final descriptionMap = Map.fromEntries(clipboardHtmlString 44 | .split('\n') 45 | .takeWhile((line) => descriptionKVRegex.hasMatch(line)) 46 | .map((line) { 47 | final kv = line.split(':'); 48 | return MapEntry(kv.first, kv.last); 49 | })); 50 | 51 | final startHtmlStr = descriptionMap['StartHTML']; 52 | expect(startHtmlStr, isNotNull); 53 | final startHtml = int.parse(startHtmlStr!); 54 | 55 | final endHtmlStr = descriptionMap['EndHTML']; 56 | expect(endHtmlStr, isNotNull); 57 | final endHtml = int.parse(endHtmlStr!); 58 | 59 | final htmlString = 60 | utf8.decode(clipboardHtmlData.sublist(startHtml, endHtml)).trim(); 61 | expect(htmlString, startsWith('')); 62 | expect(htmlString, endsWith('')); 63 | 64 | final startFragmentStr = descriptionMap['StartFragment']; 65 | expect(startFragmentStr, isNotNull); 66 | final startFragment = int.parse(startFragmentStr!); 67 | 68 | final endFragmentStr = descriptionMap['EndFragment']; 69 | expect(endFragmentStr, isNotNull); 70 | final endFragment = int.parse(endFragmentStr!); 71 | 72 | final fragmentString = utf8 73 | .decode(clipboardHtmlData.sublist(startFragment, endFragment)) 74 | .trim(); 75 | expect(fragmentString, startsWith('

')); 76 | expect(fragmentString, endsWith('

')); 77 | }); 78 | } 79 | -------------------------------------------------------------------------------- /rich_clipboard_ios/ios/Classes/RichClipboardPlugin.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UniformTypeIdentifiers 3 | 4 | let mimeTextPlain = "text/plain" 5 | let mimeTextHtml = "text/html" 6 | let utTypeTextPlain = "public.text" 7 | let utTypeTextHtml = "public.html" 8 | let utTypeTextRtf = "public.rtf" 9 | 10 | public class RichClipboardPlugin: NSObject, FlutterPlugin { 11 | public static func register(with registrar: FlutterPluginRegistrar) { 12 | let channel = FlutterMethodChannel(name: "com.bringingfire.rich_clipboard", binaryMessenger: registrar.messenger()) 13 | let instance = RichClipboardPlugin() 14 | registrar.addMethodCallDelegate(instance, channel: channel) 15 | } 16 | 17 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 18 | switch call.method { 19 | case "getData": 20 | result(getData()) 21 | case "setData": 22 | setData(call.arguments) 23 | result(nil) 24 | case "getAvailableTypes": 25 | result(getAvailableTypes()) 26 | default: 27 | result(FlutterMethodNotImplemented) 28 | } 29 | } 30 | 31 | func getData() -> [String: String] { 32 | let board = UIPasteboard.general 33 | var result: [String: String] = [:] 34 | if let text = board.string { 35 | result[mimeTextPlain] = text 36 | } 37 | if let htmlData = board.data(forPasteboardType: utTypeTextHtml) { 38 | let html = String(data: htmlData, encoding: .utf8) 39 | result[mimeTextHtml] = html 40 | } else if let rtfData = board.data(forPasteboardType: utTypeTextRtf) { 41 | do { 42 | let rtfAttrString = try NSAttributedString( 43 | data: rtfData, 44 | documentAttributes: nil) 45 | let htmlData = try rtfAttrString.data(from: NSRange(location: 0, length: rtfAttrString.length), documentAttributes: [.documentType: NSAttributedString.DocumentType.html]) 46 | result[mimeTextHtml] = String(data: htmlData, encoding: .utf8) 47 | } catch {} 48 | } 49 | return result 50 | } 51 | 52 | func setData(_ arguments: Any?) { 53 | let board = UIPasteboard.general 54 | board.items = [[:]] 55 | 56 | guard let data = (arguments as? [String: String?])?.compactMapValues({ $0 }) else { 57 | return 58 | } 59 | 60 | if let text = data[mimeTextPlain] { 61 | board.string = text 62 | } 63 | 64 | if let html = data[mimeTextHtml] { 65 | board.items[0][utTypeTextHtml] = html 66 | } 67 | } 68 | 69 | func getAvailableTypes() -> [String] { 70 | return UIPasteboard.general.types 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /rich_clipboard_macos/macos/Classes/RichClipboardPlugin.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | let mimeTextPlain = "text/plain" 5 | let mimeTextHtml = "text/html" 6 | 7 | public class RichClipboardPlugin: NSObject, FlutterPlugin { 8 | public static func register(with registrar: FlutterPluginRegistrar) { 9 | let channel = FlutterMethodChannel(name: "com.bringingfire.rich_clipboard", binaryMessenger: registrar.messenger) 10 | let instance = RichClipboardPlugin() 11 | registrar.addMethodCallDelegate(instance, channel: channel) 12 | } 13 | 14 | public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { 15 | switch call.method { 16 | case "getData": 17 | result(getData()) 18 | case "setData": 19 | setData(call.arguments) 20 | result(nil) 21 | case "getAvailableTypes": 22 | result(getAvailableTypes()) 23 | default: 24 | result(FlutterMethodNotImplemented) 25 | } 26 | } 27 | 28 | public func getData() -> [String: String] { 29 | let board = NSPasteboard.general 30 | var result: [String: String] = [:] 31 | if let text = board.string(forType: .string) { 32 | result[mimeTextPlain] = text 33 | } 34 | if let html = board.string(forType: .html) ?? getRtfAsHtml() { 35 | result[mimeTextHtml] = html 36 | } 37 | return result 38 | } 39 | 40 | func setData(_ arguments: Any?) { 41 | guard let data = (arguments as? [String: String?])?.compactMapValues({ $0 }) else { 42 | return 43 | } 44 | 45 | let board = NSPasteboard.general 46 | board.clearContents() 47 | 48 | if let text = data[mimeTextPlain] { 49 | board.setString(text, forType: .string) 50 | } 51 | 52 | if let html = data[mimeTextHtml] { 53 | board.setString(html, forType: .html) 54 | } 55 | } 56 | 57 | func getRtfAsHtml() -> String? { 58 | guard let boardRtf = NSPasteboard.general.data(forType: .rtf) else { 59 | return nil 60 | } 61 | guard let attrStr = NSAttributedString(rtf: boardRtf, documentAttributes: nil) else { 62 | return nil 63 | } 64 | guard let htmlData = try? attrStr.data( 65 | from: NSRange(location: 0, length: attrStr.length), 66 | documentAttributes: [.documentType: NSAttributedString.DocumentType.html]) 67 | else { 68 | return nil 69 | } 70 | return String(data: htmlData, encoding: String.Encoding.utf8) 71 | } 72 | 73 | func getAvailableTypes() -> [String] { 74 | guard let types = NSPasteboard.general.types else { 75 | return [] 76 | } 77 | return types.map { type in 78 | type.rawValue 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /rich_clipboard_windows/lib/rich_clipboard_windows.dart: -------------------------------------------------------------------------------- 1 | library rich_clipboard_windows; 2 | 3 | import 'package:flutter/foundation.dart'; 4 | import 'package:rich_clipboard_platform_interface/rich_clipboard_platform_interface.dart'; 5 | import 'package:rich_clipboard_windows/src/win32_clipboard.dart'; 6 | 7 | import 'src/html_utilities.dart'; 8 | 9 | const _kHtmlFormat = 'HTML Format'; 10 | 11 | /// The Windows implementation of [RichClipboard]. 12 | class RichClipboardWindows extends RichClipboardPlatform { 13 | /// The object for managing clipboard related win32 API calls. 14 | @visibleForTesting 15 | Win32Clipboard clipboard = Win32Clipboard(); 16 | 17 | /// Registers the Windows implementation. 18 | static void registerWith() { 19 | RichClipboardPlatform.instance = RichClipboardWindows(); 20 | } 21 | 22 | /// The id of the clipboard format for HTML. 23 | /// 24 | /// This getter will register the format if it does not already exist. Only 25 | /// evaluates to `null` when an error occurs. 26 | @visibleForTesting 27 | int? get cfHtml { 28 | _cfHtml ??= clipboard.registerFormat(_kHtmlFormat); 29 | return _cfHtml; 30 | } 31 | 32 | int? _cfHtml; 33 | 34 | @override 35 | Future> getAvailableTypes() async { 36 | if (!clipboard.open()) { 37 | return []; 38 | } 39 | 40 | final results = clipboard 41 | .getAvailableFormats() 42 | .map((cf) => '${cf.format} ("${cf.name}")') 43 | .toList(); 44 | clipboard.close(); 45 | return results; 46 | } 47 | 48 | @override 49 | Future getData() async { 50 | if (!clipboard.open()) { 51 | return const RichClipboardData(); 52 | } 53 | 54 | String? text; 55 | String? html; 56 | try { 57 | text = clipboard.getString(CF_UNICODETEXT); 58 | if (cfHtml != null) { 59 | html = clipboard.getString(cfHtml!, encoding: ClipboardEncoding.utf8); 60 | if (html != null) { 61 | html = stripWin32HtmlDescription(html); 62 | } 63 | } 64 | } finally { 65 | clipboard.close(); 66 | } 67 | 68 | return RichClipboardData( 69 | text: text, 70 | html: html, 71 | ); 72 | } 73 | 74 | @override 75 | Future setData(RichClipboardData data) async { 76 | if (!clipboard.open()) { 77 | return; 78 | } 79 | 80 | clipboard.empty(); 81 | 82 | if (data.text != null) { 83 | clipboard.setString(CF_UNICODETEXT, data.text!); 84 | } 85 | if (data.html != null && cfHtml != null) { 86 | _setHtmlData(data.html!); 87 | } 88 | 89 | clipboard.close(); 90 | } 91 | 92 | _setHtmlData(String html) { 93 | if (cfHtml == null) { 94 | return; 95 | } 96 | 97 | final htmlCodeUnits = constructWin32HtmlClipboardData(html); 98 | 99 | clipboard.setStringByUnits(cfHtml!, htmlCodeUnits, 100 | encoding: ClipboardEncoding.utf8); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - audio_session (0.0.1): 3 | - FlutterMacOS 4 | - FlutterMacOS (1.0.0) 5 | - FMDB (2.7.5): 6 | - FMDB/standard (= 2.7.5) 7 | - FMDB/standard (2.7.5) 8 | - just_audio (0.0.1): 9 | - FlutterMacOS 10 | - package_info_plus (0.0.1): 11 | - FlutterMacOS 12 | - path_provider_foundation (0.0.1): 13 | - Flutter 14 | - FlutterMacOS 15 | - rich_clipboard_macos (0.0.1): 16 | - FlutterMacOS 17 | - sqflite (0.0.2): 18 | - FlutterMacOS 19 | - FMDB (>= 2.7.5) 20 | - url_launcher_macos (0.0.1): 21 | - FlutterMacOS 22 | - wakelock_plus (0.0.1): 23 | - FlutterMacOS 24 | 25 | DEPENDENCIES: 26 | - audio_session (from `Flutter/ephemeral/.symlinks/plugins/audio_session/macos`) 27 | - FlutterMacOS (from `Flutter/ephemeral`) 28 | - just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`) 29 | - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) 30 | - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) 31 | - rich_clipboard_macos (from `Flutter/ephemeral/.symlinks/plugins/rich_clipboard_macos/macos`) 32 | - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`) 33 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 34 | - wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`) 35 | 36 | SPEC REPOS: 37 | trunk: 38 | - FMDB 39 | 40 | EXTERNAL SOURCES: 41 | audio_session: 42 | :path: Flutter/ephemeral/.symlinks/plugins/audio_session/macos 43 | FlutterMacOS: 44 | :path: Flutter/ephemeral 45 | just_audio: 46 | :path: Flutter/ephemeral/.symlinks/plugins/just_audio/macos 47 | package_info_plus: 48 | :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos 49 | path_provider_foundation: 50 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin 51 | rich_clipboard_macos: 52 | :path: Flutter/ephemeral/.symlinks/plugins/rich_clipboard_macos/macos 53 | sqflite: 54 | :path: Flutter/ephemeral/.symlinks/plugins/sqflite/macos 55 | url_launcher_macos: 56 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 57 | wakelock_plus: 58 | :path: Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos 59 | 60 | SPEC CHECKSUMS: 61 | audio_session: dea1f41890dbf1718f04a56f1d6150fd50039b72 62 | FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 63 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 64 | just_audio: 9b67ca7b97c61cfc9784ea23cd8cc55eb226d489 65 | package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce 66 | path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 67 | rich_clipboard_macos: 43364b66b9dc69d203eb8dd6d758e2d12e02723c 68 | sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea 69 | url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95 70 | wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269 71 | 72 | PODFILE CHECKSUM: 0d3963a09fc94f580682bd88480486da345dc3f0 73 | 74 | COCOAPODS: 1.12.0 75 | -------------------------------------------------------------------------------- /rich_clipboard/example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | 11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 12 | # which isn't available in 3.10. 13 | function(list_prepend LIST_NAME PREFIX) 14 | set(NEW_LIST "") 15 | foreach(element ${${LIST_NAME}}) 16 | list(APPEND NEW_LIST "${PREFIX}${element}") 17 | endforeach(element) 18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 19 | endfunction() 20 | 21 | # === Flutter Library === 22 | # System-level dependencies. 23 | find_package(PkgConfig REQUIRED) 24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 27 | 28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 29 | 30 | # Published to parent scope for install step. 31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 35 | 36 | list(APPEND FLUTTER_LIBRARY_HEADERS 37 | "fl_basic_message_channel.h" 38 | "fl_binary_codec.h" 39 | "fl_binary_messenger.h" 40 | "fl_dart_project.h" 41 | "fl_engine.h" 42 | "fl_json_message_codec.h" 43 | "fl_json_method_codec.h" 44 | "fl_message_codec.h" 45 | "fl_method_call.h" 46 | "fl_method_channel.h" 47 | "fl_method_codec.h" 48 | "fl_method_response.h" 49 | "fl_plugin_registrar.h" 50 | "fl_plugin_registry.h" 51 | "fl_standard_message_codec.h" 52 | "fl_standard_method_codec.h" 53 | "fl_string_codec.h" 54 | "fl_value.h" 55 | "fl_view.h" 56 | "flutter_linux.h" 57 | ) 58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 59 | add_library(flutter INTERFACE) 60 | target_include_directories(flutter INTERFACE 61 | "${EPHEMERAL_DIR}" 62 | ) 63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 64 | target_link_libraries(flutter INTERFACE 65 | PkgConfig::GTK 66 | PkgConfig::GLIB 67 | PkgConfig::GIO 68 | ) 69 | add_dependencies(flutter flutter_assemble) 70 | 71 | # === Flutter tool backend === 72 | # _phony_ is a non-existent file to force this command to run every time, 73 | # since currently there's no way to get a full input/output list from the 74 | # flutter tool. 75 | add_custom_command( 76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 78 | COMMAND ${CMAKE_COMMAND} -E env 79 | ${FLUTTER_TOOL_ENVIRONMENT} 80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 82 | VERBATIM 83 | ) 84 | add_custom_target(flutter_assemble DEPENDS 85 | "${FLUTTER_LIBRARY}" 86 | ${FLUTTER_LIBRARY_HEADERS} 87 | ) 88 | -------------------------------------------------------------------------------- /rich_clipboard_android/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RunnerTests.swift 3 | // RunnerTests 4 | // 5 | // Created by Joshua Matthews on 4/9/22. 6 | // 7 | 8 | import FlutterMacOS 9 | import rich_clipboard 10 | import XCTest 11 | 12 | class RunnerTests: XCTestCase { 13 | func testGetData_textOnly() throws { 14 | let plugin = RichClipboardPlugin() 15 | let textContent = "hello there" 16 | NSPasteboard.general.clearContents() 17 | NSPasteboard.general.setString(textContent, forType: .string) 18 | var resultDict: [String: String]? 19 | plugin.handle( 20 | FlutterMethodCall(methodName: "getData", arguments: nil), 21 | result: { (result: Any?) in 22 | resultDict = (result as? [String: String])! 23 | } 24 | ) 25 | 26 | XCTAssertEqual( 27 | resultDict, 28 | [ 29 | "text/plain": textContent, 30 | ] 31 | ) 32 | } 33 | 34 | func testGetData_withHtml() throws { 35 | let plugin = RichClipboardPlugin() 36 | let textContent = "hello there" 37 | let htmlContent = "

\(textContent)

" 38 | NSPasteboard.general.clearContents() 39 | NSPasteboard.general.setString(textContent, forType: .string) 40 | NSPasteboard.general.setString(htmlContent, forType: .html) 41 | var resultDict: [String: String?]? 42 | plugin.handle( 43 | FlutterMethodCall(methodName: "getData", arguments: nil), 44 | result: { (result: Any?) in 45 | resultDict = (result as? [String: String?])! 46 | } 47 | ) 48 | 49 | XCTAssertEqual( 50 | resultDict, 51 | [ 52 | "text/plain": textContent, 53 | "text/html": htmlContent, 54 | ] 55 | ) 56 | } 57 | 58 | func testGetData_rtfToHtml() throws { 59 | let plugin = RichClipboardPlugin() 60 | let textContent = "hello there" 61 | let rtfContent = #""" 62 | {\rtf1\ansi\ansicpg1252\cocoartf2638 63 | \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 AppleSystemUIFont;} 64 | {\colortbl;\red255\green255\blue255;} 65 | {\*\expandedcolortbl;;} 66 | \deftab560 67 | \pard\pardeftab560\slleading20\partightenfactor0 68 | 69 | \f0\fs26 \AppleTypeServices\AppleTypeServicesF2293774 \cf0 hello there} 70 | """# 71 | NSPasteboard.general.clearContents() 72 | NSPasteboard.general.setString(textContent, forType: .string) 73 | NSPasteboard.general.setString(rtfContent, forType: .rtf) 74 | var resultDict: [String: String]? 75 | plugin.handle( 76 | FlutterMethodCall(methodName: "getData", arguments: nil), 77 | result: { (result: Any?) in 78 | resultDict = (result as? [String: String])! 79 | } 80 | ) 81 | 82 | XCTAssertNotNil(resultDict) 83 | XCTAssertEqual(resultDict!.count, 2) 84 | XCTAssertEqual(resultDict!["text/plain"], textContent) 85 | XCTAssertNotNil(resultDict!["text/html"]) 86 | XCTAssertTrue(resultDict!["text/html"]!.contains("hello there")) 87 | XCTAssertTrue(resultDict!["text/html"]!.contains("Cocoa HTML Writer")) 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /rich_clipboard_windows/lib/src/html_utilities.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert' show utf8; 2 | 3 | const _kStartFragmentComment = ''; 4 | const _kEndFragmentComment = ''; 5 | 6 | const _kHtmlDescriptionTemplate = ''' 7 | Version:0.9 8 | StartHTML:0000000000 9 | EndHTML:0000000000 10 | StartFragment:0000000000 11 | EndFragment:0000000000 12 | '''; 13 | 14 | /// Remove the leading description from Windows clipboard HTML. 15 | /// 16 | /// See [HTML Clipboard Format](https://docs.microsoft.com/en-us/windows/win32/dataxchg/html-clipboard-format) 17 | /// for details. 18 | String stripWin32HtmlDescription(String html) { 19 | // The description has a StartHTML field we could use to calculate this 20 | // instead, but it's in terms of byte offset so is annoying to work with 21 | // once we already converted back to a Dart string, and since it's generated 22 | // in application code it could just contain garbage anyway. 23 | final startHtml = html.indexOf(' constructWin32HtmlClipboardData(String html) { 32 | // Windows wants these marker comments in the HTML, and future parts of our 33 | // code relies on them being present. It's probably technically incorrect 34 | // to just wrap the entire body since that could include things like meta 35 | // tags, but it works for Google Docs so it's good enough for us. 36 | if (!html.contains(_kStartFragmentComment)) { 37 | final startBodyIndex = html.indexOf('') + ''.length; 38 | html = html.substring(0, startBodyIndex) + 39 | _kStartFragmentComment + 40 | html.substring(startBodyIndex); 41 | } 42 | if (!html.contains(_kEndFragmentComment)) { 43 | final endBodyIndex = html.indexOf(''); 44 | html = html.substring(0, endBodyIndex) + 45 | _kEndFragmentComment + 46 | html.substring(endBodyIndex); 47 | } 48 | 49 | final descUtf8Len = utf8.encode(_kHtmlDescriptionTemplate).length; 50 | final htmlUtf8 = utf8.encode(html); 51 | final htmlStart = descUtf8Len; 52 | final htmlEnd = descUtf8Len + htmlUtf8.length; 53 | final fragmentStart = descUtf8Len + 54 | utf8 55 | .encode(html.substring(0, html.indexOf(_kStartFragmentComment))) 56 | .length + 57 | utf8.encode(_kStartFragmentComment).length; 58 | final fragmentEnd = descUtf8Len + 59 | utf8 60 | .encode(html.substring(0, html.lastIndexOf(_kEndFragmentComment))) 61 | .length; 62 | final desc = _kHtmlDescriptionTemplate 63 | .replaceAll( 64 | 'StartHTML:0000000000', 65 | 'StartHTML:${htmlStart.toString().padLeft(10, '0')}', 66 | ) 67 | .replaceAll( 68 | 'EndHTML:0000000000', 69 | 'EndHTML:${htmlEnd.toString().padLeft(10, '0')}', 70 | ) 71 | .replaceAll( 72 | 'StartFragment:0000000000', 73 | 'StartFragment:${fragmentStart.toString().padLeft(10, '0')}', 74 | ) 75 | .replaceAll( 76 | 'EndFragment:0000000000', 77 | 'EndFragment:${fragmentEnd.toString().padLeft(10, '0')}', 78 | ); 79 | final descUtf8 = utf8.encode(desc); 80 | final utf8Result = [...descUtf8, ...htmlUtf8]; 81 | return utf8Result; 82 | } 83 | -------------------------------------------------------------------------------- /rich_clipboard/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:rich_clipboard_example/pages/flutter_clipboard.dart'; 3 | import 'package:rich_clipboard_example/pages/rich_clipboard.dart'; 4 | import 'package:rich_clipboard_example/pages/super_editor.dart'; 5 | import 'package:rich_clipboard_example/pages/widgets_from_html.dart'; 6 | 7 | void main() { 8 | runApp(const MyApp()); 9 | } 10 | 11 | class MyApp extends StatefulWidget { 12 | const MyApp({Key? key}) : super(key: key); 13 | 14 | @override 15 | State createState() => _MyAppState(); 16 | } 17 | 18 | class _MyAppState extends State { 19 | @override 20 | Widget build(BuildContext context) { 21 | return const MaterialApp( 22 | home: HomePage(), 23 | ); 24 | } 25 | } 26 | 27 | class _MenuItem { 28 | final IconData icon; 29 | final String title; 30 | final String subtitle; 31 | final WidgetBuilder builder; 32 | 33 | _MenuItem({ 34 | required this.icon, 35 | required this.title, 36 | required this.subtitle, 37 | required this.builder, 38 | }); 39 | } 40 | 41 | final _menu = <_MenuItem>[ 42 | _MenuItem( 43 | icon: Icons.attach_money, 44 | title: 'Rich clipboard', 45 | subtitle: 'Inspect and modify clipboard contents', 46 | builder: (context) => const RichClipboardPage(), 47 | ), 48 | _MenuItem( 49 | icon: Icons.edit, 50 | title: 'Super Editor', 51 | subtitle: 'A rich text editor, extended with rich clipboard support', 52 | builder: (context) => const SuperEditorPage(), 53 | ), 54 | _MenuItem( 55 | icon: Icons.build, 56 | title: 'Widgets from html', 57 | subtitle: 'Paste html from the clipboard as widgets', 58 | builder: (context) => const WidgetsFromHtmlPage(), 59 | ), 60 | _MenuItem( 61 | icon: Icons.paste, 62 | title: 'Flutter clipboard', 63 | subtitle: 'Builtin clipboard behavior for comparison', 64 | builder: (context) => const FlutterClipboardPage(), 65 | ), 66 | ]; 67 | 68 | class HomePage extends StatefulWidget { 69 | const HomePage({Key? key}) : super(key: key); 70 | 71 | @override 72 | State createState() => _HomePageState(); 73 | } 74 | 75 | class _HomePageState extends State { 76 | int _activeIndex = 0; 77 | 78 | @override 79 | Widget build(BuildContext context) { 80 | return Scaffold( 81 | appBar: AppBar( 82 | title: Text(_menu[_activeIndex].title), 83 | ), 84 | drawer: Builder(builder: _drawer), 85 | body: _menu[_activeIndex].builder(context), 86 | ); 87 | } 88 | 89 | Widget _drawer(BuildContext context) => Drawer( 90 | child: ListView( 91 | children: List.generate( 92 | _menu.length, 93 | (index) { 94 | final item = _menu[index]; 95 | return ListTile( 96 | leading: Icon(item.icon), 97 | title: Text(item.title), 98 | subtitle: Text(item.subtitle), 99 | onTap: () => setState(() { 100 | _activeIndex = index; 101 | Navigator.of(context).pop(); 102 | }), 103 | selected: index == _activeIndex, 104 | selectedTileColor: Colors.grey.shade300, 105 | ); 106 | }, 107 | ), 108 | ), 109 | ); 110 | } 111 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /rich_clipboard/example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - audio_session (0.0.1): 3 | - Flutter 4 | - Flutter (1.0.0) 5 | - FMDB (2.7.5): 6 | - FMDB/standard (= 2.7.5) 7 | - FMDB/standard (2.7.5) 8 | - integration_test (0.0.1): 9 | - Flutter 10 | - just_audio (0.0.1): 11 | - Flutter 12 | - package_info_plus (0.4.5): 13 | - Flutter 14 | - path_provider_foundation (0.0.1): 15 | - Flutter 16 | - FlutterMacOS 17 | - rich_clipboard_ios (0.0.1): 18 | - Flutter 19 | - sqflite (0.0.3): 20 | - Flutter 21 | - FMDB (>= 2.7.5) 22 | - url_launcher_ios (0.0.1): 23 | - Flutter 24 | - video_player_avfoundation (0.0.1): 25 | - Flutter 26 | - wakelock_plus (0.0.1): 27 | - Flutter 28 | - webview_flutter_wkwebview (0.0.1): 29 | - Flutter 30 | 31 | DEPENDENCIES: 32 | - audio_session (from `.symlinks/plugins/audio_session/ios`) 33 | - Flutter (from `Flutter`) 34 | - integration_test (from `.symlinks/plugins/integration_test/ios`) 35 | - just_audio (from `.symlinks/plugins/just_audio/ios`) 36 | - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) 37 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) 38 | - rich_clipboard_ios (from `.symlinks/plugins/rich_clipboard_ios/ios`) 39 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 40 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) 41 | - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/ios`) 42 | - wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`) 43 | - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) 44 | 45 | SPEC REPOS: 46 | trunk: 47 | - FMDB 48 | 49 | EXTERNAL SOURCES: 50 | audio_session: 51 | :path: ".symlinks/plugins/audio_session/ios" 52 | Flutter: 53 | :path: Flutter 54 | integration_test: 55 | :path: ".symlinks/plugins/integration_test/ios" 56 | just_audio: 57 | :path: ".symlinks/plugins/just_audio/ios" 58 | package_info_plus: 59 | :path: ".symlinks/plugins/package_info_plus/ios" 60 | path_provider_foundation: 61 | :path: ".symlinks/plugins/path_provider_foundation/darwin" 62 | rich_clipboard_ios: 63 | :path: ".symlinks/plugins/rich_clipboard_ios/ios" 64 | sqflite: 65 | :path: ".symlinks/plugins/sqflite/ios" 66 | url_launcher_ios: 67 | :path: ".symlinks/plugins/url_launcher_ios/ios" 68 | video_player_avfoundation: 69 | :path: ".symlinks/plugins/video_player_avfoundation/ios" 70 | wakelock_plus: 71 | :path: ".symlinks/plugins/wakelock_plus/ios" 72 | webview_flutter_wkwebview: 73 | :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" 74 | 75 | SPEC CHECKSUMS: 76 | audio_session: 4f3e461722055d21515cf3261b64c973c062f345 77 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 78 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 79 | integration_test: 13825b8a9334a850581300559b8839134b124670 80 | just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa 81 | package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7 82 | path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 83 | rich_clipboard_ios: 7588abe18f881a6d0e9ec0b12e51cae2761e8942 84 | sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a 85 | url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 86 | video_player_avfoundation: 81e49bb3d9fb63dccf9fa0f6d877dc3ddbeac126 87 | wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47 88 | webview_flutter_wkwebview: 2e2d318f21a5e036e2c3f26171342e95908bd60a 89 | 90 | PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 91 | 92 | COCOAPODS: 1.12.0 93 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "example.exe" "\0" 98 | VALUE "ProductName", "example" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /rich_clipboard/example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(example LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "example") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /rich_clipboard_android/android/src/main/kotlin/com/bringingfire/rich_clipboard/RichClipboardPlugin.kt: -------------------------------------------------------------------------------- 1 | package com.bringingfire.rich_clipboard 2 | 3 | import android.content.ClipData 4 | import android.content.ClipboardManager 5 | import android.content.Context 6 | import android.os.Build 7 | import androidx.annotation.NonNull 8 | 9 | import io.flutter.embedding.engine.plugins.FlutterPlugin 10 | import io.flutter.plugin.common.MethodCall 11 | import io.flutter.plugin.common.MethodChannel 12 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler 13 | import io.flutter.plugin.common.MethodChannel.Result 14 | 15 | class RichClipboardPlugin : FlutterPlugin, MethodCallHandler { 16 | private lateinit var channel: MethodChannel 17 | private var context: Context? = null 18 | 19 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { 20 | channel = MethodChannel(flutterPluginBinding.binaryMessenger, "com.bringingfire.rich_clipboard") 21 | channel.setMethodCallHandler(this) 22 | context = flutterPluginBinding.applicationContext 23 | } 24 | 25 | override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { 26 | when (call.method) { 27 | "getAvailableTypes" -> { 28 | getAvailableTypes(result) 29 | } 30 | "getData" -> { 31 | getData(result) 32 | } 33 | "setData" -> { 34 | setData(call, result) 35 | } 36 | else -> { 37 | result.notImplemented() 38 | } 39 | } 40 | } 41 | 42 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { 43 | channel.setMethodCallHandler(null) 44 | context = null 45 | } 46 | 47 | private fun getAvailableTypes(@NonNull result: Result) { 48 | val clipboard = context!!.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager 49 | val clip = clipboard.primaryClip 50 | if (clip == null || clip.itemCount < 1) { 51 | result.success(emptyList()) 52 | return 53 | } 54 | val mimeTypes = clip.description.filterMimeTypes("*/*").toList() 55 | result.success(mimeTypes) 56 | } 57 | 58 | private fun getData(@NonNull result: Result) { 59 | val clipboard = context!!.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager 60 | val clip = clipboard.primaryClip 61 | if (clip == null || clip.itemCount < 1) { 62 | result.success(emptyMap()) 63 | return 64 | } 65 | 66 | val output = mutableMapOf() 67 | for (i in 0 until clip.itemCount) { 68 | val item = clip.getItemAt(i) 69 | if (item.text != null) { 70 | output["text/plain"] = item.text.toString() 71 | } 72 | if (item.htmlText != null) { 73 | output["text/html"] = item.htmlText.toString() 74 | } 75 | } 76 | 77 | result.success(output) 78 | } 79 | 80 | private fun setData(@NonNull call: MethodCall, @NonNull result: Result) { 81 | val args = call.arguments>()!! 82 | val clipboard = context!!.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager 83 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { 84 | clipboard.clearPrimaryClip() 85 | } 86 | 87 | if (args.contains("text/plain") && args.contains("text/html")) { 88 | val clip = ClipData.newHtmlText("text/plain", args["text/plain"], args["text/html"]) 89 | clipboard.setPrimaryClip(clip) 90 | } else if (args.contains("text/plain")) { 91 | val clip = ClipData.newPlainText("text/plain", args["text/plain"]) 92 | clipboard.setPrimaryClip(clip) 93 | } 94 | 95 | result.success(null) 96 | } 97 | } -------------------------------------------------------------------------------- /rich_clipboard/example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | 3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 4 | 5 | # Configuration provided via flutter tool. 6 | include(${EPHEMERAL_DIR}/generated_config.cmake) 7 | 8 | # TODO: Move the rest of this into files in ephemeral. See 9 | # https://github.com/flutter/flutter/issues/57146. 10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 11 | 12 | # === Flutter Library === 13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 14 | 15 | # Published to parent scope for install step. 16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 20 | 21 | list(APPEND FLUTTER_LIBRARY_HEADERS 22 | "flutter_export.h" 23 | "flutter_windows.h" 24 | "flutter_messenger.h" 25 | "flutter_plugin_registrar.h" 26 | "flutter_texture_registrar.h" 27 | ) 28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 29 | add_library(flutter INTERFACE) 30 | target_include_directories(flutter INTERFACE 31 | "${EPHEMERAL_DIR}" 32 | ) 33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 34 | add_dependencies(flutter flutter_assemble) 35 | 36 | # === Wrapper === 37 | list(APPEND CPP_WRAPPER_SOURCES_CORE 38 | "core_implementations.cc" 39 | "standard_codec.cc" 40 | ) 41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 43 | "plugin_registrar.cc" 44 | ) 45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 46 | list(APPEND CPP_WRAPPER_SOURCES_APP 47 | "flutter_engine.cc" 48 | "flutter_view_controller.cc" 49 | ) 50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 51 | 52 | # Wrapper sources needed for a plugin. 53 | add_library(flutter_wrapper_plugin STATIC 54 | ${CPP_WRAPPER_SOURCES_CORE} 55 | ${CPP_WRAPPER_SOURCES_PLUGIN} 56 | ) 57 | apply_standard_settings(flutter_wrapper_plugin) 58 | set_target_properties(flutter_wrapper_plugin PROPERTIES 59 | POSITION_INDEPENDENT_CODE ON) 60 | set_target_properties(flutter_wrapper_plugin PROPERTIES 61 | CXX_VISIBILITY_PRESET hidden) 62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 63 | target_include_directories(flutter_wrapper_plugin PUBLIC 64 | "${WRAPPER_ROOT}/include" 65 | ) 66 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 67 | 68 | # Wrapper sources needed for the runner. 69 | add_library(flutter_wrapper_app STATIC 70 | ${CPP_WRAPPER_SOURCES_CORE} 71 | ${CPP_WRAPPER_SOURCES_APP} 72 | ) 73 | apply_standard_settings(flutter_wrapper_app) 74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 75 | target_include_directories(flutter_wrapper_app PUBLIC 76 | "${WRAPPER_ROOT}/include" 77 | ) 78 | add_dependencies(flutter_wrapper_app flutter_assemble) 79 | 80 | # === Flutter tool backend === 81 | # _phony_ is a non-existent file to force this command to run every time, 82 | # since currently there's no way to get a full input/output list from the 83 | # flutter tool. 84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 86 | add_custom_command( 87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 89 | ${CPP_WRAPPER_SOURCES_APP} 90 | ${PHONY_OUTPUT} 91 | COMMAND ${CMAKE_COMMAND} -E env 92 | ${FLUTTER_TOOL_ENVIRONMENT} 93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 94 | windows-x64 $ 95 | VERBATIM 96 | ) 97 | add_custom_target(flutter_assemble DEPENDS 98 | "${FLUTTER_LIBRARY}" 99 | ${FLUTTER_LIBRARY_HEADERS} 100 | ${CPP_WRAPPER_SOURCES_CORE} 101 | ${CPP_WRAPPER_SOURCES_PLUGIN} 102 | ${CPP_WRAPPER_SOURCES_APP} 103 | ) 104 | -------------------------------------------------------------------------------- /rich_clipboard/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 64 | 70 | 71 | 72 | 73 | 79 | 81 | 87 | 88 | 89 | 90 | 92 | 93 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /rich_clipboard/example/linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "example"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /rich_clipboard/example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | project(runner LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "example") 5 | set(APPLICATION_ID "com.example.example") 6 | 7 | cmake_policy(SET CMP0063 NEW) 8 | 9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 10 | 11 | # Root filesystem for cross-building. 12 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 13 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 14 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 17 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 18 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 19 | endif() 20 | 21 | # Configure build options. 22 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 23 | set(CMAKE_BUILD_TYPE "Debug" CACHE 24 | STRING "Flutter build mode" FORCE) 25 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 26 | "Debug" "Profile" "Release") 27 | endif() 28 | 29 | # Compilation settings that should be applied to most targets. 30 | function(APPLY_STANDARD_SETTINGS TARGET) 31 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 32 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 33 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 34 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 35 | endfunction() 36 | 37 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 38 | 39 | # Flutter library and tool build rules. 40 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 41 | 42 | # System-level dependencies. 43 | find_package(PkgConfig REQUIRED) 44 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 45 | 46 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 47 | 48 | # Application build 49 | add_executable(${BINARY_NAME} 50 | "main.cc" 51 | "my_application.cc" 52 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 53 | ) 54 | apply_standard_settings(${BINARY_NAME}) 55 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 56 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 57 | add_dependencies(${BINARY_NAME} flutter_assemble) 58 | # Only the install-generated bundle's copy of the executable will launch 59 | # correctly, since the resources must in the right relative locations. To avoid 60 | # people trying to run the unbundled copy, put it in a subdirectory instead of 61 | # the default top-level location. 62 | set_target_properties(${BINARY_NAME} 63 | PROPERTIES 64 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 65 | ) 66 | 67 | # Generated plugin build rules, which manage building the plugins and adding 68 | # them to the application. 69 | include(flutter/generated_plugins.cmake) 70 | 71 | 72 | # === Installation === 73 | # By default, "installing" just makes a relocatable bundle in the build 74 | # directory. 75 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 77 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 78 | endif() 79 | 80 | # Start with a clean build bundle directory every time. 81 | install(CODE " 82 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 83 | " COMPONENT Runtime) 84 | 85 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 86 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 87 | 88 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 89 | COMPONENT Runtime) 90 | 91 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 92 | COMPONENT Runtime) 93 | 94 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 95 | COMPONENT Runtime) 96 | 97 | if(PLUGIN_BUNDLED_LIBRARIES) 98 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 99 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 100 | COMPONENT Runtime) 101 | endif() 102 | 103 | # Fully re-copy the assets directory on each build to avoid having stale files 104 | # from a previous install. 105 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 106 | install(CODE " 107 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 108 | " COMPONENT Runtime) 109 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 110 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 111 | 112 | # Install the AOT library on non-Debug builds only. 113 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 114 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 115 | COMPONENT Runtime) 116 | endif() 117 | -------------------------------------------------------------------------------- /rich_clipboard_web/lib/rich_clipboard_web.dart: -------------------------------------------------------------------------------- 1 | import 'dart:html'; 2 | 3 | import 'package:flutter_web_plugins/flutter_web_plugins.dart'; 4 | import 'package:js/js.dart'; 5 | import 'package:js/js_util.dart'; 6 | import 'package:rich_clipboard_platform_interface/rich_clipboard_platform_interface.dart'; 7 | 8 | const _kMimeTextPlain = 'text/plain'; 9 | const _kMimeTextHtml = 'text/html'; 10 | 11 | bool _detectClipboardApi() { 12 | final clipboard = window.navigator.clipboard; 13 | if (clipboard == null) { 14 | return false; 15 | } 16 | for (final methodName in ['read', 'write']) { 17 | final method = getProperty(clipboard, methodName); 18 | if (method == null) { 19 | return false; 20 | } 21 | } 22 | 23 | return true; 24 | } 25 | 26 | /// The web implementation of [RichClipboard]. 27 | class RichClipboardWeb extends RichClipboardPlatform { 28 | /// Registers the implementation. 29 | static void registerWith(Registrar registrar) { 30 | if (!_detectClipboardApi()) { 31 | return; 32 | } 33 | RichClipboardPlatform.instance = RichClipboardWeb(); 34 | } 35 | 36 | @override 37 | Future> getAvailableTypes() async { 38 | final clipboard = window.navigator.clipboard as _Clipboard?; 39 | if (clipboard == null) { 40 | return []; 41 | } 42 | 43 | final data = await clipboard.read(); 44 | if (data.isEmpty) { 45 | return []; 46 | } 47 | return data.first.types; 48 | } 49 | 50 | @override 51 | Future getData() async { 52 | final clipboard = window.navigator.clipboard as _Clipboard?; 53 | if (clipboard == null) { 54 | return const RichClipboardData(); 55 | } 56 | 57 | final contents = await clipboard.read(); 58 | if (contents.isEmpty) { 59 | return const RichClipboardData(); 60 | } 61 | 62 | final item = contents.first; 63 | final availableTypes = item.types; 64 | 65 | String? text; 66 | String? html; 67 | if (availableTypes.contains(_kMimeTextPlain)) { 68 | final textBlob = await item.getType('text/plain'); 69 | text = await textBlob.text(); 70 | } 71 | if (availableTypes.contains(_kMimeTextHtml)) { 72 | final htmlBlob = await item.getType('text/html'); 73 | html = await htmlBlob.text(); 74 | } 75 | 76 | return RichClipboardData( 77 | text: text, 78 | html: html, 79 | ); 80 | } 81 | 82 | @override 83 | Future setData(RichClipboardData data) async { 84 | final clipboard = window.navigator.clipboard as _Clipboard?; 85 | if (clipboard == null) { 86 | return; 87 | } 88 | 89 | final dataMap = Map.fromEntries( 90 | data.toMap().entries.where((entry) => entry.value != null).map( 91 | (entry) => MapEntry( 92 | entry.key, 93 | // Wrapping the string in a list here satisfies the Blob 94 | // constructor and works just fine. If something in Dart or the 95 | // web APIs change to require a list of individual characters in 96 | // the future, use the .characters getter from the characters 97 | // package to safely split the string into unicode grapheme 98 | // clusters. 99 | Blob([entry.value!], entry.key), 100 | ), 101 | ), 102 | ); 103 | 104 | final items = <_ClipboardItem>[ 105 | if (dataMap.isNotEmpty) _ClipboardItem(jsify(dataMap)) 106 | ]; 107 | await clipboard.write(items); 108 | } 109 | } 110 | 111 | @JS('Blob') 112 | @staticInterop 113 | extension _BlobText on Blob { 114 | @JS('text') 115 | external dynamic _text(); 116 | Future text() => promiseToFuture(_text()); 117 | } 118 | 119 | @JS('ClipboardItem') 120 | @staticInterop 121 | class _ClipboardItem { 122 | external factory _ClipboardItem(dynamic args); 123 | } 124 | 125 | extension _ClipboardItemImpl on _ClipboardItem { 126 | @JS('getType') 127 | external dynamic _getType(String mimeType); 128 | Future getType(String mimeType) => 129 | promiseToFuture(_getType(mimeType)); 130 | 131 | @JS('types') 132 | external List get _types; 133 | List get types => _types.cast(); 134 | } 135 | 136 | @JS('Clipboard') 137 | @staticInterop 138 | class _Clipboard {} 139 | 140 | extension _ClipboardImpl on _Clipboard { 141 | @JS('read') 142 | external dynamic _read(); 143 | Future> read() => promiseToFuture>(_read()) 144 | .then((list) => list.cast<_ClipboardItem>()); 145 | 146 | @JS('write') 147 | external dynamic _write(List<_ClipboardItem> items); 148 | Future write(List<_ClipboardItem> items) => 149 | promiseToFuture(_write(items)); 150 | } 151 | --------------------------------------------------------------------------------