├── example
├── linux
│ ├── .gitignore
│ ├── main.cc
│ ├── my_application.h
│ ├── flutter
│ │ └── CMakeLists.txt
│ ├── my_application.cc
│ └── CMakeLists.txt
├── ios
│ ├── Flutter
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── AppFrameworkInfo.plist
│ ├── 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
│ ├── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── .gitignore
├── macos
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ └── Flutter-Release.xcconfig
│ ├── Runner
│ │ ├── Configs
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ ├── Warnings.xcconfig
│ │ │ └── AppInfo.xcconfig
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── app_icon_16.png
│ │ │ │ ├── app_icon_32.png
│ │ │ │ ├── app_icon_64.png
│ │ │ │ ├── app_icon_1024.png
│ │ │ │ ├── app_icon_128.png
│ │ │ │ ├── app_icon_256.png
│ │ │ │ ├── app_icon_512.png
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── Release.entitlements
│ │ ├── DebugProfile.entitlements
│ │ ├── MainFlutterWindow.swift
│ │ └── Info.plist
│ ├── .gitignore
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── web
│ ├── favicon.png
│ ├── icons
│ │ ├── Icon-192.png
│ │ ├── Icon-512.png
│ │ ├── Icon-maskable-192.png
│ │ └── Icon-maskable-512.png
│ ├── manifest.json
│ └── index.html
├── assets
│ └── simform.png
├── windows
│ ├── runner
│ │ ├── resources
│ │ │ └── app_icon.ico
│ │ ├── resource.h
│ │ ├── CMakeLists.txt
│ │ ├── utils.h
│ │ ├── runner.exe.manifest
│ │ ├── run_loop.h
│ │ ├── flutter_window.h
│ │ ├── main.cpp
│ │ ├── utils.cpp
│ │ ├── flutter_window.cpp
│ │ ├── run_loop.cpp
│ │ ├── Runner.rc
│ │ └── win32_window.h
│ ├── .gitignore
│ ├── CMakeLists.txt
│ └── flutter
│ │ └── CMakeLists.txt
├── android
│ ├── 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
│ │ │ │ │ │ └── simform
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── .gitignore
│ ├── build.gradle
│ ├── settings.gradle
│ └── gradle.properties
├── pubspec.yaml
├── README.md
├── analysis_options.yaml
├── .metadata
├── .gitignore
└── lib
│ └── detailscreen.dart
├── preview
├── banner.png
├── showcaseview.gif
└── performance_boost.png
├── .metadata
├── pubspec.yaml
├── lib
├── src
│ ├── tooltip
│ │ ├── tooltip.dart
│ │ ├── tooltip_layout_id.dart
│ │ ├── arrow_painter.dart
│ │ ├── render_object_manager.dart
│ │ ├── animated_tooltip_multi_layout.dart
│ │ └── tooltip_content.dart
│ ├── models
│ │ ├── flutter_inherited_data.dart
│ │ ├── linked_showcase_data_model.dart
│ │ ├── action_button_icon.dart
│ │ ├── showcase_scope.dart
│ │ ├── tooltip_action_config.dart
│ │ └── tooltip_action_button.dart
│ ├── widget
│ │ ├── tooltip_slide_transition.dart
│ │ ├── showcase_circular_progress_indicator.dart
│ │ ├── default_tooltip_text_widget.dart
│ │ ├── action_widget.dart
│ │ ├── tooltip_action_button_widget.dart
│ │ └── floating_action_widget.dart
│ ├── utils
│ │ ├── extensions.dart
│ │ ├── constants.dart
│ │ └── shape_clipper.dart
│ └── showcase
│ │ ├── target_widget.dart
│ │ └── showcase_service.dart
└── showcaseview.dart
├── .github
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
├── workflows
│ ├── publish.yaml
│ ├── title-validation.yml
│ ├── flutter.yaml
│ └── web-example-release.yml
└── pull_request_template.md
├── analysis_options.yaml
├── LICENSE
├── pub_login.sh
├── .gitignore
├── CODE_OF_CONDUCT.md
└── README.md
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/preview/banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/preview/banner.png
--------------------------------------------------------------------------------
/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/web/favicon.png
--------------------------------------------------------------------------------
/example/assets/simform.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/assets/simform.png
--------------------------------------------------------------------------------
/preview/showcaseview.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/preview/showcaseview.gif
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/xcuserdata/
7 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/preview/performance_boost.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/preview/performance_boost.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/simform/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.simform.example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/showcaseview/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.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: 8b114482a4b56c45ebc85f048156039b93a4bbd8
8 | channel: master
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 | }
7 |
8 | rootProject.buildDir = '../build'
9 | subprojects {
10 | project.buildDir = "${rootProject.buildDir}/${project.name}"
11 | }
12 | subprojects {
13 | project.evaluationDependsOn(':app')
14 | }
15 |
16 | tasks.register("clean", Delete) {
17 | delete rootProject.buildDir
18 | }
19 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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: [UIApplicationLaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: An example application to demonstrate showcaseview package.
3 | version: 1.0.0+1
4 |
5 | environment:
6 | sdk: ">=3.0.0 <4.0.0"
7 |
8 | publish_to: none
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 | showcaseview:
14 | path: ../
15 |
16 | dev_dependencies:
17 | flutter_lints: 2.0.2
18 | flutter_test:
19 | sdk: flutter
20 |
21 | flutter:
22 | uses-material-design: true
23 | assets:
24 | - assets/
25 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: showcaseview
2 | description: A Flutter package to Showcase/Highlight widgets step by step.
3 | version: 5.0.1
4 | issue_tracker: https://github.com/SimformSolutionsPvtLtd/showcaseview/issues
5 | repository: https://github.com/SimformSolutionsPvtLtd/showcaseview
6 |
7 | environment:
8 | sdk: '>=3.0.0 <4.0.0'
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 |
14 | dev_dependencies:
15 | flutter_test:
16 | sdk: flutter
17 | flutter_lints: 2.0.2
18 |
19 | flutter:
20 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/lib/src/tooltip/tooltip.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/rendering.dart';
3 |
4 | import '../models/tooltip_action_config.dart';
5 | import '../showcase/showcase_controller.dart';
6 | import '../utils/constants.dart';
7 | import '../utils/enum.dart';
8 | import '../widget/action_widget.dart';
9 | import 'render_object_manager.dart';
10 | import 'tooltip_content.dart';
11 |
12 | part 'animated_tooltip_multi_layout.dart';
13 | part 'arrow_painter.dart';
14 | part 'render_animation_delegate.dart';
15 | part 'render_position_delegate.dart';
16 | part 'tooltip_layout_id.dart';
17 | part 'tooltip_wrapper.dart';
18 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.simform.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.simform. All rights reserved.
15 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(runner LANGUAGES CXX)
3 |
4 | add_executable(${BINARY_NAME} WIN32
5 | "flutter_window.cpp"
6 | "main.cpp"
7 | "run_loop.cpp"
8 | "utils.cpp"
9 | "win32_window.cpp"
10 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
11 | "Runner.rc"
12 | "runner.exe.manifest"
13 | )
14 | apply_standard_settings(${BINARY_NAME})
15 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
16 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
17 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
18 | add_dependencies(${BINARY_NAME} flutter_assemble)
19 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/ephemeral/
22 | Flutter/app.flx
23 | Flutter/app.zip
24 | Flutter/flutter_assets/
25 | Flutter/flutter_export_environment.sh
26 | ServiceDefinitions.json
27 | Runner/GeneratedPluginRegistrant.*
28 |
29 | # Exceptions to above rules.
30 | !default.mode1v3
31 | !default.mode2v3
32 | !default.pbxuser
33 | !default.perspectivev3
34 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | analyzer:
4 | language:
5 | strict-inference: true
6 | strict-raw-types: true
7 | errors:
8 | argument_type_not_assignable: error
9 | invalid_assignment: error
10 | dead_code: warning
11 | overridden_fields: ignore
12 | use_key_in_widget_constructors: ignore
13 |
14 | linter:
15 | rules:
16 | public_member_api_docs: false
17 | avoid_print: true
18 | avoid_empty_else: true
19 | annotate_overrides: true
20 | cancel_subscriptions: true
21 | close_sinks: true
22 | avoid_positional_boolean_parameters: false
23 | use_super_parameters: true
24 | prefer_relative_imports: true
25 | require_trailing_commas: true
26 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # ShowCaseView Example
2 |
3 | A Flutter application demonstrate use of the `ShowCaseView` package.
4 |
5 | ## Get packages
6 | ```dart
7 | flutter packages get
8 | ```
9 | ## Run the app
10 | `flutter run`
11 |
12 | ## Getting Started
13 |
14 | This project is a starting point for a Flutter application.
15 |
16 | A few resources to get you started if this is your first Flutter project:
17 |
18 | -[Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
19 | -[Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
20 |
21 | For help getting started with Flutter, view our
22 | [online documentation](https://flutter.dev/docs), which offers tutorials,
23 | samples, guidance on mobile development, and a full API reference.
24 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yaml:
--------------------------------------------------------------------------------
1 | name: Publish
2 |
3 | on:
4 | release:
5 | types: [published]
6 |
7 | jobs:
8 | build:
9 | runs-on: ubuntu-latest
10 | steps:
11 | - uses: actions/checkout@v2
12 | - name: Install Flutter
13 | uses: subosito/flutter-action@v1
14 | - name: Install dependencies
15 | run: flutter packages get
16 | - name: Code Formatting
17 | run: dart format --fix .
18 | - name: Check Publish Warnings
19 | run: flutter pub publish --dry-run
20 | - name: Publish
21 | uses: sakebook/actions-flutter-pub-publisher@v1.3.1
22 | with:
23 | credential: ${{ secrets.CREDENTIAL_JSON }}
24 | flutter_package: true
25 | skip_test: true
26 | dry_run: false
--------------------------------------------------------------------------------
/.github/workflows/title-validation.yml:
--------------------------------------------------------------------------------
1 | # See https://github.com/amannn/action-semantic-pull-request
2 | name: 'PR Title is Conventional'
3 |
4 | on:
5 | pull_request_target:
6 | types:
7 | - opened
8 | - edited
9 | - synchronize
10 | - reopened
11 |
12 | jobs:
13 | main:
14 | name: Validate PR title
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: amannn/action-semantic-pull-request@v4
18 | env:
19 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 | with:
21 | types: |
22 | build
23 | chore
24 | ci
25 | docs
26 | feat
27 | fix
28 | perf
29 | refactor
30 | revert
31 | style
32 | test
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }()
9 |
10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11 |
12 | repositories {
13 | google()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | plugins {
20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21 | id "com.android.application" version '8.10.0' apply false
22 | id "org.jetbrains.kotlin.android" version "1.9.10" apply false
23 | }
24 |
25 | include ":app"
26 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/src/models/flutter_inherited_data.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// Container for captured inherited widget data from showcase's context.
4 | class FlutterInheritedData {
5 | const FlutterInheritedData({
6 | required this.mediaQuery,
7 | required this.textDirection,
8 | required this.capturedThemes,
9 | required this.textStyle,
10 | });
11 |
12 | factory FlutterInheritedData.fromContext(BuildContext context) {
13 | return FlutterInheritedData(
14 | mediaQuery: MediaQuery.of(context),
15 | capturedThemes: InheritedTheme.capture(
16 | from: context,
17 | to: Navigator.maybeOf(context)?.context,
18 | ),
19 | textDirection: Directionality.of(context),
20 | textStyle: DefaultTextStyle.of(context).style,
21 | );
22 | }
23 |
24 | final MediaQueryData mediaQuery;
25 | final CapturedThemes capturedThemes;
26 | final TextDirection textDirection;
27 | final TextStyle textStyle;
28 | }
29 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/workflows/flutter.yaml:
--------------------------------------------------------------------------------
1 | name: Build
2 |
3 | on:
4 | push:
5 | paths:
6 | - '**.dart'
7 | - '**.yaml'
8 | - '**.yml'
9 | branches:
10 | - master
11 | pull_request:
12 | branches:
13 | - master
14 |
15 | jobs:
16 | build:
17 | runs-on: ubuntu-latest
18 | steps:
19 | - uses: actions/checkout@v4
20 | - name: Install Flutter
21 | uses: subosito/flutter-action@v2
22 | with:
23 | flutter-version: '3.10.0'
24 | cache: true
25 | cache-key: 'flutter-macos-stable-3.10.0-apple'
26 | cache-path: '${{ runner.tool_cache }}/flutter/macos-stable-3.10.0-apple'
27 | pub-cache-key: 'flutter-pub-macos-stable-3.10.0-apple'
28 |
29 | - name: Install dependencies
30 | run: flutter pub get
31 | - name: Code Formatting
32 | run: dart format --set-exit-if-changed .
33 | - name: Code Analyse
34 | run: dart analyze
35 | - name: Check Publish Warnings
36 | run: flutter pub publish --dry-run
37 |
--------------------------------------------------------------------------------
/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": "Showcase Preview",
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 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Simform Solutions
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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/windows/runner/run_loop.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_RUN_LOOP_H_
2 | #define RUNNER_RUN_LOOP_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | // A runloop that will service events for Flutter instances as well
10 | // as native messages.
11 | class RunLoop {
12 | public:
13 | RunLoop();
14 | ~RunLoop();
15 |
16 | // Prevent copying
17 | RunLoop(RunLoop const&) = delete;
18 | RunLoop& operator=(RunLoop const&) = delete;
19 |
20 | // Runs the run loop until the application quits.
21 | void Run();
22 |
23 | // Registers the given Flutter instance for event servicing.
24 | void RegisterFlutterInstance(
25 | flutter::FlutterEngine* flutter_instance);
26 |
27 | // Unregisters the given Flutter instance from event servicing.
28 | void UnregisterFlutterInstance(
29 | flutter::FlutterEngine* flutter_instance);
30 |
31 | private:
32 | using TimePoint = std::chrono::steady_clock::time_point;
33 |
34 | // Processes all currently pending messages for registered Flutter instances.
35 | TimePoint ProcessFlutterMessages();
36 |
37 | std::set flutter_instances_;
38 | };
39 |
40 | #endif // RUNNER_RUN_LOOP_H_
41 |
--------------------------------------------------------------------------------
/pub_login.sh:
--------------------------------------------------------------------------------
1 | # This script creates/updates credentials.json file which is used
2 | # to authorize publisher when publishing packages to pub.dev
3 |
4 | # Checking whether the secrets are available as environment
5 | # variables or not.
6 | if [ -z "${PUB_DEV_PUBLISH_ACCESS_TOKEN}" ]; then
7 | echo "Missing PUB_DEV_PUBLISH_ACCESS_TOKEN environment variable"
8 | exit 1
9 | fi
10 |
11 | if [ -z "${PUB_DEV_PUBLISH_REFRESH_TOKEN}" ]; then
12 | echo "Missing PUB_DEV_PUBLISH_REFRESH_TOKEN environment variable"
13 | exit 1
14 | fi
15 |
16 | if [ -z "${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}" ]; then
17 | echo "Missing PUB_DEV_PUBLISH_TOKEN_ENDPOINT environment variable"
18 | exit 1
19 | fi
20 |
21 | if [ -z "${PUB_DEV_PUBLISH_EXPIRATION}" ]; then
22 | echo "Missing PUB_DEV_PUBLISH_EXPIRATION environment variable"
23 | exit 1
24 | fi
25 |
26 | # Create credentials.json file.
27 | cat <~/.pub-cache/credentials.json
28 | {
29 | "accessToken":"${PUB_DEV_PUBLISH_ACCESS_TOKEN}",
30 | "refreshToken":"${PUB_DEV_PUBLISH_REFRESH_TOKEN}",
31 | "tokenEndpoint":"${PUB_DEV_PUBLISH_TOKEN_ENDPOINT}",
32 | "scopes":["https://www.googleapis.com/auth/userinfo.email","openid"],
33 | "expiration":${PUB_DEV_PUBLISH_EXPIRATION}
34 | }
35 | EOF
36 |
--------------------------------------------------------------------------------
/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 "run_loop.h"
10 | #include "win32_window.h"
11 |
12 | // A window that does nothing but host a Flutter view.
13 | class FlutterWindow : public Win32Window {
14 | public:
15 | // Creates a new FlutterWindow driven by the |run_loop|, hosting a
16 | // Flutter view running |project|.
17 | explicit FlutterWindow(RunLoop* run_loop,
18 | const flutter::DartProject& project);
19 | virtual ~FlutterWindow();
20 |
21 | protected:
22 | // Win32Window:
23 | bool OnCreate() override;
24 | void OnDestroy() override;
25 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
26 | LPARAM const lparam) noexcept override;
27 |
28 | private:
29 | // The run loop driving events for this window.
30 | RunLoop* run_loop_;
31 |
32 | // The project to run.
33 | flutter::DartProject project_;
34 |
35 | // The Flutter instance hosted by this window.
36 | std::unique_ptr flutter_controller_;
37 | };
38 |
39 | #endif // RUNNER_FLUTTER_WINDOW_H_
40 |
--------------------------------------------------------------------------------
/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 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "run_loop.h"
7 | #include "utils.h"
8 |
9 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
10 | _In_ wchar_t *command_line, _In_ int show_command) {
11 | // Attach to console when present (e.g., 'flutter run') or create a
12 | // new console when running with a debugger.
13 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
14 | CreateAndAttachConsole();
15 | }
16 |
17 | // Initialize COM, so that it is available for use in the library and/or
18 | // plugins.
19 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
20 |
21 | RunLoop run_loop;
22 |
23 | flutter::DartProject project(L"data");
24 |
25 | std::vector command_line_arguments =
26 | GetCommandLineArguments();
27 |
28 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
29 |
30 | FlutterWindow window(&run_loop, project);
31 | Win32Window::Point origin(10, 10);
32 | Win32Window::Size size(1280, 720);
33 | if (!window.CreateAndShow(L"example", origin, size)) {
34 | return EXIT_FAILURE;
35 | }
36 | window.SetQuitOnClose(true);
37 |
38 | run_loop.Run();
39 |
40 | ::CoUninitialize();
41 | return EXIT_SUCCESS;
42 | }
43 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### Flutter ###
2 | # Flutter/Dart/Pub related
3 | **/doc/api/
4 | .dart_tool/
5 | .flutter-plugins
6 | .packages
7 | .pub-cache/
8 | .pub/
9 | .idea/
10 | .vscode/
11 | build/
12 |
13 | # Android related
14 | **/android/**/gradle-wrapper.jar
15 | **/android/.gradle
16 | **/android/captures/
17 | **/android/gradlew
18 | **/android/gradlew.bat
19 | **/android/local.properties
20 | **/android/**/GeneratedPluginRegistrant.java
21 |
22 | # iOS/XCode related
23 | **/ios/**/*.mode1v3
24 | **/ios/**/*.mode2v3
25 | **/ios/**/*.moved-aside
26 | **/ios/**/*.pbxuser
27 | **/ios/**/*.perspectivev3
28 | **/ios/**/*sync/
29 | **/ios/**/.sconsign.dblite
30 | **/ios/**/.tags*
31 | **/ios/**/.vagrant/
32 | **/ios/**/DerivedData/
33 | **/ios/**/Icon?
34 | **/ios/**/Pods/
35 | **/ios/**/.symlinks/
36 | **/ios/**/profile
37 | **/ios/**/xcuserdata
38 | **/ios/.generated/
39 | **/ios/Flutter/App.framework
40 | **/ios/Flutter/Flutter.framework
41 | **/ios/Flutter/Generated.xcconfig
42 | **/ios/Flutter/app.flx
43 | **/ios/Flutter/app.zip
44 | **/ios/Flutter/flutter_assets/
45 | **/ios/ServiceDefinitions.json
46 | **/ios/Runner/GeneratedPluginRegistrant.*
47 |
48 | # Exceptions to above rules.
49 | !**/ios/**/default.mode1v3
50 | !**/ios/**/default.mode2v3
51 | !**/ios/**/default.pbxuser
52 | !**/ios/**/default.perspectivev3
53 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
54 |
55 | /showcaseview.iml
56 |
57 | .idea/instapk.xml
58 | instapk.log*
59 | ios/Frameworks/
60 | ios/Runner.xcworkspace/xcshareddata/
61 | example/ios/Flutter/flutter_export_environment.sh
62 | flutter_showcaseview.iml
63 | pubspec.lock
64 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright © 2020, Simform Solutions
3 | # All rights reserved.
4 | #
5 | # Redistribution and use in source and binary forms, with or without
6 | # modification, are permitted provided that the following conditions are met:
7 | #
8 | # 1. Redistributions of source code must retain the above copyright notice, this
9 | # list of conditions and the following disclaimer.
10 | #
11 | # 2. Redistributions in binary form must reproduce the above copyright notice,
12 | # this list of conditions and the following disclaimer in the documentation
13 | # and/or other materials provided with the distribution.
14 | #
15 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19 | # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 | # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 | # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 | # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 | # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 | #
26 |
27 | org.gradle.jvmargs=-Xmx1536M
28 | android.enableR8=true
29 | android.useAndroidX=true
30 | android.defaults.buildfeatures.buildconfig=true
31 | android.nonTransitiveRClass=false
32 | android.nonFinalResIds=false
33 |
--------------------------------------------------------------------------------
/lib/showcaseview.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | library showcaseview;
24 |
25 | export 'src/models/action_button_icon.dart';
26 | export 'src/models/tooltip_action_button.dart';
27 | export 'src/models/tooltip_action_config.dart';
28 | export 'src/showcase/showcase.dart';
29 | export 'src/showcase/showcase_view.dart';
30 | export 'src/showcase_widget.dart';
31 | export 'src/utils/enum.dart' hide ShowcaseProgressType, TooltipLayoutSlot;
32 | export 'src/widget/floating_action_widget.dart';
33 | export 'src/widget/tooltip_action_button_widget.dart';
34 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 | CADisableMinimumFrameDurationOnPhone
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/.github/workflows/web-example-release.yml:
--------------------------------------------------------------------------------
1 | name: web-example-release
2 | on:
3 | workflow_dispatch: # Allows manual triggering
4 | release:
5 | types: [published] # Triggers when a release is published
6 |
7 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
8 | permissions:
9 | contents: read
10 | pages: write
11 | id-token: write
12 |
13 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
14 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
15 | concurrency:
16 | group: "pages"
17 | cancel-in-progress: false
18 |
19 | jobs:
20 | build:
21 | runs-on: ubuntu-latest
22 | timeout-minutes: 15
23 | environment:
24 | name: github-pages
25 | url: ${{ steps.deployment.outputs.page_url }}
26 | steps:
27 | - name: Checkout input branch from github
28 | uses: actions/checkout@v4.1.1
29 | - name: Flutter action
30 | uses: subosito/flutter-action@v2.13.0
31 | with:
32 | flutter-version: '3.32.5'
33 | cache: true
34 | cache-key: 'flutter-3.32.5-stable'
35 | cache-path: '${{ runner.tool_cache }}/flutter/3.32.5-stable'
36 | pub-cache-key: 'flutter-pub-3.32.5-stable'
37 | - name: Setup Pages
38 | uses: actions/configure-pages@v5
39 | - name: Project Clean Up
40 | run: flutter clean && flutter pub get
41 | - name: Build Web App
42 | run: cd example && flutter build web --base-href="/showcaseview/"
43 | - name: Upload Web Artifact
44 | uses: actions/upload-pages-artifact@v3.0.1
45 | with:
46 | path: 'example/build/web'
47 | - name: Deploy to GitHub Pages
48 | id: deployment
49 | uses: actions/deploy-pages@v4.0.5
50 |
--------------------------------------------------------------------------------
/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 and should not be manually edited.
5 |
6 | version:
7 | revision: "edada7c56edf4a183c1735310e123c7f923584f1"
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: edada7c56edf4a183c1735310e123c7f923584f1
17 | base_revision: edada7c56edf4a183c1735310e123c7f923584f1
18 | - platform: android
19 | create_revision: edada7c56edf4a183c1735310e123c7f923584f1
20 | base_revision: edada7c56edf4a183c1735310e123c7f923584f1
21 | - platform: ios
22 | create_revision: edada7c56edf4a183c1735310e123c7f923584f1
23 | base_revision: edada7c56edf4a183c1735310e123c7f923584f1
24 | - platform: linux
25 | create_revision: edada7c56edf4a183c1735310e123c7f923584f1
26 | base_revision: edada7c56edf4a183c1735310e123c7f923584f1
27 | - platform: macos
28 | create_revision: edada7c56edf4a183c1735310e123c7f923584f1
29 | base_revision: edada7c56edf4a183c1735310e123c7f923584f1
30 | - platform: web
31 | create_revision: edada7c56edf4a183c1735310e123c7f923584f1
32 | base_revision: edada7c56edf4a183c1735310e123c7f923584f1
33 | - platform: windows
34 | create_revision: edada7c56edf4a183c1735310e123c7f923584f1
35 | base_revision: edada7c56edf4a183c1735310e123c7f923584f1
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | # Description
2 |
8 |
9 |
10 | ## Checklist
11 |
15 |
16 | - [ ] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc).
17 | - [ ] I have followed the [Contributor Guide] when preparing my PR.
18 | - [ ] I have updated/added tests for ALL new/updated/fixed functionality.
19 | - [ ] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`.
20 | - [ ] I have updated/added relevant examples in `examples` or `docs`.
21 |
22 |
23 | ## Breaking Change?
24 |
36 |
37 | - [ ] Yes, this PR is a breaking change.
38 | - [ ] No, this PR is not a breaking change.
39 |
40 |
41 | ## Related Issues
42 |
46 |
47 |
48 | [Contributor Guide]: https://github.com/SimformSolutionsPvtLtd/showcaseview/blob/master/CONTRIBUTING.md
49 | [Conventional Commit]: https://conventionalcommits.org
50 |
--------------------------------------------------------------------------------
/lib/src/widget/tooltip_slide_transition.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | import 'package:flutter/widgets.dart';
24 |
25 | class ToolTipSlideTransition extends AnimatedWidget {
26 | /// [SlideTransition] could have been used instead of this widget,
27 | /// but it internally uses [FractionalTranslation] which affects the
28 | /// transformation based on the size of a child. This widget uses
29 | /// [Transform.translate] which would fix translation independent of the
30 | /// child's size.
31 | const ToolTipSlideTransition({
32 | required Listenable position,
33 | required this.child,
34 | super.key,
35 | }) : super(listenable: position);
36 |
37 | final Widget child;
38 |
39 | @override
40 | Widget build(BuildContext context) {
41 | final progress = listenable as Animation;
42 | return Transform.translate(offset: progress.value, child: child);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/lib/src/tooltip/tooltip_layout_id.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | part of 'tooltip.dart';
23 |
24 | class _TooltipLayoutId extends ParentDataWidget {
25 | const _TooltipLayoutId({
26 | required this.id,
27 | required super.child,
28 | required super.key,
29 | });
30 |
31 | final Object id;
32 |
33 | @override
34 | void applyParentData(RenderObject renderObject) {
35 | assert(renderObject.parentData is MultiChildLayoutParentData);
36 | final parentData = renderObject.parentData! as MultiChildLayoutParentData;
37 |
38 | if (parentData.id == id) return;
39 |
40 | parentData.id = id;
41 |
42 | final targetObject = renderObject.parent;
43 | if (targetObject is! RenderObject) return;
44 |
45 | targetObject.markNeedsLayout();
46 | }
47 |
48 | @override
49 | Type get debugTypicalAncestorWidgetClass => _AnimatedTooltipMultiLayout;
50 | }
51 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | id "dev.flutter.flutter-gradle-plugin"
5 | }
6 | def localProperties = new Properties()
7 | def localPropertiesFile = rootProject.file('local.properties')
8 | if (localPropertiesFile.exists()) {
9 | localPropertiesFile.withReader('UTF-8') { reader ->
10 | localProperties.load(reader)
11 | }
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 | android {
25 | compileSdkVersion 34
26 |
27 | compileOptions {
28 | sourceCompatibility JavaVersion.VERSION_17
29 | targetCompatibility JavaVersion.VERSION_17
30 | }
31 |
32 | kotlinOptions {
33 | jvmTarget = '17'
34 | }
35 |
36 | sourceSets {
37 | main.java.srcDirs += 'src/main/kotlin'
38 | }
39 |
40 | lintOptions {
41 | disable 'InvalidPackage'
42 | }
43 |
44 | defaultConfig {
45 | applicationId "com.simform.example"
46 | minSdkVersion flutter.minSdkVersion
47 | targetSdkVersion 33
48 | versionCode flutterVersionCode.toInteger()
49 | versionName flutterVersionName
50 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
51 | }
52 |
53 | buildTypes {
54 | release {
55 | // Signing with the debug keys for now, so `flutter run --release` works.
56 | signingConfig signingConfigs.debug
57 | }
58 | }
59 | namespace 'com.simform.example'
60 | }
61 |
62 | flutter {
63 | source '../..'
64 | }
65 |
66 | dependencies {
67 | testImplementation 'junit:junit:4.13.1'
68 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
69 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
70 | }
71 |
--------------------------------------------------------------------------------
/lib/src/utils/extensions.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'dart:ui';
23 |
24 | extension ListExtension on List {
25 | /// Removes and returns the first element that satisfies the provided test
26 | /// function. If no element satisfies the test, returns the result of
27 | /// calling [orElse], or null if [orElse] is omitted.
28 | E? removeFirstWhere(
29 | bool Function(E element) test, {
30 | E Function()? orElse,
31 | }) {
32 | final length = this.length;
33 | for (var i = 0; i < length; i++) {
34 | final element = this[i];
35 | if (test(element)) {
36 | removeAt(i);
37 | return element;
38 | }
39 |
40 | if (length != this.length) throw ConcurrentModificationError(this);
41 | }
42 | return orElse?.call();
43 | }
44 | }
45 |
46 | extension ColorExtension on Color {
47 | /// Converts opacity value to color with alpha
48 | /// This avoids using the deprecated overlayOpacity directly
49 | Color reduceOpacity(double opacity) => withAlpha((opacity * 255).round());
50 | }
51 |
--------------------------------------------------------------------------------
/lib/src/widget/showcase_circular_progress_indicator.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/cupertino.dart' show CupertinoActivityIndicator;
23 | import 'package:flutter/material.dart';
24 |
25 | import '../utils/constants.dart';
26 |
27 | class ShowcaseCircularProgressIndicator extends StatelessWidget {
28 | const ShowcaseCircularProgressIndicator({super.key});
29 |
30 | @override
31 | Widget build(BuildContext context) {
32 | final theme = Theme.of(context);
33 | switch (theme.platform) {
34 | case TargetPlatform.iOS:
35 | case TargetPlatform.macOS:
36 | return const CupertinoActivityIndicator(
37 | radius: Constants.cupertinoActivityIndicatorRadius,
38 | color: Colors.white,
39 | );
40 | case TargetPlatform.android:
41 | case TargetPlatform.fuchsia:
42 | case TargetPlatform.linux:
43 | case TargetPlatform.windows:
44 | return const CircularProgressIndicator(
45 | valueColor: AlwaysStoppedAnimation(Colors.white),
46 | );
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/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 | # Visual Studio Code related
19 | .vscode/
20 |
21 | # Flutter/Dart/Pub related
22 | **/doc/api/
23 | .dart_tool/
24 | .flutter-plugins
25 | .packages
26 | .pub-cache/
27 | .pub/
28 | /build/
29 |
30 | # Android related
31 | **/android/**/gradle-wrapper.jar
32 | **/android/.gradle
33 | **/android/captures/
34 | **/android/gradlew
35 | **/android/gradlew.bat
36 | **/android/local.properties
37 | **/android/**/GeneratedPluginRegistrant.java
38 |
39 | # iOS/XCode related
40 | **/ios/**/*.mode1v3
41 | **/ios/**/*.mode2v3
42 | **/ios/**/*.moved-aside
43 | **/ios/**/*.pbxuser
44 | **/ios/**/*.perspectivev3
45 | **/ios/**/*sync/
46 | **/ios/**/.sconsign.dblite
47 | **/ios/**/.tags*
48 | **/ios/**/.vagrant/
49 | **/ios/**/DerivedData/
50 | **/ios/**/Icon?
51 | **/ios/**/Pods/
52 | **/ios/**/.symlinks/
53 | **/ios/**/profile
54 | **/ios/**/xcuserdata
55 | **/ios/.generated/
56 | **/ios/Flutter/App.framework
57 | **/ios/Flutter/Flutter.framework
58 | **/ios/Flutter/Generated.xcconfig
59 | **/ios/Flutter/app.flx
60 | **/ios/Flutter/app.zip
61 | **/ios/Flutter/flutter_assets/
62 | **/ios/ServiceDefinitions.json
63 | **/ios/Runner/GeneratedPluginRegistrant.*
64 | /ios/Flutter/.last_build_id
65 | # Exceptions to above rules.
66 | !**/ios/**/default.mode1v3
67 | !**/ios/**/default.mode2v3
68 | !**/ios/**/default.pbxuser
69 | !**/ios/**/default.perspectivev3
70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
71 | /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
72 | pubspec.lock
73 |
74 | # Windows project.
75 | windows/flutter/generated_plugin_registrant.cc
76 | windows/flutter/generated_plugin_registrant.h
77 | windows/flutter/generated_plugins.cmake
78 |
79 | # Linux Project
80 | linux/flutter/generated_plugin_registrant.cc
81 | linux/flutter/generated_plugin_registrant.h
82 | linux/flutter/generated_plugins.cmake
83 |
84 | # macOS Project
85 | macos/Flutter/ephemeral/Flutter-Generated.xcconfig
86 | macos/Flutter/ephemeral/flutter_export_environment.sh
87 | macos/Flutter/GeneratedPluginRegistrant.swift
--------------------------------------------------------------------------------
/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(RunLoop* run_loop,
8 | const flutter::DartProject& project)
9 | : run_loop_(run_loop), project_(project) {}
10 |
11 | FlutterWindow::~FlutterWindow() {}
12 |
13 | bool FlutterWindow::OnCreate() {
14 | if (!Win32Window::OnCreate()) {
15 | return false;
16 | }
17 |
18 | RECT frame = GetClientArea();
19 |
20 | // The size here must match the window dimensions to avoid unnecessary surface
21 | // creation / destruction in the startup path.
22 | flutter_controller_ = std::make_unique(
23 | frame.right - frame.left, frame.bottom - frame.top, project_);
24 | // Ensure that basic setup of the controller was successful.
25 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
26 | return false;
27 | }
28 | RegisterPlugins(flutter_controller_->engine());
29 | run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
30 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
31 | return true;
32 | }
33 |
34 | void FlutterWindow::OnDestroy() {
35 | if (flutter_controller_) {
36 | run_loop_->UnregisterFlutterInstance(flutter_controller_->engine());
37 | flutter_controller_ = nullptr;
38 | }
39 |
40 | Win32Window::OnDestroy();
41 | }
42 |
43 | LRESULT
44 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
45 | WPARAM const wparam,
46 | LPARAM const lparam) noexcept {
47 | // Give Flutter, including plugins, an opportunity to handle window messages.
48 | if (flutter_controller_) {
49 | std::optional result =
50 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
51 | lparam);
52 | if (result) {
53 | return *result;
54 | }
55 | }
56 |
57 | switch (message) {
58 | case WM_FONTCHANGE:
59 | flutter_controller_->engine()->ReloadSystemFonts();
60 | break;
61 | }
62 |
63 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
64 | }
65 |
--------------------------------------------------------------------------------
/lib/src/models/linked_showcase_data_model.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/widgets.dart';
23 |
24 | @immutable
25 | class LinkedShowcaseDataModel {
26 | /// This model is used to move linked showcase overlay data to parent
27 | /// showcase to crop linked showcase rect.
28 | const LinkedShowcaseDataModel({
29 | required this.rect,
30 | required this.radius,
31 | required this.overlayPadding,
32 | required this.isCircle,
33 | });
34 |
35 | final Rect rect;
36 | final EdgeInsets overlayPadding;
37 | final BorderRadius? radius;
38 | final bool isCircle;
39 |
40 | @override
41 | bool operator ==(Object other) =>
42 | identical(this, other) ||
43 | other is LinkedShowcaseDataModel &&
44 | runtimeType == other.runtimeType &&
45 | rect == other.rect &&
46 | radius == other.radius &&
47 | overlayPadding == other.overlayPadding &&
48 | isCircle == other.isCircle;
49 |
50 | @override
51 | int get hashCode => Object.hash(
52 | rect,
53 | radius,
54 | overlayPadding,
55 | isCircle,
56 | );
57 | }
58 |
--------------------------------------------------------------------------------
/lib/src/widget/default_tooltip_text_widget.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/material.dart';
23 |
24 | class DefaultTooltipTextWidget extends StatelessWidget {
25 | const DefaultTooltipTextWidget({
26 | required this.alignment,
27 | required this.padding,
28 | required this.text,
29 | this.textAlign,
30 | this.textDirection,
31 | this.textColor,
32 | this.textStyle,
33 | super.key,
34 | });
35 |
36 | final AlignmentGeometry alignment;
37 | final EdgeInsetsGeometry padding;
38 | final String text;
39 | final TextAlign? textAlign;
40 | final TextDirection? textDirection;
41 | final Color? textColor;
42 | final TextStyle? textStyle;
43 |
44 | @override
45 | Widget build(BuildContext context) {
46 | return Align(
47 | alignment: alignment,
48 | child: Padding(
49 | padding: padding,
50 | child: Text(
51 | text,
52 | textAlign: textAlign,
53 | textDirection: textDirection,
54 | style: textStyle ??
55 | Theme.of(context)
56 | .textTheme
57 | .titleSmall
58 | ?.merge(TextStyle(color: textColor)),
59 | ),
60 | ),
61 | );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
12 |
20 |
24 |
27 |
28 |
31 |
32 |
33 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/example/windows/runner/run_loop.cpp:
--------------------------------------------------------------------------------
1 | #include "run_loop.h"
2 |
3 | #include
4 |
5 | #include
6 |
7 | RunLoop::RunLoop() {}
8 |
9 | RunLoop::~RunLoop() {}
10 |
11 | void RunLoop::Run() {
12 | bool keep_running = true;
13 | TimePoint next_flutter_event_time = TimePoint::clock::now();
14 | while (keep_running) {
15 | std::chrono::nanoseconds wait_duration =
16 | std::max(std::chrono::nanoseconds(0),
17 | next_flutter_event_time - TimePoint::clock::now());
18 | ::MsgWaitForMultipleObjects(
19 | 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000),
20 | QS_ALLINPUT);
21 | bool processed_events = false;
22 | MSG message;
23 | // All pending Windows messages must be processed; MsgWaitForMultipleObjects
24 | // won't return again for items left in the queue after PeekMessage.
25 | while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) {
26 | processed_events = true;
27 | if (message.message == WM_QUIT) {
28 | keep_running = false;
29 | break;
30 | }
31 | ::TranslateMessage(&message);
32 | ::DispatchMessage(&message);
33 | // Allow Flutter to process messages each time a Windows message is
34 | // processed, to prevent starvation.
35 | next_flutter_event_time =
36 | std::min(next_flutter_event_time, ProcessFlutterMessages());
37 | }
38 | // If the PeekMessage loop didn't run, process Flutter messages.
39 | if (!processed_events) {
40 | next_flutter_event_time =
41 | std::min(next_flutter_event_time, ProcessFlutterMessages());
42 | }
43 | }
44 | }
45 |
46 | void RunLoop::RegisterFlutterInstance(
47 | flutter::FlutterEngine* flutter_instance) {
48 | flutter_instances_.insert(flutter_instance);
49 | }
50 |
51 | void RunLoop::UnregisterFlutterInstance(
52 | flutter::FlutterEngine* flutter_instance) {
53 | flutter_instances_.erase(flutter_instance);
54 | }
55 |
56 | RunLoop::TimePoint RunLoop::ProcessFlutterMessages() {
57 | TimePoint next_event_time = TimePoint::max();
58 | for (auto instance : flutter_instances_) {
59 | std::chrono::nanoseconds wait_duration = instance->ProcessMessages();
60 | if (wait_duration != std::chrono::nanoseconds::max()) {
61 | next_event_time =
62 | std::min(next_event_time, TimePoint::clock::now() + wait_duration);
63 | }
64 | }
65 | return next_event_time;
66 | }
67 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/src/models/action_button_icon.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/cupertino.dart';
23 | import 'package:flutter/material.dart';
24 |
25 | class ActionButtonIcon {
26 | /// Creates an icon configuration for a tooltip action button with a
27 | /// standard [Icon].
28 | ///
29 | /// The [icon] parameter is required and specifies the icon to display.
30 | /// The optional [padding] parameter defines spacing around the icon.
31 | const ActionButtonIcon({
32 | required Icon this.icon,
33 | this.padding,
34 | });
35 |
36 | /// Creates an icon configuration for a tooltip action button with an
37 | /// [ImageIcon].
38 | ///
39 | /// The [icon] parameter is required and specifies the image icon to display.
40 | /// The optional [padding] parameter defines spacing around the icon.
41 | const ActionButtonIcon.withImageIcon({
42 | required ImageIcon this.icon,
43 | this.padding,
44 | });
45 |
46 | /// The icon widget to display in the button.
47 | ///
48 | /// Can be either an [Icon] or [ImageIcon] depending on which constructor
49 | /// is used.
50 | final Widget icon;
51 |
52 | /// Optional padding to apply around the icon.
53 | final EdgeInsets? padding;
54 |
55 | @override
56 | bool operator ==(Object other) {
57 | if (identical(this, other)) return true;
58 | return other is ActionButtonIcon &&
59 | icon == other.icon &&
60 | padding == other.padding;
61 | }
62 |
63 | @override
64 | int get hashCode => Object.hash(icon, padding);
65 | }
66 |
--------------------------------------------------------------------------------
/lib/src/tooltip/arrow_painter.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | part of 'tooltip.dart';
23 |
24 | class ShowcaseArrow extends StatelessWidget {
25 | const ShowcaseArrow({
26 | super.key,
27 | required this.strokeColor,
28 | });
29 |
30 | final Color strokeColor;
31 |
32 | @override
33 | Widget build(BuildContext context) {
34 | return CustomPaint(
35 | painter: _ArrowPainter(
36 | strokeColor: strokeColor,
37 | ),
38 | size: const Size(Constants.arrowWidth, Constants.arrowHeight),
39 | );
40 | }
41 | }
42 |
43 | class _ArrowPainter extends CustomPainter {
44 | _ArrowPainter({
45 | this.strokeColor = Colors.black,
46 | this.strokeWidth = Constants.arrowStrokeWidth,
47 | this.paintingStyle = PaintingStyle.fill,
48 | }) : _paint = Paint()
49 | ..color = strokeColor
50 | ..strokeWidth = strokeWidth
51 | ..style = paintingStyle,
52 | // Cache the triangle path since it never changes
53 | _path = Path()
54 | ..moveTo(0, Constants.arrowHeight)
55 | ..lineTo(Constants.arrowWidth * 0.5, 0)
56 | ..lineTo(Constants.arrowWidth, Constants.arrowHeight)
57 | ..lineTo(0, Constants.arrowHeight);
58 |
59 | final Color strokeColor;
60 | final PaintingStyle paintingStyle;
61 | final double strokeWidth;
62 | final Paint _paint;
63 | final Path _path;
64 |
65 | @override
66 | void paint(Canvas canvas, Size size) => canvas.drawPath(
67 | _path,
68 | _paint,
69 | );
70 |
71 | @override
72 | bool shouldRepaint(covariant _ArrowPainter oldDelegate) {
73 | return oldDelegate.strokeColor != strokeColor ||
74 | oldDelegate.paintingStyle != paintingStyle ||
75 | oldDelegate.strokeWidth != strokeWidth;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/lib/src/models/showcase_scope.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/foundation.dart';
23 | import 'package:flutter/widgets.dart';
24 |
25 | import '../showcase/showcase_controller.dart';
26 | import '../showcase/showcase_view.dart';
27 |
28 | class ShowcaseScope {
29 | /// A container class that manages showcase views within a specific named
30 | /// scope.
31 | ///
32 | /// This class is responsible for:
33 | /// - Maintain a reference to a named scope and its associated [ShowcaseView].
34 | /// - Store and organize [ShowcaseController] instances by their GlobalKeys.
35 | /// - Enable multiple independent showcase systems to coexist in different
36 | /// parts of the app.
37 | /// - Facilitate proper routing of showcase events to the correct controllers.
38 | ///
39 | /// This class is primarily used by [ShowcaseService] to manage showcase
40 | /// views and their controllers within different scopes, allowing for
41 | /// isolated showcase experiences that can be independently controlled and
42 | /// navigated.
43 | ShowcaseScope({
44 | required this.name,
45 | required this.showcaseView,
46 | });
47 |
48 | final String name;
49 | final ShowcaseView showcaseView;
50 |
51 | /// A mapping of showcase keys to their associated controllers
52 | /// - Key: GlobalKey of a showcase (provided by user)
53 | /// - Value: Map of showcase IDs to their controllers
54 | final Map> controllers = {};
55 |
56 | @override
57 | bool operator ==(Object other) {
58 | if (identical(this, other)) return true;
59 | return other is ShowcaseScope &&
60 | name == other.name &&
61 | showcaseView == other.showcaseView &&
62 | mapEquals(controllers, other.controllers);
63 | }
64 |
65 | @override
66 | int get hashCode => Object.hash(name, showcaseView, controllers);
67 | }
68 |
--------------------------------------------------------------------------------
/lib/src/utils/constants.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/material.dart';
23 |
24 | import '../widget/showcase_circular_progress_indicator.dart';
25 |
26 | class Constants {
27 | Constants._();
28 |
29 | /// Arrow dimensions
30 | static const double arrowWidth = 18;
31 | static const double arrowHeight = 9;
32 |
33 | static const double arrowStrokeWidth = 10;
34 |
35 | /// Padding when arrow is visible
36 | static const double withArrowToolTipPadding = 7;
37 |
38 | /// Padding when arrow is not visible
39 | static const double withOutArrowToolTipPadding = 0;
40 |
41 | /// Minimum tooltip dimensions to maintain usability
42 | static const double minimumToolTipWidth = 50;
43 | // Currently we are not constraining height but will do in future
44 | static const double minimumToolTipHeight = 50;
45 |
46 | /// This is amount of extra offset scale alignment will have
47 | /// i.e if it is bottom position then centerBottom + [extraAlignmentOffset]
48 | /// in bottom
49 | static const double extraAlignmentOffset = 5;
50 |
51 | static const Radius defaultTargetRadius = Radius.circular(3);
52 |
53 | static const ShapeBorder defaultTargetShapeBorder = RoundedRectangleBorder(
54 | borderRadius: BorderRadius.all(Radius.circular(8)),
55 | );
56 |
57 | static const double cupertinoActivityIndicatorRadius = 12;
58 | static const Widget defaultProgressIndicator =
59 | ShowcaseCircularProgressIndicator();
60 |
61 | static const Duration defaultAnimationDuration = Duration(milliseconds: 2000);
62 |
63 | /// Default scope name when none is specified
64 | static const String defaultScope = '_showcaseDefaultScope';
65 | static const String initialScope = '_showcaseInitialScope';
66 |
67 | static const Duration defaultAutoPlayDelay = Duration(milliseconds: 2000);
68 | static const Duration defaultScrollDuration = Duration(milliseconds: 300);
69 | }
70 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
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.simform" "\0"
93 | VALUE "FileDescription", "A new Flutter project." "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "example" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2021 com.simform. 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 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at developer@simform.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/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 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
64 |
65 |
71 |
73 |
79 |
80 |
81 |
82 |
84 |
85 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/lib/src/widget/action_widget.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/material.dart';
23 |
24 | import '../models/tooltip_action_config.dart';
25 |
26 | class ActionWidget extends StatelessWidget {
27 | /// A widget that displays action buttons in a tooltip.
28 | ///
29 | /// This widget is responsible for rendering and aligning action buttons
30 | /// within the tooltip. It works in conjunction with [TooltipActionConfig] to
31 | /// determine how these action buttons should be laid out.
32 | ///
33 | /// The widget can be positioned in two ways:
34 | /// - Inside the tooltip content (when [TooltipActionConfig.position] is set
35 | /// to [TooltipActionPosition.inside]).
36 | /// - Outside the tooltip content (when [TooltipActionConfig.position] is set
37 | /// to [TooltipActionPosition.outside] or when a custom container is used).
38 | ///
39 | /// The layout of action buttons can be customized using:
40 | /// - [alignment] - Controls how buttons are spaced horizontally.
41 | /// - [crossAxisAlignment] - Controls how buttons are aligned vertically.
42 | /// - [outsidePadding] - Adds padding around the buttons when placed inside
43 | /// the tooltip.
44 | const ActionWidget({
45 | required this.children,
46 | required this.tooltipActionConfig,
47 | this.outsidePadding = EdgeInsets.zero,
48 | super.key,
49 | });
50 |
51 | final TooltipActionConfig tooltipActionConfig;
52 | final List children;
53 | final EdgeInsets outsidePadding;
54 |
55 | @override
56 | Widget build(BuildContext context) {
57 | return Material(
58 | type: MaterialType.transparency,
59 | child: Padding(
60 | padding: outsidePadding,
61 | child: tooltipActionConfig.position.isInsideHorizontal
62 | ? Column(
63 | mainAxisSize: tooltipActionConfig.mainAxisSize,
64 | mainAxisAlignment: tooltipActionConfig.alignment,
65 | crossAxisAlignment: tooltipActionConfig.crossAxisAlignment,
66 | textBaseline: tooltipActionConfig.textBaseline,
67 | children: children,
68 | )
69 | : Row(
70 | mainAxisSize: tooltipActionConfig.mainAxisSize,
71 | mainAxisAlignment: tooltipActionConfig.alignment,
72 | crossAxisAlignment: tooltipActionConfig.crossAxisAlignment,
73 | textBaseline: tooltipActionConfig.textBaseline,
74 | children: children,
75 | ),
76 | ),
77 | );
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
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 |
--------------------------------------------------------------------------------
/lib/src/models/tooltip_action_config.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/material.dart';
23 |
24 | import '../utils/enum.dart';
25 |
26 | class TooltipActionConfig {
27 | /// Configuration options for tooltip action buttons.
28 | ///
29 | /// This class allows you to configure the overall appearance and layout of
30 | /// action buttons within a tooltip widget.
31 | const TooltipActionConfig({
32 | this.alignment = MainAxisAlignment.spaceBetween,
33 | this.actionGap = 5,
34 | this.position = TooltipActionPosition.inside,
35 | this.gapBetweenContentAndAction = 10,
36 | this.crossAxisAlignment = CrossAxisAlignment.start,
37 | this.mainAxisSize = MainAxisSize.max,
38 | this.textBaseline,
39 | }) : assert(
40 | crossAxisAlignment != CrossAxisAlignment.stretch,
41 | 'Can not use stretch as height is unbounded',
42 | );
43 |
44 | /// Defines tooltip action widget position. It can be inside the tooltip
45 | /// widget or outside.
46 | final TooltipActionPosition position;
47 |
48 | /// Defines the alignment of actions buttons of tooltip action widget.
49 | final MainAxisAlignment alignment;
50 |
51 | /// Defines the gap between the actions buttons of tooltip action widget.
52 | final double actionGap;
53 |
54 | /// Defines vertically gap between tooltip content and actions.
55 | final double gapBetweenContentAndAction;
56 |
57 | /// Defines running direction alignment for the Action widgets.
58 | final CrossAxisAlignment crossAxisAlignment;
59 |
60 | /// If aligning items according to their baseline, which baseline to use.
61 | /// This must be set if using baseline alignment.
62 | final TextBaseline? textBaseline;
63 |
64 | /// Defines the main axis size of action buttons of tooltip action widget.
65 | final MainAxisSize mainAxisSize;
66 |
67 | @override
68 | bool operator ==(Object other) {
69 | if (identical(this, other)) return true;
70 | return other is TooltipActionConfig &&
71 | alignment == other.alignment &&
72 | actionGap == other.actionGap &&
73 | position == other.position &&
74 | gapBetweenContentAndAction == other.gapBetweenContentAndAction &&
75 | crossAxisAlignment == other.crossAxisAlignment &&
76 | textBaseline == other.textBaseline &&
77 | mainAxisSize == other.mainAxisSize;
78 | }
79 |
80 | @override
81 | int get hashCode => Object.hashAllUnordered([
82 | alignment,
83 | actionGap,
84 | position,
85 | gapBetweenContentAndAction,
86 | crossAxisAlignment,
87 | textBaseline,
88 | mainAxisSize,
89 | ]);
90 | }
91 |
--------------------------------------------------------------------------------
/example/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
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 |
--------------------------------------------------------------------------------
/lib/src/tooltip/render_object_manager.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/rendering.dart';
23 |
24 | import '../utils/enum.dart';
25 |
26 | class RenderObjectManager {
27 | /// A utility class that manages RenderBox objects used within the tooltip
28 | /// layout system.
29 | ///
30 | /// This class does:
31 | /// - Act as a registry for render objects indexed by their
32 | /// [TooltipLayoutSlot].
33 | /// - Provide methods to perform layout operations on render objects without
34 | /// direct coupling.
35 | /// - Manage position, size and constraint information for tooltip
36 | /// components (content box, action box, and arrow).
37 | /// - Facilitate communication between the main [_RenderPositionDelegate]
38 | /// and its child elements.
39 | /// - Support both dry layout calculation (for measurement) and actual
40 | /// layout operations.
41 | /// - Handle position adjustment through offset management.
42 | ///
43 | /// This class is primarily used by the tooltip rendering system to
44 | /// coordinate the layout and positioning of tooltip components while
45 | /// ensuring they stay within screen boundaries and maintain proper alignment
46 | /// relative to the target widget.
47 | RenderObjectManager({
48 | required this.customRenderBox,
49 | required TooltipLayoutSlot slot,
50 | }) {
51 | renderObjects[slot] = this;
52 | }
53 |
54 | final RenderBox customRenderBox;
55 | BoxConstraints? renderConstraints;
56 | Size? dryLayoutSize;
57 | double? height;
58 | double? xOffset;
59 | double? yOffset;
60 |
61 | static Map renderObjects = {};
62 |
63 | /// Clears renderObjects map.
64 | static void clear() => renderObjects.clear();
65 |
66 | /// Performs dry layout to calculate the preferred size without actually
67 | /// laying out.
68 | Size performDryLayout(BoxConstraints constraints) {
69 | renderConstraints = constraints;
70 | dryLayoutSize = customRenderBox.getDryLayout(constraints);
71 | return dryLayoutSize!;
72 | }
73 |
74 | /// Performs actual layout on the RenderBox.
75 | void performLayout(BoxConstraints constraints, {bool parentUsesSize = true}) {
76 | customRenderBox.layout(constraints, parentUsesSize: parentUsesSize);
77 | dryLayoutSize = customRenderBox.size;
78 | }
79 |
80 | /// Gets the current size of the RenderBox.
81 | Size get size => dryLayoutSize ?? customRenderBox.size;
82 |
83 | Offset get getOffset => Offset(xOffset ?? 0, yOffset ?? 0);
84 |
85 | MultiChildLayoutParentData get layoutParentData {
86 | assert(customRenderBox.parentData is MultiChildLayoutParentData);
87 | return customRenderBox.parentData! as MultiChildLayoutParentData;
88 | }
89 |
90 | /// Sets the position of the RenderBox.
91 | void setOffset(double x, double y) {
92 | xOffset = x;
93 | yOffset = y;
94 | final parentData = customRenderBox.parentData;
95 | if (parentData is! MultiChildLayoutParentData) return;
96 | parentData.offset = Offset(x, y);
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/lib/src/showcase/target_widget.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/material.dart';
23 |
24 | class TargetWidget extends StatelessWidget {
25 | /// A widget that represents the target of a showcase.
26 | ///
27 | /// This widget creates a transparent overlay that highlights a UI element
28 | /// that needs to be showcased. It defines the position, size, and interaction
29 | /// behavior of the target area.
30 | ///
31 | /// It is positioned absolutely within the showcase overlay and can respond
32 | /// to various gestures like tap, double tap, and long press.
33 | const TargetWidget({
34 | required this.offset,
35 | required this.size,
36 | required this.shapeBorder,
37 | required this.targetPadding,
38 | this.onTap,
39 | this.radius,
40 | this.onDoubleTap,
41 | this.onLongPress,
42 | this.disableDefaultChildGestures = false,
43 | super.key,
44 | });
45 |
46 | /// The position of the target widget in the overlay coordinates.
47 | final Offset offset;
48 |
49 | /// The size of the target widget to be highlighted.
50 | final Size size;
51 |
52 | /// Callback function when the target is tapped.
53 | final VoidCallback? onTap;
54 |
55 | /// Callback function when the target is double-tapped.
56 | final VoidCallback? onDoubleTap;
57 |
58 | /// Callback function when the target is long-pressed.
59 | final VoidCallback? onLongPress;
60 |
61 | /// The shape of the target highlight.
62 | final ShapeBorder shapeBorder;
63 |
64 | /// Border radius when using a rectangular shape.
65 | final BorderRadius? radius;
66 |
67 | /// Whether to disable gesture detection on the target area.
68 | ///
69 | /// When true, the target area will not respond to gestures and will
70 | /// not show a pointer cursor on hover.
71 | final bool disableDefaultChildGestures;
72 |
73 | /// Padding applied around the target to increase its highlight area.
74 | final EdgeInsets targetPadding;
75 |
76 | @override
77 | Widget build(BuildContext context) {
78 | final targetWidgetContent = GestureDetector(
79 | onTap: onTap,
80 | onLongPress: onLongPress,
81 | onDoubleTap: onDoubleTap,
82 | behavior: HitTestBehavior.translucent,
83 | child: Container(
84 | height: size.height.abs(),
85 | width: size.width.abs(),
86 | margin: targetPadding,
87 | decoration: ShapeDecoration(
88 | shape: radius == null
89 | ? shapeBorder
90 | : RoundedRectangleBorder(borderRadius: radius!),
91 | ),
92 | ),
93 | );
94 | return Positioned(
95 | top: offset.dy - targetPadding.top,
96 | left: offset.dx - targetPadding.left,
97 | child: disableDefaultChildGestures
98 | ? IgnorePointer(child: targetWidgetContent)
99 | : MouseRegion(
100 | cursor: SystemMouseCursors.click,
101 | child: targetWidgetContent,
102 | ),
103 | );
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/lib/src/widget/tooltip_action_button_widget.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/material.dart';
23 |
24 | import '../models/tooltip_action_button.dart';
25 | import '../showcase/showcase_view.dart';
26 |
27 | class TooltipActionButtonWidget extends StatelessWidget {
28 | /// A widget that renders action buttons within showcase tooltips.
29 | ///
30 | /// This widget is responsible for building interactive buttons that appear
31 | /// in showcase tooltips, such as "Next," "Previous," or "Skip" buttons. It
32 | /// renders either a custom button provided in the config or builds a
33 | /// standard button with optional leading/trailing icons based on the
34 | /// provided configuration.
35 | ///
36 | /// It supports both local tooltip actions (specific to a single showcase)
37 | /// and global tooltip actions (applied to all showcases in a sequence).
38 | const TooltipActionButtonWidget({
39 | required this.config,
40 | required this.showCaseState,
41 | super.key,
42 | });
43 |
44 | /// This will provide the configuration for the action buttons.
45 | final TooltipActionButton config;
46 |
47 | /// This is used for close, next and previous showcase navigation.
48 | final ShowcaseView showCaseState;
49 |
50 | @override
51 | Widget build(BuildContext context) {
52 | final theme = Theme.of(context);
53 |
54 | final child = config.button ??
55 | MouseRegion(
56 | cursor: SystemMouseCursors.click,
57 | child: GestureDetector(
58 | onTap: _handleOnTap,
59 | child: Container(
60 | padding: config.padding,
61 | decoration: BoxDecoration(
62 | color: config.backgroundColor ?? theme.primaryColor,
63 | borderRadius: config.borderRadius,
64 | border: config.border,
65 | ),
66 | child: Row(
67 | mainAxisSize: MainAxisSize.min,
68 | children: [
69 | if (config.leadIcon case final lead?)
70 | Padding(
71 | padding: lead.padding ?? const EdgeInsets.only(right: 5),
72 | child: lead.icon,
73 | ),
74 | Text(
75 | config.name ?? config.type?.actionName ?? '',
76 | style: config.textStyle,
77 | ),
78 | if (config.tailIcon case final tail?)
79 | Padding(
80 | padding: tail.padding ?? const EdgeInsets.only(left: 5),
81 | child: tail.icon,
82 | ),
83 | ],
84 | ),
85 | ),
86 | ),
87 | );
88 |
89 | // Semantics widget is used to improve accessibility for screen readers.
90 | // Only applied when semanticEnable is true.
91 | if (showCaseState.semanticEnable) {
92 | return Semantics(
93 | button: true,
94 | liveRegion: true,
95 | child: child,
96 | );
97 | }
98 |
99 | return child;
100 | }
101 |
102 | void _handleOnTap() {
103 | if (config.onTap != null) {
104 | config.onTap?.call();
105 | } else {
106 | config.type?.onTap(showCaseState);
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/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.simform.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 |
--------------------------------------------------------------------------------
/lib/src/tooltip/animated_tooltip_multi_layout.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | part of 'tooltip.dart';
23 |
24 | class _AnimatedTooltipMultiLayout extends MultiChildRenderObjectWidget {
25 | const _AnimatedTooltipMultiLayout({
26 | required super.children,
27 | required this.scaleController,
28 | required this.moveController,
29 | required this.scaleAnimation,
30 | required this.moveAnimation,
31 | required this.targetPosition,
32 | required this.targetSize,
33 | required this.screenSize,
34 | required this.hasSecondBox,
35 | required this.hasArrow,
36 | required this.gapBetweenContentAndAction,
37 | required this.toolTipSlideEndDistance,
38 | required this.position,
39 | required this.scaleAlignment,
40 | required this.screenEdgePadding,
41 | required this.targetPadding,
42 | required this.showcaseOffset,
43 | required this.targetTooltipGap,
44 | // If we remove this parameter it will cause error in v3.29.0 so ignore
45 | // ignore: unused_element_parameter
46 | super.key,
47 | });
48 |
49 | final AnimationController scaleController;
50 | final AnimationController moveController;
51 | final Animation scaleAnimation;
52 | final Animation moveAnimation;
53 | final Offset targetPosition;
54 | final Size targetSize;
55 | final TooltipPosition? position;
56 | final Size screenSize;
57 | final bool hasSecondBox;
58 | final bool hasArrow;
59 | final double gapBetweenContentAndAction;
60 | final double toolTipSlideEndDistance;
61 | final Alignment? scaleAlignment;
62 | final double screenEdgePadding;
63 | final EdgeInsets targetPadding;
64 | final Offset showcaseOffset;
65 | final double targetTooltipGap;
66 |
67 | @override
68 | RenderObject createRenderObject(BuildContext context) {
69 | return _RenderAnimationDelegate(
70 | scaleController: scaleController,
71 | moveController: moveController,
72 | scaleAnimation: scaleAnimation,
73 | moveAnimation: moveAnimation,
74 | targetPosition: targetPosition,
75 | targetSize: targetSize,
76 | position: position,
77 | screenSize: screenSize,
78 | hasSecondBox: hasSecondBox,
79 | hasArrow: hasArrow,
80 | scaleAlignment: scaleAlignment,
81 | gapBetweenContentAndAction: gapBetweenContentAndAction,
82 | toolTipSlideEndDistance: toolTipSlideEndDistance,
83 | screenEdgePadding: screenEdgePadding,
84 | targetPadding: targetPadding,
85 | showcaseOffset: showcaseOffset,
86 | targetTooltipGap: targetTooltipGap,
87 | );
88 | }
89 |
90 | @override
91 | void updateRenderObject(
92 | BuildContext context,
93 | _RenderAnimationDelegate renderObject,
94 | ) {
95 | renderObject
96 | ..scaleController = scaleController
97 | ..moveController = moveController
98 | ..scaleAnimation = scaleAnimation
99 | ..moveAnimation = moveAnimation
100 | ..targetPosition = targetPosition
101 | ..targetSize = targetSize
102 | ..position = position
103 | ..screenSize = screenSize
104 | ..hasSecondBox = hasSecondBox
105 | ..hasArrow = hasArrow
106 | ..screenEdgePadding = screenEdgePadding
107 | ..toolTipSlideEndDistance = toolTipSlideEndDistance
108 | ..gapBetweenContentAndAction = gapBetweenContentAndAction
109 | ..targetPadding = targetPadding
110 | ..showcaseOffset = showcaseOffset
111 | ..targetTooltipGap = targetTooltipGap;
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # ShowCaseView
4 |
5 | [](https://github.com/SimformSolutionsPvtLtd/showcaseview/actions) [](https://pub.dev/packages/showcaseview)
6 | [](https://github.com/Solido/awesome-flutter#ui-helpers)
7 |
8 | A Flutter package that allows you to showcase/highlight your widgets step by step, providing
9 | interactive tutorials for your application's UI.
10 |
11 | _Check out other amazing open-source [Flutter libraries](https://simform-flutter-packages.web.app) and [Mobile libraries](https://github.com/SimformSolutionsPvtLtd/Awesome-Mobile-Libraries) developed by Simform Solutions!_
12 |
13 | ## Preview
14 | _**For live web demo, visit [ShowcaseView Web Example](https://simformsolutionspvtltd.github.io/showcaseview/)**_
15 |
16 | 
17 |
18 | ## Features
19 |
20 | - Guide users through your app by highlighting specific widgets step by step.
21 | - Customize tooltips with titles, descriptions, actions, and styling.
22 | - Handles scrolling the widget into view for showcasing.
23 | - Support for custom tooltip widgets.
24 | - Animation and transition effects for tooltip.
25 | - Options to showcase multiple widgets at the same time.
26 |
27 | ## Performance Gains on v5.x.x
28 |
29 | Version 5.0.0+ delivers exceptional performance improvements that make ShowcaseView faster and
30 | more efficient than ever:
31 |
32 | 
33 |
34 | > *Performance metrics based on internal benchmarking tests performed on a mid-tier android device.*
35 |
36 | ### 🚀 **Memory Reduction**
37 | - **Optimized memory usage**: Reduced from **1.8 MB to 0.6 MB**
38 | - Significantly reduced memory footprint for better app performance
39 |
40 | ### ⚡ **Faster Refresh**
41 | - **Smoother animations**: Average FPS increased from **58 to 88 FPS**
42 | - Better performance on lower-end devices and complex UI layouts
43 |
44 | ### 🎯 **Quicker Rendering**
45 | - **Lightning-fast startup**: Initial render time reduced from **68ms to 24ms**
46 | - Dramatically improved time-to-interactive for showcases
47 |
48 | ## Documentation
49 |
50 | Visit our [documentation](https://simform-flutter-packages.web.app/showCaseView) site for all
51 | implementation details, usage instructions, code examples, and advanced features.
52 |
53 | ## Installation
54 |
55 | ```yaml
56 | dependencies:
57 | showcaseview:
58 | ```
59 |
60 | ## Support
61 |
62 | For questions, issues, or feature requests, [create an issue](https://github.com/SimformSolutionsPvtLtd/showcaseview/issues) on GitHub or reach out via the GitHub Discussions tab. We're happy to help and encourage community contributions.
63 | To contribute documentation updates specifically, please make changes to the doc/documentation.md file and submit a pull request.
64 |
65 | ## Main Contributors
66 |
67 | |  |  |  |
68 | |:------------------------------------------------------------------:|:------------------------------------------------------------------:|:------------------------------------------------------------------:|
69 | | [Vatsal Tanna](https://github.com/vatsaltanna) | [Sahil Totala](https://github.com/Flamingloon) | [Aditya Chavda](https://github.com/aditya-chavda) |
70 |
71 | |  |  |  |
72 | |:------------------------------------------------------------------:|:------------------------------------------------------------------:|:------------------------------------------------------------------:|
73 | | [Sanket Kachchela](https://github.com/SanketKachhela) | [Ujas Majithiya](https://github.com/Ujas-Majithiya) | [Happy Makadiya](https://github.com/HappyMakadiyaS) |
74 |
75 | ## License
76 |
77 | This project is licensed under the MIT License - see the [LICENSE](https://simform-flutter-packages.web.app/showCaseView/license) file for details.
78 |
--------------------------------------------------------------------------------
/lib/src/tooltip/tooltip_content.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../models/tooltip_action_config.dart';
4 | import '../widget/action_widget.dart';
5 | import '../widget/default_tooltip_text_widget.dart';
6 |
7 | class ToolTipContent extends StatelessWidget {
8 | /// Builds the tooltip content layout based on action position configuration.
9 | ///
10 | /// Supports following layouts:
11 | /// - Vertical layout (actions at bottom) for [TooltipActionPosition.inside]
12 | /// - Horizontal layout (actions on left/right) for
13 | /// [TooltipActionPosition.insideLeft] and [TooltipActionPosition.insideRight]
14 | const ToolTipContent({
15 | required this.description,
16 | required this.titleTextAlign,
17 | required this.descriptionTextAlign,
18 | required this.titleAlignment,
19 | required this.descriptionAlignment,
20 | required this.tooltipActionConfig,
21 | required this.tooltipActions,
22 | required this.textColor,
23 | this.title,
24 | this.titleTextStyle,
25 | this.descTextStyle,
26 | this.titlePadding,
27 | this.descriptionPadding,
28 | this.titleTextDirection,
29 | this.descriptionTextDirection,
30 | super.key,
31 | }) : assert(
32 | title != null || description != null,
33 | 'Either title or description must be provided',
34 | );
35 |
36 | final String? title;
37 | final TextAlign titleTextAlign;
38 | final String? description;
39 | final TextAlign descriptionTextAlign;
40 | final AlignmentGeometry titleAlignment;
41 | final AlignmentGeometry descriptionAlignment;
42 | final TextStyle? titleTextStyle;
43 | final TextStyle? descTextStyle;
44 | final Color textColor;
45 | final EdgeInsets? titlePadding;
46 | final EdgeInsets? descriptionPadding;
47 | final TextDirection? titleTextDirection;
48 | final TextDirection? descriptionTextDirection;
49 | final TooltipActionConfig tooltipActionConfig;
50 | final List tooltipActions;
51 |
52 | @override
53 | Widget build(BuildContext context) {
54 | final shouldShowActionsInside =
55 | tooltipActions.isNotEmpty && tooltipActionConfig.position.isInside;
56 | final textTheme = Theme.of(context).textTheme;
57 |
58 | // Build title widget
59 | Widget? titleWidget;
60 | if (title case final title?) {
61 | titleWidget = DefaultTooltipTextWidget(
62 | padding: titlePadding ?? EdgeInsets.zero,
63 | text: title,
64 | textAlign: titleTextAlign,
65 | alignment: titleAlignment,
66 | textColor: textColor,
67 | textDirection: titleTextDirection,
68 | textStyle: titleTextStyle ??
69 | textTheme.titleLarge?.merge(TextStyle(color: textColor)),
70 | );
71 | }
72 |
73 | // Build description widget
74 | Widget? descriptionWidget;
75 | if (description case final desc?) {
76 | descriptionWidget = DefaultTooltipTextWidget(
77 | padding: descriptionPadding ?? EdgeInsets.zero,
78 | text: desc,
79 | textAlign: descriptionTextAlign,
80 | alignment: descriptionAlignment,
81 | textColor: textColor,
82 | textDirection: descriptionTextDirection,
83 | textStyle: descTextStyle ??
84 | textTheme.titleSmall?.merge(TextStyle(color: textColor)),
85 | );
86 | }
87 |
88 | // Build action widget
89 | Widget? actionWidget;
90 | if (shouldShowActionsInside) {
91 | actionWidget = ActionWidget(
92 | tooltipActionConfig: tooltipActionConfig,
93 | children: tooltipActions,
94 | );
95 | }
96 |
97 | // For vertical action positioning (default), use Column layout
98 | final contentColumn = Column(
99 | mainAxisSize: MainAxisSize.min,
100 | children: [
101 | if (titleWidget != null) titleWidget,
102 | if (descriptionWidget != null) descriptionWidget,
103 | if (actionWidget != null &&
104 | tooltipActionConfig.position.isInsideVertical) ...[
105 | SizedBox(
106 | height: tooltipActionConfig.gapBetweenContentAndAction,
107 | ),
108 | actionWidget,
109 | ],
110 | ],
111 | );
112 |
113 | // If no horizontal action positioning, return vertical layout
114 | if (actionWidget == null ||
115 | !tooltipActionConfig.position.isInsideHorizontal) {
116 | return contentColumn;
117 | }
118 |
119 | // For horizontal action positioning, use Row layout
120 | final gap = SizedBox(
121 | width: tooltipActionConfig.gapBetweenContentAndAction,
122 | );
123 |
124 | return Row(
125 | mainAxisSize: MainAxisSize.min,
126 | children: [
127 | if (tooltipActionConfig.position.isInsideLeft) ...[
128 | actionWidget,
129 | gap,
130 | ],
131 | Flexible(child: contentColumn),
132 | if (tooltipActionConfig.position.isInsideRight) ...[
133 | gap,
134 | actionWidget,
135 | ],
136 | ],
137 | );
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/example/lib/detailscreen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:showcaseview/showcaseview.dart';
3 |
4 | class Detail extends StatefulWidget {
5 | const Detail({Key? key}) : super(key: key);
6 |
7 | @override
8 | State createState() => _DetailState();
9 | }
10 |
11 | class _DetailState extends State {
12 | final GlobalKey _one = GlobalKey();
13 | BuildContext? myContext;
14 |
15 | // This is optional but if you need different configuration in
16 | // ShowcaseView then you can register new ShowcaseView
17 | final showcaseDetailScope = ShowcaseView.register(scope: "_detailsScreen");
18 |
19 | @override
20 | void initState() {
21 | super.initState();
22 | WidgetsBinding.instance.addPostFrameCallback(
23 | (_) => showcaseDetailScope
24 | ..startShowCase([_one], delay: const Duration(milliseconds: 200))
25 | ..addOnFinishCallback(_onShowcaseFinished)
26 | ..addOnDismissCallback(_onShowcaseDismissed),
27 | );
28 | }
29 |
30 | @override
31 | void dispose() {
32 | showcaseDetailScope
33 | ..removeOnFinishCallback(_onShowcaseFinished)
34 | ..removeOnDismissCallback(_onShowcaseDismissed);
35 | super.dispose();
36 | }
37 |
38 | void _onShowcaseFinished() {
39 | debugPrint("Showcase tour finished!");
40 | }
41 |
42 | void _onShowcaseDismissed(GlobalKey? dismissedAt) {
43 | debugPrint("Showcase dismissed $dismissedAt");
44 | }
45 |
46 | @override
47 | Widget build(BuildContext context) {
48 | return Scaffold(
49 | appBar: AppBar(
50 | backgroundColor: Colors.transparent,
51 | elevation: 0,
52 | leading: IconButton(
53 | icon: const Icon(
54 | Icons.arrow_back,
55 | color: Colors.black,
56 | ),
57 | onPressed: () {
58 | Navigator.pop(context);
59 | },
60 | ),
61 | ),
62 | body: Padding(
63 | padding: const EdgeInsets.all(16),
64 | child: ListView(
65 | children: [
66 | Showcase(
67 | key: _one,
68 | title: 'Title',
69 | description: 'Desc',
70 | scope: '_detailsScreen',
71 | floatingActionWidget: FloatingActionWidget(
72 | left: 16,
73 | bottom: 16,
74 | child: Padding(
75 | padding: const EdgeInsets.all(16.0),
76 | child: ElevatedButton(
77 | style: ElevatedButton.styleFrom(
78 | backgroundColor: const Color(0xffEE5366),
79 | ),
80 | onPressed: showcaseDetailScope.dismiss,
81 | child: const Text(
82 | 'Close Showcase',
83 | style: TextStyle(
84 | color: Colors.white,
85 | fontSize: 15,
86 | ),
87 | ),
88 | ),
89 | ),
90 | ),
91 | child: InkWell(
92 | onTap: () {},
93 | child: const Text(
94 | 'Flutter Notification',
95 | style: TextStyle(
96 | fontSize: 25,
97 | fontWeight: FontWeight.w600,
98 | ),
99 | ),
100 | ),
101 | ),
102 | const SizedBox(
103 | height: 16,
104 | ),
105 | const Text(
106 | 'Hi, you have new Notification from flutter group, open '
107 | 'slack and check it out',
108 | style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
109 | ),
110 | const SizedBox(
111 | height: 16,
112 | ),
113 | RichText(
114 | text: const TextSpan(
115 | style: TextStyle(
116 | fontWeight: FontWeight.w400,
117 | color: Colors.black,
118 | ),
119 | children: [
120 | TextSpan(text: 'Hi team,\n\n'),
121 | TextSpan(
122 | text: 'As some of you know, we’re moving to Slack for '
123 | 'our internal team communications. Slack is a '
124 | 'messaging app where we can talk, share files, '
125 | 'and work together. It also connects with tools '
126 | 'we already use, like [add your examples here], '
127 | 'plus 900+ other apps.\n\n',
128 | ),
129 | TextSpan(
130 | text: 'Why are we moving to Slack?\n\n',
131 | style: TextStyle(
132 | fontWeight: FontWeight.w600,
133 | color: Colors.black,
134 | ),
135 | ),
136 | TextSpan(
137 | text: 'We want to use the best communication tools to '
138 | 'make our lives easier and be more productive. '
139 | 'Having everything in one place will help us '
140 | 'work together better and faster, rather than '
141 | 'jumping around between emails, IMs, texts and '
142 | 'a bunch of other programs. Everything you share '
143 | 'in Slack is automatically indexed and archived, '
144 | 'creating a searchable archive of all our work.',
145 | ),
146 | ],
147 | ),
148 | ),
149 | ],
150 | ),
151 | ),
152 | );
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/lib/src/models/tooltip_action_button.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/foundation.dart';
23 | import 'package:flutter/material.dart';
24 |
25 | import '../../showcaseview.dart';
26 |
27 | class TooltipActionButton {
28 | /// A class that defines interactive action buttons within showcase tooltips.
29 | ///
30 | /// Provides a way to add interactive buttons to tooltips in the showcase
31 | /// view. These buttons can perform standard navigation actions also
32 | /// supports custom actions through callback functions and fully custom
33 | /// button widgets.
34 | ///
35 | /// There are two ways to create tooltip action buttons:
36 | /// 1. Using the default constructor for standard buttons with predefined
37 | /// styles and standard action types (next, previous, skip).
38 | /// 2. Using the [TooltipActionButton.custom] constructor for fully custom
39 | /// button widgets.
40 | ///
41 | /// Tooltip action buttons can be used in two contexts:
42 | /// - As local actions specific to a single showcase tooltip by providing
43 | /// them in [Showcase.tooltipActions].
44 | /// - As global actions that appear in all showcase tooltips by providing
45 | /// them in [ShowcaseView.globalTooltipActions].
46 | ///
47 | /// The appearance and position of these buttons are controlled by the
48 | /// [TooltipActionConfig] class, which can define whether the buttons appear
49 | /// inside or outside the tooltip container and how they are aligned.
50 | const TooltipActionButton({
51 | required this.type,
52 | this.borderRadius = const BorderRadius.all(Radius.circular(50)),
53 | this.padding = const EdgeInsets.symmetric(horizontal: 15, vertical: 4),
54 | this.hideActionWidgetForShowcase = const [],
55 | this.backgroundColor,
56 | this.textStyle,
57 | this.leadIcon,
58 | this.tailIcon,
59 | this.name,
60 | this.onTap,
61 | this.border,
62 | }) : button = null;
63 |
64 | const TooltipActionButton.custom({
65 | required this.button,
66 | this.hideActionWidgetForShowcase = const [],
67 | }) : backgroundColor = null,
68 | borderRadius = null,
69 | textStyle = null,
70 | padding = null,
71 | leadIcon = null,
72 | tailIcon = null,
73 | type = null,
74 | name = null,
75 | onTap = null,
76 | border = null;
77 |
78 | /// Background color for the action button.
79 | ///
80 | /// If not provided, theme's primary color will be used as default.
81 | final Color? backgroundColor;
82 |
83 | /// Border radius for the action button.
84 | ///
85 | /// Defaults to a rounded shape with circular radius of 50.
86 | final BorderRadius? borderRadius;
87 |
88 | /// Text style for the button label.
89 | ///
90 | /// Controls the appearance of the text inside the button.
91 | final TextStyle? textStyle;
92 |
93 | /// Padding inside the action button.
94 | final EdgeInsets? padding;
95 |
96 | /// A custom widget to use instead of the default button appearance.
97 | ///
98 | /// When provided, most other appearance properties are ignored.
99 | final Widget? button;
100 |
101 | /// Icon to display before the button text.
102 | final ActionButtonIcon? leadIcon;
103 |
104 | /// Icon to display after the button text.
105 | final ActionButtonIcon? tailIcon;
106 |
107 | /// Predefined action type that determines the button's default behavior.
108 | final TooltipDefaultActionType? type;
109 |
110 | /// Display text for the button.
111 | ///
112 | /// If not provided, uses the name from the action type.
113 | final String? name;
114 |
115 | /// Callback function triggered when the button is tapped.
116 | ///
117 | /// When provided, this overrides the default behavior of the action type.
118 | final VoidCallback? onTap;
119 |
120 | /// Border to apply around the button.
121 | ///
122 | /// Allows for custom border styling such as color, width, and style.
123 | final Border? border;
124 |
125 | /// Hides action widgets for the showcase. Add key of particular showcase
126 | /// in this list.
127 | /// This only works for the global action widgets
128 | /// Defaults to []
129 | final List hideActionWidgetForShowcase;
130 |
131 | @override
132 | bool operator ==(Object other) {
133 | if (identical(this, other)) return true;
134 | return other is TooltipActionButton &&
135 | other.type == type &&
136 | other.borderRadius == borderRadius &&
137 | other.padding == padding &&
138 | other.backgroundColor == backgroundColor &&
139 | other.textStyle == textStyle &&
140 | other.leadIcon == leadIcon &&
141 | other.tailIcon == tailIcon &&
142 | other.name == name &&
143 | other.button == button &&
144 | other.border == border &&
145 | listEquals(
146 | other.hideActionWidgetForShowcase,
147 | hideActionWidgetForShowcase,
148 | );
149 | }
150 |
151 | @override
152 | int get hashCode {
153 | return Object.hashAllUnordered(
154 | [
155 | type,
156 | borderRadius,
157 | padding,
158 | hideActionWidgetForShowcase,
159 | backgroundColor,
160 | textStyle,
161 | leadIcon,
162 | tailIcon,
163 | name,
164 | onTap,
165 | button,
166 | border,
167 | ],
168 | );
169 | }
170 | }
171 |
--------------------------------------------------------------------------------
/lib/src/widget/floating_action_widget.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/material.dart';
23 |
24 | class FloatingActionWidget extends StatelessWidget {
25 | /// A widget that displays a floating action button that doesn't animate
26 | /// during the showcase tour. It can be used for:
27 | ///
28 | /// * Adding custom buttons like 'Skip', 'Next', or 'Close'.
29 | /// * Creating persistent UI elements that remain visible throughout the
30 | /// showcase.
31 | ///
32 | /// Example usage:
33 | /// ```dart
34 | /// Showcase(
35 | /// key: showcaseKey,
36 | /// description: 'Feature description',
37 | /// child: YourWidget(),
38 | /// floatingActionWidget: FloatingActionWidget(
39 | /// left: 16,
40 | /// bottom: 16,
41 | /// child: ElevatedButton(
42 | /// onPressed: () => ShowcaseView.of(context).dismiss(),
43 | /// child: Text('Skip'),
44 | /// ),
45 | /// ),
46 | /// )
47 | /// ```
48 | const FloatingActionWidget({
49 | required this.child,
50 | this.right,
51 | this.width,
52 | this.height,
53 | this.left,
54 | this.bottom,
55 | this.top,
56 | super.key,
57 | });
58 |
59 | /// This is same as the Positioned.directional widget
60 | /// Creates a widget that controls where a child of a [Stack] is positioned.
61 | ///
62 | /// Only two out of the three horizontal values (`start`, `end`,
63 | /// [width]), and only two out of the three vertical values ([top],
64 | /// [bottom], [height]), can be set. In each case, at least one of
65 | /// the three must be null.
66 | ///
67 | /// If `textDirection` is [TextDirection.rtl], then the `start` argument is
68 | /// used for the [right] property and the `end` argument is used for the
69 | /// [left] property. Otherwise, if `textDirection` is [TextDirection.ltr],
70 | /// then the `start` argument is used for the [left] property and the `end`
71 | /// argument is used for the [right] property.
72 | factory FloatingActionWidget.directional({
73 | required TextDirection textDirection,
74 | required Widget child,
75 | double? start,
76 | double? top,
77 | double? end,
78 | double? bottom,
79 | double? width,
80 | double? height,
81 | Key? key,
82 | }) {
83 | /// Default value will be [TextDirection.ltr].
84 | var left = start;
85 | var right = end;
86 | switch (textDirection) {
87 | case TextDirection.ltr:
88 | break;
89 | case TextDirection.rtl:
90 | left = end;
91 | right = start;
92 | }
93 | return FloatingActionWidget(
94 | key: key,
95 | left: left,
96 | top: top,
97 | right: right,
98 | bottom: bottom,
99 | width: width,
100 | height: height,
101 | child: child,
102 | );
103 | }
104 |
105 | /// The widget below this widget in the tree.
106 | ///
107 | /// {@macro flutter.widgets.ProxyWidget.child}
108 | final Widget child;
109 |
110 | /// The distance that the child's left edge is inset from the left of the
111 | /// stack.
112 | ///
113 | /// Only two out of the three horizontal values ([left], [right], [width])
114 | /// can be set. The third must be null.
115 | ///
116 | /// If all three are null, the [Stack.alignment] is used to position the child
117 | /// horizontally.
118 | final double? left;
119 |
120 | /// The distance that the child's top edge is inset from the top of the stack.
121 | ///
122 | /// Only two out of the three vertical values ([top], [bottom], [height])
123 | /// can be set. The third must be null.
124 | ///
125 | /// If all three are null, the [Stack.alignment] is used to position the child
126 | /// vertically.
127 | final double? top;
128 |
129 | /// Only two out of the three horizontal values ([left], [right], [width])
130 | /// can be set. The third must be null.
131 | ///
132 | /// If all three are null, the [Stack.alignment] is used to position the child
133 | /// horizontally.
134 | final double? right;
135 |
136 | /// The distance that the child's bottom edge is inset from the bottom of
137 | /// the stack.
138 | ///
139 | /// Only two out of the three vertical values ([top], [bottom], [height])
140 | /// can be set. The third must be null.
141 | ///
142 | /// If all three are null, the [Stack.alignment] is used to position the child
143 | /// vertically.
144 | final double? bottom;
145 |
146 | /// The child's width.
147 | ///
148 | /// Only two out of the three horizontal values ([left], [right], [width])
149 | /// can be set. The third must be null.
150 | ///
151 | /// If all three are null, the [Stack.alignment] is used to position the child
152 | /// horizontally.
153 | final double? width;
154 |
155 | /// The child's height.
156 | ///
157 | /// Only two out of the three vertical values ([top], [bottom], [height])
158 | /// can be set. The third must be null.
159 | ///
160 | /// If all three are null, the [Stack.alignment] is used to position the child
161 | /// vertically.
162 | final double? height;
163 |
164 | @override
165 | Widget build(BuildContext context) {
166 | return Positioned(
167 | key: key,
168 | left: left,
169 | top: top,
170 | right: right,
171 | bottom: bottom,
172 | width: width,
173 | height: height,
174 | child: Material(color: Colors.transparent, child: child),
175 | );
176 | }
177 | }
178 |
--------------------------------------------------------------------------------
/lib/src/utils/shape_clipper.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 |
23 | import 'dart:ui' as ui;
24 |
25 | import 'package:flutter/foundation.dart';
26 | import 'package:flutter/material.dart';
27 |
28 | import '../models/linked_showcase_data_model.dart';
29 | import 'constants.dart';
30 |
31 | class ShapeClipper extends CustomClipper {
32 | /// A custom clipper that creates cutout shapes in the overlay for showcased
33 | /// widgets.
34 | ///
35 | /// This clipper is used by the [ShowcaseView]'s overlay system to create
36 | /// transparent regions that reveal the target widgets being showcased. It
37 | /// works by:
38 | ///
39 | /// 1. Creating a base path covering the entire overlay area.
40 | /// 2. For each target widget in [linkedObjectData], cutting out a shape using
41 | /// the difference operation.
42 | /// 3. Supporting different shape types (circular or rectangular with custom
43 | /// radius).
44 | /// 4. Handling multiple target shapes that can merge when overlapping.
45 | const ShapeClipper({
46 | this.linkedObjectData = const [],
47 | });
48 |
49 | final List linkedObjectData;
50 |
51 | @override
52 | ui.Path getClip(ui.Size size) {
53 | // Using a different clipping approach on web since the optimized approach
54 | // is not working in Flutter (3.10.0 - 3.32.5).
55 | if (kIsWeb) {
56 | return _webClip(size);
57 | }
58 | return _optimisedClip(size);
59 | }
60 |
61 | /// This clipping method is less optimized but ensures correct cutout rendering
62 | /// on web and all platforms. The [_optimisedClip] method does not work reliably
63 | /// on web, so a conditional check is used to select this implementation for web.
64 | ui.Path _webClip(ui.Size size) {
65 | var mainObjectPath = Path()
66 | ..fillType = ui.PathFillType.evenOdd
67 | ..addRect(Offset.zero & size)
68 | ..addRRect(RRect.fromRectAndCorners(ui.Rect.zero));
69 |
70 | final linkedObjectLength = linkedObjectData.length;
71 | for (var i = 0; i < linkedObjectLength; i++) {
72 | final widgetInfo = linkedObjectData[i];
73 | final customRadius = widgetInfo.isCircle
74 | ? Radius.circular(
75 | widgetInfo.rect.height + widgetInfo.overlayPadding.vertical,
76 | )
77 | : Constants.defaultTargetRadius;
78 |
79 | final rect = Rect.fromLTRB(
80 | widgetInfo.rect.left - widgetInfo.overlayPadding.left,
81 | widgetInfo.rect.top - widgetInfo.overlayPadding.top,
82 | widgetInfo.rect.right + widgetInfo.overlayPadding.right,
83 | widgetInfo.rect.bottom + widgetInfo.overlayPadding.bottom,
84 | );
85 |
86 | /// We have use this approach so that overlapping cutout will merge with
87 | /// each other
88 | mainObjectPath = Path.combine(
89 | PathOperation.difference,
90 | mainObjectPath,
91 | Path()
92 | ..addRRect(
93 | RRect.fromRectAndCorners(
94 | rect,
95 | topLeft: (widgetInfo.radius?.topLeft ?? customRadius),
96 | topRight: (widgetInfo.radius?.topRight ?? customRadius),
97 | bottomLeft: (widgetInfo.radius?.bottomLeft ?? customRadius),
98 | bottomRight: (widgetInfo.radius?.bottomRight ?? customRadius),
99 | ),
100 | ),
101 | );
102 | }
103 |
104 | return mainObjectPath;
105 | }
106 |
107 | /// Returns a [ui.Path] representing the overlay with cutouts for each showcased widget.
108 | ///
109 | /// This implementation is optimized for non-web platforms.
110 | ui.Path _optimisedClip(ui.Size size) {
111 | // Start with a path for the entire screen
112 | final screenPath = Path()..addRect(Offset.zero & size);
113 |
114 | // If there are no showcase items, return the full screen path
115 | if (linkedObjectData.isEmpty) {
116 | return screenPath;
117 | }
118 |
119 | // Create a path that will contain all the cutout shapes
120 | final cutoutsPath = Path();
121 |
122 | // Add all showcase shapes to the cutouts path
123 | for (final widgetInfo in linkedObjectData) {
124 | final customRadius = widgetInfo.isCircle
125 | ? Radius.circular(
126 | widgetInfo.rect.height + widgetInfo.overlayPadding.vertical,
127 | )
128 | : Constants.defaultTargetRadius;
129 |
130 | final rect = Rect.fromLTRB(
131 | widgetInfo.rect.left - widgetInfo.overlayPadding.left,
132 | widgetInfo.rect.top - widgetInfo.overlayPadding.top,
133 | widgetInfo.rect.right + widgetInfo.overlayPadding.right,
134 | widgetInfo.rect.bottom + widgetInfo.overlayPadding.bottom,
135 | );
136 |
137 | cutoutsPath.addRRect(
138 | RRect.fromRectAndCorners(
139 | rect,
140 | topLeft: (widgetInfo.radius?.topLeft ?? customRadius),
141 | topRight: (widgetInfo.radius?.topRight ?? customRadius),
142 | bottomLeft: (widgetInfo.radius?.bottomLeft ?? customRadius),
143 | bottomRight: (widgetInfo.radius?.bottomRight ?? customRadius),
144 | ),
145 | );
146 | }
147 |
148 | // Create the final path by subtracting all cutouts from the screen path
149 | // Using PathOperation.difference to cut out the shapes
150 | final finalPath = Path.combine(
151 | PathOperation.difference,
152 | screenPath,
153 | cutoutsPath,
154 | );
155 |
156 | return finalPath;
157 | }
158 |
159 | @override
160 | bool shouldReclip(covariant ShapeClipper oldClipper) =>
161 | !listEquals(linkedObjectData, oldClipper.linkedObjectData);
162 | }
163 |
--------------------------------------------------------------------------------
/lib/src/showcase/showcase_service.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021 Simform Solutions
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a copy
5 | * of this software and associated documentation files (the "Software"), to deal
6 | * in the Software without restriction, including without limitation the rights
7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 | * copies of the Software, and to permit persons to whom the Software is
9 | * furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be
12 | * included in all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 | * SOFTWARE.
21 | */
22 | import 'package:flutter/widgets.dart';
23 |
24 | import '../models/showcase_scope.dart';
25 | import '../utils/constants.dart';
26 | import '../utils/extensions.dart';
27 | import 'showcase_controller.dart';
28 | import 'showcase_view.dart';
29 |
30 | /// A scoped service locator for showcase functionality.
31 | ///
32 | /// This class provides global access to [ShowcaseView] instances without
33 | /// requiring a BuildContext, similar to the GetIt service locator pattern,
34 | /// but with support for multiple independent scopes.
35 | class ShowcaseService {
36 | ShowcaseService._();
37 |
38 | /// Singleton instance of the service
39 | static final ShowcaseService _instance = ShowcaseService._();
40 |
41 | /// Returns the global instance of the service
42 | static ShowcaseService get instance => _instance;
43 |
44 | /// Map of scope names to showcase controllers
45 | final Map _showcaseViews = {};
46 |
47 | /// Stack of scope names to track navigation
48 | final List _scopeStack = [Constants.initialScope];
49 |
50 | /// Current active scope name
51 | late String currentScope = _scopeStack.last;
52 |
53 | /// Returns the all scope name
54 | List get scopes => _scopeStack;
55 |
56 | /// Registers a [ShowcaseView] with the service in the specified scope.
57 | ///
58 | /// * [showcaseView] - The showcase manager to register
59 | /// * [scope] - Optional scope name (defaults to [currentScope])
60 | void register(ShowcaseView showcaseView, {String? scope}) {
61 | final scopeName = scope ?? currentScope;
62 | _showcaseViews[scopeName] = ShowcaseScope(
63 | showcaseView: showcaseView,
64 | name: scopeName,
65 | );
66 |
67 | // If a new scope is provided, push it to the stack
68 | if (scope == null || scope == currentScope) return;
69 | currentScope = scopeName;
70 | _scopeStack.add(scope);
71 | }
72 |
73 | /// Unregisters the [ShowcaseView] from the specified scope.
74 | ///
75 | /// * [scope] - Optional scope name (defaults to [currentScope])
76 | String? unregister({String? scope}) {
77 | final scopeName = scope ?? currentScope;
78 | _showcaseViews.remove(scopeName);
79 |
80 | // If we're removing the current scope, pop it from the stack
81 | _scopeStack.removeFirstWhere((existingScope) => existingScope == scope);
82 | currentScope =
83 | _scopeStack.isEmpty ? Constants.initialScope : _scopeStack.last;
84 |
85 | return scope;
86 | }
87 |
88 | /// Returns whether a manager is registered in the specified scope.
89 | ///
90 | /// * [scope] - Optional scope name (defaults to [currentScope])
91 | bool isRegistered({String? scope}) =>
92 | _showcaseViews.containsKey(scope ?? currentScope);
93 |
94 | /// Returns the [ShowcaseScope] instance for the specified scope name.
95 | ///
96 | /// * [scope] - Optional scope name (defaults to [currentScope])
97 | ///
98 | /// Throws an exception if not registered.
99 | ShowcaseScope getScope({String? scope}) {
100 | final scopeName = scope ?? currentScope;
101 | final showcaseScope = _showcaseViews[scopeName];
102 | if (showcaseScope != null) return showcaseScope;
103 |
104 | if (scopeName != Constants.initialScope) {
105 | throw Exception(
106 | 'No ShowcaseView registered for scope "$scopeName". '
107 | 'Make sure ShowcaseView is initialized in this scope.',
108 | );
109 | } else {
110 | throw Exception(
111 | 'No ShowcaseView is registered. Make sure ShowcaseView is '
112 | 'registered before using Showcase widget',
113 | );
114 | }
115 | }
116 |
117 | /// Returns a map of showcase controllers for the specified scope.
118 | ///
119 | /// This method provides access to all controllers registered in a specific
120 | /// scope, organized by their GlobalKeys and IDs.
121 | ///
122 | /// * [scope] - The scope name to retrieve controllers from
123 | ///
124 | /// Returns a nested map where the outer key is the GlobalKey and the inner
125 | /// key is the controller ID.
126 | Map> getControllers({
127 | required String scope,
128 | }) =>
129 | getScope(scope: scope).controllers;
130 |
131 | /// Returns the [ShowcaseView] from the specified scope.
132 | ///
133 | /// * [scope] - Optional scope name (defaults to [currentScope])
134 | ///
135 | /// Throws an exception if no [scope] is not registered.
136 | ShowcaseView get({String? scope}) =>
137 | getScope(scope: scope ?? currentScope).showcaseView;
138 |
139 | void updateCurrentScope(String scope) => currentScope = scope;
140 |
141 | /// Registers a showcase controller for given key and ID.
142 | void addController({
143 | required GlobalKey key,
144 | required ShowcaseController controller,
145 | required int id,
146 | required String scope,
147 | }) {
148 | getControllers(scope: scope)
149 | .putIfAbsent(
150 | key,
151 | () => {},
152 | )
153 | .update(
154 | id,
155 | (value) => controller,
156 | ifAbsent: () => controller,
157 | );
158 | }
159 |
160 | /// Removes showcase controller for given key and ID.
161 | void removeController({
162 | required GlobalKey key,
163 | required int id,
164 | required String scope,
165 | }) =>
166 | _showcaseViews[scope]?.controllers[key]?.remove(id);
167 |
168 | /// Returns showcase controller for given key and ID.
169 | /// Throws assertion error if controller not found.
170 | ShowcaseController getController({
171 | required GlobalKey key,
172 | required int id,
173 | required String scope,
174 | }) {
175 | final controller = getControllers(scope: scope)[key]?[id];
176 | assert(
177 | controller != null,
178 | 'Please register [ShowcaseView] first by calling '
179 | '[ShowcaseView.register()]',
180 | );
181 | return controller!;
182 | }
183 | }
184 |
--------------------------------------------------------------------------------