kasy-cli 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/bin/kasy.js +529 -0
- package/docs/cli-reference.md +251 -0
- package/lib/commands/add.js +777 -0
- package/lib/commands/check.js +240 -0
- package/lib/commands/codemagic.js +161 -0
- package/lib/commands/deploy.js +257 -0
- package/lib/commands/docs.js +47 -0
- package/lib/commands/doctor.js +227 -0
- package/lib/commands/features.js +36 -0
- package/lib/commands/ios.js +206 -0
- package/lib/commands/new.js +1870 -0
- package/lib/commands/notifications.js +207 -0
- package/lib/commands/remove.js +466 -0
- package/lib/commands/run.js +75 -0
- package/lib/commands/update.js +382 -0
- package/lib/commands/validate.js +131 -0
- package/lib/scaffold/CHANGELOG.json +6 -0
- package/lib/scaffold/backends/api/.flutter-plugins-dependencies +1 -0
- package/lib/scaffold/backends/api/analysis_options.yaml +5 -0
- package/lib/scaffold/backends/api/generator.js +76 -0
- package/lib/scaffold/backends/api/patch/README.md +85 -0
- package/lib/scaffold/backends/api/patch/android/app/src/main/AndroidManifest.xml +87 -0
- package/lib/scaffold/backends/api/patch/ios/Runner/AppDelegate.swift +61 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/api/meta_ads_api.dart +80 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/api/storage_api.dart +117 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/api/user_api.dart +148 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/entities/json_converters.dart +35 -0
- package/lib/scaffold/backends/api/patch/lib/core/data/entities/user_entity.dart +48 -0
- package/lib/scaffold/backends/api/patch/lib/core/rating/widgets/review_popup.dart +211 -0
- package/lib/scaffold/backends/api/patch/lib/environnements.dart +151 -0
- package/lib/scaffold/backends/api/patch/lib/features/authentication/api/authentication_api.dart +303 -0
- package/lib/scaffold/backends/api/patch/lib/features/authentication/api/authentication_api_interface.dart +80 -0
- package/lib/scaffold/backends/api/patch/lib/features/authentication/repositories/authentication_repository.dart +406 -0
- package/lib/scaffold/backends/api/patch/lib/features/camera/xfile_extension.dart +6 -0
- package/lib/scaffold/backends/api/patch/lib/features/feedbacks/api/entities/feature_request_entity.dart +24 -0
- package/lib/scaffold/backends/api/patch/lib/features/feedbacks/api/entities/feature_vote_entity.dart +21 -0
- package/lib/scaffold/backends/api/patch/lib/features/feedbacks/api/feature_request_api.dart +52 -0
- package/lib/scaffold/backends/api/patch/lib/features/feedbacks/api/feature_vote_api.dart +60 -0
- package/lib/scaffold/backends/api/patch/lib/features/llm_chat/api/llm_chat_api.dart +58 -0
- package/lib/scaffold/backends/api/patch/lib/features/llm_chat/api/llm_chat_message_entity.dart +29 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/api/device_api.dart +398 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/api/entities/device_entity.dart +39 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/api/entities/notifications_entity.dart +23 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/api/notifications_api.dart +333 -0
- package/lib/scaffold/backends/api/patch/lib/features/notifications/providers/models/notification.dart +185 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/api/entities/user_info_entity.dart +26 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/api/user_infos_api.dart +107 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/models/user_info.dart +94 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/repositories/user_infos_repository.dart +29 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/animations/movefade_anim.dart +34 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/components/onboarding_att_setup.dart +66 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +73 -0
- package/lib/scaffold/backends/api/patch/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +173 -0
- package/lib/scaffold/backends/api/patch/lib/features/settings/ui/widgets/avatar_utils.dart +33 -0
- package/lib/scaffold/backends/api/patch/lib/features/subscription/api/entities/subscription_entity.dart +34 -0
- package/lib/scaffold/backends/api/patch/lib/features/subscription/api/subscription_api.dart +49 -0
- package/lib/scaffold/backends/api/patch/lib/features/subscription/shared/maybeshow_premium.dart +88 -0
- package/lib/scaffold/backends/api/patch/lib/main.dart +256 -0
- package/lib/scaffold/backends/api/patch/lib/router.dart +133 -0
- package/lib/scaffold/backends/api/pubspec.yaml.tpl +108 -0
- package/lib/scaffold/backends/firebase/deploy.js +1006 -0
- package/lib/scaffold/backends/firebase/generator.js +24 -0
- package/lib/scaffold/backends/firebase/setup-from-scratch.js +1008 -0
- package/lib/scaffold/backends/firebase/tokens.js +113 -0
- package/lib/scaffold/backends/supabase/.flutter-plugins-dependencies +1 -0
- package/lib/scaffold/backends/supabase/analysis_options.yaml +5 -0
- package/lib/scaffold/backends/supabase/config.toml +34 -0
- package/lib/scaffold/backends/supabase/deploy.js +485 -0
- package/lib/scaffold/backends/supabase/edge-functions/delete-user-account/README.md +15 -0
- package/lib/scaffold/backends/supabase/edge-functions/delete-user-account/index.ts +97 -0
- package/lib/scaffold/backends/supabase/edge-functions/llm-chat/index.ts +156 -0
- package/lib/scaffold/backends/supabase/edge-functions/meta-track-event/index.ts +292 -0
- package/lib/scaffold/backends/supabase/edge-functions/revenuecat-webhook/README.md +30 -0
- package/lib/scaffold/backends/supabase/edge-functions/revenuecat-webhook/index.ts +488 -0
- package/lib/scaffold/backends/supabase/edge-functions/send-push-notification/README.md +35 -0
- package/lib/scaffold/backends/supabase/edge-functions/send-push-notification/index.ts +314 -0
- package/lib/scaffold/backends/supabase/generator.js +108 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000001_initial_schema.sql +149 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000002_storage_bucket.sql +40 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000005_vote_triggers.sql +34 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000006_notification_webhook.sql +36 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000007_welcome_notification.sql +64 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000008_user_feature_requests.sql +2 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000009_llm_messages.sql +22 -0
- package/lib/scaffold/backends/supabase/migrations/20240101000010_notification_image.sql +2 -0
- package/lib/scaffold/backends/supabase/patch/README.md +121 -0
- package/lib/scaffold/backends/supabase/patch/android/app/src/main/AndroidManifest.xml +87 -0
- package/lib/scaffold/backends/supabase/patch/ios/Runner/AppDelegate.swift +61 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/api/meta_ads_api.dart +75 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/api/storage_api.dart +83 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/api/user_api.dart +143 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/entities/json_converters.dart +35 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/data/entities/user_entity.dart +48 -0
- package/lib/scaffold/backends/supabase/patch/lib/core/rating/widgets/review_popup.dart +211 -0
- package/lib/scaffold/backends/supabase/patch/lib/environnements.dart +149 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/authentication/api/authentication_api.dart +546 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/authentication/repositories/authentication_repository.dart +410 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/camera/xfile_extension.dart +6 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/api/entities/feature_request_entity.dart +25 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/api/entities/feature_vote_entity.dart +21 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/api/feature_request_api.dart +59 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/api/feature_vote_api.dart +85 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/feedbacks/ui/component/add_feature_form.dart +199 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/llm_chat/api/llm_chat_api.dart +47 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/llm_chat/api/llm_chat_message_entity.dart +30 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/llm_chat/providers/llm_chat_notifier.dart +266 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/api/device_api.dart +410 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/api/entities/device_entity.dart +51 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/api/entities/notifications_entity.dart +26 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/api/notifications_api.dart +317 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/notifications/providers/models/notification.dart +174 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/api/entities/user_info_entity.dart +26 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/api/user_infos_api.dart +90 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/models/user_info.dart +94 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/repositories/user_infos_repository.dart +29 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/animations/movefade_anim.dart +34 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/components/onboarding_att_setup.dart +66 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +73 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +173 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/settings/ui/widgets/avatar_utils.dart +35 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/subscription/api/entities/subscription_entity.dart +35 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/subscription/api/subscription_api.dart +44 -0
- package/lib/scaffold/backends/supabase/patch/lib/features/subscription/shared/maybeshow_premium.dart +85 -0
- package/lib/scaffold/backends/supabase/patch/lib/google_auth_options.dart +23 -0
- package/lib/scaffold/backends/supabase/patch/lib/main.dart +288 -0
- package/lib/scaffold/backends/supabase/patch/lib/router.dart +133 -0
- package/lib/scaffold/backends/supabase/pubspec.yaml.tpl +110 -0
- package/lib/scaffold/backends/supabase/tokens.js +9 -0
- package/lib/scaffold/catalog.js +177 -0
- package/lib/scaffold/engine.js +230 -0
- package/lib/scaffold/features/README.md +152 -0
- package/lib/scaffold/features/analytics/lib/core/data/api/analytics_api.dart +124 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.es.md +35 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.md +35 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/BUG.pt.md +35 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.es.md +12 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.md +12 -0
- package/lib/scaffold/features/ci/.github/ISSUE_TEMPLATE/feature_request.pt.md +12 -0
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.es.md +17 -0
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.md +17 -0
- package/lib/scaffold/features/ci/.github/PULL_REQUEST_TEMPLATE.pt.md +17 -0
- package/lib/scaffold/features/ci/.github/dependabot.yml +16 -0
- package/lib/scaffold/features/ci/.github/workflows/app.yml +20 -0
- package/lib/scaffold/features/ci/.gitlab/templates/deploy.yaml +14 -0
- package/lib/scaffold/features/ci/.gitlab/templates/dropbox.yaml +19 -0
- package/lib/scaffold/features/ci/.gitlab/templates/flutter.yaml +163 -0
- package/lib/scaffold/features/ci/.gitlab/templates/mailgun.yaml +28 -0
- package/lib/scaffold/features/ci/.gitlab-ci.yml +37 -0
- package/lib/scaffold/features/ci/codemagic.yaml +157 -0
- package/lib/scaffold/features/facebook/lib/core/data/api/tracking_api.dart +111 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/entities/feature_request_entity.dart +27 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/entities/feature_vote_entity.dart +27 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/feature_request_api.dart +50 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/api/feature_vote_api.dart +79 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/models/feature_requests.dart +48 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/models/feedback_state.dart +42 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/providers/feedback_page_notifier.dart +147 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/repositories/feature_request_repository.dart +95 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/component/add_feature_form.dart +199 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/feedback_page.dart +175 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/widgets/add_feature_button.dart +76 -0
- package/lib/scaffold/features/feedback/lib/features/feedbacks/ui/widgets/feature_card.dart +279 -0
- package/lib/scaffold/features/ios-release/.kasy/apple.env.example +8 -0
- package/lib/scaffold/features/ios-release/.kasy/codemagic.env.example +7 -0
- package/lib/scaffold/features/ios-release/docs/codemagic-release.en.md +50 -0
- package/lib/scaffold/features/ios-release/docs/codemagic-release.es.md +50 -0
- package/lib/scaffold/features/ios-release/docs/codemagic-release.pt.md +50 -0
- package/lib/scaffold/features/ios-release/docs/ios-release.en.md +41 -0
- package/lib/scaffold/features/ios-release/docs/ios-release.es.md +41 -0
- package/lib/scaffold/features/ios-release/docs/ios-release.pt.md +41 -0
- package/lib/scaffold/features/ios-release/scripts/bump-ios-version.js +38 -0
- package/lib/scaffold/features/ios-release/scripts/release-ios.sh +137 -0
- package/lib/scaffold/features/llm_chat/lib/features/llm_chat/llm_chat_page.dart +301 -0
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/providers/reminder_notifier.dart +81 -0
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/repositories/reminder_preferences.dart +76 -0
- package/lib/scaffold/features/local_notifications/lib/features/local_reminder/ui/reminder_page.dart +282 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/api/entities/user_info_entity.dart +24 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/api/user_infos_api.dart +71 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/models/user_info.dart +92 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/providers/onboarding_model.dart +15 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/providers/onboarding_provider.dart +78 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/repositories/user_infos_repository.dart +29 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/animations/page_transitions.dart +30 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_att_setup.dart +66 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_features.dart +72 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_loader.dart +92 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +73 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/components/onboarding_questions.dart +89 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/onboarding_page.dart +94 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_background.dart +80 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_feature.dart +139 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_illustration_scaffold.dart +110 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_progress.dart +84 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +173 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_reassurance.dart +45 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/onboarding_sticky_footer.dart +77 -0
- package/lib/scaffold/features/onboarding/lib/features/onboarding/ui/widgets/selectable_row_tile.dart +392 -0
- package/lib/scaffold/features/revenuecat/lib/core/data/api/tracking_api.dart +116 -0
- package/lib/scaffold/features/revenuecat/lib/core/data/models/subscription.dart +322 -0
- package/lib/scaffold/features/revenuecat/lib/core/home_widgets/home_widget_background_task.dart +41 -0
- package/lib/scaffold/features/revenuecat/lib/core/states/user_state_notifier.dart +305 -0
- package/lib/scaffold/features/widget/lib/core/home_widgets/home_widget_background_task.dart +41 -0
- package/lib/scaffold/features/widget/lib/core/home_widgets/home_widget_mywidget_service.dart +57 -0
- package/lib/scaffold/features/widget/lib/core/home_widgets/home_widget_service.dart +54 -0
- package/lib/scaffold/features/widget/lib/features/settings/ui/components/admin/admin_home_widgets.dart +32 -0
- package/lib/scaffold/generate.js +370 -0
- package/lib/scaffold/patch.js +395 -0
- package/lib/scaffold/shared/backend-config.js +74 -0
- package/lib/scaffold/shared/fcm-service-account.js +126 -0
- package/lib/scaffold/shared/generator-utils.js +1664 -0
- package/lib/scaffold/shared/post-build.js +809 -0
- package/lib/scaffold/shared/template-strings.js +112 -0
- package/lib/utils/apple-release.js +273 -0
- package/lib/utils/checks.js +319 -0
- package/lib/utils/codemagic-release.js +127 -0
- package/lib/utils/fs.js +122 -0
- package/lib/utils/i18n.js +2123 -0
- package/lib/utils/license-gate.js +72 -0
- package/lib/utils/license.js +64 -0
- package/lib/utils/prompts.js +213 -0
- package/lib/utils/updates.js +97 -0
- package/package.json +55 -0
- package/templates/firebase/.env.example +24 -0
- package/templates/firebase/.firebaserc +5 -0
- package/templates/firebase/.kasy/apple.env.example +8 -0
- package/templates/firebase/.kasy/codemagic.env.example +7 -0
- package/templates/firebase/.metadata +30 -0
- package/templates/firebase/.windsurfrules +95 -0
- package/templates/firebase/Makefile +30 -0
- package/templates/firebase/README.en.md +180 -0
- package/templates/firebase/README.es.md +180 -0
- package/templates/firebase/README.md +180 -0
- package/templates/firebase/analysis_options.yaml +37 -0
- package/templates/firebase/android/app/build.gradle.kts +80 -0
- package/templates/firebase/android/app/src/debug/AndroidManifest.xml +7 -0
- package/templates/firebase/android/app/src/main/AndroidManifest.xml +93 -0
- package/templates/firebase/android/app/src/main/kotlin/com/aicrus/firebase/kit/MainActivity.kt +36 -0
- package/templates/firebase/android/app/src/main/kotlin/com/aicrus/firebase/kit/MyWidget.kt +50 -0
- package/templates/firebase/android/app/src/main/kotlin/com/aicrus/firebase/kit/MyWidgetReceiver.kt +7 -0
- package/templates/firebase/android/app/src/main/res/drawable/background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable/launch_background.xml +9 -0
- package/templates/firebase/android/app/src/main/res/drawable-hdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-mdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-v21/background.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-v21/launch_background.xml +9 -0
- package/templates/firebase/android/app/src/main/res/drawable-xhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/drawable-xxxhdpi/splash.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/templates/firebase/android/app/src/main/res/values/strings.xml +6 -0
- package/templates/firebase/android/app/src/main/res/values/styles.xml +22 -0
- package/templates/firebase/android/app/src/main/res/values-night/styles.xml +22 -0
- package/templates/firebase/android/app/src/main/res/values-night-v31/styles.xml +20 -0
- package/templates/firebase/android/app/src/main/res/values-v31/styles.xml +20 -0
- package/templates/firebase/android/app/src/main/res/xml/locales_config.xml +7 -0
- package/templates/firebase/android/app/src/main/res/xml/mywidget_info.xml +11 -0
- package/templates/firebase/android/app/src/profile/AndroidManifest.xml +7 -0
- package/templates/firebase/android/build.gradle.kts +28 -0
- package/templates/firebase/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/templates/firebase/android/gradle.properties +2 -0
- package/templates/firebase/android/settings.gradle.kts +29 -0
- package/templates/firebase/assets/icons/apple.png +0 -0
- package/templates/firebase/assets/icons/facebook.png +0 -0
- package/templates/firebase/assets/icons/google.png +0 -0
- package/templates/firebase/assets/icons/google_play_games.png +0 -0
- package/templates/firebase/assets/images/app_icon.png +0 -0
- package/templates/firebase/assets/images/empty_notifications.jpg +0 -0
- package/templates/firebase/assets/images/icon.png +0 -0
- package/templates/firebase/assets/images/onboarding/authentication-login-template.jpg +0 -0
- package/templates/firebase/assets/images/onboarding/img1.jpg +0 -0
- package/templates/firebase/assets/images/onboarding/img2.jpg +0 -0
- package/templates/firebase/assets/images/onboarding/img3.jpg +0 -0
- package/templates/firebase/assets/images/onboarding/notifications.png +0 -0
- package/templates/firebase/assets/images/onboarding/onboarding.png +0 -0
- package/templates/firebase/assets/images/onboarding/purchase.png +0 -0
- package/templates/firebase/assets/images/premium-bg.jpg +0 -0
- package/templates/firebase/assets/images/premium-switch-header.png +0 -0
- package/templates/firebase/assets/images/review.png +0 -0
- package/templates/firebase/assets/images/splashscreen.png +0 -0
- package/templates/firebase/assets/images/update.png +0 -0
- package/templates/firebase/build.yaml +13 -0
- package/templates/firebase/devtools_options.yaml +3 -0
- package/templates/firebase/docs/auth-setup.en.md +145 -0
- package/templates/firebase/docs/auth-setup.es.md +145 -0
- package/templates/firebase/docs/auth-setup.pt.md +145 -0
- package/templates/firebase/docs/codemagic-release.en.md +50 -0
- package/templates/firebase/docs/codemagic-release.es.md +50 -0
- package/templates/firebase/docs/codemagic-release.pt.md +50 -0
- package/templates/firebase/docs/ios-release.en.md +41 -0
- package/templates/firebase/docs/ios-release.es.md +41 -0
- package/templates/firebase/docs/ios-release.pt.md +54 -0
- package/templates/firebase/docs/navigation-transitions.md +80 -0
- package/templates/firebase/docs/revenuecat-setup.es.md +341 -0
- package/templates/firebase/docs/revenuecat-setup.pt.md +341 -0
- package/templates/firebase/firebase.json +1 -0
- package/templates/firebase/firestore.indexes.json +25 -0
- package/templates/firebase/firestore.rules +51 -0
- package/templates/firebase/functions/.eslintrc.js +45 -0
- package/templates/firebase/functions/jest.config.js +16 -0
- package/templates/firebase/functions/package-lock.json +6876 -0
- package/templates/firebase/functions/package.json +33 -0
- package/templates/firebase/functions/src/authentication/functions.ts +30 -0
- package/templates/firebase/functions/src/authentication/triggers.ts +103 -0
- package/templates/firebase/functions/src/core/api/meta_ads_api.ts +390 -0
- package/templates/firebase/functions/src/core/data/entities/entity_utils.ts +87 -0
- package/templates/firebase/functions/src/core/data/entities/notification_entity.ts +74 -0
- package/templates/firebase/functions/src/core/data/entities/page.ts +4 -0
- package/templates/firebase/functions/src/core/data/entities/subscription_entity.ts +76 -0
- package/templates/firebase/functions/src/core/data/entities/user_device_entity.ts +64 -0
- package/templates/firebase/functions/src/core/data/entities/user_entity.ts +43 -0
- package/templates/firebase/functions/src/core/data/repositories/repositories.ts +16 -0
- package/templates/firebase/functions/src/core/data/repositories/subscription_repository.ts +42 -0
- package/templates/firebase/functions/src/core/data/repositories/user_device_repository.ts +31 -0
- package/templates/firebase/functions/src/core/data/repositories/user_notifications_repository.ts +58 -0
- package/templates/firebase/functions/src/core/data/repositories/user_repository.ts +84 -0
- package/templates/firebase/functions/src/core/logger/logger.ts +13 -0
- package/templates/firebase/functions/src/core/storage/storage_manager.ts +52 -0
- package/templates/firebase/functions/src/core/utils/async_utils.ts +5 -0
- package/templates/firebase/functions/src/feature_requests/triggers.ts +3 -0
- package/templates/firebase/functions/src/index.ts +24 -0
- package/templates/firebase/functions/src/llm_chat/index.ts +181 -0
- package/templates/firebase/functions/src/notifications/admin_functions.ts +91 -0
- package/templates/firebase/functions/src/notifications/models/notification.ts +61 -0
- package/templates/firebase/functions/src/notifications/notifications_api.ts +147 -0
- package/templates/firebase/functions/src/notifications/triggers.ts +102 -0
- package/templates/firebase/functions/src/subscriptions/models/revenuecat_events.ts +162 -0
- package/templates/firebase/functions/src/subscriptions/models/subscription_status.ts +18 -0
- package/templates/firebase/functions/src/subscriptions/models/subscriptions.ts +173 -0
- package/templates/firebase/functions/src/subscriptions/subscriptions_functions.ts +135 -0
- package/templates/firebase/functions/src/subscriptions/triggers.ts +35 -0
- package/templates/firebase/functions/src/test/core/data/entities/entity_utils.spec.ts +44 -0
- package/templates/firebase/functions/tsconfig.dev.json +5 -0
- package/templates/firebase/functions/tsconfig.json +18 -0
- package/templates/firebase/home_widget_config.json +30 -0
- package/templates/firebase/ios/Flutter/AppFrameworkInfo.plist +24 -0
- package/templates/firebase/ios/Flutter/Debug.xcconfig +2 -0
- package/templates/firebase/ios/Flutter/Profile.xcconfig +2 -0
- package/templates/firebase/ios/Flutter/Release.xcconfig +2 -0
- package/templates/firebase/ios/HomeWidgetExtension/HomeWidgetBundle.swift +13 -0
- package/templates/firebase/ios/HomeWidgetExtension/Info.plist +29 -0
- package/templates/firebase/ios/HomeWidgetExtension/MyWidget.swift +86 -0
- package/templates/firebase/ios/HomeWidgetExtension.entitlements +10 -0
- package/templates/firebase/ios/NotificationService/Info.plist +31 -0
- package/templates/firebase/ios/NotificationService/NotificationService.swift +76 -0
- package/templates/firebase/ios/Podfile +111 -0
- package/templates/firebase/ios/Runner/AppDelegate.swift +75 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +1 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json +21 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
- package/templates/firebase/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
- package/templates/firebase/ios/Runner/Base.lproj/LaunchScreen.storyboard +44 -0
- package/templates/firebase/ios/Runner/Base.lproj/Main.storyboard +26 -0
- package/templates/firebase/ios/Runner/Info.plist +132 -0
- package/templates/firebase/ios/Runner/Runner-Bridging-Header.h +1 -0
- package/templates/firebase/ios/Runner/Runner.entitlements +14 -0
- package/templates/firebase/ios/Runner/es.lproj/InfoPlist.strings +10 -0
- package/templates/firebase/ios/Runner/pt-BR.lproj/InfoPlist.strings +10 -0
- package/templates/firebase/ios/Runner/pt.lproj/InfoPlist.strings +10 -0
- package/templates/firebase/ios/Runner.xcodeproj/project.pbxproj +1108 -0
- package/templates/firebase/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/templates/firebase/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/templates/firebase/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/templates/firebase/ios/Runner.xcodeproj/xcshareddata/xcschemes/NotificationService.xcscheme +58 -0
- package/templates/firebase/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +101 -0
- package/templates/firebase/ios/Runner.xcworkspace/contents.xcworkspacedata +10 -0
- package/templates/firebase/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/templates/firebase/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/templates/firebase/ios/RunnerTests/RunnerTests.swift +12 -0
- package/templates/firebase/lib/components/components.dart +27 -0
- package/templates/firebase/lib/components/kasy_accordion.dart +384 -0
- package/templates/firebase/lib/components/kasy_alert.dart +266 -0
- package/templates/firebase/lib/components/kasy_app_bar.dart +536 -0
- package/templates/firebase/lib/components/kasy_avatar.dart +549 -0
- package/templates/firebase/lib/components/kasy_avatar_presets.dart +104 -0
- package/templates/firebase/lib/components/kasy_badge.dart +278 -0
- package/templates/firebase/lib/components/kasy_bottom_sheet.dart +338 -0
- package/templates/firebase/lib/components/kasy_button.dart +926 -0
- package/templates/firebase/lib/components/kasy_card.dart +128 -0
- package/templates/firebase/lib/components/kasy_checkbox.dart +429 -0
- package/templates/firebase/lib/components/kasy_chip.dart +83 -0
- package/templates/firebase/lib/components/kasy_dialog.dart +789 -0
- package/templates/firebase/lib/components/kasy_otp_verification_bottom_sheet.dart +233 -0
- package/templates/firebase/lib/components/kasy_skeleton.dart +225 -0
- package/templates/firebase/lib/components/kasy_text_area.dart +392 -0
- package/templates/firebase/lib/components/kasy_text_field.dart +591 -0
- package/templates/firebase/lib/components/kasy_text_field_otp.dart +532 -0
- package/templates/firebase/lib/components/kasy_toast.dart +803 -0
- package/templates/firebase/lib/core/ads/ads_provider.dart +136 -0
- package/templates/firebase/lib/core/ads/ads_state.dart +15 -0
- package/templates/firebase/lib/core/animations/bottomfade_anim.dart +37 -0
- package/templates/firebase/lib/core/animations/movefade_anim.dart +34 -0
- package/templates/firebase/lib/core/animations/slideright_anim.dart +38 -0
- package/templates/firebase/lib/core/bottom_menu/bart_inner_paths.dart +5 -0
- package/templates/firebase/lib/core/bottom_menu/bottom_menu.dart +127 -0
- package/templates/firebase/lib/core/bottom_menu/bottom_router.dart +281 -0
- package/templates/firebase/lib/core/bottom_menu/kasy_bart_navigation.dart +22 -0
- package/templates/firebase/lib/core/bottom_menu/kasy_bottom_bar_factory.dart +127 -0
- package/templates/firebase/lib/core/bottom_menu/notification_bottom_item.dart +48 -0
- package/templates/firebase/lib/core/config/app_env.dart +100 -0
- package/templates/firebase/lib/core/config/features.dart +15 -0
- package/templates/firebase/lib/core/data/api/analytics_api.dart +124 -0
- package/templates/firebase/lib/core/data/api/base_api_exceptions.dart +28 -0
- package/templates/firebase/lib/core/data/api/firestore_retry.dart +29 -0
- package/templates/firebase/lib/core/data/api/http_client.dart +38 -0
- package/templates/firebase/lib/core/data/api/image.dart +52 -0
- package/templates/firebase/lib/core/data/api/remote_config_api.dart +170 -0
- package/templates/firebase/lib/core/data/api/storage_api.dart +115 -0
- package/templates/firebase/lib/core/data/api/tracking_api.dart +119 -0
- package/templates/firebase/lib/core/data/api/user_api.dart +115 -0
- package/templates/firebase/lib/core/data/entities/json_converters.dart +39 -0
- package/templates/firebase/lib/core/data/entities/upload_result.dart +48 -0
- package/templates/firebase/lib/core/data/entities/user_entity.dart +54 -0
- package/templates/firebase/lib/core/data/models/pageable.dart +12 -0
- package/templates/firebase/lib/core/data/models/subscription.dart +322 -0
- package/templates/firebase/lib/core/data/models/user.dart +107 -0
- package/templates/firebase/lib/core/data/repositories/user_repository.dart +130 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector.dart +464 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector_highlight.dart +88 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector_info.dart +70 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector_panel.dart +204 -0
- package/templates/firebase/lib/core/dev_inspector/dev_inspector_service.dart +321 -0
- package/templates/firebase/lib/core/extensions/date.ext.dart +32 -0
- package/templates/firebase/lib/core/guards/authenticated_guard.dart +37 -0
- package/templates/firebase/lib/core/guards/guard.dart +68 -0
- package/templates/firebase/lib/core/guards/user_info_guard.dart +55 -0
- package/templates/firebase/lib/core/haptics/haptic_feedback_notifier.dart +19 -0
- package/templates/firebase/lib/core/haptics/kasy_haptics.dart +27 -0
- package/templates/firebase/lib/core/home_widgets/home_widget_background_task.dart +41 -0
- package/templates/firebase/lib/core/home_widgets/home_widget_mywidget_service.dart +57 -0
- package/templates/firebase/lib/core/home_widgets/home_widget_service.dart +54 -0
- package/templates/firebase/lib/core/icons/kasy_icons.dart +86 -0
- package/templates/firebase/lib/core/initializer/models/run_state.dart +14 -0
- package/templates/firebase/lib/core/initializer/onstart_service.dart +38 -0
- package/templates/firebase/lib/core/initializer/onstart_widget.dart +83 -0
- package/templates/firebase/lib/core/initializer/pending_notification_handler.dart +48 -0
- package/templates/firebase/lib/core/keyboard_fix/keyboard_flicker_fix.dart +164 -0
- package/templates/firebase/lib/core/navigation/kasy_fade_page_transitions_builder.dart +34 -0
- package/templates/firebase/lib/core/navigation/kasy_material_page_route.dart +41 -0
- package/templates/firebase/lib/core/navigation/kasy_navigation_config.dart +29 -0
- package/templates/firebase/lib/core/navigation/kasy_page_transition.dart +40 -0
- package/templates/firebase/lib/core/navigation/kasy_route_transition.dart +68 -0
- package/templates/firebase/lib/core/navigation/kasy_transition_kind.dart +17 -0
- package/templates/firebase/lib/core/navigation/navigation.dart +6 -0
- package/templates/firebase/lib/core/rating/api/rating_api.dart +99 -0
- package/templates/firebase/lib/core/rating/models/rating.dart +52 -0
- package/templates/firebase/lib/core/rating/models/review.dart +70 -0
- package/templates/firebase/lib/core/rating/providers/rating_repository.dart +75 -0
- package/templates/firebase/lib/core/rating/widgets/rate_banner.dart +190 -0
- package/templates/firebase/lib/core/rating/widgets/rate_popup.dart +54 -0
- package/templates/firebase/lib/core/rating/widgets/review_popup.dart +175 -0
- package/templates/firebase/lib/core/security/biometric_copy_slot.dart +20 -0
- package/templates/firebase/lib/core/security/biometric_guard.dart +114 -0
- package/templates/firebase/lib/core/security/biometric_preference_notifier.dart +17 -0
- package/templates/firebase/lib/core/security/biometric_service.dart +79 -0
- package/templates/firebase/lib/core/security/biometric_ui_bundle.dart +136 -0
- package/templates/firebase/lib/core/security/secured_storage.dart +46 -0
- package/templates/firebase/lib/core/shared_preferences/shared_preferences.dart +70 -0
- package/templates/firebase/lib/core/sidebar/kasy_sidebar.dart +2021 -0
- package/templates/firebase/lib/core/states/components/maybe_ask_biometric_setup.dart +88 -0
- package/templates/firebase/lib/core/states/components/maybe_ask_rating.dart +49 -0
- package/templates/firebase/lib/core/states/components/maybe_show_update_bottom_sheet.dart +86 -0
- package/templates/firebase/lib/core/states/components/maybeshow_component.dart +110 -0
- package/templates/firebase/lib/core/states/events_dispatcher.dart +103 -0
- package/templates/firebase/lib/core/states/models/event_model.dart +118 -0
- package/templates/firebase/lib/core/states/models/user_state.dart +22 -0
- package/templates/firebase/lib/core/states/notifications_dispatcher.dart +81 -0
- package/templates/firebase/lib/core/states/translations.dart +11 -0
- package/templates/firebase/lib/core/states/user_state_notifier.dart +321 -0
- package/templates/firebase/lib/core/theme/colors.dart +262 -0
- package/templates/firebase/lib/core/theme/extensions/theme_extension.dart +48 -0
- package/templates/firebase/lib/core/theme/providers/kasy_theme.dart +76 -0
- package/templates/firebase/lib/core/theme/providers/theme_provider.dart +212 -0
- package/templates/firebase/lib/core/theme/radius.dart +33 -0
- package/templates/firebase/lib/core/theme/shadows.dart +64 -0
- package/templates/firebase/lib/core/theme/spacing.dart +44 -0
- package/templates/firebase/lib/core/theme/texts.dart +176 -0
- package/templates/firebase/lib/core/theme/theme.dart +24 -0
- package/templates/firebase/lib/core/theme/theme_data/theme_data.dart +32 -0
- package/templates/firebase/lib/core/theme/theme_data/theme_data_factory.dart +15 -0
- package/templates/firebase/lib/core/theme/universal_theme.dart +210 -0
- package/templates/firebase/lib/core/toast/toast_service.dart +55 -0
- package/templates/firebase/lib/core/ui/app_dialog.dart +26 -0
- package/templates/firebase/lib/core/web_device_preview/web_device_preview.dart +1126 -0
- package/templates/firebase/lib/core/widgets/debouncer.dart +31 -0
- package/templates/firebase/lib/core/widgets/kasy_hover.dart +166 -0
- package/templates/firebase/lib/core/widgets/kasy_pressable.dart +2 -0
- package/templates/firebase/lib/core/widgets/kasy_pressable_depth.dart +161 -0
- package/templates/firebase/lib/core/widgets/kasy_scroll_behavior.dart +17 -0
- package/templates/firebase/lib/core/widgets/keyboard_visibility.dart +75 -0
- package/templates/firebase/lib/core/widgets/page_background.dart +71 -0
- package/templates/firebase/lib/core/widgets/page_not_found.dart +15 -0
- package/templates/firebase/lib/core/widgets/responsive_layout.dart +215 -0
- package/templates/firebase/lib/core/widgets/update_bottom_sheet.dart +192 -0
- package/templates/firebase/lib/environnements.dart +160 -0
- package/templates/firebase/lib/features/authentication/api/authentication_api.dart +528 -0
- package/templates/firebase/lib/features/authentication/api/authentication_api_interface.dart +84 -0
- package/templates/firebase/lib/features/authentication/providers/models/email.dart +36 -0
- package/templates/firebase/lib/features/authentication/providers/models/password.dart +37 -0
- package/templates/firebase/lib/features/authentication/providers/models/phone_signin_state.dart +21 -0
- package/templates/firebase/lib/features/authentication/providers/models/recover_state.dart +21 -0
- package/templates/firebase/lib/features/authentication/providers/models/signin_state.dart +20 -0
- package/templates/firebase/lib/features/authentication/providers/models/signup_state.dart +20 -0
- package/templates/firebase/lib/features/authentication/providers/phone_auth_notifier.dart +132 -0
- package/templates/firebase/lib/features/authentication/providers/recover_provider.dart +51 -0
- package/templates/firebase/lib/features/authentication/providers/signin_state_provider.dart +166 -0
- package/templates/firebase/lib/features/authentication/providers/signup_state_provider.dart +67 -0
- package/templates/firebase/lib/features/authentication/repositories/authentication_repository.dart +399 -0
- package/templates/firebase/lib/features/authentication/repositories/exceptions/authentication_exceptions.dart +85 -0
- package/templates/firebase/lib/features/authentication/ui/components/apple_signin.dart +19 -0
- package/templates/firebase/lib/features/authentication/ui/components/facebook_signin.dart +19 -0
- package/templates/firebase/lib/features/authentication/ui/components/google_signin.dart +32 -0
- package/templates/firebase/lib/features/authentication/ui/components/otp_verification.dart +100 -0
- package/templates/firebase/lib/features/authentication/ui/components/phone_input.dart +109 -0
- package/templates/firebase/lib/features/authentication/ui/phone_auth_page.dart +60 -0
- package/templates/firebase/lib/features/authentication/ui/recover_password_page.dart +101 -0
- package/templates/firebase/lib/features/authentication/ui/signin_page.dart +321 -0
- package/templates/firebase/lib/features/authentication/ui/signup_page.dart +310 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/auth_brand.dart +35 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/auth_page_back_button.dart +149 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/otp_input.dart +194 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/recover_password_result.dart +62 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/round_signin.dart +73 -0
- package/templates/firebase/lib/features/authentication/ui/widgets/social_separator.dart +26 -0
- package/templates/firebase/lib/features/dev/keyboard_test_page.dart +93 -0
- package/templates/firebase/lib/features/feedbacks/api/entities/feature_request_entity.dart +27 -0
- package/templates/firebase/lib/features/feedbacks/api/entities/feature_vote_entity.dart +27 -0
- package/templates/firebase/lib/features/feedbacks/api/feature_request_api.dart +51 -0
- package/templates/firebase/lib/features/feedbacks/api/feature_vote_api.dart +79 -0
- package/templates/firebase/lib/features/feedbacks/models/feature_requests.dart +48 -0
- package/templates/firebase/lib/features/feedbacks/models/feedback_state.dart +43 -0
- package/templates/firebase/lib/features/feedbacks/providers/feedback_page_notifier.dart +147 -0
- package/templates/firebase/lib/features/feedbacks/repositories/feature_request_repository.dart +92 -0
- package/templates/firebase/lib/features/feedbacks/ui/component/add_feature_form.dart +112 -0
- package/templates/firebase/lib/features/feedbacks/ui/feedback_page.dart +184 -0
- package/templates/firebase/lib/features/feedbacks/ui/widgets/add_feature_button.dart +66 -0
- package/templates/firebase/lib/features/feedbacks/ui/widgets/feature_card.dart +266 -0
- package/templates/firebase/lib/features/home/design_system_page.dart +552 -0
- package/templates/firebase/lib/features/home/home_components_page.dart +314 -0
- package/templates/firebase/lib/features/home/home_components_preview_page.dart +791 -0
- package/templates/firebase/lib/features/home/home_components_preview_registry.dart +7712 -0
- package/templates/firebase/lib/features/home/home_features_page.dart +207 -0
- package/templates/firebase/lib/features/home/home_page.dart +348 -0
- package/templates/firebase/lib/features/llm_chat/api/llm_chat_api.dart +50 -0
- package/templates/firebase/lib/features/llm_chat/api/llm_chat_message_entity.dart +35 -0
- package/templates/firebase/lib/features/llm_chat/llm_chat_page.dart +352 -0
- package/templates/firebase/lib/features/llm_chat/providers/llm_chat_notifier.dart +315 -0
- package/templates/firebase/lib/features/llm_chat/ui/widgets/llm_chat_avatars.dart +148 -0
- package/templates/firebase/lib/features/llm_chat/ui/widgets/llm_chat_composer.dart +124 -0
- package/templates/firebase/lib/features/local_reminder/providers/reminder_notifier.dart +81 -0
- package/templates/firebase/lib/features/local_reminder/repositories/reminder_preferences.dart +76 -0
- package/templates/firebase/lib/features/local_reminder/ui/reminder_page.dart +288 -0
- package/templates/firebase/lib/features/notifications/api/device_api.dart +433 -0
- package/templates/firebase/lib/features/notifications/api/entities/device_entity.dart +62 -0
- package/templates/firebase/lib/features/notifications/api/entities/notifications_entity.dart +35 -0
- package/templates/firebase/lib/features/notifications/api/local_notifier.dart +409 -0
- package/templates/firebase/lib/features/notifications/api/notifications_api.dart +319 -0
- package/templates/firebase/lib/features/notifications/providers/models/device.dart +27 -0
- package/templates/firebase/lib/features/notifications/providers/models/notification.dart +196 -0
- package/templates/firebase/lib/features/notifications/providers/models/notification_list.dart +38 -0
- package/templates/firebase/lib/features/notifications/providers/notifications_provider.dart +120 -0
- package/templates/firebase/lib/features/notifications/repositories/background_notification_handler.dart +13 -0
- package/templates/firebase/lib/features/notifications/repositories/device_repository.dart +137 -0
- package/templates/firebase/lib/features/notifications/repositories/notifications_repository.dart +214 -0
- package/templates/firebase/lib/features/notifications/shared/att_permission.dart +75 -0
- package/templates/firebase/lib/features/notifications/shared/notification_permission_bottom_sheet.dart +144 -0
- package/templates/firebase/lib/features/notifications/ui/components/notification_settings_sheet.dart +169 -0
- package/templates/firebase/lib/features/notifications/ui/components/notification_tile.dart +46 -0
- package/templates/firebase/lib/features/notifications/ui/components/notifications_header.dart +32 -0
- package/templates/firebase/lib/features/notifications/ui/components/push_notification_switcher.dart +106 -0
- package/templates/firebase/lib/features/notifications/ui/notifications_page.dart +202 -0
- package/templates/firebase/lib/features/notifications/ui/request_notification_permission.dart +84 -0
- package/templates/firebase/lib/features/notifications/ui/widgets/empty_notifications.dart +73 -0
- package/templates/firebase/lib/features/notifications/ui/widgets/notification_tile.dart +362 -0
- package/templates/firebase/lib/features/onboarding/api/entities/user_info_entity.dart +24 -0
- package/templates/firebase/lib/features/onboarding/api/user_infos_api.dart +71 -0
- package/templates/firebase/lib/features/onboarding/models/user_info.dart +92 -0
- package/templates/firebase/lib/features/onboarding/providers/onboarding_model.dart +15 -0
- package/templates/firebase/lib/features/onboarding/providers/onboarding_provider.dart +78 -0
- package/templates/firebase/lib/features/onboarding/repositories/user_infos_repository.dart +29 -0
- package/templates/firebase/lib/features/onboarding/ui/animations/page_transitions.dart +33 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_att_setup.dart +66 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_features.dart +76 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_loader.dart +92 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_notifications_setup.dart +76 -0
- package/templates/firebase/lib/features/onboarding/ui/components/onboarding_questions.dart +89 -0
- package/templates/firebase/lib/features/onboarding/ui/onboarding_page.dart +108 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_background.dart +80 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_feature.dart +145 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_illustration_scaffold.dart +125 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_progress.dart +84 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_radio_question.dart +173 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_reassurance.dart +44 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/onboarding_sticky_footer.dart +77 -0
- package/templates/firebase/lib/features/onboarding/ui/widgets/selectable_row_tile.dart +392 -0
- package/templates/firebase/lib/features/settings/settings_page.dart +460 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/admin_bottom_sheet.dart +301 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/admin_home_widgets.dart +38 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/admin_paywalls.dart +53 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/admin_routes.dart +22 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/send_push_notification_page.dart +366 -0
- package/templates/firebase/lib/features/settings/ui/components/admin/send_push_notifier.dart +40 -0
- package/templates/firebase/lib/features/settings/ui/components/avatar_component.dart +430 -0
- package/templates/firebase/lib/features/settings/ui/components/delete_user_component.dart +28 -0
- package/templates/firebase/lib/features/settings/ui/components/language_switcher.dart +163 -0
- package/templates/firebase/lib/features/settings/ui/widgets/admin_card.dart +59 -0
- package/templates/firebase/lib/features/settings/ui/widgets/avatar_utils.dart +51 -0
- package/templates/firebase/lib/features/settings/ui/widgets/round_progress.dart +151 -0
- package/templates/firebase/lib/features/settings/ui/widgets/settings_bottom_sheet_option_tile.dart +52 -0
- package/templates/firebase/lib/features/settings/ui/widgets/settings_tile.dart +163 -0
- package/templates/firebase/lib/features/subscription/api/entities/subscription_entity.dart +40 -0
- package/templates/firebase/lib/features/subscription/api/inapp_subscription_api.dart +389 -0
- package/templates/firebase/lib/features/subscription/api/subscription_api.dart +39 -0
- package/templates/firebase/lib/features/subscription/providers/models/premium_state.dart +35 -0
- package/templates/firebase/lib/features/subscription/providers/premium_page_provider.dart +259 -0
- package/templates/firebase/lib/features/subscription/repositories/subscription_repository.dart +177 -0
- package/templates/firebase/lib/features/subscription/shared/maybeshow_premium.dart +85 -0
- package/templates/firebase/lib/features/subscription/ui/component/active_premium_content.dart +171 -0
- package/templates/firebase/lib/features/subscription/ui/component/paywall_minimal.dart +146 -0
- package/templates/firebase/lib/features/subscription/ui/component/paywall_row.dart +332 -0
- package/templates/firebase/lib/features/subscription/ui/component/paywall_with_switch.dart +207 -0
- package/templates/firebase/lib/features/subscription/ui/component/premium_content.dart +157 -0
- package/templates/firebase/lib/features/subscription/ui/component/premium_page_factory.dart +161 -0
- package/templates/firebase/lib/features/subscription/ui/premium_page.dart +139 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/comparison_table.dart +346 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/feature_line.dart +131 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/paywall_empty_state.dart +68 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_background.dart +63 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_background_gradient.dart +53 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_banner.dart +80 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_bottom_menu.dart +102 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_card.dart +26 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_close_button.dart +61 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/premium_feature.dart +39 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/selectable_col.dart +377 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/selectable_row.dart +436 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/trial_switcher.dart +85 -0
- package/templates/firebase/lib/features/subscription/ui/widgets/unsubscribe_feedback_popup.dart +123 -0
- package/templates/firebase/lib/firebase_options.dart +75 -0
- package/templates/firebase/lib/google_auth_options.dart +10 -0
- package/templates/firebase/lib/i18n/app_locale_display.dart +17 -0
- package/templates/firebase/lib/i18n/en.i18n.json +514 -0
- package/templates/firebase/lib/i18n/es.i18n.json +514 -0
- package/templates/firebase/lib/i18n/pt.i18n.json +514 -0
- package/templates/firebase/lib/i18n/widgets/locale_code_badge.dart +47 -0
- package/templates/firebase/lib/main.dart +263 -0
- package/templates/firebase/lib/router.dart +226 -0
- package/templates/firebase/login-redesign-preview.png +0 -0
- package/templates/firebase/pubspec.yaml +177 -0
- package/templates/firebase/scripts/bump-ios-version.js +38 -0
- package/templates/firebase/scripts/release-ios.sh +137 -0
- package/templates/firebase/slang.yaml +7 -0
- package/templates/firebase/storage.rules +12 -0
- package/templates/firebase/test/core/data/api/analytics_api_fake.dart +25 -0
- package/templates/firebase/test/core/data/api/fake_remote_config_api.dart +45 -0
- package/templates/firebase/test/core/data/api/storage_api_fake.dart +28 -0
- package/templates/firebase/test/core/data/models/subscription_test.dart +42 -0
- package/templates/firebase/test/core/data/repositories/user_repository_test.dart +56 -0
- package/templates/firebase/test/core/guards/guard_test.dart +78 -0
- package/templates/firebase/test/core/navigation/kasy_page_transition_test.dart +30 -0
- package/templates/firebase/test/core/onstart_service_test.dart +18 -0
- package/templates/firebase/test/core/rating/rating_api_fake.dart +58 -0
- package/templates/firebase/test/core/rating/rating_banner_test.dart +117 -0
- package/templates/firebase/test/core/rating/rating_test.dart +60 -0
- package/templates/firebase/test/core/security/secured_storage_fake.dart +33 -0
- package/templates/firebase/test/core/states/event_dispatcher_test.dart +269 -0
- package/templates/firebase/test/core/states/user_state_notifier_test.dart +244 -0
- package/templates/firebase/test/core/widgets/responsive_layout_test.dart +50 -0
- package/templates/firebase/test/device_test_utils.dart +98 -0
- package/templates/firebase/test/features/authentication/data/api/auth_api_fake.dart +169 -0
- package/templates/firebase/test/features/authentication/data/api/user_api_fake.dart +86 -0
- package/templates/firebase/test/features/authentication/lost_password_page_test.dart +59 -0
- package/templates/firebase/test/features/authentication/repositories/authentication_repository_test.dart +88 -0
- package/templates/firebase/test/features/authentication/signin_page_test.dart +133 -0
- package/templates/firebase/test/features/authentication/signup_page_test.dart +136 -0
- package/templates/firebase/test/features/notifications/data/device_api_fake.dart +66 -0
- package/templates/firebase/test/features/notifications/data/fake_facebook_api.dart +40 -0
- package/templates/firebase/test/features/notifications/data/local_notifier_fake.dart +59 -0
- package/templates/firebase/test/features/notifications/data/notifications_api_fake.dart +120 -0
- package/templates/firebase/test/features/notifications/data/notifications_settings_fake.dart +34 -0
- package/templates/firebase/test/features/notifications/providers/device_repository_test.dart +68 -0
- package/templates/firebase/test/features/notifications/providers/notifications_repository_test.dart +74 -0
- package/templates/firebase/test/features/notifications/ui/notifications_page_test.dart +69 -0
- package/templates/firebase/test/features/subscription/api/fake_inapp_subscription_api.dart +85 -0
- package/templates/firebase/test/features/subscription/api/fake_revenuecat_product.dart +186 -0
- package/templates/firebase/test/features/subscription/api/fake_subscription_api.dart +11 -0
- package/templates/firebase/test/features/subscription/subscription_page_test.dart +119 -0
- package/templates/firebase/test/firebase_test_utils.dart +25 -0
- package/templates/firebase/test/test_utils.dart +272 -0
- package/templates/firebase/web/favicon.png +0 -0
- package/templates/firebase/web/firebase-messaging-sw.js +27 -0
- package/templates/firebase/web/icons/Icon-192.png +0 -0
- package/templates/firebase/web/icons/Icon-512.png +0 -0
- package/templates/firebase/web/icons/Icon-maskable-192.png +0 -0
- package/templates/firebase/web/icons/Icon-maskable-512.png +0 -0
- package/templates/firebase/web/index.html +110 -0
- package/templates/firebase/web/local_notifications.js +31 -0
- package/templates/firebase/web/manifest.json +35 -0
- package/templates/firebase/web/splash/img/dark-1x.png +0 -0
- package/templates/firebase/web/splash/img/dark-2x.png +0 -0
- package/templates/firebase/web/splash/img/dark-3x.png +0 -0
- package/templates/firebase/web/splash/img/dark-4x.png +0 -0
- package/templates/firebase/web/splash/img/light-1x.png +0 -0
- package/templates/firebase/web/splash/img/light-2x.png +0 -0
- package/templates/firebase/web/splash/img/light-3x.png +0 -0
- package/templates/firebase/web/splash/img/light-4x.png +0 -0
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
import 'dart:async';
|
|
2
|
+
|
|
3
|
+
import 'package:flutter/material.dart';
|
|
4
|
+
import 'package:kasy_kit/components/kasy_button.dart';
|
|
5
|
+
import 'package:kasy_kit/core/theme/theme.dart';
|
|
6
|
+
import 'package:universal_io/io.dart';
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Public types
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/// Semantic tone of a [KasyToast].
|
|
13
|
+
enum KasyToastTone { neutral, accent, success, warning, danger }
|
|
14
|
+
|
|
15
|
+
/// Where the toast stack appears on screen.
|
|
16
|
+
enum KasyToastPlacement { top, bottom }
|
|
17
|
+
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// KasyToast — visual widget (card)
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
/// The toast card widget. Can be embedded statically for previews;
|
|
23
|
+
/// for live use call [showKasyToast].
|
|
24
|
+
class KasyToast extends StatelessWidget {
|
|
25
|
+
const KasyToast({
|
|
26
|
+
super.key,
|
|
27
|
+
required this.title,
|
|
28
|
+
this.message,
|
|
29
|
+
this.tone = KasyToastTone.neutral,
|
|
30
|
+
this.icon,
|
|
31
|
+
this.onClose,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
final String title;
|
|
35
|
+
final String? message;
|
|
36
|
+
final KasyToastTone tone;
|
|
37
|
+
|
|
38
|
+
/// Custom leading widget (e.g. an app logo). Falls back to the tone's
|
|
39
|
+
/// default icon when null.
|
|
40
|
+
final Widget? icon;
|
|
41
|
+
|
|
42
|
+
final VoidCallback? onClose;
|
|
43
|
+
|
|
44
|
+
@override
|
|
45
|
+
Widget build(BuildContext context) {
|
|
46
|
+
final KasyColors c = context.colors;
|
|
47
|
+
final bool isDark = context.isDark;
|
|
48
|
+
final _Palette pal = _palette(c, tone);
|
|
49
|
+
|
|
50
|
+
return DecoratedBox(
|
|
51
|
+
decoration: BoxDecoration(
|
|
52
|
+
color: c.surface,
|
|
53
|
+
borderRadius: KasyRadius.lgBorderRadius,
|
|
54
|
+
border: Border.all(
|
|
55
|
+
color: c.outline.withValues(alpha: isDark ? 0.22 : 0.28),
|
|
56
|
+
),
|
|
57
|
+
boxShadow: [
|
|
58
|
+
BoxShadow(
|
|
59
|
+
color: Colors.black.withValues(alpha: isDark ? 0.12 : 0.04),
|
|
60
|
+
blurRadius: 10,
|
|
61
|
+
offset: const Offset(0, 4),
|
|
62
|
+
),
|
|
63
|
+
],
|
|
64
|
+
),
|
|
65
|
+
child: Padding(
|
|
66
|
+
padding: const EdgeInsets.symmetric(
|
|
67
|
+
horizontal: KasySpacing.md,
|
|
68
|
+
vertical: 14,
|
|
69
|
+
),
|
|
70
|
+
child: Row(
|
|
71
|
+
crossAxisAlignment: CrossAxisAlignment.start,
|
|
72
|
+
children: [
|
|
73
|
+
Padding(
|
|
74
|
+
padding: const EdgeInsets.only(top: 2),
|
|
75
|
+
child: icon ?? Icon(pal.icon, size: 24, color: pal.accent),
|
|
76
|
+
),
|
|
77
|
+
const SizedBox(width: KasySpacing.smd),
|
|
78
|
+
Expanded(
|
|
79
|
+
child: Column(
|
|
80
|
+
crossAxisAlignment: CrossAxisAlignment.start,
|
|
81
|
+
mainAxisSize: MainAxisSize.min,
|
|
82
|
+
children: [
|
|
83
|
+
Text(
|
|
84
|
+
title,
|
|
85
|
+
style: context.textTheme.titleMedium?.copyWith(
|
|
86
|
+
color: pal.accent,
|
|
87
|
+
fontWeight: FontWeight.w700,
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
if (message != null) ...[
|
|
91
|
+
const SizedBox(height: 4),
|
|
92
|
+
Text(
|
|
93
|
+
message!,
|
|
94
|
+
style: context.textTheme.bodyMedium?.copyWith(
|
|
95
|
+
// Slightly darker than muted in light, slightly lighter in dark.
|
|
96
|
+
color: Color.lerp(
|
|
97
|
+
c.muted,
|
|
98
|
+
isDark ? Colors.white : Colors.black,
|
|
99
|
+
0.18,
|
|
100
|
+
),
|
|
101
|
+
),
|
|
102
|
+
),
|
|
103
|
+
],
|
|
104
|
+
],
|
|
105
|
+
),
|
|
106
|
+
),
|
|
107
|
+
const SizedBox(width: KasySpacing.smd),
|
|
108
|
+
Padding(
|
|
109
|
+
padding: const EdgeInsets.only(top: 1),
|
|
110
|
+
child: KasyButton(
|
|
111
|
+
label: 'Close',
|
|
112
|
+
size: KasyButtonSize.small,
|
|
113
|
+
backgroundColor: pal.buttonBg,
|
|
114
|
+
foregroundColor: pal.buttonFg,
|
|
115
|
+
onPressed: onClose,
|
|
116
|
+
),
|
|
117
|
+
),
|
|
118
|
+
],
|
|
119
|
+
),
|
|
120
|
+
),
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// ---------------------------------------------------------------------------
|
|
126
|
+
// Public API
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
|
|
129
|
+
/// Shows a toast at the top or bottom of the screen and returns a callback to
|
|
130
|
+
/// dismiss it early. Toasts stack when called multiple times.
|
|
131
|
+
///
|
|
132
|
+
/// ```dart
|
|
133
|
+
/// showKasyToast(context,
|
|
134
|
+
/// title: 'Upload complete',
|
|
135
|
+
/// message: 'Your file has been saved.',
|
|
136
|
+
/// tone: KasyToastTone.success,
|
|
137
|
+
/// placement: KasyToastPlacement.bottom,
|
|
138
|
+
/// );
|
|
139
|
+
/// ```
|
|
140
|
+
VoidCallback showKasyToast(
|
|
141
|
+
BuildContext context, {
|
|
142
|
+
required String title,
|
|
143
|
+
String? message,
|
|
144
|
+
KasyToastTone tone = KasyToastTone.neutral,
|
|
145
|
+
|
|
146
|
+
/// Custom leading widget — falls back to the tone's icon when null.
|
|
147
|
+
Widget? icon,
|
|
148
|
+
Duration duration = const Duration(seconds: 4),
|
|
149
|
+
|
|
150
|
+
/// When true the toast persists until dismissed manually.
|
|
151
|
+
bool persistent = false,
|
|
152
|
+
VoidCallback? onClose,
|
|
153
|
+
KasyToastPlacement placement = KasyToastPlacement.top,
|
|
154
|
+
}) {
|
|
155
|
+
if (Platform.environment.containsKey('FLUTTER_TEST')) return () {};
|
|
156
|
+
return _KasyToastManager.instance.show(
|
|
157
|
+
context,
|
|
158
|
+
_ToastData(
|
|
159
|
+
title: title,
|
|
160
|
+
message: message,
|
|
161
|
+
tone: tone,
|
|
162
|
+
icon: icon,
|
|
163
|
+
duration: duration,
|
|
164
|
+
persistent: persistent,
|
|
165
|
+
onClose: onClose,
|
|
166
|
+
placement: placement,
|
|
167
|
+
),
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/// Immediately dismisses every visible toast.
|
|
172
|
+
void hideAllKasyToasts() => _KasyToastManager.instance.hideAll();
|
|
173
|
+
|
|
174
|
+
/// Shows a fully custom toast built by [builder]. Returns a callback to
|
|
175
|
+
/// dismiss it early.
|
|
176
|
+
///
|
|
177
|
+
/// ```dart
|
|
178
|
+
/// showKasyToastWidget(context,
|
|
179
|
+
/// builder: (dismiss) => MyCustomToastCard(onClose: dismiss),
|
|
180
|
+
/// );
|
|
181
|
+
/// ```
|
|
182
|
+
VoidCallback showKasyToastWidget(
|
|
183
|
+
BuildContext context, {
|
|
184
|
+
required Widget Function(VoidCallback dismiss) builder,
|
|
185
|
+
Duration duration = const Duration(seconds: 4),
|
|
186
|
+
bool persistent = false,
|
|
187
|
+
VoidCallback? onClose,
|
|
188
|
+
KasyToastPlacement placement = KasyToastPlacement.top,
|
|
189
|
+
}) {
|
|
190
|
+
if (Platform.environment.containsKey('FLUTTER_TEST')) return () {};
|
|
191
|
+
return _KasyToastManager.instance.show(
|
|
192
|
+
context,
|
|
193
|
+
_ToastData(
|
|
194
|
+
title: '',
|
|
195
|
+
duration: duration,
|
|
196
|
+
persistent: persistent,
|
|
197
|
+
onClose: onClose,
|
|
198
|
+
placement: placement,
|
|
199
|
+
customBuilder: builder,
|
|
200
|
+
),
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
// Internal data class
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
|
|
208
|
+
class _ToastData {
|
|
209
|
+
const _ToastData({
|
|
210
|
+
required this.title,
|
|
211
|
+
this.message,
|
|
212
|
+
this.tone = KasyToastTone.neutral,
|
|
213
|
+
this.icon,
|
|
214
|
+
this.duration = const Duration(seconds: 4),
|
|
215
|
+
this.persistent = false,
|
|
216
|
+
this.onClose,
|
|
217
|
+
this.placement = KasyToastPlacement.top,
|
|
218
|
+
this.customBuilder,
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
final String title;
|
|
222
|
+
final String? message;
|
|
223
|
+
final KasyToastTone tone;
|
|
224
|
+
final Widget? icon;
|
|
225
|
+
final Duration duration;
|
|
226
|
+
final bool persistent;
|
|
227
|
+
final VoidCallback? onClose;
|
|
228
|
+
final KasyToastPlacement placement;
|
|
229
|
+
|
|
230
|
+
/// When set, renders this widget instead of [KasyToast]. The callback
|
|
231
|
+
/// passed to the builder dismisses the toast when called.
|
|
232
|
+
final Widget Function(VoidCallback dismiss)? customBuilder;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// ---------------------------------------------------------------------------
|
|
236
|
+
// Singleton manager
|
|
237
|
+
// ---------------------------------------------------------------------------
|
|
238
|
+
|
|
239
|
+
class _KasyToastManager {
|
|
240
|
+
_KasyToastManager._();
|
|
241
|
+
static final _KasyToastManager instance = _KasyToastManager._();
|
|
242
|
+
|
|
243
|
+
final Map<KasyToastPlacement, OverlayEntry?> _entries = {
|
|
244
|
+
KasyToastPlacement.top: null,
|
|
245
|
+
KasyToastPlacement.bottom: null,
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
final Map<KasyToastPlacement, _KasyToastLayerState?> _layers = {
|
|
249
|
+
KasyToastPlacement.top: null,
|
|
250
|
+
KasyToastPlacement.bottom: null,
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
final Map<KasyToastPlacement, List<_ToastData>> _pending = {
|
|
254
|
+
KasyToastPlacement.top: [],
|
|
255
|
+
KasyToastPlacement.bottom: [],
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
VoidCallback show(BuildContext ctx, _ToastData data) {
|
|
259
|
+
final p = data.placement;
|
|
260
|
+
if (_entries[p] == null) {
|
|
261
|
+
_entries[p] = OverlayEntry(
|
|
262
|
+
builder: (_) => _KasyToastLayer(placement: p),
|
|
263
|
+
);
|
|
264
|
+
_overlayFor(ctx)?.insert(_entries[p]!);
|
|
265
|
+
_pending[p]!.add(data);
|
|
266
|
+
// Capture dismiss callbacks once the layer is mounted next frame.
|
|
267
|
+
VoidCallback? storedDismiss;
|
|
268
|
+
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
269
|
+
for (final d in _pending[p]!) {
|
|
270
|
+
final cb = _layers[p]?.addToast(d);
|
|
271
|
+
if (d == data) storedDismiss = cb;
|
|
272
|
+
}
|
|
273
|
+
_pending[p]!.clear();
|
|
274
|
+
});
|
|
275
|
+
// Delegate: after the next frame storedDismiss will be populated.
|
|
276
|
+
return () => storedDismiss?.call();
|
|
277
|
+
}
|
|
278
|
+
return _layers[p]?.addToast(data) ?? () {};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
void hideAll() {
|
|
282
|
+
for (final p in KasyToastPlacement.values) {
|
|
283
|
+
_layers[p]?.hideAll();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
void _onLayerEmpty(KasyToastPlacement p) {
|
|
288
|
+
_entries[p]?.remove();
|
|
289
|
+
_entries[p] = null;
|
|
290
|
+
_layers[p] = null;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
OverlayState? _overlayFor(BuildContext ctx) {
|
|
294
|
+
try {
|
|
295
|
+
return Navigator.of(ctx, rootNavigator: true).overlay;
|
|
296
|
+
} catch (_) {
|
|
297
|
+
return Overlay.maybeOf(ctx);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// ---------------------------------------------------------------------------
|
|
303
|
+
// Overlay layer (manages active toasts + animations)
|
|
304
|
+
// ---------------------------------------------------------------------------
|
|
305
|
+
|
|
306
|
+
class _KasyToastLayer extends StatefulWidget {
|
|
307
|
+
const _KasyToastLayer({required this.placement});
|
|
308
|
+
|
|
309
|
+
final KasyToastPlacement placement;
|
|
310
|
+
|
|
311
|
+
@override
|
|
312
|
+
State<_KasyToastLayer> createState() => _KasyToastLayerState();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
class _ToastItem {
|
|
316
|
+
_ToastItem({required this.data, required this.controller});
|
|
317
|
+
final _ToastData data;
|
|
318
|
+
final AnimationController controller;
|
|
319
|
+
|
|
320
|
+
Timer? _timer;
|
|
321
|
+
Duration _remaining = Duration.zero;
|
|
322
|
+
final Stopwatch _watch = Stopwatch();
|
|
323
|
+
VoidCallback? _onExpire;
|
|
324
|
+
|
|
325
|
+
void scheduleTimer(VoidCallback onExpire) {
|
|
326
|
+
if (data.persistent) return;
|
|
327
|
+
_onExpire = onExpire;
|
|
328
|
+
_remaining = data.duration;
|
|
329
|
+
_watch.start();
|
|
330
|
+
_timer = Timer(data.duration, onExpire);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/// Pauses the auto-dismiss timer (hover / press hold).
|
|
334
|
+
void pause() {
|
|
335
|
+
if (_timer == null) return;
|
|
336
|
+
_timer!.cancel();
|
|
337
|
+
_timer = null;
|
|
338
|
+
_watch.stop();
|
|
339
|
+
final Duration left = _remaining - _watch.elapsed;
|
|
340
|
+
_remaining = left < Duration.zero ? Duration.zero : left;
|
|
341
|
+
_watch.reset();
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/// Resumes from where it left off.
|
|
345
|
+
void resume() {
|
|
346
|
+
if (_onExpire == null || _timer != null) return;
|
|
347
|
+
if (_remaining <= Duration.zero) {
|
|
348
|
+
_onExpire!();
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
_watch.start();
|
|
352
|
+
_timer = Timer(_remaining, _onExpire!);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
void cancelTimer() {
|
|
356
|
+
_timer?.cancel();
|
|
357
|
+
_timer = null;
|
|
358
|
+
_watch.stop();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
class _KasyToastLayerState extends State<_KasyToastLayer>
|
|
363
|
+
with TickerProviderStateMixin {
|
|
364
|
+
final List<_ToastItem> _items = [];
|
|
365
|
+
final Map<_ToastItem, GlobalKey> _keys = {};
|
|
366
|
+
final Map<_ToastItem, double> _heights = {};
|
|
367
|
+
|
|
368
|
+
static const int _maxVisible = 3;
|
|
369
|
+
static const double _peekOffset = 8.0;
|
|
370
|
+
|
|
371
|
+
@override
|
|
372
|
+
void initState() {
|
|
373
|
+
super.initState();
|
|
374
|
+
_KasyToastManager.instance._layers[widget.placement] = this;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
@override
|
|
378
|
+
void dispose() {
|
|
379
|
+
_KasyToastManager.instance._layers[widget.placement] = null;
|
|
380
|
+
for (final item in _items) {
|
|
381
|
+
item.cancelTimer();
|
|
382
|
+
item.controller.dispose();
|
|
383
|
+
}
|
|
384
|
+
super.dispose();
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
GlobalKey _keyFor(_ToastItem item) =>
|
|
388
|
+
_keys.putIfAbsent(item, () => GlobalKey());
|
|
389
|
+
|
|
390
|
+
void _measureHeights() {
|
|
391
|
+
bool changed = false;
|
|
392
|
+
for (final entry in _keys.entries) {
|
|
393
|
+
final box =
|
|
394
|
+
entry.value.currentContext?.findRenderObject() as RenderBox?;
|
|
395
|
+
if (box == null || !box.hasSize) continue;
|
|
396
|
+
final h = box.size.height;
|
|
397
|
+
if (_heights[entry.key] != h) {
|
|
398
|
+
_heights[entry.key] = h;
|
|
399
|
+
changed = true;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (changed && mounted) setState(() {});
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
VoidCallback addToast(_ToastData data) {
|
|
406
|
+
final ctrl = AnimationController(
|
|
407
|
+
vsync: this,
|
|
408
|
+
duration: const Duration(milliseconds: 380),
|
|
409
|
+
reverseDuration: const Duration(milliseconds: 260),
|
|
410
|
+
);
|
|
411
|
+
final item = _ToastItem(data: data, controller: ctrl);
|
|
412
|
+
if (mounted) {
|
|
413
|
+
setState(() {
|
|
414
|
+
if (_items.length >= 10) {
|
|
415
|
+
_dismiss(_items.last);
|
|
416
|
+
}
|
|
417
|
+
_items.insert(0, item);
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
ctrl.forward();
|
|
421
|
+
item.scheduleTimer(() => _dismiss(item));
|
|
422
|
+
return () => _dismiss(item);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
void _dismiss(_ToastItem item) {
|
|
426
|
+
if (!mounted || !_items.contains(item)) return;
|
|
427
|
+
item.cancelTimer();
|
|
428
|
+
item.controller.reverse().then((_) {
|
|
429
|
+
if (!mounted) return;
|
|
430
|
+
setState(() {
|
|
431
|
+
_items.remove(item);
|
|
432
|
+
_keys.remove(item);
|
|
433
|
+
_heights.remove(item);
|
|
434
|
+
});
|
|
435
|
+
item.controller.dispose();
|
|
436
|
+
if (_items.isEmpty) {
|
|
437
|
+
_KasyToastManager.instance._onLayerEmpty(widget.placement);
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
void hideAll() {
|
|
443
|
+
for (final item in List.of(_items)) {
|
|
444
|
+
_dismiss(item);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
@override
|
|
449
|
+
Widget build(BuildContext context) {
|
|
450
|
+
if (_items.isEmpty) return const SizedBox.shrink();
|
|
451
|
+
|
|
452
|
+
final bool isTop = widget.placement == KasyToastPlacement.top;
|
|
453
|
+
|
|
454
|
+
// Mede alturas todo frame para manter o posicionamento do stack correto.
|
|
455
|
+
WidgetsBinding.instance.addPostFrameCallback((_) => _measureHeights());
|
|
456
|
+
|
|
457
|
+
return Positioned(
|
|
458
|
+
top: isTop ? 0 : null,
|
|
459
|
+
bottom: isTop ? null : 0,
|
|
460
|
+
left: 0,
|
|
461
|
+
right: 0,
|
|
462
|
+
child: SafeArea(
|
|
463
|
+
top: isTop,
|
|
464
|
+
bottom: !isTop,
|
|
465
|
+
child: Padding(
|
|
466
|
+
padding: EdgeInsets.only(
|
|
467
|
+
top: isTop ? KasySpacing.sm : 0,
|
|
468
|
+
bottom: isTop ? 0 : KasySpacing.sm,
|
|
469
|
+
),
|
|
470
|
+
child: Center(
|
|
471
|
+
child: ConstrainedBox(
|
|
472
|
+
constraints: const BoxConstraints(maxWidth: 480),
|
|
473
|
+
child: Padding(
|
|
474
|
+
padding: const EdgeInsets.symmetric(
|
|
475
|
+
horizontal: KasySpacing.md,
|
|
476
|
+
),
|
|
477
|
+
child: _items.length == 1
|
|
478
|
+
? _AnimatedToast(
|
|
479
|
+
key: _keyFor(_items[0]),
|
|
480
|
+
item: _items[0],
|
|
481
|
+
onClose: () => _dismiss(_items[0]),
|
|
482
|
+
swipeable: true,
|
|
483
|
+
)
|
|
484
|
+
: _buildStack(isTop),
|
|
485
|
+
),
|
|
486
|
+
),
|
|
487
|
+
),
|
|
488
|
+
),
|
|
489
|
+
),
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
Widget _buildStack(bool isTop) {
|
|
494
|
+
final visible = _items.sublist(0, _maxVisible.clamp(0, _items.length));
|
|
495
|
+
final renderOrder = visible.reversed.toList();
|
|
496
|
+
final double? frontHeight = _heights[visible[0]];
|
|
497
|
+
|
|
498
|
+
return Stack(
|
|
499
|
+
clipBehavior: Clip.none,
|
|
500
|
+
children: renderOrder.map((item) {
|
|
501
|
+
final int fromFront = visible.indexOf(item);
|
|
502
|
+
final bool isFront = fromFront == 0;
|
|
503
|
+
|
|
504
|
+
// Para top: usa altura medida para que o peek seja sempre _peekOffset px.
|
|
505
|
+
// Para bottom: offset negativo fixo já garante peek consistente.
|
|
506
|
+
double yOffset;
|
|
507
|
+
if (isTop && frontHeight != null) {
|
|
508
|
+
final double cardH = _heights[item] ?? frontHeight;
|
|
509
|
+
yOffset = frontHeight + fromFront * _peekOffset - cardH;
|
|
510
|
+
} else {
|
|
511
|
+
yOffset = fromFront * _peekOffset * (isTop ? 1.0 : -1.0);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
Widget child = _AnimatedToast(
|
|
515
|
+
key: _keyFor(item),
|
|
516
|
+
item: item,
|
|
517
|
+
onClose: () => _dismiss(item),
|
|
518
|
+
swipeable: isFront,
|
|
519
|
+
);
|
|
520
|
+
|
|
521
|
+
child = Transform.translate(
|
|
522
|
+
offset: Offset(0, yOffset),
|
|
523
|
+
child: Transform.scale(
|
|
524
|
+
scaleX: (1.0 - fromFront * 0.05).clamp(0.0, 1.0),
|
|
525
|
+
alignment: Alignment.topCenter,
|
|
526
|
+
child: Opacity(
|
|
527
|
+
opacity: (1.0 - fromFront * 0.12).clamp(0.0, 1.0),
|
|
528
|
+
child: child,
|
|
529
|
+
),
|
|
530
|
+
),
|
|
531
|
+
);
|
|
532
|
+
|
|
533
|
+
return isFront ? child : IgnorePointer(child: child);
|
|
534
|
+
}).toList(),
|
|
535
|
+
);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
// ---------------------------------------------------------------------------
|
|
541
|
+
// Animated wrapper per toast
|
|
542
|
+
// ---------------------------------------------------------------------------
|
|
543
|
+
|
|
544
|
+
class _AnimatedToast extends StatefulWidget {
|
|
545
|
+
const _AnimatedToast({
|
|
546
|
+
super.key,
|
|
547
|
+
required this.item,
|
|
548
|
+
required this.onClose,
|
|
549
|
+
this.swipeable = false,
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
final _ToastItem item;
|
|
553
|
+
final VoidCallback onClose;
|
|
554
|
+
final bool swipeable;
|
|
555
|
+
|
|
556
|
+
@override
|
|
557
|
+
State<_AnimatedToast> createState() => _AnimatedToastState();
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
class _AnimatedToastState extends State<_AnimatedToast>
|
|
561
|
+
with SingleTickerProviderStateMixin {
|
|
562
|
+
double _dragOffset = 0;
|
|
563
|
+
AnimationController? _snapCtrl;
|
|
564
|
+
Widget? _cachedCustom;
|
|
565
|
+
|
|
566
|
+
// Pause tracking: hover (web/desktop) and press-hold (native)
|
|
567
|
+
bool _hovering = false;
|
|
568
|
+
bool _pressing = false;
|
|
569
|
+
|
|
570
|
+
void _updatePause() {
|
|
571
|
+
if (_hovering || _pressing) {
|
|
572
|
+
widget.item.pause();
|
|
573
|
+
} else {
|
|
574
|
+
widget.item.resume();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
@override
|
|
579
|
+
void dispose() {
|
|
580
|
+
_snapCtrl?.dispose();
|
|
581
|
+
super.dispose();
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
void _snapBack() {
|
|
585
|
+
final double start = _dragOffset;
|
|
586
|
+
_snapCtrl?.dispose();
|
|
587
|
+
_snapCtrl = AnimationController(
|
|
588
|
+
vsync: this,
|
|
589
|
+
duration: const Duration(milliseconds: 180),
|
|
590
|
+
);
|
|
591
|
+
final anim = Tween<double>(begin: start, end: 0).animate(
|
|
592
|
+
CurvedAnimation(parent: _snapCtrl!, curve: Curves.easeOut),
|
|
593
|
+
);
|
|
594
|
+
anim.addListener(() => setState(() => _dragOffset = anim.value));
|
|
595
|
+
_snapCtrl!.forward();
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
@override
|
|
599
|
+
Widget build(BuildContext context) {
|
|
600
|
+
final bool isTop =
|
|
601
|
+
widget.item.data.placement == KasyToastPlacement.top;
|
|
602
|
+
|
|
603
|
+
final Animation<Offset> slide = Tween<Offset>(
|
|
604
|
+
begin: Offset(0, isTop ? -1.8 : 1.8),
|
|
605
|
+
end: Offset.zero,
|
|
606
|
+
).animate(CurvedAnimation(
|
|
607
|
+
parent: widget.item.controller,
|
|
608
|
+
curve: Curves.easeOutCubic,
|
|
609
|
+
reverseCurve: Curves.easeInCubic,
|
|
610
|
+
));
|
|
611
|
+
|
|
612
|
+
final Animation<double> fade = CurvedAnimation(
|
|
613
|
+
parent: widget.item.controller,
|
|
614
|
+
curve: const Interval(0.0, 0.55, curve: Curves.easeOut),
|
|
615
|
+
reverseCurve: const Interval(0.45, 1.0, curve: Curves.easeIn),
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
void dismiss() {
|
|
619
|
+
widget.item.data.onClose?.call();
|
|
620
|
+
widget.onClose();
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
Widget innerContent;
|
|
624
|
+
if (widget.item.data.customBuilder != null) {
|
|
625
|
+
_cachedCustom ??= widget.item.data.customBuilder!(dismiss);
|
|
626
|
+
innerContent = _cachedCustom!;
|
|
627
|
+
} else {
|
|
628
|
+
innerContent = KasyToast(
|
|
629
|
+
title: widget.item.data.title,
|
|
630
|
+
message: widget.item.data.message,
|
|
631
|
+
tone: widget.item.data.tone,
|
|
632
|
+
icon: widget.item.data.icon,
|
|
633
|
+
onClose: dismiss,
|
|
634
|
+
);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
final toastCard = SlideTransition(
|
|
638
|
+
position: slide,
|
|
639
|
+
child: FadeTransition(
|
|
640
|
+
opacity: fade,
|
|
641
|
+
child: innerContent,
|
|
642
|
+
),
|
|
643
|
+
);
|
|
644
|
+
|
|
645
|
+
Widget result = toastCard;
|
|
646
|
+
|
|
647
|
+
if (widget.swipeable) {
|
|
648
|
+
result = GestureDetector(
|
|
649
|
+
onVerticalDragUpdate: (details) {
|
|
650
|
+
final double delta = details.delta.dy;
|
|
651
|
+
if (isTop && delta > 0) return;
|
|
652
|
+
if (!isTop && delta < 0) return;
|
|
653
|
+
setState(() => _dragOffset += delta);
|
|
654
|
+
},
|
|
655
|
+
onVerticalDragEnd: (details) {
|
|
656
|
+
final double velocity = details.primaryVelocity ?? 0;
|
|
657
|
+
final bool shouldDismiss =
|
|
658
|
+
_dragOffset.abs() > 60 || velocity.abs() > 600;
|
|
659
|
+
if (shouldDismiss) {
|
|
660
|
+
widget.item.data.onClose?.call();
|
|
661
|
+
widget.onClose();
|
|
662
|
+
} else {
|
|
663
|
+
_snapBack();
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
child: Transform.translate(
|
|
667
|
+
offset: Offset(0, _dragOffset),
|
|
668
|
+
child: toastCard,
|
|
669
|
+
),
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Pause on web hover; pause on native press-hold.
|
|
674
|
+
// Listener uses translucent behaviour so it doesn't block swipe gestures.
|
|
675
|
+
return MouseRegion(
|
|
676
|
+
onEnter: (_) {
|
|
677
|
+
_hovering = true;
|
|
678
|
+
_updatePause();
|
|
679
|
+
},
|
|
680
|
+
onExit: (_) {
|
|
681
|
+
_hovering = false;
|
|
682
|
+
_updatePause();
|
|
683
|
+
},
|
|
684
|
+
child: Listener(
|
|
685
|
+
behavior: HitTestBehavior.translucent,
|
|
686
|
+
onPointerDown: (_) {
|
|
687
|
+
_pressing = true;
|
|
688
|
+
_updatePause();
|
|
689
|
+
},
|
|
690
|
+
onPointerUp: (_) {
|
|
691
|
+
_pressing = false;
|
|
692
|
+
_updatePause();
|
|
693
|
+
},
|
|
694
|
+
onPointerCancel: (_) {
|
|
695
|
+
_pressing = false;
|
|
696
|
+
_updatePause();
|
|
697
|
+
},
|
|
698
|
+
child: result,
|
|
699
|
+
),
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
// ---------------------------------------------------------------------------
|
|
705
|
+
// Palette resolution
|
|
706
|
+
// ---------------------------------------------------------------------------
|
|
707
|
+
|
|
708
|
+
class _Palette {
|
|
709
|
+
const _Palette({
|
|
710
|
+
required this.accent,
|
|
711
|
+
required this.icon,
|
|
712
|
+
required this.buttonBg,
|
|
713
|
+
required this.buttonFg,
|
|
714
|
+
});
|
|
715
|
+
|
|
716
|
+
final Color accent;
|
|
717
|
+
final IconData icon;
|
|
718
|
+
final Color buttonBg;
|
|
719
|
+
final Color buttonFg;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
_Palette _palette(KasyColors c, KasyToastTone tone) {
|
|
723
|
+
switch (tone) {
|
|
724
|
+
case KasyToastTone.neutral:
|
|
725
|
+
return _Palette(
|
|
726
|
+
accent: c.onSurface,
|
|
727
|
+
icon: KasyIcons.notification,
|
|
728
|
+
buttonBg: c.surfaceNeutralSoft,
|
|
729
|
+
buttonFg: c.onSurface,
|
|
730
|
+
);
|
|
731
|
+
case KasyToastTone.accent:
|
|
732
|
+
return _Palette(
|
|
733
|
+
accent: c.primary,
|
|
734
|
+
icon: KasyIcons.info,
|
|
735
|
+
buttonBg: c.primary,
|
|
736
|
+
buttonFg: c.onPrimary,
|
|
737
|
+
);
|
|
738
|
+
case KasyToastTone.success:
|
|
739
|
+
final Color successDark = HSLColor.fromColor(c.success)
|
|
740
|
+
.withLightness(
|
|
741
|
+
(HSLColor.fromColor(c.success).lightness - 0.09).clamp(0.0, 1.0),
|
|
742
|
+
)
|
|
743
|
+
.toColor();
|
|
744
|
+
return _Palette(
|
|
745
|
+
accent: successDark,
|
|
746
|
+
icon: KasyIcons.checkCircle,
|
|
747
|
+
buttonBg: successDark,
|
|
748
|
+
buttonFg: c.onSuccess,
|
|
749
|
+
);
|
|
750
|
+
case KasyToastTone.warning:
|
|
751
|
+
return _Palette(
|
|
752
|
+
accent: c.warning,
|
|
753
|
+
icon: KasyIcons.privacy,
|
|
754
|
+
buttonBg: c.warning,
|
|
755
|
+
buttonFg: c.onWarning,
|
|
756
|
+
);
|
|
757
|
+
case KasyToastTone.danger:
|
|
758
|
+
return _Palette(
|
|
759
|
+
accent: c.error,
|
|
760
|
+
icon: KasyIcons.error,
|
|
761
|
+
buttonBg: c.error,
|
|
762
|
+
buttonFg: c.onError,
|
|
763
|
+
);
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// ---------------------------------------------------------------------------
|
|
768
|
+
// Backward-compatible API (keep existing callers working)
|
|
769
|
+
// ---------------------------------------------------------------------------
|
|
770
|
+
|
|
771
|
+
/// Retained for backwards compat — prefer [showKasyToast].
|
|
772
|
+
void showSuccessToast({
|
|
773
|
+
required BuildContext context,
|
|
774
|
+
required String title,
|
|
775
|
+
required String text,
|
|
776
|
+
Duration duration = const Duration(seconds: 3),
|
|
777
|
+
}) {
|
|
778
|
+
showKasyToast(
|
|
779
|
+
context,
|
|
780
|
+
title: title,
|
|
781
|
+
message: text,
|
|
782
|
+
tone: KasyToastTone.success,
|
|
783
|
+
duration: duration,
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/// Retained for backwards compat — prefer [showKasyToast].
|
|
788
|
+
void showErrorToast({
|
|
789
|
+
required BuildContext context,
|
|
790
|
+
required String title,
|
|
791
|
+
required String text,
|
|
792
|
+
Duration duration = const Duration(seconds: 3),
|
|
793
|
+
String? reason,
|
|
794
|
+
}) {
|
|
795
|
+
showKasyToast(
|
|
796
|
+
context,
|
|
797
|
+
title: title,
|
|
798
|
+
message: reason != null ? '$text ($reason)' : text,
|
|
799
|
+
tone: KasyToastTone.danger,
|
|
800
|
+
duration: duration,
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
|