├── LICENSE ├── README.md ├── docs ├── .last_build_id ├── favicon.png ├── version.json ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── assets │ ├── FontManifest.json │ ├── fonts │ │ └── MaterialIcons-Regular.otf │ ├── AssetManifest.json │ ├── AssetManifest.bin │ ├── packages │ │ ├── flutter_arc_text │ │ │ └── assets │ │ │ │ └── README.md │ │ └── storybook_flutter │ │ │ └── assets │ │ │ └── README.md │ └── shaders │ │ └── ink_sparkle.frag ├── canvaskit │ ├── skwasm.wasm │ ├── canvaskit.wasm │ ├── chromium │ │ └── canvaskit.wasm │ └── skwasm.worker.js ├── manifest.json ├── index.html ├── flutter_service_worker.js └── flutter.js ├── .gitignore ├── packages └── flutter_arc_text │ ├── example │ ├── 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 │ │ │ └── project.pbxproj │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── RunnerTests │ │ │ └── RunnerTests.swift │ │ └── .gitignore │ ├── analysis_options.yaml │ ├── macos │ │ ├── Flutter │ │ │ ├── Flutter-Debug.xcconfig │ │ │ ├── Flutter-Release.xcconfig │ │ │ └── GeneratedPluginRegistrant.swift │ │ ├── Runner │ │ │ ├── Configs │ │ │ │ ├── Debug.xcconfig │ │ │ │ ├── Release.xcconfig │ │ │ │ ├── Warnings.xcconfig │ │ │ │ └── AppInfo.xcconfig │ │ │ ├── Assets.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── app_icon_128.png │ │ │ │ │ ├── app_icon_16.png │ │ │ │ │ ├── app_icon_256.png │ │ │ │ │ ├── app_icon_32.png │ │ │ │ │ ├── app_icon_512.png │ │ │ │ │ ├── app_icon_64.png │ │ │ │ │ ├── app_icon_1024.png │ │ │ │ │ └── Contents.json │ │ │ ├── AppDelegate.swift │ │ │ ├── Release.entitlements │ │ │ ├── DebugProfile.entitlements │ │ │ ├── MainFlutterWindow.swift │ │ │ ├── Info.plist │ │ │ └── Base.lproj │ │ │ │ └── MainMenu.xib │ │ ├── .gitignore │ │ ├── Runner.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── Runner.xcodeproj │ │ │ ├── project.xcworkspace │ │ │ │ └── xcshareddata │ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── RunnerTests │ │ │ └── RunnerTests.swift │ ├── android │ │ ├── gradle.properties │ │ ├── app │ │ │ ├── src │ │ │ │ ├── main │ │ │ │ │ ├── res │ │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ │ ├── drawable │ │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ │ ├── values │ │ │ │ │ │ │ └── styles.xml │ │ │ │ │ │ └── values-night │ │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── kotlin │ │ │ │ │ │ └── com │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── example │ │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ └── profile │ │ │ │ │ └── AndroidManifest.xml │ │ │ └── build.gradle │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ ├── .gitignore │ │ ├── build.gradle │ │ └── settings.gradle │ ├── web │ │ ├── favicon.png │ │ ├── icons │ │ │ ├── Icon-192.png │ │ │ ├── Icon-512.png │ │ │ ├── Icon-maskable-192.png │ │ │ └── Icon-maskable-512.png │ │ ├── manifest.json │ │ └── index.html │ ├── pubspec.yaml │ ├── README.md │ ├── .gitignore │ ├── .metadata │ └── lib │ │ └── main.dart │ ├── analysis_options.yaml │ ├── lib │ ├── flutter_arc_text.dart │ └── src │ │ ├── enums.dart │ │ ├── arc_text.dart │ │ └── arc_text_painter.dart │ ├── test │ ├── goldens │ │ └── flutter_arc_text.png │ ├── flutter_test_config.dart │ └── flutter_arc_text_test.dart │ ├── assets │ └── README.md │ ├── .metadata │ ├── pubspec.yaml │ ├── README.md │ ├── CHANGELOG.md │ ├── LICENSE │ └── .gitignore ├── screenshot_sm.png ├── pubspec.yaml ├── tool └── build_docs.sh ├── melos.yaml ├── .github └── workflows │ └── check.yml └── pubspec.lock /LICENSE: -------------------------------------------------------------------------------- 1 | packages/flutter_arc_text/LICENSE -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | packages/flutter_arc_text/README.md -------------------------------------------------------------------------------- /docs/.last_build_id: -------------------------------------------------------------------------------- 1 | aadbf4c588dd1d3868b221f3dff1fa2a -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | *.iml 3 | build/ 4 | .dart_tool/ 5 | -------------------------------------------------------------------------------- /docs/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/favicon.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /screenshot_sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/screenshot_sm.png -------------------------------------------------------------------------------- /docs/version.json: -------------------------------------------------------------------------------- 1 | {"app_name":"example","version":"1.0.0","build_number":"1","package_name":"example"} -------------------------------------------------------------------------------- /docs/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/icons/Icon-192.png -------------------------------------------------------------------------------- /docs/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/icons/Icon-512.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:mews_pedantic/analysis_options.yaml 2 | -------------------------------------------------------------------------------- /docs/assets/FontManifest.json: -------------------------------------------------------------------------------- 1 | [{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]}] -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:mews_pedantic/analysis_options.yaml 2 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /docs/canvaskit/skwasm.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/canvaskit/skwasm.wasm -------------------------------------------------------------------------------- /docs/canvaskit/canvaskit.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/canvaskit/canvaskit.wasm -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /docs/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /docs/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /docs/canvaskit/chromium/canvaskit.wasm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/canvaskit/chromium/canvaskit.wasm -------------------------------------------------------------------------------- /docs/assets/fonts/MaterialIcons-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/docs/assets/fonts/MaterialIcons-Regular.otf -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/lib/flutter_arc_text.dart: -------------------------------------------------------------------------------- 1 | export 'src/arc_text.dart'; 2 | export 'src/arc_text_painter.dart'; 3 | export 'src/enums.dart'; 4 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/web/favicon.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_arc_text_workspace 2 | 3 | environment: 4 | sdk: ">=3.0.0 <4.0.0" 5 | flutter: ">=3.13.0" 6 | 7 | dev_dependencies: 8 | melos: ^3.1.1 9 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/test/goldens/flutter_arc_text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/test/goldens/flutter_arc_text.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/lib/src/enums.dart: -------------------------------------------------------------------------------- 1 | enum StartAngleAlignment { start, center, end } 2 | 3 | enum Direction { clockwise, counterClockwise } 4 | 5 | enum Placement { inside, outside, middle } 6 | -------------------------------------------------------------------------------- /docs/assets/AssetManifest.json: -------------------------------------------------------------------------------- 1 | {"packages/flutter_arc_text/assets/README.md":["packages/flutter_arc_text/assets/README.md"],"packages/storybook_flutter/assets/README.md":["packages/storybook_flutter/assets/README.md"]} -------------------------------------------------------------------------------- /docs/assets/AssetManifest.bin: -------------------------------------------------------------------------------- 1 | *packages/flutter_arc_text/assets/README.md  asset*packages/flutter_arc_text/assets/README.md+packages/storybook_flutter/assets/README.md  asset+packages/storybook_flutter/assets/README.md -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/assets/README.md: -------------------------------------------------------------------------------- 1 | At the moment for having the required files generated for font processing the `pubspec.yaml` should have an entry in the 2 | assets section. 3 | 4 | Since git doesn't allow checking in empty folders, we have this file here. 5 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ookami-kb/flutter_arc_text/HEAD/packages/flutter_arc_text/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /tool/build_docs.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | set -x 3 | 4 | pushd example 5 | flutter build web --web-renderer canvaskit --base-href "/flutter_arc_text/" 6 | rm -rf $MELOS_ROOT_PATH/docs 7 | mkdir $MELOS_ROOT_PATH/docs 8 | cp -r build/web/ $MELOS_ROOT_PATH/docs 9 | popd 10 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /docs/assets/packages/flutter_arc_text/assets/README.md: -------------------------------------------------------------------------------- 1 | At the moment for having the required files generated for font processing the `pubspec.yaml` should have an entry in the 2 | assets section. 3 | 4 | Since git doesn't allow checking in empty folders, we have this file here. 5 | -------------------------------------------------------------------------------- /docs/assets/packages/storybook_flutter/assets/README.md: -------------------------------------------------------------------------------- 1 | At the moment for having the required files generated for font processing the `pubspec.yaml` should have an entry in the 2 | assets section. 3 | 4 | Since git doesn't allow checking in empty folders, we have this file here. 5 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/.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: 84a1de5c74eb9f7e550c6da776c5b621d5b581f6 8 | channel: master 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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. -------------------------------------------------------------------------------- /packages/flutter_arc_text/test/flutter_test_config.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:golden_toolkit/golden_toolkit.dart'; 4 | 5 | Future testExecutable(FutureOr Function() testMain) => 6 | GoldenToolkit.runWithConfiguration( 7 | () async { 8 | await loadAppFonts(); 9 | 10 | return testMain(); 11 | }, 12 | config: GoldenToolkitConfiguration(), 13 | ); 14 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | version: 1.0.0+1 4 | publish_to: none 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | flutter_arc_text: 13 | path: ../ 14 | storybook_flutter: ^0.14.0 15 | vector_math: ^2.1.4 16 | 17 | dev_dependencies: 18 | flutter_test: 19 | sdk: flutter 20 | mews_pedantic: ^0.20.0 21 | 22 | flutter: 23 | uses-material-design: true 24 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_arc_text 2 | description: Flutter widget that renders text along the arc with configurable radius. 3 | version: 0.6.0 4 | homepage: https://github.com/ookami-kb/flutter_arc_text 5 | 6 | environment: 7 | sdk: ">=3.0.0 <4.0.0" 8 | flutter: ">=3.13.0" 9 | 10 | dependencies: 11 | characters: ^1.3.0 12 | flutter: 13 | sdk: flutter 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | golden_toolkit: ^0.15.0 19 | mews_pedantic: ^0.20.0 20 | vector_math: ^2.1.4 21 | 22 | flutter: 23 | assets: 24 | - assets/ 25 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /melos.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_arc_text 2 | 3 | packages: 4 | - "packages/**" 5 | 6 | command: 7 | version: 8 | workspaceChangelog: false 9 | 10 | scripts: 11 | format: dart format --set-exit-if-changed --output=none . 12 | pub_get: melos exec -- "flutter pub get" 13 | analyze: flutter analyze . 14 | 15 | test: 16 | run: melos exec -c 1 --fail-fast -- "flutter test --no-pub" 17 | packageFilters: 18 | dirExists: 19 | - test 20 | 21 | check_master: 22 | run: | 23 | melos run format \ 24 | && melos run pub_get \ 25 | && melos run analyze \ 26 | && melos run test --no-select 27 | 28 | build:docs: melos exec --scope="flutter_arc_text" -- "sh MELOS_ROOT_PATH/tool/build_docs.sh" 29 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | 35 | # Exceptions to above rules. 36 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 37 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /.github/workflows/check.yml: -------------------------------------------------------------------------------- 1 | name: Check 2 | on: 3 | pull_request: 4 | branches: 5 | - master 6 | 7 | concurrency: 8 | group: ${{ github.head_ref }} 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | check: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v2 16 | 17 | - uses: subosito/flutter-action@v1 18 | with: 19 | flutter-version: "3.13.8" 20 | 21 | - run: echo "$HOME/.pub-cache/bin" >> $GITHUB_PATH 22 | 23 | - run: dart pub global activate melos 24 | 25 | - run: melos run check_master 26 | 27 | - name: Store failure artifacts 28 | if: ${{ failure() }} 29 | uses: actions/upload-artifact@v2 30 | with: 31 | name: golden-test-failure 32 | path: "**/test/failures/" 33 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | plugins { 14 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false 15 | } 16 | } 17 | 18 | include ":app" 19 | 20 | apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle" 21 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/README.md: -------------------------------------------------------------------------------- 1 | [![](https://img.shields.io/pub/v/flutter_arc_text)](https://pub.dev/packages/flutter_arc_text) 2 | 3 | # Flutter Arc Text 4 | 5 | Renders text along the arc. See [demo](https://ookami-kb.github.io/flutter_arc_text/). 6 | 7 | The story behind the plugin is [here](https://developers.mews.com/flutter-how-to-draw-text-along-arc/). 8 | 9 | ![](screenshot_sm.png) 10 | 11 | ## Basic usage 12 | 13 | ```dart 14 | class MyApp extends StatelessWidget { 15 | @override 16 | Widget build(BuildContext context) => ArcText( 17 | radius: 100, 18 | text: 'Hello, Flutter!', 19 | textStyle: TextStyle(fontSize: 18, color: Colors.black), 20 | startAngle: -pi / 2, 21 | startAngleAlignment: StartAngleAlignment.start, 22 | placement: Placement.outside, 23 | direction: Direction.clockwise 24 | ); 25 | } 26 | ``` 27 | 28 | ## Example 29 | 30 | See [example](example) project. 31 | -------------------------------------------------------------------------------- /docs/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "short_name": "example", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 0.6.0 2 | 3 | > Note: This release has breaking changes. 4 | 5 | - **FEAT**: Make TextStyle parameter optional (#25). 6 | - **BREAKING** **REFACTOR**: Migrate to Flutter 3.13 (#24). 7 | 8 | ## 0.5.0 9 | 10 | > Note: This release has breaking changes. 11 | 12 | - **CHORE**: Update project structure. 13 | - **BREAKING** **FEAT**: Add PainterDelegate (#17). 14 | 15 | ## 0.4.1 16 | 17 | - **FEAT**: Improve emoji support (#13). 18 | - **CI**: Set up CI. 19 | - **CHORE**: Update dependencies. 20 | - **BUILD**: Update demo. 21 | - **BUILD**: Update demo. 22 | - **BUILD**: Update demo. 23 | 24 | ## 0.4.0 25 | * :cop: Migrate to null safety 26 | 27 | ## 0.3.2 28 | * Added Placement.middle option 29 | 30 | ## 0.3.1 31 | * Added `stretchAngle` and `interLetterAngle` parameters 32 | 33 | ## 0.3.0 34 | * Change `ArcTextPainter::paint` method signature 35 | 36 | ## 0.2.0 37 | * Hide parameters 38 | 39 | ## 0.1.4 40 | * Add Placement and Direction 41 | * Extract `ArcTextPainter` 42 | 43 | ## 0.1.3 44 | * Add StartAngleAlignment 45 | 46 | ## 0.1.2 47 | * Update description to make pub analyzer happy 48 | 49 | ## 0.1.1 50 | * Update code style and description 51 | 52 | ## 0.1.0 53 | * Initial release 54 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019, Kirill Bubochkin 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | example 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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: "6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e" 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: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 17 | base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 18 | - platform: android 19 | create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 20 | base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 21 | - platform: ios 22 | create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 23 | base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 24 | - platform: linux 25 | create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 26 | base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 27 | - platform: macos 28 | create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 29 | base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 30 | - platform: web 31 | create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 32 | base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 33 | - platform: windows 34 | create_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 35 | base_revision: 6c4930c4ac86fb286f30e31d0ec8bffbcbb9953e 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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/.gitignore: -------------------------------------------------------------------------------- 1 | pubspec.lock 2 | 3 | # Miscellaneous 4 | *.class 5 | *.log 6 | *.pyc 7 | *.swp 8 | .DS_Store 9 | .atom/ 10 | .buildlog/ 11 | .history 12 | .svn/ 13 | 14 | # IntelliJ related 15 | *.iml 16 | *.ipr 17 | *.iws 18 | ../../.idea/ 19 | 20 | # The .vscode folder contains launch configuration and tasks you configure in 21 | # VS Code which you may wish to be included in version control, so this line 22 | # is commented out by default. 23 | #.vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | **/doc/api/ 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | build/ 34 | 35 | # Android related 36 | **/android/**/gradle-wrapper.jar 37 | **/android/.gradle 38 | **/android/captures/ 39 | **/android/gradlew 40 | **/android/gradlew.bat 41 | **/android/local.properties 42 | **/android/**/GeneratedPluginRegistrant.java 43 | 44 | # iOS/XCode related 45 | **/ios/**/*.mode1v3 46 | **/ios/**/*.mode2v3 47 | **/ios/**/*.moved-aside 48 | **/ios/**/*.pbxuser 49 | **/ios/**/*.perspectivev3 50 | **/ios/**/*sync/ 51 | **/ios/**/.sconsign.dblite 52 | **/ios/**/.tags* 53 | **/ios/**/.vagrant/ 54 | **/ios/**/DerivedData/ 55 | **/ios/**/Icon? 56 | **/ios/**/Pods/ 57 | **/ios/**/.symlinks/ 58 | **/ios/**/profile 59 | **/ios/**/xcuserdata 60 | **/ios/.generated/ 61 | **/ios/Flutter/App.framework 62 | **/ios/Flutter/Flutter.framework 63 | **/ios/Flutter/Flutter.podspec 64 | **/ios/Flutter/Generated.xcconfig 65 | **/ios/Flutter/app.flx 66 | **/ios/Flutter/app.zip 67 | **/ios/Flutter/flutter_assets/ 68 | **/ios/Flutter/flutter_export_environment.sh 69 | **/ios/ServiceDefinitions.json 70 | **/ios/Runner/GeneratedPluginRegistrant.* 71 | 72 | # Exceptions to above rules. 73 | !**/ios/**/default.mode1v3 74 | !**/ios/**/default.mode2v3 75 | !**/ios/**/default.pbxuser 76 | !**/ios/**/default.perspectivev3 77 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 78 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.example.example" 27 | compileSdkVersion flutter.compileSdkVersion 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.example.example" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | buildTypes { 55 | release { 56 | // TODO: Add your own signing config for the release build. 57 | // Signing with the debug keys for now, so `flutter run --release` works. 58 | signingConfig signingConfigs.debug 59 | } 60 | } 61 | } 62 | 63 | flutter { 64 | source '../..' 65 | } 66 | 67 | dependencies {} 68 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /docs/canvaskit/skwasm.worker.js: -------------------------------------------------------------------------------- 1 | "use strict";var Module={};var ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string";if(ENVIRONMENT_IS_NODE){var nodeWorkerThreads=require("worker_threads");var parentPort=nodeWorkerThreads.parentPort;parentPort.on("message",data=>onmessage({data:data}));var fs=require("fs");Object.assign(global,{self:global,require:require,Module:Module,location:{href:__filename},Worker:nodeWorkerThreads.Worker,importScripts:function(f){(0,eval)(fs.readFileSync(f,"utf8")+"//# sourceURL="+f)},postMessage:function(msg){parentPort.postMessage(msg)},performance:global.performance||{now:function(){return Date.now()}}})}var initializedJS=false;var pendingNotifiedProxyingQueues=[];function threadPrintErr(){var text=Array.prototype.slice.call(arguments).join(" ");if(ENVIRONMENT_IS_NODE){fs.writeSync(2,text+"\n");return}console.error(text)}function threadAlert(){var text=Array.prototype.slice.call(arguments).join(" ");postMessage({cmd:"alert",text:text,threadId:Module["_pthread_self"]()})}var err=threadPrintErr;self.alert=threadAlert;Module["instantiateWasm"]=(info,receiveInstance)=>{var module=Module["wasmModule"];Module["wasmModule"]=null;var instance=new WebAssembly.Instance(module,info);return receiveInstance(instance)};self.onunhandledrejection=e=>{throw e.reason??e};function handleMessage(e){try{if(e.data.cmd==="load"){let messageQueue=[];self.onmessage=e=>messageQueue.push(e);self.startWorker=instance=>{Module=instance;postMessage({"cmd":"loaded"});for(let msg of messageQueue){handleMessage(msg)}self.onmessage=handleMessage};Module["wasmModule"]=e.data.wasmModule;for(const handler of e.data.handlers){Module[handler]=function(){postMessage({cmd:"callHandler",handler:handler,args:[...arguments]})}}Module["wasmMemory"]=e.data.wasmMemory;Module["buffer"]=Module["wasmMemory"].buffer;Module["ENVIRONMENT_IS_PTHREAD"]=true;if(typeof e.data.urlOrBlob=="string"){importScripts(e.data.urlOrBlob)}else{var objectUrl=URL.createObjectURL(e.data.urlOrBlob);importScripts(objectUrl);URL.revokeObjectURL(objectUrl)}skwasm(Module)}else if(e.data.cmd==="run"){Module["__emscripten_thread_init"](e.data.pthread_ptr,0,0,1);Module["establishStackSpace"]();Module["PThread"].receiveObjectTransfer(e.data);Module["PThread"].threadInitTLS();if(!initializedJS){pendingNotifiedProxyingQueues.forEach(queue=>{Module["executeNotifiedProxyingQueue"](queue)});pendingNotifiedProxyingQueues=[];initializedJS=true}try{Module["invokeEntryPoint"](e.data.start_routine,e.data.arg)}catch(ex){if(ex!="unwind"){throw ex}}}else if(e.data.cmd==="cancel"){if(Module["_pthread_self"]()){Module["__emscripten_thread_exit"](-1)}}else if(e.data.target==="setimmediate"){}else if(e.data.cmd==="processProxyingQueue"){if(initializedJS){Module["executeNotifiedProxyingQueue"](e.data.queue)}else{pendingNotifiedProxyingQueues.push(e.data.queue)}}else if(e.data.cmd){err("worker.js received unknown command "+e.data.cmd);err(e.data)}}catch(ex){if(Module["__emscripten_thread_crashed"]){Module["__emscripten_thread_crashed"]()}throw ex}}self.onmessage=handleMessage; 2 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/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 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/test/flutter_arc_text_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_arc_text/flutter_arc_text.dart'; 5 | import 'package:golden_toolkit/golden_toolkit.dart'; 6 | import 'package:vector_math/vector_math.dart' hide Colors; 7 | 8 | void main() { 9 | testGoldens('Golden tests', (tester) async { 10 | final builder = GoldenBuilder.grid(columns: 2, widthToHeightRatio: 1) 11 | ..addScenario('Default', const App()) 12 | ..addScenario( 13 | 'StartAngleAlignment.end', 14 | const App(alignment: StartAngleAlignment.end), 15 | ) 16 | ..addScenario( 17 | 'Placement.inside', 18 | const App(placement: Placement.inside), 19 | ) 20 | ..addScenario( 21 | 'stretchAngle', 22 | App(stretchAngle: radians(270)), 23 | ) 24 | ..addScenario( 25 | 'interLetterAngle', 26 | App(interLetterAngle: radians(5)), 27 | ) 28 | ..addScenario( 29 | 'painterDelegate clockwise', 30 | const App( 31 | placement: Placement.middle, 32 | alignment: StartAngleAlignment.center, 33 | painterDelegate: _delegate, 34 | ), 35 | ) 36 | ..addScenario( 37 | 'painterDelegate counterclockwise', 38 | App( 39 | placement: Placement.middle, 40 | alignment: StartAngleAlignment.center, 41 | painterDelegate: _delegate, 42 | direction: Direction.counterClockwise, 43 | startAngle: radians(180), 44 | ), 45 | ); 46 | 47 | await tester.pumpWidgetBuilder(builder.build()); 48 | await screenMatchesGolden( 49 | tester, 50 | 'flutter_arc_text', 51 | autoHeight: true, 52 | ); 53 | }); 54 | } 55 | 56 | class App extends StatelessWidget { 57 | const App({ 58 | super.key, 59 | this.startAngle = 0, 60 | this.alignment = StartAngleAlignment.start, 61 | this.direction = Direction.clockwise, 62 | this.placement = Placement.outside, 63 | this.stretchAngle, 64 | this.interLetterAngle, 65 | this.painterDelegate, 66 | }); 67 | 68 | final double startAngle; 69 | final StartAngleAlignment alignment; 70 | final Direction direction; 71 | final Placement placement; 72 | final double? stretchAngle; 73 | final double? interLetterAngle; 74 | final PainterDelegate? painterDelegate; 75 | 76 | @override 77 | Widget build(BuildContext context) => Center( 78 | child: Container( 79 | color: Colors.white, 80 | width: 300, 81 | height: 300, 82 | child: ArcText( 83 | text: 'Hello, Golden Test for ArcText!', 84 | radius: 100, 85 | textStyle: const TextStyle( 86 | fontSize: 14, 87 | color: Colors.black, 88 | fontFamily: 'Roboto', 89 | ), 90 | startAngleAlignment: alignment, 91 | startAngle: startAngle, 92 | direction: direction, 93 | placement: placement, 94 | stretchAngle: stretchAngle, 95 | interLetterAngle: interLetterAngle, 96 | painterDelegate: painterDelegate ?? 97 | (Canvas canvas, Size size, ArcTextPainter painter) => 98 | painter.paint(canvas, size), 99 | ), 100 | ), 101 | ); 102 | } 103 | 104 | final _backgroundPaint = Paint() 105 | ..style = PaintingStyle.stroke 106 | ..strokeWidth = 2 107 | ..color = Colors.black; 108 | 109 | final _decorationPaint = Paint() 110 | ..style = PaintingStyle.stroke 111 | ..strokeCap = StrokeCap.round 112 | ..strokeWidth = 32 113 | ..color = Colors.yellow; 114 | 115 | void _delegate(Canvas canvas, Size size, ArcTextPainter painter) { 116 | final rect = Rect.fromCircle( 117 | center: Offset(size.width / 2, size.height / 2), 118 | radius: painter.radius, 119 | ); 120 | 121 | canvas.drawArc( 122 | rect, 123 | painter.startAngle, 124 | painter.sweepAngle, 125 | false, 126 | _decorationPaint, 127 | ); 128 | 129 | painter.paint(canvas, size); 130 | 131 | canvas.drawArc( 132 | rect, 133 | painter.finalAngle + radians(15), 134 | 2 * pi - painter.sweepAngle - radians(30), 135 | false, 136 | _backgroundPaint, 137 | ); 138 | } 139 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_arc_text/flutter_arc_text.dart'; 5 | import 'package:storybook_flutter/storybook_flutter.dart'; 6 | import 'package:vector_math/vector_math.dart' hide Colors; 7 | 8 | void main() => runApp(const MyApp()); 9 | 10 | class MyApp extends StatelessWidget { 11 | const MyApp({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) => Storybook( 15 | initialStory: 'Arc text', 16 | stories: [ 17 | Story( 18 | name: 'Arc text', 19 | builder: (context) { 20 | final displayCircle = context.knobs.boolean( 21 | label: 'Display circle', 22 | initial: true, 23 | ); 24 | final radius = context.knobs 25 | .slider(label: 'Radius', initial: 100, max: 200, min: 50); 26 | final startAngle = context.knobs 27 | .slider(label: 'Start angle', initial: 0, max: 360) * 28 | pi / 29 | 180; 30 | final stretchAngle = context.knobs 31 | .slider(label: 'Stretch angle', initial: 0, max: 360) * 32 | pi / 33 | 180; 34 | final text = context.knobs.text( 35 | label: 'Text', 36 | initial: 'Hello, Flutter! I am ArcText widget. ' 37 | 'I can draw circular text.', 38 | ); 39 | final alignment = context.knobs.options( 40 | label: 'Alignment', 41 | options: const [ 42 | Option( 43 | label: 'Start', 44 | value: StartAngleAlignment.start, 45 | ), 46 | Option( 47 | label: 'Center', 48 | value: StartAngleAlignment.center, 49 | ), 50 | Option(label: 'End', value: StartAngleAlignment.end), 51 | ], 52 | initial: StartAngleAlignment.start, 53 | ); 54 | final hasBackground = context.knobs.boolean(label: 'Background'); 55 | final hasDecoration = context.knobs.boolean(label: 'Decoration'); 56 | 57 | return Container( 58 | decoration: displayCircle 59 | ? BoxDecoration( 60 | border: Border.all(), 61 | borderRadius: BorderRadius.circular(radius), 62 | color: Colors.white, 63 | ) 64 | : null, 65 | width: radius * 2, 66 | height: radius * 2, 67 | child: ArcText( 68 | radius: radius, 69 | text: text, 70 | textStyle: const TextStyle(fontSize: 18, color: Colors.black), 71 | startAngle: startAngle, 72 | startAngleAlignment: alignment, 73 | placement: context.knobs.options( 74 | label: 'Placement', 75 | options: const [ 76 | Option(label: 'Outside', value: Placement.outside), 77 | Option(label: 'Inside', value: Placement.inside), 78 | Option(label: 'Middle', value: Placement.middle), 79 | ], 80 | initial: Placement.outside, 81 | ), 82 | direction: 83 | context.knobs.boolean(label: 'Clockwise', initial: true) 84 | ? Direction.clockwise 85 | : Direction.counterClockwise, 86 | stretchAngle: stretchAngle == 0 ? null : stretchAngle, 87 | painterDelegate: _makeDelegate(hasBackground, hasDecoration), 88 | ), 89 | ); 90 | }, 91 | ), 92 | ], 93 | ); 94 | } 95 | 96 | final _backgroundPaint = Paint() 97 | ..style = PaintingStyle.stroke 98 | ..strokeWidth = 2 99 | ..color = Colors.black; 100 | 101 | final _decorationPaint = Paint() 102 | ..style = PaintingStyle.stroke 103 | ..strokeCap = StrokeCap.round 104 | ..strokeWidth = 32 105 | ..color = Colors.yellow; 106 | 107 | PainterDelegate _makeDelegate(bool hasBackground, bool hasDecoration) => 108 | (canvas, size, painter) { 109 | final rect = Rect.fromCircle( 110 | center: Offset(size.width / 2, size.height / 2), 111 | radius: painter.radius, 112 | ); 113 | 114 | if (hasBackground) { 115 | canvas.drawArc( 116 | rect, 117 | painter.startAngle, 118 | painter.sweepAngle, 119 | false, 120 | _decorationPaint, 121 | ); 122 | } 123 | 124 | painter.paint(canvas, size); 125 | 126 | if (hasDecoration) { 127 | canvas.drawArc( 128 | rect, 129 | painter.finalAngle + radians(10), 130 | 2 * pi - painter.sweepAngle - radians(20), 131 | false, 132 | _backgroundPaint, 133 | ); 134 | } 135 | }; 136 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/lib/src/arc_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_arc_text/src/arc_text_painter.dart'; 4 | import 'package:flutter_arc_text/src/enums.dart'; 5 | 6 | class ArcText extends StatelessWidget { 7 | const ArcText({ 8 | super.key, 9 | required this.radius, 10 | required this.text, 11 | this.textStyle, 12 | this.startAngle = 0, 13 | this.startAngleAlignment = StartAngleAlignment.start, 14 | this.direction = Direction.clockwise, 15 | this.placement = Placement.outside, 16 | this.stretchAngle, 17 | this.interLetterAngle, 18 | this.painterDelegate = _defaultPaint, 19 | }); 20 | 21 | /// Radius of the arc along which the text will be drawn. 22 | final double radius; 23 | 24 | /// Text to draw. 25 | final String text; 26 | 27 | /// TextStyle that will be applied to the text. 28 | final TextStyle? textStyle; 29 | 30 | /// Initial angle (0 is top center, positive angle is clockwise). 31 | final double startAngle; 32 | 33 | /// Angle of the arc to fit text into by adjusting inter-letter space. 34 | /// 35 | /// At least one of [stretchAngle] and [interLetterAngle] should be null. 36 | final double? stretchAngle; 37 | 38 | /// Inter-letter spacing set by angle. 39 | /// 40 | /// At least one of [stretchAngle] and [interLetterAngle] should be null. 41 | final double? interLetterAngle; 42 | 43 | /// Text alignment around [startAngle]. 44 | /// 45 | /// - [StartAngleAlignment.start] – text will start from [startAngle]. 46 | /// - [StartAngleAlignment.center] – text will be centered on [startAngle]. 47 | /// - [StartAngleAlignment.end] – text will end on [startAngle]. 48 | final StartAngleAlignment startAngleAlignment; 49 | 50 | /// Text direction. 51 | final Direction direction; 52 | 53 | /// Text placement relative to circle with the same [radius]. 54 | final Placement placement; 55 | 56 | /// Controls how the text will be rendered. 57 | /// 58 | /// By default, it just calls 59 | /// 60 | /// ```dart 61 | /// painter.paint(canvas, size); 62 | /// ``` 63 | /// 64 | /// You can use this parameter, for example, to add decoration before or 65 | /// after text is drawn. Consider the following delegate to draw background 66 | /// behind the text: 67 | /// 68 | /// ```dart 69 | /// final decorationPaint = Paint() 70 | /// ..style = PaintingStyle.stroke 71 | /// ..strokeCap = StrokeCap.round 72 | /// ..strokeWidth = 32 73 | /// ..color = Colors.yellow; 74 | /// 75 | /// void painterDelegate(Canvas canvas, Size size, ArcTextPainter painter) { 76 | /// final rect = Rect.fromCircle( 77 | /// center: Offset(size.width / 2, size.height / 2), 78 | /// radius: painter.radius, 79 | /// ); 80 | /// canvas.drawArc( 81 | /// rect, 82 | /// painter.startAngle, 83 | /// painter.sweepAngle, 84 | /// false, 85 | /// decorationPaint, 86 | /// ); 87 | /// painter.paint(canvas, size); 88 | /// } 89 | /// ``` 90 | /// 91 | /// For a more complex use case, take a look at the example package. 92 | /// 93 | /// Don't forget to call `painter.paint(canvas, size)` in your custom 94 | /// delegate to draw the text itself. 95 | final PainterDelegate painterDelegate; 96 | 97 | @override 98 | Widget build(BuildContext context) { 99 | final DefaultTextStyle defaultTextStyle = DefaultTextStyle.of(context); 100 | TextStyle effectiveTextStyle = defaultTextStyle.style.merge(textStyle); 101 | 102 | if (MediaQuery.boldTextOf(context)) { 103 | effectiveTextStyle = effectiveTextStyle 104 | .merge(const TextStyle(fontWeight: FontWeight.bold)); 105 | } 106 | 107 | return CustomPaint( 108 | painter: _Painter( 109 | radius: radius, 110 | text: text, 111 | textStyle: effectiveTextStyle, 112 | alignment: startAngleAlignment, 113 | initialAngle: startAngle, 114 | direction: direction, 115 | placement: placement, 116 | stretchAngle: stretchAngle, 117 | interLetterAngle: interLetterAngle, 118 | painterDelegate: painterDelegate, 119 | ), 120 | ); 121 | } 122 | } 123 | 124 | class _Painter extends CustomPainter { 125 | _Painter({ 126 | required num radius, 127 | required String text, 128 | TextStyle? textStyle, 129 | required StartAngleAlignment alignment, 130 | required double initialAngle, 131 | required Direction direction, 132 | required Placement placement, 133 | double? stretchAngle, 134 | double? interLetterAngle, 135 | required PainterDelegate painterDelegate, 136 | }) : _painterDelegate = painterDelegate, 137 | _painter = ArcTextPainter( 138 | radius: radius, 139 | text: text, 140 | textStyle: textStyle, 141 | alignment: alignment, 142 | initialAngle: initialAngle, 143 | direction: direction, 144 | placement: placement, 145 | stretchAngle: stretchAngle, 146 | interLetterAngle: interLetterAngle, 147 | ); 148 | 149 | final ArcTextPainter _painter; 150 | final PainterDelegate _painterDelegate; 151 | 152 | @override 153 | void paint(Canvas canvas, Size size) => 154 | _painterDelegate(canvas, size, _painter); 155 | 156 | @override 157 | bool shouldRepaint(CustomPainter oldDelegate) => true; 158 | } 159 | 160 | /// Use this delegate to override how the text will be rendered. 161 | typedef PainterDelegate = void Function( 162 | Canvas canvas, 163 | Size size, 164 | ArcTextPainter painter, 165 | ); 166 | 167 | void _defaultPaint(Canvas canvas, Size size, ArcTextPainter painter) { 168 | painter.paint(canvas, size); 169 | } 170 | -------------------------------------------------------------------------------- /packages/flutter_arc_text/lib/src/arc_text_painter.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math' as math; 2 | 3 | import 'package:characters/characters.dart'; 4 | import 'package:flutter/rendering.dart'; 5 | import 'package:flutter_arc_text/src/enums.dart'; 6 | 7 | class ArcTextPainter { 8 | ArcTextPainter({ 9 | required num radius, 10 | required String text, 11 | TextStyle? textStyle, 12 | StartAngleAlignment alignment = StartAngleAlignment.start, 13 | double initialAngle = 0, 14 | this.direction = Direction.clockwise, 15 | Placement placement = Placement.outside, 16 | double? stretchAngle, 17 | double? interLetterAngle, 18 | }) : assert( 19 | stretchAngle == null || interLetterAngle == null, 20 | 'stretchAngle and interLetterAngle should not be both not null', 21 | ), 22 | radius = radius.toDouble(), 23 | _text = text, 24 | _textStyle = textStyle { 25 | _textPainter 26 | ..text = TextSpan(text: _text, style: textStyle) 27 | ..layout(minWidth: 0, maxWidth: double.maxFinite); 28 | 29 | switch (placement) { 30 | case Placement.inside: 31 | _effectiveRadius = this.radius - _textPainter.height; 32 | case Placement.outside: 33 | _effectiveRadius = this.radius; 34 | case Placement.middle: 35 | _effectiveRadius = this.radius - _textPainter.height / 2; 36 | } 37 | 38 | _interLetterAngle = (stretchAngle != null && _text.characters.length > 1) 39 | ? (stretchAngle - 40 | _calculateSweepAngle( 41 | _textPainter, 42 | _textStyle, 43 | _effectiveRadius, 44 | _text, 45 | 0, 46 | )) / 47 | _text.characters.length 48 | : interLetterAngle ?? 0; 49 | 50 | final double alignmentOffset = 51 | _getAlignmentOffset(alignment, stretchAngle ?? sweepAngle); 52 | switch (direction) { 53 | case Direction.clockwise: 54 | _angleWithAlignment = initialAngle + alignmentOffset; 55 | _angleMultiplier = 1; 56 | _heightOffset = -_effectiveRadius - _textPainter.height; 57 | case Direction.counterClockwise: 58 | _angleWithAlignment = initialAngle - alignmentOffset + math.pi; 59 | _angleMultiplier = -1; 60 | _heightOffset = _effectiveRadius; 61 | } 62 | } 63 | 64 | final String _text; 65 | final TextStyle? _textStyle; 66 | late final double _effectiveRadius; 67 | late final int _angleMultiplier; 68 | late final double _heightOffset; 69 | late final double _angleWithAlignment; 70 | late final double _interLetterAngle; 71 | final Direction direction; 72 | final double radius; 73 | 74 | final _textPainter = TextPainter(textDirection: TextDirection.ltr); 75 | 76 | /// Call this method whenever the text needs to be repainted. 77 | /// 78 | /// Center of the arc by default will be in the center rectangle of [size] 79 | /// with top left in (0, 0). You can control it with [offset]. 80 | void paint(Canvas canvas, Size size, {Offset? offset}) { 81 | final effectiveOffset = offset ?? Offset(size.width / 2, size.height / 2); 82 | canvas 83 | ..save() 84 | ..translate(effectiveOffset.dx, effectiveOffset.dy) 85 | ..rotate(_angleWithAlignment); 86 | _drawText(canvas, _angleMultiplier, _heightOffset); 87 | canvas.restore(); 88 | } 89 | 90 | /// Returns angle from which the text rendering starts. 91 | /// 92 | /// {@template flutter_arc_text.angle} 93 | /// Zero radians is the point on the right hand side of the circle 94 | /// and positive angles goes clockwise. 95 | /// 96 | /// Whether it is start or end of the text depends on [direction], but 97 | /// it's always correct to assume that 98 | /// [startAngle] + [sweepAngle] == [finalAngle]. 99 | /// {@endtemplate} 100 | double get startAngle { 101 | switch (direction) { 102 | case Direction.clockwise: 103 | return _angleWithAlignment - math.pi / 2; 104 | case Direction.counterClockwise: 105 | return _angleWithAlignment + math.pi / 2 - sweepAngle; 106 | } 107 | } 108 | 109 | /// Returns angle where the text rendering stops. 110 | /// 111 | /// {@macro flutter_arc_text.angle} 112 | late final double sweepAngle = _calculateSweepAngle( 113 | _textPainter, 114 | _textStyle, 115 | _effectiveRadius, 116 | _text, 117 | _interLetterAngle, 118 | ); 119 | 120 | /// Returns final angle at which the text stops. 121 | double get finalAngle => startAngle + sweepAngle; 122 | 123 | void _drawText(Canvas canvas, int angleMultiplier, double heightOffset) { 124 | for (final graphemeCluster in _text.characters) { 125 | final translation = _getTranslation( 126 | _textPainter, 127 | _textStyle, 128 | _effectiveRadius, 129 | graphemeCluster, 130 | ); 131 | final halfAngleOffset = translation.alpha / 2 * angleMultiplier; 132 | canvas.rotate(halfAngleOffset); 133 | _textPainter.paint( 134 | canvas, 135 | Offset(-translation.letterWidth / 2, heightOffset), 136 | ); 137 | canvas.rotate(halfAngleOffset + _interLetterAngle * angleMultiplier); 138 | } 139 | } 140 | } 141 | 142 | double _getAlignmentOffset(StartAngleAlignment alignment, double angle) { 143 | switch (alignment) { 144 | case StartAngleAlignment.start: 145 | return 0; 146 | case StartAngleAlignment.center: 147 | return -angle / 2; 148 | case StartAngleAlignment.end: 149 | return -angle; 150 | } 151 | } 152 | 153 | double _calculateSweepAngle( 154 | TextPainter painter, 155 | TextStyle? style, 156 | double radius, 157 | String text, 158 | double interLetterAngle, 159 | ) { 160 | double finalRotation = 0; 161 | for (final graphemeCluster in text.characters) { 162 | final translation = _getTranslation( 163 | painter, 164 | style, 165 | radius, 166 | graphemeCluster, 167 | ); 168 | finalRotation += translation.alpha + interLetterAngle; 169 | } 170 | 171 | return finalRotation - interLetterAngle; 172 | } 173 | 174 | /// Calculates width and central angle for the provided [letter]. 175 | LetterTranslation _getTranslation( 176 | TextPainter painter, 177 | TextStyle? style, 178 | double radius, 179 | String letter, 180 | ) { 181 | painter 182 | ..text = TextSpan(text: letter, style: style) 183 | ..layout(minWidth: 0, maxWidth: double.maxFinite); 184 | 185 | return LetterTranslation.fromRadius(painter.width, radius); 186 | } 187 | 188 | class LetterTranslation { 189 | const LetterTranslation(this.letterWidth, this.alpha); 190 | 191 | LetterTranslation.fromRadius(this.letterWidth, double radius) 192 | : alpha = 2 * math.asin(letterWidth / (2 * radius)); 193 | 194 | final double letterWidth; 195 | final double alpha; 196 | } 197 | -------------------------------------------------------------------------------- /docs/flutter_service_worker.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const MANIFEST = 'flutter-app-manifest'; 3 | const TEMP = 'flutter-temp-cache'; 4 | const CACHE_NAME = 'flutter-app-cache'; 5 | 6 | const RESOURCES = {"version.json": "ff966ab969ba381b900e61629bfb9789", 7 | "index.html": "3011daf8486d4792433bc0858946d297", 8 | "/": "3011daf8486d4792433bc0858946d297", 9 | "main.dart.js": "6c5188f19dcbab5f40235cbf00fba349", 10 | "flutter.js": "6fef97aeca90b426343ba6c5c9dc5d4a", 11 | "favicon.png": "5dcef449791fa27946b3d35ad8803796", 12 | "icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1", 13 | "icons/Icon-maskable-192.png": "c457ef57daa1d16f64b27b786ec2ea3c", 14 | "icons/Icon-maskable-512.png": "301a7604d45b3e739efc881eb04896ea", 15 | "icons/Icon-512.png": "96e752610906ba2a93c65f8abe1645f1", 16 | "manifest.json": "0867c3e13649ac4d06fe34b7b3ddce08", 17 | "assets/AssetManifest.json": "f681c4cedb563ed90abc1c6740b4fed5", 18 | "assets/NOTICES": "753e90c0c0d7570ae3b25021c70245fb", 19 | "assets/FontManifest.json": "7b2a36307916a9721811788013e65289", 20 | "assets/packages/storybook_flutter/assets/README.md": "fbaed1ae60d80596d99545ef45d72803", 21 | "assets/packages/flutter_arc_text/assets/README.md": "fbaed1ae60d80596d99545ef45d72803", 22 | "assets/shaders/ink_sparkle.frag": "f8b80e740d33eb157090be4e995febdf", 23 | "assets/AssetManifest.bin": "85f130f08cbeaa530e2286a8fed5caa6", 24 | "assets/fonts/MaterialIcons-Regular.otf": "82c768d996d35ffff2f3393b54c15368", 25 | "canvaskit/skwasm.js": "95f16c6690f955a45b2317496983dbe9", 26 | "canvaskit/skwasm.wasm": "1a074e8452fe5e0d02b112e22cdcf455", 27 | "canvaskit/chromium/canvaskit.js": "96ae916cd2d1b7320fff853ee22aebb0", 28 | "canvaskit/chromium/canvaskit.wasm": "be0e3b33510f5b7b0cc76cc4d3e50048", 29 | "canvaskit/canvaskit.js": "bbf39143dfd758d8d847453b120c8ebb", 30 | "canvaskit/canvaskit.wasm": "42df12e09ecc0d5a4a34a69d7ee44314", 31 | "canvaskit/skwasm.worker.js": "51253d3321b11ddb8d73fa8aa87d3b15"}; 32 | // The application shell files that are downloaded before a service worker can 33 | // start. 34 | const CORE = ["main.dart.js", 35 | "index.html", 36 | "assets/AssetManifest.json", 37 | "assets/FontManifest.json"]; 38 | 39 | // During install, the TEMP cache is populated with the application shell files. 40 | self.addEventListener("install", (event) => { 41 | self.skipWaiting(); 42 | return event.waitUntil( 43 | caches.open(TEMP).then((cache) => { 44 | return cache.addAll( 45 | CORE.map((value) => new Request(value, {'cache': 'reload'}))); 46 | }) 47 | ); 48 | }); 49 | // During activate, the cache is populated with the temp files downloaded in 50 | // install. If this service worker is upgrading from one with a saved 51 | // MANIFEST, then use this to retain unchanged resource files. 52 | self.addEventListener("activate", function(event) { 53 | return event.waitUntil(async function() { 54 | try { 55 | var contentCache = await caches.open(CACHE_NAME); 56 | var tempCache = await caches.open(TEMP); 57 | var manifestCache = await caches.open(MANIFEST); 58 | var manifest = await manifestCache.match('manifest'); 59 | // When there is no prior manifest, clear the entire cache. 60 | if (!manifest) { 61 | await caches.delete(CACHE_NAME); 62 | contentCache = await caches.open(CACHE_NAME); 63 | for (var request of await tempCache.keys()) { 64 | var response = await tempCache.match(request); 65 | await contentCache.put(request, response); 66 | } 67 | await caches.delete(TEMP); 68 | // Save the manifest to make future upgrades efficient. 69 | await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES))); 70 | // Claim client to enable caching on first launch 71 | self.clients.claim(); 72 | return; 73 | } 74 | var oldManifest = await manifest.json(); 75 | var origin = self.location.origin; 76 | for (var request of await contentCache.keys()) { 77 | var key = request.url.substring(origin.length + 1); 78 | if (key == "") { 79 | key = "/"; 80 | } 81 | // If a resource from the old manifest is not in the new cache, or if 82 | // the MD5 sum has changed, delete it. Otherwise the resource is left 83 | // in the cache and can be reused by the new service worker. 84 | if (!RESOURCES[key] || RESOURCES[key] != oldManifest[key]) { 85 | await contentCache.delete(request); 86 | } 87 | } 88 | // Populate the cache with the app shell TEMP files, potentially overwriting 89 | // cache files preserved above. 90 | for (var request of await tempCache.keys()) { 91 | var response = await tempCache.match(request); 92 | await contentCache.put(request, response); 93 | } 94 | await caches.delete(TEMP); 95 | // Save the manifest to make future upgrades efficient. 96 | await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES))); 97 | // Claim client to enable caching on first launch 98 | self.clients.claim(); 99 | return; 100 | } catch (err) { 101 | // On an unhandled exception the state of the cache cannot be guaranteed. 102 | console.error('Failed to upgrade service worker: ' + err); 103 | await caches.delete(CACHE_NAME); 104 | await caches.delete(TEMP); 105 | await caches.delete(MANIFEST); 106 | } 107 | }()); 108 | }); 109 | // The fetch handler redirects requests for RESOURCE files to the service 110 | // worker cache. 111 | self.addEventListener("fetch", (event) => { 112 | if (event.request.method !== 'GET') { 113 | return; 114 | } 115 | var origin = self.location.origin; 116 | var key = event.request.url.substring(origin.length + 1); 117 | // Redirect URLs to the index.html 118 | if (key.indexOf('?v=') != -1) { 119 | key = key.split('?v=')[0]; 120 | } 121 | if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') { 122 | key = '/'; 123 | } 124 | // If the URL is not the RESOURCE list then return to signal that the 125 | // browser should take over. 126 | if (!RESOURCES[key]) { 127 | return; 128 | } 129 | // If the URL is the index.html, perform an online-first request. 130 | if (key == '/') { 131 | return onlineFirst(event); 132 | } 133 | event.respondWith(caches.open(CACHE_NAME) 134 | .then((cache) => { 135 | return cache.match(event.request).then((response) => { 136 | // Either respond with the cached resource, or perform a fetch and 137 | // lazily populate the cache only if the resource was successfully fetched. 138 | return response || fetch(event.request).then((response) => { 139 | if (response && Boolean(response.ok)) { 140 | cache.put(event.request, response.clone()); 141 | } 142 | return response; 143 | }); 144 | }) 145 | }) 146 | ); 147 | }); 148 | self.addEventListener('message', (event) => { 149 | // SkipWaiting can be used to immediately activate a waiting service worker. 150 | // This will also require a page refresh triggered by the main worker. 151 | if (event.data === 'skipWaiting') { 152 | self.skipWaiting(); 153 | return; 154 | } 155 | if (event.data === 'downloadOffline') { 156 | downloadOffline(); 157 | return; 158 | } 159 | }); 160 | // Download offline will check the RESOURCES for all files not in the cache 161 | // and populate them. 162 | async function downloadOffline() { 163 | var resources = []; 164 | var contentCache = await caches.open(CACHE_NAME); 165 | var currentContent = {}; 166 | for (var request of await contentCache.keys()) { 167 | var key = request.url.substring(origin.length + 1); 168 | if (key == "") { 169 | key = "/"; 170 | } 171 | currentContent[key] = true; 172 | } 173 | for (var resourceKey of Object.keys(RESOURCES)) { 174 | if (!currentContent[resourceKey]) { 175 | resources.push(resourceKey); 176 | } 177 | } 178 | return contentCache.addAll(resources); 179 | } 180 | // Attempt to download the resource online before falling back to 181 | // the offline cache. 182 | function onlineFirst(event) { 183 | return event.respondWith( 184 | fetch(event.request).then((response) => { 185 | return caches.open(CACHE_NAME).then((cache) => { 186 | cache.put(event.request, response.clone()); 187 | return response; 188 | }); 189 | }).catch((error) => { 190 | return caches.open(CACHE_NAME).then((cache) => { 191 | return cache.match(event.request).then((response) => { 192 | if (response != null) { 193 | return response; 194 | } 195 | throw error; 196 | }); 197 | }); 198 | }) 199 | ); 200 | } 201 | -------------------------------------------------------------------------------- /docs/assets/shaders/ink_sparkle.frag: -------------------------------------------------------------------------------- 1 | { 2 | "sksl": "// This SkSL shader is autogenerated by spirv-cross.\n\nfloat4 flutter_FragCoord;\n\nuniform vec4 u_color;\nuniform float u_alpha;\nuniform vec4 u_sparkle_color;\nuniform float u_sparkle_alpha;\nuniform float u_blur;\nuniform vec2 u_center;\nuniform float u_radius_scale;\nuniform float u_max_radius;\nuniform vec2 u_resolution_scale;\nuniform vec2 u_noise_scale;\nuniform float u_noise_phase;\nuniform vec2 u_circle1;\nuniform vec2 u_circle2;\nuniform vec2 u_circle3;\nuniform vec2 u_rotation1;\nuniform vec2 u_rotation2;\nuniform vec2 u_rotation3;\n\nvec4 fragColor;\n\nvec2 FLT_flutter_local_FlutterFragCoord()\n{\n return flutter_FragCoord.xy;\n}\n\nmat2 FLT_flutter_local_rotate2d(vec2 rad)\n{\n return mat2(vec2(rad.x, -rad.y), vec2(rad.y, rad.x));\n}\n\nfloat FLT_flutter_local_soft_circle(vec2 uv, vec2 xy, float radius, float blur)\n{\n float blur_half = blur * 0.5;\n float d = distance(uv, xy);\n return 1.0 - smoothstep(1.0 - blur_half, 1.0 + blur_half, d / radius);\n}\n\nfloat FLT_flutter_local_circle_grid(vec2 resolution, inout vec2 p, vec2 xy, vec2 rotation, float cell_diameter)\n{\n vec2 param = rotation;\n p = (FLT_flutter_local_rotate2d(param) * (xy - p)) + xy;\n p = mod(p, vec2(cell_diameter)) / resolution;\n float cell_uv = (cell_diameter / resolution.y) * 0.5;\n float r = 0.64999997615814208984375 * cell_uv;\n vec2 param_1 = p;\n vec2 param_2 = vec2(cell_uv);\n float param_3 = r;\n float param_4 = r * 50.0;\n return FLT_flutter_local_soft_circle(param_1, param_2, param_3, param_4);\n}\n\nfloat FLT_flutter_local_turbulence(vec2 uv)\n{\n vec2 uv_scale = uv * vec2(0.800000011920928955078125);\n vec2 param = vec2(0.800000011920928955078125);\n vec2 param_1 = uv_scale;\n vec2 param_2 = u_circle1;\n vec2 param_3 = u_rotation1;\n float param_4 = 0.17000000178813934326171875;\n float _301 = FLT_flutter_local_circle_grid(param, param_1, param_2, param_3, param_4);\n float g1 = _301;\n vec2 param_5 = vec2(0.800000011920928955078125);\n vec2 param_6 = uv_scale;\n vec2 param_7 = u_circle2;\n vec2 param_8 = u_rotation2;\n float param_9 = 0.20000000298023223876953125;\n float _313 = FLT_flutter_local_circle_grid(param_5, param_6, param_7, param_8, param_9);\n float g2 = _313;\n vec2 param_10 = vec2(0.800000011920928955078125);\n vec2 param_11 = uv_scale;\n vec2 param_12 = u_circle3;\n vec2 param_13 = u_rotation3;\n float param_14 = 0.2750000059604644775390625;\n float _326 = FLT_flutter_local_circle_grid(param_10, param_11, param_12, param_13, param_14);\n float g3 = _326;\n float v = (((g1 * g1) + g2) - g3) * 0.5;\n return clamp(0.449999988079071044921875 + (0.800000011920928955078125 * v), 0.0, 1.0);\n}\n\nfloat FLT_flutter_local_soft_ring(vec2 uv, vec2 xy, float radius, float thickness, float blur)\n{\n vec2 param = uv;\n vec2 param_1 = xy;\n float param_2 = radius + thickness;\n float param_3 = blur;\n float circle_outer = FLT_flutter_local_soft_circle(param, param_1, param_2, param_3);\n vec2 param_4 = uv;\n vec2 param_5 = xy;\n float param_6 = max(radius - thickness, 0.0);\n float param_7 = blur;\n float circle_inner = FLT_flutter_local_soft_circle(param_4, param_5, param_6, param_7);\n return clamp(circle_outer - circle_inner, 0.0, 1.0);\n}\n\nfloat FLT_flutter_local_triangle_noise(inout vec2 n)\n{\n n = fract(n * vec2(5.398700237274169921875, 5.442100048065185546875));\n n += vec2(dot(n.yx, n + vec2(21.5351009368896484375, 14.3136997222900390625)));\n float xy = n.x * n.y;\n return (fract(xy * 95.43070220947265625) + fract(xy * 75.0496063232421875)) - 1.0;\n}\n\nfloat FLT_flutter_local_threshold(float v, float l, float h)\n{\n return step(l, v) * (1.0 - step(h, v));\n}\n\nfloat FLT_flutter_local_sparkle(vec2 uv, float t)\n{\n vec2 param = uv;\n float _224 = FLT_flutter_local_triangle_noise(param);\n float n = _224;\n float param_1 = n;\n float param_2 = 0.0;\n float param_3 = 0.0500000007450580596923828125;\n float s = FLT_flutter_local_threshold(param_1, param_2, param_3);\n float param_4 = n + sin(3.1415927410125732421875 * (t + 0.3499999940395355224609375));\n float param_5 = 0.100000001490116119384765625;\n float param_6 = 0.1500000059604644775390625;\n s += FLT_flutter_local_threshold(param_4, param_5, param_6);\n float param_7 = n + sin(3.1415927410125732421875 * (t + 0.699999988079071044921875));\n float param_8 = 0.20000000298023223876953125;\n float param_9 = 0.25;\n s += FLT_flutter_local_threshold(param_7, param_8, param_9);\n float param_10 = n + sin(3.1415927410125732421875 * (t + 1.0499999523162841796875));\n float param_11 = 0.300000011920928955078125;\n float param_12 = 0.3499999940395355224609375;\n s += FLT_flutter_local_threshold(param_10, param_11, param_12);\n return clamp(s, 0.0, 1.0) * 0.550000011920928955078125;\n}\n\nvoid FLT_main()\n{\n vec2 p = FLT_flutter_local_FlutterFragCoord();\n vec2 uv_1 = p * u_resolution_scale;\n vec2 density_uv = uv_1 - mod(p, u_noise_scale);\n float radius = u_max_radius * u_radius_scale;\n vec2 param_13 = uv_1;\n float turbulence = FLT_flutter_local_turbulence(param_13);\n vec2 param_14 = p;\n vec2 param_15 = u_center;\n float param_16 = radius;\n float param_17 = 0.0500000007450580596923828125 * u_max_radius;\n float param_18 = u_blur;\n float ring = FLT_flutter_local_soft_ring(param_14, param_15, param_16, param_17, param_18);\n vec2 param_19 = density_uv;\n float param_20 = u_noise_phase;\n float sparkle = ((FLT_flutter_local_sparkle(param_19, param_20) * ring) * turbulence) * u_sparkle_alpha;\n vec2 param_21 = p;\n vec2 param_22 = u_center;\n float param_23 = radius;\n float param_24 = u_blur;\n float wave_alpha = (FLT_flutter_local_soft_circle(param_21, param_22, param_23, param_24) * u_alpha) * u_color.w;\n vec4 wave_color = vec4(u_color.xyz * wave_alpha, wave_alpha);\n vec4 sparkle_color = vec4(u_sparkle_color.xyz * u_sparkle_color.w, u_sparkle_color.w);\n fragColor = mix(wave_color, sparkle_color, vec4(sparkle));\n}\n\nhalf4 main(float2 iFragCoord)\n{\n flutter_FragCoord = float4(iFragCoord, 0, 0);\n FLT_main();\n return fragColor;\n}\n", 3 | "stage": 1, 4 | "target_platform": 2, 5 | "uniforms": [ 6 | { 7 | "array_elements": 0, 8 | "bit_width": 32, 9 | "columns": 1, 10 | "location": 0, 11 | "name": "u_color", 12 | "rows": 4, 13 | "type": 10 14 | }, 15 | { 16 | "array_elements": 0, 17 | "bit_width": 32, 18 | "columns": 1, 19 | "location": 1, 20 | "name": "u_alpha", 21 | "rows": 1, 22 | "type": 10 23 | }, 24 | { 25 | "array_elements": 0, 26 | "bit_width": 32, 27 | "columns": 1, 28 | "location": 2, 29 | "name": "u_sparkle_color", 30 | "rows": 4, 31 | "type": 10 32 | }, 33 | { 34 | "array_elements": 0, 35 | "bit_width": 32, 36 | "columns": 1, 37 | "location": 3, 38 | "name": "u_sparkle_alpha", 39 | "rows": 1, 40 | "type": 10 41 | }, 42 | { 43 | "array_elements": 0, 44 | "bit_width": 32, 45 | "columns": 1, 46 | "location": 4, 47 | "name": "u_blur", 48 | "rows": 1, 49 | "type": 10 50 | }, 51 | { 52 | "array_elements": 0, 53 | "bit_width": 32, 54 | "columns": 1, 55 | "location": 5, 56 | "name": "u_center", 57 | "rows": 2, 58 | "type": 10 59 | }, 60 | { 61 | "array_elements": 0, 62 | "bit_width": 32, 63 | "columns": 1, 64 | "location": 6, 65 | "name": "u_radius_scale", 66 | "rows": 1, 67 | "type": 10 68 | }, 69 | { 70 | "array_elements": 0, 71 | "bit_width": 32, 72 | "columns": 1, 73 | "location": 7, 74 | "name": "u_max_radius", 75 | "rows": 1, 76 | "type": 10 77 | }, 78 | { 79 | "array_elements": 0, 80 | "bit_width": 32, 81 | "columns": 1, 82 | "location": 8, 83 | "name": "u_resolution_scale", 84 | "rows": 2, 85 | "type": 10 86 | }, 87 | { 88 | "array_elements": 0, 89 | "bit_width": 32, 90 | "columns": 1, 91 | "location": 9, 92 | "name": "u_noise_scale", 93 | "rows": 2, 94 | "type": 10 95 | }, 96 | { 97 | "array_elements": 0, 98 | "bit_width": 32, 99 | "columns": 1, 100 | "location": 10, 101 | "name": "u_noise_phase", 102 | "rows": 1, 103 | "type": 10 104 | }, 105 | { 106 | "array_elements": 0, 107 | "bit_width": 32, 108 | "columns": 1, 109 | "location": 11, 110 | "name": "u_circle1", 111 | "rows": 2, 112 | "type": 10 113 | }, 114 | { 115 | "array_elements": 0, 116 | "bit_width": 32, 117 | "columns": 1, 118 | "location": 12, 119 | "name": "u_circle2", 120 | "rows": 2, 121 | "type": 10 122 | }, 123 | { 124 | "array_elements": 0, 125 | "bit_width": 32, 126 | "columns": 1, 127 | "location": 13, 128 | "name": "u_circle3", 129 | "rows": 2, 130 | "type": 10 131 | }, 132 | { 133 | "array_elements": 0, 134 | "bit_width": 32, 135 | "columns": 1, 136 | "location": 14, 137 | "name": "u_rotation1", 138 | "rows": 2, 139 | "type": 10 140 | }, 141 | { 142 | "array_elements": 0, 143 | "bit_width": 32, 144 | "columns": 1, 145 | "location": 15, 146 | "name": "u_rotation2", 147 | "rows": 2, 148 | "type": 10 149 | }, 150 | { 151 | "array_elements": 0, 152 | "bit_width": 32, 153 | "columns": 1, 154 | "location": 16, 155 | "name": "u_rotation3", 156 | "rows": 2, 157 | "type": 10 158 | } 159 | ] 160 | } -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | ansi_styles: 5 | dependency: transitive 6 | description: 7 | name: ansi_styles 8 | sha256: "9c656cc12b3c27b17dd982b2cc5c0cfdfbdabd7bc8f3ae5e8542d9867b47ce8a" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "0.3.2+1" 12 | args: 13 | dependency: transitive 14 | description: 15 | name: args 16 | sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.4.2" 20 | async: 21 | dependency: transitive 22 | description: 23 | name: async 24 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "2.11.0" 28 | boolean_selector: 29 | dependency: transitive 30 | description: 31 | name: boolean_selector 32 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "2.1.1" 36 | charcode: 37 | dependency: transitive 38 | description: 39 | name: charcode 40 | sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.3.1" 44 | cli_launcher: 45 | dependency: transitive 46 | description: 47 | name: cli_launcher 48 | sha256: "5e7e0282b79e8642edd6510ee468ae2976d847a0a29b3916e85f5fa1bfe24005" 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "0.3.1" 52 | cli_util: 53 | dependency: transitive 54 | description: 55 | name: cli_util 56 | sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "0.4.0" 60 | collection: 61 | dependency: transitive 62 | description: 63 | name: collection 64 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "1.18.0" 68 | conventional_commit: 69 | dependency: transitive 70 | description: 71 | name: conventional_commit 72 | sha256: dec15ad1118f029c618651a4359eb9135d8b88f761aa24e4016d061cd45948f2 73 | url: "https://pub.dev" 74 | source: hosted 75 | version: "0.6.0+1" 76 | file: 77 | dependency: transitive 78 | description: 79 | name: file 80 | sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" 81 | url: "https://pub.dev" 82 | source: hosted 83 | version: "6.1.4" 84 | glob: 85 | dependency: transitive 86 | description: 87 | name: glob 88 | sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" 89 | url: "https://pub.dev" 90 | source: hosted 91 | version: "2.1.2" 92 | graphs: 93 | dependency: transitive 94 | description: 95 | name: graphs 96 | sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 97 | url: "https://pub.dev" 98 | source: hosted 99 | version: "2.3.1" 100 | http: 101 | dependency: transitive 102 | description: 103 | name: http 104 | sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" 105 | url: "https://pub.dev" 106 | source: hosted 107 | version: "1.1.0" 108 | http_parser: 109 | dependency: transitive 110 | description: 111 | name: http_parser 112 | sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" 113 | url: "https://pub.dev" 114 | source: hosted 115 | version: "4.0.2" 116 | io: 117 | dependency: transitive 118 | description: 119 | name: io 120 | sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" 121 | url: "https://pub.dev" 122 | source: hosted 123 | version: "1.0.4" 124 | json_annotation: 125 | dependency: transitive 126 | description: 127 | name: json_annotation 128 | sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 129 | url: "https://pub.dev" 130 | source: hosted 131 | version: "4.8.1" 132 | matcher: 133 | dependency: transitive 134 | description: 135 | name: matcher 136 | sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" 137 | url: "https://pub.dev" 138 | source: hosted 139 | version: "0.12.16" 140 | melos: 141 | dependency: "direct dev" 142 | description: 143 | name: melos 144 | sha256: "3f22f6cc629d72acf3acc8a7f8563384550290fa30790efa328c9cf606aa17d7" 145 | url: "https://pub.dev" 146 | source: hosted 147 | version: "3.1.1" 148 | meta: 149 | dependency: transitive 150 | description: 151 | name: meta 152 | sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 153 | url: "https://pub.dev" 154 | source: hosted 155 | version: "1.11.0" 156 | mustache_template: 157 | dependency: transitive 158 | description: 159 | name: mustache_template 160 | sha256: a46e26f91445bfb0b60519be280555b06792460b27b19e2b19ad5b9740df5d1c 161 | url: "https://pub.dev" 162 | source: hosted 163 | version: "2.0.0" 164 | path: 165 | dependency: transitive 166 | description: 167 | name: path 168 | sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" 169 | url: "https://pub.dev" 170 | source: hosted 171 | version: "1.8.3" 172 | platform: 173 | dependency: transitive 174 | description: 175 | name: platform 176 | sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" 177 | url: "https://pub.dev" 178 | source: hosted 179 | version: "3.1.3" 180 | pool: 181 | dependency: transitive 182 | description: 183 | name: pool 184 | sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" 185 | url: "https://pub.dev" 186 | source: hosted 187 | version: "1.5.1" 188 | process: 189 | dependency: transitive 190 | description: 191 | name: process 192 | sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" 193 | url: "https://pub.dev" 194 | source: hosted 195 | version: "4.2.4" 196 | prompts: 197 | dependency: transitive 198 | description: 199 | name: prompts 200 | sha256: "3773b845e85a849f01e793c4fc18a45d52d7783b4cb6c0569fad19f9d0a774a1" 201 | url: "https://pub.dev" 202 | source: hosted 203 | version: "2.0.0" 204 | pub_semver: 205 | dependency: transitive 206 | description: 207 | name: pub_semver 208 | sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" 209 | url: "https://pub.dev" 210 | source: hosted 211 | version: "2.1.4" 212 | pub_updater: 213 | dependency: transitive 214 | description: 215 | name: pub_updater 216 | sha256: b06600619c8c219065a548f8f7c192b3e080beff95488ed692780f48f69c0625 217 | url: "https://pub.dev" 218 | source: hosted 219 | version: "0.3.1" 220 | pubspec: 221 | dependency: transitive 222 | description: 223 | name: pubspec 224 | sha256: f534a50a2b4d48dc3bc0ec147c8bd7c304280fff23b153f3f11803c4d49d927e 225 | url: "https://pub.dev" 226 | source: hosted 227 | version: "2.3.0" 228 | quiver: 229 | dependency: transitive 230 | description: 231 | name: quiver 232 | sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 233 | url: "https://pub.dev" 234 | source: hosted 235 | version: "3.2.1" 236 | source_span: 237 | dependency: transitive 238 | description: 239 | name: source_span 240 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 241 | url: "https://pub.dev" 242 | source: hosted 243 | version: "1.10.0" 244 | stack_trace: 245 | dependency: transitive 246 | description: 247 | name: stack_trace 248 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" 249 | url: "https://pub.dev" 250 | source: hosted 251 | version: "1.11.1" 252 | stream_channel: 253 | dependency: transitive 254 | description: 255 | name: stream_channel 256 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 257 | url: "https://pub.dev" 258 | source: hosted 259 | version: "2.1.2" 260 | string_scanner: 261 | dependency: transitive 262 | description: 263 | name: string_scanner 264 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 265 | url: "https://pub.dev" 266 | source: hosted 267 | version: "1.2.0" 268 | term_glyph: 269 | dependency: transitive 270 | description: 271 | name: term_glyph 272 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 273 | url: "https://pub.dev" 274 | source: hosted 275 | version: "1.2.1" 276 | test_api: 277 | dependency: transitive 278 | description: 279 | name: test_api 280 | sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" 281 | url: "https://pub.dev" 282 | source: hosted 283 | version: "0.6.1" 284 | typed_data: 285 | dependency: transitive 286 | description: 287 | name: typed_data 288 | sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c 289 | url: "https://pub.dev" 290 | source: hosted 291 | version: "1.3.2" 292 | uri: 293 | dependency: transitive 294 | description: 295 | name: uri 296 | sha256: "889eea21e953187c6099802b7b4cf5219ba8f3518f604a1033064d45b1b8268a" 297 | url: "https://pub.dev" 298 | source: hosted 299 | version: "1.0.0" 300 | yaml: 301 | dependency: transitive 302 | description: 303 | name: yaml 304 | sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" 305 | url: "https://pub.dev" 306 | source: hosted 307 | version: "3.1.2" 308 | yaml_edit: 309 | dependency: transitive 310 | description: 311 | name: yaml_edit 312 | sha256: "1579d4a0340a83cf9e4d580ea51a16329c916973bffd5bd4b45e911b25d46bfd" 313 | url: "https://pub.dev" 314 | source: hosted 315 | version: "2.1.1" 316 | sdks: 317 | dart: ">=3.0.0 <4.0.0" 318 | flutter: ">=3.13.0" 319 | -------------------------------------------------------------------------------- /docs/flutter.js: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Flutter Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | if (!_flutter) { 6 | var _flutter = {}; 7 | } 8 | _flutter.loader = null; 9 | 10 | (function () { 11 | "use strict"; 12 | 13 | const baseUri = ensureTrailingSlash(getBaseURI()); 14 | 15 | function getBaseURI() { 16 | const base = document.querySelector("base"); 17 | return (base && base.getAttribute("href")) || ""; 18 | } 19 | 20 | function ensureTrailingSlash(uri) { 21 | if (uri == "") { 22 | return uri; 23 | } 24 | return uri.endsWith("/") ? uri : `${uri}/`; 25 | } 26 | 27 | /** 28 | * Wraps `promise` in a timeout of the given `duration` in ms. 29 | * 30 | * Resolves/rejects with whatever the original `promises` does, or rejects 31 | * if `promise` takes longer to complete than `duration`. In that case, 32 | * `debugName` is used to compose a legible error message. 33 | * 34 | * If `duration` is < 0, the original `promise` is returned unchanged. 35 | * @param {Promise} promise 36 | * @param {number} duration 37 | * @param {string} debugName 38 | * @returns {Promise} a wrapped promise. 39 | */ 40 | async function timeout(promise, duration, debugName) { 41 | if (duration < 0) { 42 | return promise; 43 | } 44 | let timeoutId; 45 | const _clock = new Promise((_, reject) => { 46 | timeoutId = setTimeout(() => { 47 | reject( 48 | new Error( 49 | `${debugName} took more than ${duration}ms to resolve. Moving on.`, 50 | { 51 | cause: timeout, 52 | } 53 | ) 54 | ); 55 | }, duration); 56 | }); 57 | 58 | return Promise.race([promise, _clock]).finally(() => { 59 | clearTimeout(timeoutId); 60 | }); 61 | } 62 | 63 | /** 64 | * Handles the creation of a TrustedTypes `policy` that validates URLs based 65 | * on an (optional) incoming array of RegExes. 66 | */ 67 | class FlutterTrustedTypesPolicy { 68 | /** 69 | * Constructs the policy. 70 | * @param {[RegExp]} validPatterns the patterns to test URLs 71 | * @param {String} policyName the policy name (optional) 72 | */ 73 | constructor(validPatterns, policyName = "flutter-js") { 74 | const patterns = validPatterns || [ 75 | /\.js$/, 76 | ]; 77 | if (window.trustedTypes) { 78 | this.policy = trustedTypes.createPolicy(policyName, { 79 | createScriptURL: function(url) { 80 | const parsed = new URL(url, window.location); 81 | const file = parsed.pathname.split("/").pop(); 82 | const matches = patterns.some((pattern) => pattern.test(file)); 83 | if (matches) { 84 | return parsed.toString(); 85 | } 86 | console.error( 87 | "URL rejected by TrustedTypes policy", 88 | policyName, ":", url, "(download prevented)"); 89 | } 90 | }); 91 | } 92 | } 93 | } 94 | 95 | /** 96 | * Handles loading/reloading Flutter's service worker, if configured. 97 | * 98 | * @see: https://developers.google.com/web/fundamentals/primers/service-workers 99 | */ 100 | class FlutterServiceWorkerLoader { 101 | /** 102 | * Injects a TrustedTypesPolicy (or undefined if the feature is not supported). 103 | * @param {TrustedTypesPolicy | undefined} policy 104 | */ 105 | setTrustedTypesPolicy(policy) { 106 | this._ttPolicy = policy; 107 | } 108 | 109 | /** 110 | * Returns a Promise that resolves when the latest Flutter service worker, 111 | * configured by `settings` has been loaded and activated. 112 | * 113 | * Otherwise, the promise is rejected with an error message. 114 | * @param {*} settings Service worker settings 115 | * @returns {Promise} that resolves when the latest serviceWorker is ready. 116 | */ 117 | loadServiceWorker(settings) { 118 | if (settings == null) { 119 | // In the future, settings = null -> uninstall service worker? 120 | console.debug("Null serviceWorker configuration. Skipping."); 121 | return Promise.resolve(); 122 | } 123 | if (!("serviceWorker" in navigator)) { 124 | let errorMessage = "Service Worker API unavailable."; 125 | if (!window.isSecureContext) { 126 | errorMessage += "\nThe current context is NOT secure." 127 | errorMessage += "\nRead more: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts"; 128 | } 129 | return Promise.reject( 130 | new Error(errorMessage) 131 | ); 132 | } 133 | const { 134 | serviceWorkerVersion, 135 | serviceWorkerUrl = `${baseUri}flutter_service_worker.js?v=${serviceWorkerVersion}`, 136 | timeoutMillis = 4000, 137 | } = settings; 138 | 139 | // Apply the TrustedTypes policy, if present. 140 | let url = serviceWorkerUrl; 141 | if (this._ttPolicy != null) { 142 | url = this._ttPolicy.createScriptURL(url); 143 | } 144 | 145 | const serviceWorkerActivation = navigator.serviceWorker 146 | .register(url) 147 | .then(this._getNewServiceWorker) 148 | .then(this._waitForServiceWorkerActivation); 149 | 150 | // Timeout race promise 151 | return timeout( 152 | serviceWorkerActivation, 153 | timeoutMillis, 154 | "prepareServiceWorker" 155 | ); 156 | } 157 | 158 | /** 159 | * Returns the latest service worker for the given `serviceWorkerRegistrationPromise`. 160 | * 161 | * This might return the current service worker, if there's no new service worker 162 | * awaiting to be installed/updated. 163 | * 164 | * @param {Promise} serviceWorkerRegistrationPromise 165 | * @returns {Promise} 166 | */ 167 | async _getNewServiceWorker(serviceWorkerRegistrationPromise) { 168 | const reg = await serviceWorkerRegistrationPromise; 169 | 170 | if (!reg.active && (reg.installing || reg.waiting)) { 171 | // No active web worker and we have installed or are installing 172 | // one for the first time. Simply wait for it to activate. 173 | console.debug("Installing/Activating first service worker."); 174 | return reg.installing || reg.waiting; 175 | } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) { 176 | // When the app updates the serviceWorkerVersion changes, so we 177 | // need to ask the service worker to update. 178 | return reg.update().then((newReg) => { 179 | console.debug("Updating service worker."); 180 | return newReg.installing || newReg.waiting || newReg.active; 181 | }); 182 | } else { 183 | console.debug("Loading from existing service worker."); 184 | return reg.active; 185 | } 186 | } 187 | 188 | /** 189 | * Returns a Promise that resolves when the `latestServiceWorker` changes its 190 | * state to "activated". 191 | * 192 | * @param {Promise} latestServiceWorkerPromise 193 | * @returns {Promise} 194 | */ 195 | async _waitForServiceWorkerActivation(latestServiceWorkerPromise) { 196 | const serviceWorker = await latestServiceWorkerPromise; 197 | 198 | if (!serviceWorker || serviceWorker.state == "activated") { 199 | if (!serviceWorker) { 200 | return Promise.reject( 201 | new Error("Cannot activate a null service worker!") 202 | ); 203 | } else { 204 | console.debug("Service worker already active."); 205 | return Promise.resolve(); 206 | } 207 | } 208 | return new Promise((resolve, _) => { 209 | serviceWorker.addEventListener("statechange", () => { 210 | if (serviceWorker.state == "activated") { 211 | console.debug("Activated new service worker."); 212 | resolve(); 213 | } 214 | }); 215 | }); 216 | } 217 | } 218 | 219 | /** 220 | * Handles injecting the main Flutter web entrypoint (main.dart.js), and notifying 221 | * the user when Flutter is ready, through `didCreateEngineInitializer`. 222 | * 223 | * @see https://docs.flutter.dev/development/platform-integration/web/initialization 224 | */ 225 | class FlutterEntrypointLoader { 226 | /** 227 | * Creates a FlutterEntrypointLoader. 228 | */ 229 | constructor() { 230 | // Watchdog to prevent injecting the main entrypoint multiple times. 231 | this._scriptLoaded = false; 232 | } 233 | 234 | /** 235 | * Injects a TrustedTypesPolicy (or undefined if the feature is not supported). 236 | * @param {TrustedTypesPolicy | undefined} policy 237 | */ 238 | setTrustedTypesPolicy(policy) { 239 | this._ttPolicy = policy; 240 | } 241 | 242 | /** 243 | * Loads flutter main entrypoint, specified by `entrypointUrl`, and calls a 244 | * user-specified `onEntrypointLoaded` callback with an EngineInitializer 245 | * object when it's done. 246 | * 247 | * @param {*} options 248 | * @returns {Promise | undefined} that will eventually resolve with an 249 | * EngineInitializer, or will be rejected with the error caused by the loader. 250 | * Returns undefined when an `onEntrypointLoaded` callback is supplied in `options`. 251 | */ 252 | async loadEntrypoint(options) { 253 | const { entrypointUrl = `${baseUri}main.dart.js`, onEntrypointLoaded } = 254 | options || {}; 255 | 256 | return this._loadEntrypoint(entrypointUrl, onEntrypointLoaded); 257 | } 258 | 259 | /** 260 | * Resolves the promise created by loadEntrypoint, and calls the `onEntrypointLoaded` 261 | * function supplied by the user (if needed). 262 | * 263 | * Called by Flutter through `_flutter.loader.didCreateEngineInitializer` method, 264 | * which is bound to the correct instance of the FlutterEntrypointLoader by 265 | * the FlutterLoader object. 266 | * 267 | * @param {Function} engineInitializer @see https://github.com/flutter/engine/blob/main/lib/web_ui/lib/src/engine/js_interop/js_loader.dart#L42 268 | */ 269 | didCreateEngineInitializer(engineInitializer) { 270 | if (typeof this._didCreateEngineInitializerResolve === "function") { 271 | this._didCreateEngineInitializerResolve(engineInitializer); 272 | // Remove the resolver after the first time, so Flutter Web can hot restart. 273 | this._didCreateEngineInitializerResolve = null; 274 | // Make the engine revert to "auto" initialization on hot restart. 275 | delete _flutter.loader.didCreateEngineInitializer; 276 | } 277 | if (typeof this._onEntrypointLoaded === "function") { 278 | this._onEntrypointLoaded(engineInitializer); 279 | } 280 | } 281 | 282 | /** 283 | * Injects a script tag into the DOM, and configures this loader to be able to 284 | * handle the "entrypoint loaded" notifications received from Flutter web. 285 | * 286 | * @param {string} entrypointUrl the URL of the script that will initialize 287 | * Flutter. 288 | * @param {Function} onEntrypointLoaded a callback that will be called when 289 | * Flutter web notifies this object that the entrypoint is 290 | * loaded. 291 | * @returns {Promise | undefined} a Promise that resolves when the entrypoint 292 | * is loaded, or undefined if `onEntrypointLoaded` 293 | * is a function. 294 | */ 295 | _loadEntrypoint(entrypointUrl, onEntrypointLoaded) { 296 | const useCallback = typeof onEntrypointLoaded === "function"; 297 | 298 | if (!this._scriptLoaded) { 299 | this._scriptLoaded = true; 300 | const scriptTag = this._createScriptTag(entrypointUrl); 301 | if (useCallback) { 302 | // Just inject the script tag, and return nothing; Flutter will call 303 | // `didCreateEngineInitializer` when it's done. 304 | console.debug("Injecting