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,926 @@
|
|
|
1
|
+
import 'package:flutter/foundation.dart' show kIsWeb;
|
|
2
|
+
import 'package:flutter/material.dart';
|
|
3
|
+
import 'package:flutter/services.dart';
|
|
4
|
+
import 'package:kasy_kit/core/theme/theme.dart';
|
|
5
|
+
import 'package:kasy_kit/core/widgets/kasy_hover.dart';
|
|
6
|
+
import 'package:kasy_kit/core/widgets/kasy_pressable_depth.dart';
|
|
7
|
+
|
|
8
|
+
/// Neutral pill fill for soft / neutral / tertiary buttons (light #EBEBED, dark #272729).
|
|
9
|
+
Color _neutralFilledButtonSurface(BuildContext context) =>
|
|
10
|
+
context.isDark ? const Color(0xFF272729) : const Color(0xFFEBEBED);
|
|
11
|
+
|
|
12
|
+
/// Visual variants for [KasyButton].
|
|
13
|
+
enum KasyButtonVariant {
|
|
14
|
+
primary,
|
|
15
|
+
|
|
16
|
+
/// Legacy outlined variant used in existing screens.
|
|
17
|
+
secondary,
|
|
18
|
+
|
|
19
|
+
/// Legacy text variant used in existing screens.
|
|
20
|
+
tertiary,
|
|
21
|
+
destructive,
|
|
22
|
+
|
|
23
|
+
/// Soft destructive style (tinted background + danger text).
|
|
24
|
+
destructiveSoft,
|
|
25
|
+
|
|
26
|
+
/// Filled inverted: white/surface background + primary text.
|
|
27
|
+
inverse,
|
|
28
|
+
|
|
29
|
+
/// Compact inline text action.
|
|
30
|
+
link,
|
|
31
|
+
|
|
32
|
+
/// Soft filled style with brand text.
|
|
33
|
+
soft,
|
|
34
|
+
|
|
35
|
+
/// Soft filled neutral style.
|
|
36
|
+
neutral,
|
|
37
|
+
|
|
38
|
+
/// Neutral outlined style.
|
|
39
|
+
outline,
|
|
40
|
+
|
|
41
|
+
/// Text-only neutral style.
|
|
42
|
+
ghost,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// Vertical rhythm presets for [KasyButton].
|
|
46
|
+
enum KasyButtonSize { small, medium, large }
|
|
47
|
+
|
|
48
|
+
/// Placement for [icon] when label is shown.
|
|
49
|
+
enum KasyButtonIconAlignment { leading, trailing, top }
|
|
50
|
+
|
|
51
|
+
/// Press-feedback style for [KasyButton].
|
|
52
|
+
enum KasyButtonPressEffect {
|
|
53
|
+
/// Scale/depth animation (default).
|
|
54
|
+
depth,
|
|
55
|
+
|
|
56
|
+
/// Subtle background fill via [KasyHover] — matches card/list press style.
|
|
57
|
+
fill,
|
|
58
|
+
|
|
59
|
+
/// Scale/depth + fill overlay combined.
|
|
60
|
+
both,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/// Loading behavior while [isLoading] is true.
|
|
64
|
+
enum KasyButtonLoadingBehavior {
|
|
65
|
+
/// Keep normal button shape and only swap content to a spinner.
|
|
66
|
+
inline,
|
|
67
|
+
|
|
68
|
+
/// Morph width to a round loading orb and restore when loading finishes.
|
|
69
|
+
shrinkToCircle,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/// Design-system button used across the app.
|
|
73
|
+
///
|
|
74
|
+
/// Backward compatible with existing calls (`label`, `variant`, `isLoading`,
|
|
75
|
+
/// `icon`, `expand`) and extended with richer visual variants and size control.
|
|
76
|
+
///
|
|
77
|
+
/// Stroke: outlined styles use [variant] (e.g. [KasyButtonVariant.secondary],
|
|
78
|
+
/// [KasyButtonVariant.outline]). Custom rim: non-transparent [borderColor] plus
|
|
79
|
+
/// optional [outlineWidth].
|
|
80
|
+
///
|
|
81
|
+
/// Corners default to [KasyRadius.md] or a circle for icon-only; set
|
|
82
|
+
/// [borderRadius] to override (e.g. `BorderRadius.circular(KasyRadius.md)`).
|
|
83
|
+
class KasyButton extends StatelessWidget {
|
|
84
|
+
final String label;
|
|
85
|
+
final VoidCallback? onPressed;
|
|
86
|
+
final KasyButtonVariant variant;
|
|
87
|
+
final bool isLoading;
|
|
88
|
+
final IconData? icon;
|
|
89
|
+
final bool expand;
|
|
90
|
+
final KasyButtonSize size;
|
|
91
|
+
final KasyButtonIconAlignment iconAlignment;
|
|
92
|
+
final KasyButtonLoadingBehavior loadingBehavior;
|
|
93
|
+
final Duration morphDuration;
|
|
94
|
+
final Duration morphBackDuration;
|
|
95
|
+
|
|
96
|
+
/// Optional fixed width when [expand] is false.
|
|
97
|
+
final double? width;
|
|
98
|
+
|
|
99
|
+
/// Optional fills and colors; omit to use tokens from [variant].
|
|
100
|
+
final Color? backgroundColor;
|
|
101
|
+
final Color? foregroundColor;
|
|
102
|
+
|
|
103
|
+
/// Stroke override. When the color is not fully transparent, draws the rim.
|
|
104
|
+
final Color? borderColor;
|
|
105
|
+
|
|
106
|
+
/// Hairline thickness when [borderColor] / variant resolves a visible stroke (~1 px if omitted).
|
|
107
|
+
final double? outlineWidth;
|
|
108
|
+
|
|
109
|
+
/// Rounded corners; omit for defaults (md body, circular icon-only).
|
|
110
|
+
final BorderRadius? borderRadius;
|
|
111
|
+
final Gradient? backgroundGradient;
|
|
112
|
+
final FontWeight? fontWeight;
|
|
113
|
+
final String? semanticLabel;
|
|
114
|
+
|
|
115
|
+
/// Press feedback style; defaults to [KasyButtonPressEffect.depth] (scale).
|
|
116
|
+
///
|
|
117
|
+
/// Use [KasyButtonPressEffect.fill] for pill/surface buttons where a
|
|
118
|
+
/// background fill matches nearby card or list press feedback.
|
|
119
|
+
final KasyButtonPressEffect pressEffect;
|
|
120
|
+
|
|
121
|
+
/// Light tap feedback via [KasyPressableDepth]; disable with false.
|
|
122
|
+
final bool hapticFeedbackEnabled;
|
|
123
|
+
|
|
124
|
+
/// Icon-only layout: replaces the circular extent from [size] metrics (width × height).
|
|
125
|
+
final double? iconOnlyLayoutExtent;
|
|
126
|
+
|
|
127
|
+
/// Icon-only: drawn glyph size; when null, uses the metric for [size].
|
|
128
|
+
final double? iconGlyphSize;
|
|
129
|
+
|
|
130
|
+
const KasyButton({
|
|
131
|
+
super.key,
|
|
132
|
+
required this.label,
|
|
133
|
+
required this.onPressed,
|
|
134
|
+
this.variant = KasyButtonVariant.primary,
|
|
135
|
+
this.isLoading = false,
|
|
136
|
+
this.icon,
|
|
137
|
+
this.expand = false,
|
|
138
|
+
this.size = KasyButtonSize.medium,
|
|
139
|
+
this.iconAlignment = KasyButtonIconAlignment.leading,
|
|
140
|
+
this.loadingBehavior = KasyButtonLoadingBehavior.inline,
|
|
141
|
+
this.morphDuration = const Duration(milliseconds: 180),
|
|
142
|
+
this.morphBackDuration = const Duration(milliseconds: 130),
|
|
143
|
+
this.width,
|
|
144
|
+
this.backgroundColor,
|
|
145
|
+
this.foregroundColor,
|
|
146
|
+
this.borderColor,
|
|
147
|
+
this.outlineWidth,
|
|
148
|
+
this.borderRadius,
|
|
149
|
+
this.backgroundGradient,
|
|
150
|
+
this.fontWeight,
|
|
151
|
+
this.semanticLabel,
|
|
152
|
+
this.pressEffect = kIsWeb
|
|
153
|
+
? KasyButtonPressEffect.both
|
|
154
|
+
: KasyButtonPressEffect.depth,
|
|
155
|
+
this.hapticFeedbackEnabled = true,
|
|
156
|
+
this.iconOnlyLayoutExtent,
|
|
157
|
+
this.iconGlyphSize,
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/// Circular icon-only action button.
|
|
161
|
+
const KasyButton.iconOnly({
|
|
162
|
+
super.key,
|
|
163
|
+
required IconData this.icon,
|
|
164
|
+
required this.onPressed,
|
|
165
|
+
this.variant = KasyButtonVariant.primary,
|
|
166
|
+
this.isLoading = false,
|
|
167
|
+
this.size = KasyButtonSize.medium,
|
|
168
|
+
this.loadingBehavior = KasyButtonLoadingBehavior.inline,
|
|
169
|
+
this.morphDuration = const Duration(milliseconds: 180),
|
|
170
|
+
this.morphBackDuration = const Duration(milliseconds: 130),
|
|
171
|
+
this.width,
|
|
172
|
+
this.backgroundColor,
|
|
173
|
+
this.foregroundColor,
|
|
174
|
+
this.borderColor,
|
|
175
|
+
this.outlineWidth,
|
|
176
|
+
this.borderRadius,
|
|
177
|
+
this.backgroundGradient,
|
|
178
|
+
this.fontWeight,
|
|
179
|
+
this.semanticLabel,
|
|
180
|
+
this.pressEffect = kIsWeb
|
|
181
|
+
? KasyButtonPressEffect.both
|
|
182
|
+
: KasyButtonPressEffect.depth,
|
|
183
|
+
this.hapticFeedbackEnabled = true,
|
|
184
|
+
this.iconOnlyLayoutExtent,
|
|
185
|
+
this.iconGlyphSize,
|
|
186
|
+
}) : label = '',
|
|
187
|
+
expand = false,
|
|
188
|
+
iconAlignment = KasyButtonIconAlignment.leading;
|
|
189
|
+
|
|
190
|
+
bool get _isIconOnly => label.trim().isEmpty && icon != null;
|
|
191
|
+
|
|
192
|
+
@override
|
|
193
|
+
Widget build(BuildContext context) {
|
|
194
|
+
final bool interactive = onPressed != null && !isLoading;
|
|
195
|
+
final _KasyButtonMetrics metrics = _metricsFor(size);
|
|
196
|
+
final _KasyButtonPalette palette = _resolvePalette(
|
|
197
|
+
context,
|
|
198
|
+
disabledLook: onPressed == null,
|
|
199
|
+
isLoading: isLoading,
|
|
200
|
+
variant: variant,
|
|
201
|
+
);
|
|
202
|
+
final bool morphToCircle =
|
|
203
|
+
isLoading &&
|
|
204
|
+
loadingBehavior == KasyButtonLoadingBehavior.shrinkToCircle;
|
|
205
|
+
final double layoutIconExtent = _isIconOnly && iconOnlyLayoutExtent != null
|
|
206
|
+
? iconOnlyLayoutExtent!
|
|
207
|
+
: metrics.iconOnlyExtent;
|
|
208
|
+
final double buttonHeight = _isIconOnly ? layoutIconExtent : metrics.height;
|
|
209
|
+
final double? targetWidth = morphToCircle
|
|
210
|
+
? buttonHeight
|
|
211
|
+
: expand
|
|
212
|
+
? double.infinity
|
|
213
|
+
: (_isIconOnly && width == null ? buttonHeight : width);
|
|
214
|
+
|
|
215
|
+
final Widget shell = _KasyButtonShell(
|
|
216
|
+
label: label,
|
|
217
|
+
icon: icon,
|
|
218
|
+
enabled: interactive,
|
|
219
|
+
isLoading: isLoading,
|
|
220
|
+
isIconOnly: _isIconOnly,
|
|
221
|
+
morphToCircle: morphToCircle,
|
|
222
|
+
iconAlignment: iconAlignment,
|
|
223
|
+
metrics: metrics,
|
|
224
|
+
palette: palette,
|
|
225
|
+
buttonHeight: buttonHeight,
|
|
226
|
+
iconOnlyGlyphOverride: iconGlyphSize,
|
|
227
|
+
variant: variant,
|
|
228
|
+
onPressed: onPressed,
|
|
229
|
+
semanticLabel: semanticLabel,
|
|
230
|
+
backgroundGradient: backgroundGradient,
|
|
231
|
+
fontWeight: fontWeight,
|
|
232
|
+
pressEffect: pressEffect,
|
|
233
|
+
hapticFeedbackEnabled: hapticFeedbackEnabled,
|
|
234
|
+
outlineWidth: outlineWidth,
|
|
235
|
+
borderRadius: borderRadius,
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
Widget result;
|
|
239
|
+
if (expand) {
|
|
240
|
+
result = SizedBox(width: double.infinity, child: shell);
|
|
241
|
+
} else if (targetWidth != null && targetWidth.isFinite) {
|
|
242
|
+
final Duration widthMorphDuration = morphToCircle
|
|
243
|
+
? morphBackDuration
|
|
244
|
+
: morphDuration;
|
|
245
|
+
result = TweenAnimationBuilder<double>(
|
|
246
|
+
duration: widthMorphDuration,
|
|
247
|
+
curve: Curves.easeInOutCubic,
|
|
248
|
+
tween: Tween<double>(begin: targetWidth, end: targetWidth),
|
|
249
|
+
child: shell,
|
|
250
|
+
builder: (BuildContext context, double animatedWidth, Widget? child) {
|
|
251
|
+
return SizedBox(width: animatedWidth, child: child);
|
|
252
|
+
},
|
|
253
|
+
);
|
|
254
|
+
} else {
|
|
255
|
+
result = shell;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
_KasyButtonPalette _resolvePalette(
|
|
262
|
+
BuildContext context, {
|
|
263
|
+
required bool disabledLook,
|
|
264
|
+
required bool isLoading,
|
|
265
|
+
required KasyButtonVariant variant,
|
|
266
|
+
}) {
|
|
267
|
+
final KasyColors c = context.colors;
|
|
268
|
+
final _KasyButtonPalette base = switch (variant) {
|
|
269
|
+
KasyButtonVariant.primary => _KasyButtonPalette(
|
|
270
|
+
background: c.primary,
|
|
271
|
+
foreground: c.onPrimary,
|
|
272
|
+
border: Colors.transparent,
|
|
273
|
+
),
|
|
274
|
+
KasyButtonVariant.secondary => _KasyButtonPalette(
|
|
275
|
+
background: Colors.transparent,
|
|
276
|
+
foreground: c.primary,
|
|
277
|
+
border: c.outlineButton,
|
|
278
|
+
),
|
|
279
|
+
KasyButtonVariant.tertiary => _KasyButtonPalette(
|
|
280
|
+
background: _neutralFilledButtonSurface(context),
|
|
281
|
+
foreground: c.onSurface,
|
|
282
|
+
border: Colors.transparent,
|
|
283
|
+
),
|
|
284
|
+
KasyButtonVariant.destructive => _KasyButtonPalette(
|
|
285
|
+
background: c.error,
|
|
286
|
+
foreground: c.onError,
|
|
287
|
+
border: Colors.transparent,
|
|
288
|
+
),
|
|
289
|
+
KasyButtonVariant.destructiveSoft => _KasyButtonPalette(
|
|
290
|
+
background: c.surfaceErrorSoft,
|
|
291
|
+
foreground: c.error,
|
|
292
|
+
border: Colors.transparent,
|
|
293
|
+
),
|
|
294
|
+
KasyButtonVariant.inverse => _KasyButtonPalette(
|
|
295
|
+
background: c.onPrimary,
|
|
296
|
+
foreground: c.primary,
|
|
297
|
+
border: Colors.transparent,
|
|
298
|
+
),
|
|
299
|
+
KasyButtonVariant.link => _KasyButtonPalette(
|
|
300
|
+
background: Colors.transparent,
|
|
301
|
+
foreground: c.primary,
|
|
302
|
+
border: Colors.transparent,
|
|
303
|
+
),
|
|
304
|
+
KasyButtonVariant.soft => _KasyButtonPalette(
|
|
305
|
+
background: _neutralFilledButtonSurface(context),
|
|
306
|
+
foreground: c.primary,
|
|
307
|
+
border: Colors.transparent,
|
|
308
|
+
),
|
|
309
|
+
KasyButtonVariant.neutral => _KasyButtonPalette(
|
|
310
|
+
background: _neutralFilledButtonSurface(context),
|
|
311
|
+
foreground: c.onSurface,
|
|
312
|
+
border: Colors.transparent,
|
|
313
|
+
),
|
|
314
|
+
KasyButtonVariant.outline => _KasyButtonPalette(
|
|
315
|
+
background: Colors.transparent,
|
|
316
|
+
foreground: c.onSurface,
|
|
317
|
+
border: context.isDark
|
|
318
|
+
? const Color(0x2BFFFFFF)
|
|
319
|
+
: c.outline.withValues(alpha: 0.48),
|
|
320
|
+
),
|
|
321
|
+
KasyButtonVariant.ghost => _KasyButtonPalette(
|
|
322
|
+
background: Colors.transparent,
|
|
323
|
+
foreground: c.onSurface,
|
|
324
|
+
border: Colors.transparent,
|
|
325
|
+
),
|
|
326
|
+
};
|
|
327
|
+
final Color resolvedBg = backgroundColor ?? base.background;
|
|
328
|
+
final Color resolvedFg = foregroundColor ?? base.foreground;
|
|
329
|
+
final Color resolvedBorder = borderColor ?? base.border;
|
|
330
|
+
if (disabledLook) {
|
|
331
|
+
// Loading + disabled: keep loading palette so spinner colours read well.
|
|
332
|
+
final _KasyButtonPalette? loading = _disabledLoadingPalette(
|
|
333
|
+
context,
|
|
334
|
+
variant,
|
|
335
|
+
isLoading: isLoading,
|
|
336
|
+
);
|
|
337
|
+
if (loading != null) {
|
|
338
|
+
final Color? fgCustom = foregroundColor;
|
|
339
|
+
final Color fg = fgCustom != null
|
|
340
|
+
? fgCustom.withValues(alpha: 0.92)
|
|
341
|
+
: loading.foreground;
|
|
342
|
+
final Color bg = backgroundColor ?? loading.background;
|
|
343
|
+
return _KasyButtonPalette(
|
|
344
|
+
background: bg,
|
|
345
|
+
foreground: fg,
|
|
346
|
+
border: _disabledBorderFor(variant, resolvedBorder),
|
|
347
|
+
);
|
|
348
|
+
}
|
|
349
|
+
// Normal disabled: compute opaque muted colours so the button stays
|
|
350
|
+
// solid — no transparency bleed-through from whatever is behind it.
|
|
351
|
+
final Color blendSurface = context.colors.surfaceNeutralSoft;
|
|
352
|
+
final bool hasSolidBg = resolvedBg.a > 0.05;
|
|
353
|
+
return _KasyButtonPalette(
|
|
354
|
+
background: hasSolidBg
|
|
355
|
+
? Color.alphaBlend(resolvedBg.withValues(alpha: 0.46), blendSurface)
|
|
356
|
+
: resolvedBg, // transparent-bg variants (secondary, link, ghost) keep transparent
|
|
357
|
+
foreground: resolvedFg.withValues(alpha: 0.45),
|
|
358
|
+
border: resolvedBorder.a > 0.05
|
|
359
|
+
? resolvedBorder.withValues(alpha: 0.40)
|
|
360
|
+
: resolvedBorder,
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
return _KasyButtonPalette(
|
|
364
|
+
background: resolvedBg,
|
|
365
|
+
foreground: resolvedFg,
|
|
366
|
+
border: resolvedBorder,
|
|
367
|
+
);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
_KasyButtonPalette? _disabledLoadingPalette(
|
|
371
|
+
BuildContext context,
|
|
372
|
+
KasyButtonVariant variant, {
|
|
373
|
+
required bool isLoading,
|
|
374
|
+
}) {
|
|
375
|
+
if (!isLoading) {
|
|
376
|
+
return null;
|
|
377
|
+
}
|
|
378
|
+
final KasyColors c = context.colors;
|
|
379
|
+
final Color soft = c.surfaceNeutralSoft;
|
|
380
|
+
return switch (variant) {
|
|
381
|
+
KasyButtonVariant.primary => _KasyButtonPalette(
|
|
382
|
+
background: Color.alphaBlend(c.primary.withValues(alpha: 0.62), soft),
|
|
383
|
+
foreground: c.onPrimary.withValues(alpha: 0.94),
|
|
384
|
+
border: Colors.transparent,
|
|
385
|
+
),
|
|
386
|
+
KasyButtonVariant.neutral || KasyButtonVariant.soft => _KasyButtonPalette(
|
|
387
|
+
background: _neutralFilledButtonSurface(context),
|
|
388
|
+
foreground: c.primary.withValues(alpha: 0.90),
|
|
389
|
+
border: Colors.transparent,
|
|
390
|
+
),
|
|
391
|
+
_ => null,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
Color _disabledBorderFor(KasyButtonVariant variant, Color resolvedBorder) {
|
|
396
|
+
final bool keepsStroke =
|
|
397
|
+
variant == KasyButtonVariant.secondary ||
|
|
398
|
+
variant == KasyButtonVariant.outline;
|
|
399
|
+
if (!keepsStroke || resolvedBorder.a == 0) {
|
|
400
|
+
return Colors.transparent;
|
|
401
|
+
}
|
|
402
|
+
return resolvedBorder.withValues(alpha: 0.42);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
_KasyButtonMetrics _metricsFor(KasyButtonSize buttonSize) {
|
|
406
|
+
return switch (buttonSize) {
|
|
407
|
+
KasyButtonSize.small => const _KasyButtonMetrics(
|
|
408
|
+
height: 40,
|
|
409
|
+
iconOnlyExtent: 40,
|
|
410
|
+
horizontalPadding: EdgeInsets.symmetric(horizontal: 16),
|
|
411
|
+
labelFontSize: 13,
|
|
412
|
+
iconSize: 16,
|
|
413
|
+
iconOnlyGlyphSize: 12,
|
|
414
|
+
loadingSpinnerExtent: 13,
|
|
415
|
+
),
|
|
416
|
+
KasyButtonSize.medium => const _KasyButtonMetrics(
|
|
417
|
+
height: 47,
|
|
418
|
+
iconOnlyExtent: 47,
|
|
419
|
+
horizontalPadding: EdgeInsets.symmetric(horizontal: 18),
|
|
420
|
+
labelFontSize: 14,
|
|
421
|
+
iconSize: 18,
|
|
422
|
+
iconOnlyGlyphSize: 14,
|
|
423
|
+
loadingSpinnerExtent: 14,
|
|
424
|
+
),
|
|
425
|
+
KasyButtonSize.large => const _KasyButtonMetrics(
|
|
426
|
+
height: 54,
|
|
427
|
+
iconOnlyExtent: 54,
|
|
428
|
+
horizontalPadding: EdgeInsets.symmetric(horizontal: 22),
|
|
429
|
+
labelFontSize: 15,
|
|
430
|
+
iconSize: 19,
|
|
431
|
+
iconOnlyGlyphSize: 18,
|
|
432
|
+
loadingSpinnerExtent: 15,
|
|
433
|
+
),
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
class _KasyButtonShell extends StatelessWidget {
|
|
439
|
+
final String label;
|
|
440
|
+
final IconData? icon;
|
|
441
|
+
final bool enabled;
|
|
442
|
+
final bool isLoading;
|
|
443
|
+
final bool isIconOnly;
|
|
444
|
+
final bool morphToCircle;
|
|
445
|
+
final KasyButtonIconAlignment iconAlignment;
|
|
446
|
+
final _KasyButtonMetrics metrics;
|
|
447
|
+
final _KasyButtonPalette palette;
|
|
448
|
+
final double buttonHeight;
|
|
449
|
+
final double? iconOnlyGlyphOverride;
|
|
450
|
+
final KasyButtonVariant variant;
|
|
451
|
+
final VoidCallback? onPressed;
|
|
452
|
+
final String? semanticLabel;
|
|
453
|
+
final Gradient? backgroundGradient;
|
|
454
|
+
final FontWeight? fontWeight;
|
|
455
|
+
final KasyButtonPressEffect pressEffect;
|
|
456
|
+
final bool hapticFeedbackEnabled;
|
|
457
|
+
final double? outlineWidth;
|
|
458
|
+
final BorderRadius? borderRadius;
|
|
459
|
+
static const Duration _contentTransitionDuration = Duration(
|
|
460
|
+
milliseconds: 220,
|
|
461
|
+
);
|
|
462
|
+
|
|
463
|
+
const _KasyButtonShell({
|
|
464
|
+
required this.label,
|
|
465
|
+
required this.icon,
|
|
466
|
+
required this.enabled,
|
|
467
|
+
required this.isLoading,
|
|
468
|
+
required this.isIconOnly,
|
|
469
|
+
required this.morphToCircle,
|
|
470
|
+
required this.iconAlignment,
|
|
471
|
+
required this.metrics,
|
|
472
|
+
required this.palette,
|
|
473
|
+
required this.buttonHeight,
|
|
474
|
+
this.iconOnlyGlyphOverride,
|
|
475
|
+
required this.variant,
|
|
476
|
+
required this.onPressed,
|
|
477
|
+
required this.semanticLabel,
|
|
478
|
+
required this.backgroundGradient,
|
|
479
|
+
required this.fontWeight,
|
|
480
|
+
required this.pressEffect,
|
|
481
|
+
required this.hapticFeedbackEnabled,
|
|
482
|
+
required this.outlineWidth,
|
|
483
|
+
required this.borderRadius,
|
|
484
|
+
});
|
|
485
|
+
|
|
486
|
+
String get _accessibilityLabel =>
|
|
487
|
+
semanticLabel ?? (label.isEmpty ? 'Button' : label);
|
|
488
|
+
|
|
489
|
+
Widget _wrapFocus(Widget child, BorderRadius borderRadius) {
|
|
490
|
+
if (!kIsWeb || !enabled || onPressed == null) return child;
|
|
491
|
+
return _WebKeyboardFocus(
|
|
492
|
+
onActivate: onPressed!,
|
|
493
|
+
borderRadius: borderRadius,
|
|
494
|
+
child: child,
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
@override
|
|
499
|
+
Widget build(BuildContext context) {
|
|
500
|
+
final bool compactLink = variant == KasyButtonVariant.link;
|
|
501
|
+
final BorderRadius resolvedRadius = morphToCircle
|
|
502
|
+
? BorderRadius.circular(buttonHeight / 2)
|
|
503
|
+
: borderRadius ??
|
|
504
|
+
BorderRadius.circular(
|
|
505
|
+
isIconOnly ? buttonHeight / 2 : KasyRadius.md,
|
|
506
|
+
);
|
|
507
|
+
|
|
508
|
+
if (compactLink) {
|
|
509
|
+
final Widget linkVisual = _buildContent(context, compactLink);
|
|
510
|
+
if (enabled && onPressed != null) {
|
|
511
|
+
return _wrapFocus(
|
|
512
|
+
KasyPressableDepth(
|
|
513
|
+
semanticLabel: _accessibilityLabel,
|
|
514
|
+
onPressed: onPressed!,
|
|
515
|
+
hapticFeedbackEnabled: hapticFeedbackEnabled,
|
|
516
|
+
child: linkVisual,
|
|
517
|
+
),
|
|
518
|
+
resolvedRadius,
|
|
519
|
+
);
|
|
520
|
+
}
|
|
521
|
+
return Semantics(
|
|
522
|
+
button: true,
|
|
523
|
+
enabled: false,
|
|
524
|
+
label: _accessibilityLabel,
|
|
525
|
+
child: linkVisual,
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
final BoxDecoration decoration = BoxDecoration(
|
|
530
|
+
color: backgroundGradient != null ? null : palette.background,
|
|
531
|
+
gradient: backgroundGradient,
|
|
532
|
+
borderRadius: resolvedRadius,
|
|
533
|
+
border: palette.border.a == 0
|
|
534
|
+
? null
|
|
535
|
+
: Border.all(color: palette.border, width: outlineWidth ?? 1),
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
final Widget content = AnimatedSwitcher(
|
|
539
|
+
duration: _contentTransitionDuration,
|
|
540
|
+
switchInCurve: Curves.easeOutCubic,
|
|
541
|
+
switchOutCurve: Curves.easeInCubic,
|
|
542
|
+
transitionBuilder: (Widget child, Animation<double> animation) {
|
|
543
|
+
final Animation<Offset> slide = Tween<Offset>(
|
|
544
|
+
begin: const Offset(0.06, 0),
|
|
545
|
+
end: Offset.zero,
|
|
546
|
+
).animate(animation);
|
|
547
|
+
return FadeTransition(
|
|
548
|
+
opacity: animation,
|
|
549
|
+
child: SlideTransition(position: slide, child: child),
|
|
550
|
+
);
|
|
551
|
+
},
|
|
552
|
+
layoutBuilder: (Widget? currentChild, List<Widget> previousChildren) {
|
|
553
|
+
return Stack(
|
|
554
|
+
alignment: Alignment.center,
|
|
555
|
+
children: <Widget>[
|
|
556
|
+
...previousChildren,
|
|
557
|
+
if (currentChild != null) currentChild,
|
|
558
|
+
],
|
|
559
|
+
);
|
|
560
|
+
},
|
|
561
|
+
child: KeyedSubtree(
|
|
562
|
+
key: ValueKey<String>(_contentStateKey(compactLink)),
|
|
563
|
+
child: _buildContent(context, compactLink),
|
|
564
|
+
),
|
|
565
|
+
);
|
|
566
|
+
final Widget inner =
|
|
567
|
+
iconAlignment == KasyButtonIconAlignment.top && !isIconOnly
|
|
568
|
+
? Padding(
|
|
569
|
+
padding: const EdgeInsets.symmetric(
|
|
570
|
+
vertical: 14,
|
|
571
|
+
horizontal: 16,
|
|
572
|
+
),
|
|
573
|
+
child: content,
|
|
574
|
+
)
|
|
575
|
+
: SizedBox(
|
|
576
|
+
height: buttonHeight,
|
|
577
|
+
child: Padding(
|
|
578
|
+
padding: isIconOnly || morphToCircle
|
|
579
|
+
? EdgeInsets.zero
|
|
580
|
+
: metrics.horizontalPadding,
|
|
581
|
+
child: content,
|
|
582
|
+
),
|
|
583
|
+
);
|
|
584
|
+
|
|
585
|
+
final Widget painted = DecoratedBox(
|
|
586
|
+
decoration: decoration,
|
|
587
|
+
child: inner,
|
|
588
|
+
);
|
|
589
|
+
|
|
590
|
+
if (!enabled || onPressed == null) {
|
|
591
|
+
return Semantics(
|
|
592
|
+
button: true,
|
|
593
|
+
enabled: false,
|
|
594
|
+
label: _accessibilityLabel,
|
|
595
|
+
child: ClipRRect(borderRadius: resolvedRadius, child: painted),
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
if (pressEffect == KasyButtonPressEffect.fill) {
|
|
600
|
+
return _wrapFocus(
|
|
601
|
+
ClipRRect(
|
|
602
|
+
borderRadius: resolvedRadius,
|
|
603
|
+
child: DecoratedBox(
|
|
604
|
+
decoration: decoration,
|
|
605
|
+
child: KasyHover(
|
|
606
|
+
onTap: onPressed!,
|
|
607
|
+
pressColor: palette.foreground,
|
|
608
|
+
semanticLabel: _accessibilityLabel,
|
|
609
|
+
hapticEnabled: hapticFeedbackEnabled,
|
|
610
|
+
child: inner,
|
|
611
|
+
),
|
|
612
|
+
),
|
|
613
|
+
),
|
|
614
|
+
resolvedRadius,
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
if (pressEffect == KasyButtonPressEffect.both) {
|
|
619
|
+
final bool isDark = Theme.of(context).brightness == Brightness.dark;
|
|
620
|
+
return _wrapFocus(
|
|
621
|
+
KasyPressableDepth(
|
|
622
|
+
semanticLabel: _accessibilityLabel,
|
|
623
|
+
onPressed: onPressed!,
|
|
624
|
+
clipBorderRadius: resolvedRadius,
|
|
625
|
+
hapticFeedbackEnabled: hapticFeedbackEnabled,
|
|
626
|
+
pressOverlayColor: palette.foreground.withValues(
|
|
627
|
+
alpha: isDark ? 0.04 : 0.10,
|
|
628
|
+
),
|
|
629
|
+
child: painted,
|
|
630
|
+
),
|
|
631
|
+
resolvedRadius,
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return _wrapFocus(
|
|
636
|
+
KasyPressableDepth(
|
|
637
|
+
semanticLabel: _accessibilityLabel,
|
|
638
|
+
onPressed: onPressed!,
|
|
639
|
+
clipBorderRadius: resolvedRadius,
|
|
640
|
+
hapticFeedbackEnabled: hapticFeedbackEnabled,
|
|
641
|
+
child: painted,
|
|
642
|
+
),
|
|
643
|
+
resolvedRadius,
|
|
644
|
+
);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
Widget _buildContent(BuildContext context, bool compactLink) {
|
|
648
|
+
final double effectiveIconOnlyGlyph =
|
|
649
|
+
iconOnlyGlyphOverride ?? metrics.iconOnlyGlyphSize;
|
|
650
|
+
|
|
651
|
+
if (isLoading && morphToCircle) {
|
|
652
|
+
return Center(
|
|
653
|
+
child: _ButtonLoading(
|
|
654
|
+
color: palette.foreground,
|
|
655
|
+
extent: metrics.loadingSpinnerExtent,
|
|
656
|
+
),
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
if (isLoading && !compactLink && !isIconOnly && !morphToCircle) {
|
|
661
|
+
final TextStyle loadingTextStyle =
|
|
662
|
+
context.textTheme.labelLarge?.copyWith(
|
|
663
|
+
color: palette.foreground,
|
|
664
|
+
fontWeight: fontWeight ?? FontWeight.w600,
|
|
665
|
+
fontSize: metrics.labelFontSize,
|
|
666
|
+
height: 1.05,
|
|
667
|
+
) ??
|
|
668
|
+
TextStyle(
|
|
669
|
+
color: palette.foreground,
|
|
670
|
+
fontWeight: fontWeight ?? FontWeight.w600,
|
|
671
|
+
fontSize: metrics.labelFontSize,
|
|
672
|
+
height: 1.05,
|
|
673
|
+
);
|
|
674
|
+
return Center(
|
|
675
|
+
child: Row(
|
|
676
|
+
mainAxisSize: MainAxisSize.min,
|
|
677
|
+
children: [
|
|
678
|
+
_ButtonLoading(
|
|
679
|
+
color: palette.foreground,
|
|
680
|
+
extent: metrics.loadingSpinnerExtent,
|
|
681
|
+
),
|
|
682
|
+
const SizedBox(width: KasySpacing.sm),
|
|
683
|
+
Flexible(
|
|
684
|
+
child: Text(
|
|
685
|
+
label,
|
|
686
|
+
maxLines: 1,
|
|
687
|
+
overflow: TextOverflow.ellipsis,
|
|
688
|
+
style: loadingTextStyle,
|
|
689
|
+
textAlign: TextAlign.center,
|
|
690
|
+
),
|
|
691
|
+
),
|
|
692
|
+
],
|
|
693
|
+
),
|
|
694
|
+
);
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
if (isLoading) {
|
|
698
|
+
return Center(
|
|
699
|
+
child: _ButtonLoading(
|
|
700
|
+
color: palette.foreground,
|
|
701
|
+
extent: isIconOnly
|
|
702
|
+
? effectiveIconOnlyGlyph
|
|
703
|
+
: metrics.loadingSpinnerExtent,
|
|
704
|
+
),
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
if (isIconOnly && icon != null) {
|
|
709
|
+
return Center(
|
|
710
|
+
child: Icon(
|
|
711
|
+
icon,
|
|
712
|
+
size: effectiveIconOnlyGlyph,
|
|
713
|
+
color: palette.foreground,
|
|
714
|
+
),
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
final TextStyle textStyle =
|
|
719
|
+
context.textTheme.labelLarge?.copyWith(
|
|
720
|
+
color: palette.foreground,
|
|
721
|
+
fontWeight: fontWeight ?? FontWeight.w600,
|
|
722
|
+
fontSize: metrics.labelFontSize,
|
|
723
|
+
height: 1.05,
|
|
724
|
+
) ??
|
|
725
|
+
TextStyle(
|
|
726
|
+
color: palette.foreground,
|
|
727
|
+
fontWeight: fontWeight ?? FontWeight.w600,
|
|
728
|
+
fontSize: metrics.labelFontSize,
|
|
729
|
+
height: 1.05,
|
|
730
|
+
);
|
|
731
|
+
|
|
732
|
+
final Widget text = Text(
|
|
733
|
+
label,
|
|
734
|
+
maxLines: 1,
|
|
735
|
+
overflow: TextOverflow.ellipsis,
|
|
736
|
+
style: textStyle,
|
|
737
|
+
textAlign: TextAlign.center,
|
|
738
|
+
);
|
|
739
|
+
final bool hasIcon = icon != null;
|
|
740
|
+
if (!hasIcon) {
|
|
741
|
+
return Center(child: text);
|
|
742
|
+
}
|
|
743
|
+
final Widget iconWidget = Icon(
|
|
744
|
+
icon,
|
|
745
|
+
size: metrics.iconSize,
|
|
746
|
+
color: palette.foreground,
|
|
747
|
+
);
|
|
748
|
+
if (iconAlignment == KasyButtonIconAlignment.top && !compactLink) {
|
|
749
|
+
return Column(
|
|
750
|
+
mainAxisSize: MainAxisSize.min,
|
|
751
|
+
children: <Widget>[
|
|
752
|
+
Icon(icon, size: metrics.iconSize + 4, color: palette.foreground),
|
|
753
|
+
const SizedBox(height: 6),
|
|
754
|
+
text,
|
|
755
|
+
],
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
if (compactLink) {
|
|
759
|
+
return Row(
|
|
760
|
+
mainAxisSize: MainAxisSize.min,
|
|
761
|
+
children: iconAlignment == KasyButtonIconAlignment.leading
|
|
762
|
+
? <Widget>[iconWidget, const SizedBox(width: KasySpacing.xs), text]
|
|
763
|
+
: <Widget>[text, const SizedBox(width: KasySpacing.xs), iconWidget],
|
|
764
|
+
);
|
|
765
|
+
}
|
|
766
|
+
return Center(
|
|
767
|
+
child: Row(
|
|
768
|
+
mainAxisSize: MainAxisSize.min,
|
|
769
|
+
children: iconAlignment == KasyButtonIconAlignment.leading
|
|
770
|
+
? <Widget>[iconWidget, const SizedBox(width: KasySpacing.sm), text]
|
|
771
|
+
: <Widget>[text, const SizedBox(width: KasySpacing.sm), iconWidget],
|
|
772
|
+
),
|
|
773
|
+
);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
String _contentStateKey(bool compactLink) {
|
|
777
|
+
if (isLoading && morphToCircle) {
|
|
778
|
+
return 'loading-circle';
|
|
779
|
+
}
|
|
780
|
+
if (isLoading && !compactLink && !isIconOnly && !morphToCircle) {
|
|
781
|
+
return 'loading-inline-label';
|
|
782
|
+
}
|
|
783
|
+
if (isLoading) {
|
|
784
|
+
return 'loading-glyph';
|
|
785
|
+
}
|
|
786
|
+
if (isIconOnly) {
|
|
787
|
+
return 'icon-only';
|
|
788
|
+
}
|
|
789
|
+
if (icon != null) {
|
|
790
|
+
return compactLink ? 'text-icon-link' : 'text-icon';
|
|
791
|
+
}
|
|
792
|
+
return 'text-only';
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
class _ButtonLoading extends StatelessWidget {
|
|
797
|
+
final Color color;
|
|
798
|
+
final double extent;
|
|
799
|
+
|
|
800
|
+
const _ButtonLoading({required this.color, required this.extent});
|
|
801
|
+
|
|
802
|
+
@override
|
|
803
|
+
Widget build(BuildContext context) {
|
|
804
|
+
final double stroke = (extent * 0.12).clamp(1.6, 2.5);
|
|
805
|
+
return SizedBox(
|
|
806
|
+
width: extent,
|
|
807
|
+
height: extent,
|
|
808
|
+
child: CircularProgressIndicator(
|
|
809
|
+
strokeWidth: stroke,
|
|
810
|
+
valueColor: AlwaysStoppedAnimation<Color>(color),
|
|
811
|
+
backgroundColor: color.withValues(alpha: 0.2),
|
|
812
|
+
),
|
|
813
|
+
);
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
class _KasyButtonPalette {
|
|
818
|
+
final Color background;
|
|
819
|
+
final Color foreground;
|
|
820
|
+
final Color border;
|
|
821
|
+
|
|
822
|
+
const _KasyButtonPalette({
|
|
823
|
+
required this.background,
|
|
824
|
+
required this.foreground,
|
|
825
|
+
required this.border,
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
class _KasyButtonMetrics {
|
|
830
|
+
final double height;
|
|
831
|
+
final double iconOnlyExtent;
|
|
832
|
+
final EdgeInsets horizontalPadding;
|
|
833
|
+
final double labelFontSize;
|
|
834
|
+
|
|
835
|
+
/// Ícone ao lado do rótulo (botões com texto).
|
|
836
|
+
final double iconSize;
|
|
837
|
+
|
|
838
|
+
/// Tamanho do glifo dentro do botão apenas-ícone (pode diferir de [iconSize]).
|
|
839
|
+
final double iconOnlyGlyphSize;
|
|
840
|
+
final double loadingSpinnerExtent;
|
|
841
|
+
|
|
842
|
+
const _KasyButtonMetrics({
|
|
843
|
+
required this.height,
|
|
844
|
+
required this.iconOnlyExtent,
|
|
845
|
+
required this.horizontalPadding,
|
|
846
|
+
required this.labelFontSize,
|
|
847
|
+
required this.iconSize,
|
|
848
|
+
required this.iconOnlyGlyphSize,
|
|
849
|
+
required this.loadingSpinnerExtent,
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
/// Web-only wrapper that makes a button keyboard-navigable (Tab) and
|
|
854
|
+
/// activates it on Enter/Space key press. Shows a focus ring when focused.
|
|
855
|
+
class _WebKeyboardFocus extends StatefulWidget {
|
|
856
|
+
final VoidCallback onActivate;
|
|
857
|
+
final Widget child;
|
|
858
|
+
final BorderRadius borderRadius;
|
|
859
|
+
|
|
860
|
+
const _WebKeyboardFocus({
|
|
861
|
+
required this.onActivate,
|
|
862
|
+
required this.child,
|
|
863
|
+
required this.borderRadius,
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
@override
|
|
867
|
+
State<_WebKeyboardFocus> createState() => _WebKeyboardFocusState();
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
class _WebKeyboardFocusState extends State<_WebKeyboardFocus> {
|
|
871
|
+
late final FocusNode _node;
|
|
872
|
+
bool _focused = false;
|
|
873
|
+
|
|
874
|
+
@override
|
|
875
|
+
void initState() {
|
|
876
|
+
super.initState();
|
|
877
|
+
_node = FocusNode();
|
|
878
|
+
_node.addListener(_onFocusChange);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
@override
|
|
882
|
+
void dispose() {
|
|
883
|
+
_node.removeListener(_onFocusChange);
|
|
884
|
+
_node.dispose();
|
|
885
|
+
super.dispose();
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
void _onFocusChange() {
|
|
889
|
+
if (mounted) setState(() => _focused = _node.hasFocus);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
KeyEventResult _onKeyEvent(FocusNode node, KeyEvent event) {
|
|
893
|
+
if (event is KeyDownEvent &&
|
|
894
|
+
(event.logicalKey == LogicalKeyboardKey.enter ||
|
|
895
|
+
event.logicalKey == LogicalKeyboardKey.space ||
|
|
896
|
+
event.logicalKey == LogicalKeyboardKey.numpadEnter)) {
|
|
897
|
+
widget.onActivate();
|
|
898
|
+
return KeyEventResult.handled;
|
|
899
|
+
}
|
|
900
|
+
return KeyEventResult.ignored;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
@override
|
|
904
|
+
Widget build(BuildContext context) {
|
|
905
|
+
final Color focusColor = Theme.of(context).colorScheme.primary;
|
|
906
|
+
return Focus(
|
|
907
|
+
focusNode: _node,
|
|
908
|
+
onKeyEvent: _onKeyEvent,
|
|
909
|
+
child: AnimatedContainer(
|
|
910
|
+
duration: const Duration(milliseconds: 120),
|
|
911
|
+
decoration: _focused
|
|
912
|
+
? BoxDecoration(
|
|
913
|
+
borderRadius: widget.borderRadius,
|
|
914
|
+
boxShadow: [
|
|
915
|
+
BoxShadow(
|
|
916
|
+
color: focusColor.withValues(alpha: 0.5),
|
|
917
|
+
spreadRadius: 2,
|
|
918
|
+
),
|
|
919
|
+
],
|
|
920
|
+
)
|
|
921
|
+
: const BoxDecoration(),
|
|
922
|
+
child: widget.child,
|
|
923
|
+
),
|
|
924
|
+
);
|
|
925
|
+
}
|
|
926
|
+
}
|