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,1126 @@
|
|
|
1
|
+
import 'dart:async';
|
|
2
|
+
import 'dart:ui' as ui;
|
|
3
|
+
|
|
4
|
+
import 'package:device_preview/device_preview.dart';
|
|
5
|
+
import 'package:flutter/foundation.dart';
|
|
6
|
+
import 'package:flutter/material.dart';
|
|
7
|
+
import 'package:flutter/rendering.dart';
|
|
8
|
+
import 'package:jiffy/jiffy.dart';
|
|
9
|
+
import 'package:kasy_kit/core/dev_inspector/dev_inspector.dart';
|
|
10
|
+
import 'package:kasy_kit/core/theme/theme.dart';
|
|
11
|
+
import 'package:kasy_kit/i18n/translations.g.dart';
|
|
12
|
+
import 'package:provider/provider.dart';
|
|
13
|
+
import 'package:shared_preferences/shared_preferences.dart';
|
|
14
|
+
import 'package:universal_html/html.dart' as html;
|
|
15
|
+
|
|
16
|
+
const String webDevicePreviewEnabledPrefKey = 'web_device_preview_enabled';
|
|
17
|
+
const String _platformPrefKey = 'web_device_preview_platform';
|
|
18
|
+
const String _iosIndexPrefKey = 'web_device_preview_ios_index';
|
|
19
|
+
const String _androidIndexPrefKey = 'web_device_preview_android_index';
|
|
20
|
+
const String _iPadIndexPrefKey = 'web_device_preview_ipad_index';
|
|
21
|
+
const String _bgDarkPrefKey = 'web_device_preview_bg_dark';
|
|
22
|
+
const String _landscapePrefKey = 'web_device_preview_landscape';
|
|
23
|
+
const String _textScalePrefKey = 'web_device_preview_text_scale';
|
|
24
|
+
|
|
25
|
+
final ValueNotifier<bool> webDevicePreviewEnabledNotifier =
|
|
26
|
+
ValueNotifier<bool>(false);
|
|
27
|
+
|
|
28
|
+
// Platform order: 0 = iOS, 1 = Android, 2 = iPad
|
|
29
|
+
|
|
30
|
+
// iOS: compact → standard → pro
|
|
31
|
+
final List<DeviceInfo> _iosDevices = [
|
|
32
|
+
Devices.ios.iPhoneSE,
|
|
33
|
+
Devices.ios.iPhone16,
|
|
34
|
+
Devices.ios.iPhone16Pro,
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
// Android: compact → standard → pro
|
|
38
|
+
final List<DeviceInfo> _androidDevices = [
|
|
39
|
+
Devices.android.samsungGalaxyA50,
|
|
40
|
+
Devices.android.googlePixel9,
|
|
41
|
+
Devices.android.samsungGalaxyS25,
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
// iPad: standard → pro 11" → pro 13"
|
|
45
|
+
final List<DeviceInfo> _iPadDevices = [
|
|
46
|
+
Devices.ios.iPad,
|
|
47
|
+
Devices.ios.iPadPro11Inches,
|
|
48
|
+
Devices.ios.iPadPro13InchesM4,
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
// Compact labels so the pill stays narrow regardless of how many devices we add.
|
|
52
|
+
String _shortName(String name) => switch (name) {
|
|
53
|
+
'iPhone SE' => 'SE',
|
|
54
|
+
'iPhone 16' => '16',
|
|
55
|
+
'iPhone 16 Pro' => '16 Pro',
|
|
56
|
+
'iPad' => 'iPad',
|
|
57
|
+
'iPad Pro 11" (M4)' => '11"',
|
|
58
|
+
'iPad Pro 13" (M4)' => '13"',
|
|
59
|
+
'Samsung Galaxy A50' => 'A50',
|
|
60
|
+
'Google Pixel 9' => 'Pixel 9',
|
|
61
|
+
'Samsung Galaxy S25' => 'S25',
|
|
62
|
+
_ => name,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
class WebDevicePreview extends StatefulWidget {
|
|
66
|
+
const WebDevicePreview({super.key, required this.child});
|
|
67
|
+
|
|
68
|
+
final Widget child;
|
|
69
|
+
|
|
70
|
+
static Widget wrap({required Widget child}) {
|
|
71
|
+
if (!kIsWeb || !kDebugMode) return child;
|
|
72
|
+
return WebDevicePreview(child: child);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@override
|
|
76
|
+
State<WebDevicePreview> createState() => _WebDevicePreviewState();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
class _WebDevicePreviewState extends State<WebDevicePreview> {
|
|
80
|
+
int _platform = 0; // 0 = iOS, 1 = Android, 2 = iPad
|
|
81
|
+
int _iosIndex = 1; // default: iPhone 16
|
|
82
|
+
int _androidIndex = 1; // default: Google Pixel 9
|
|
83
|
+
int _iPadIndex = 0;
|
|
84
|
+
bool _controlsVisible = false;
|
|
85
|
+
Timer? _controlsTimer;
|
|
86
|
+
|
|
87
|
+
final ValueNotifier<DeviceInfo> _deviceNotifier =
|
|
88
|
+
ValueNotifier<DeviceInfo>(_iosDevices[1]); // iPhone 16
|
|
89
|
+
final ValueNotifier<bool> _frameVisibleNotifier = ValueNotifier<bool>(true);
|
|
90
|
+
final ValueNotifier<bool> _bgDarkNotifier = ValueNotifier<bool>(false);
|
|
91
|
+
final ValueNotifier<bool> _landscapeNotifier = ValueNotifier<bool>(false);
|
|
92
|
+
final ValueNotifier<double> _textScaleNotifier = ValueNotifier<double>(1.0);
|
|
93
|
+
late final ValueNotifier<AppLocale> _localeNotifier;
|
|
94
|
+
final _screenshotKey = GlobalKey();
|
|
95
|
+
|
|
96
|
+
static const _textScaleSteps = [1.0, 1.3, 1.5];
|
|
97
|
+
|
|
98
|
+
List<DeviceInfo> get _devices => switch (_platform) {
|
|
99
|
+
1 => _androidDevices,
|
|
100
|
+
2 => _iPadDevices,
|
|
101
|
+
_ => _iosDevices,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
int get _currentIndex => switch (_platform) {
|
|
105
|
+
1 => _androidIndex,
|
|
106
|
+
2 => _iPadIndex,
|
|
107
|
+
_ => _iosIndex,
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
DeviceInfo get _currentDevice => _devices[_currentIndex];
|
|
111
|
+
|
|
112
|
+
@override
|
|
113
|
+
void initState() {
|
|
114
|
+
super.initState();
|
|
115
|
+
_localeNotifier = ValueNotifier<AppLocale>(
|
|
116
|
+
LocaleSettings.instance.currentLocale,
|
|
117
|
+
);
|
|
118
|
+
webDevicePreviewEnabledNotifier.addListener(_onEnabledChanged);
|
|
119
|
+
_bgDarkNotifier.addListener(_onBgChanged);
|
|
120
|
+
unawaited(_bootstrap());
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@override
|
|
124
|
+
void dispose() {
|
|
125
|
+
webDevicePreviewEnabledNotifier.removeListener(_onEnabledChanged);
|
|
126
|
+
_bgDarkNotifier.removeListener(_onBgChanged);
|
|
127
|
+
_deviceNotifier.dispose();
|
|
128
|
+
_frameVisibleNotifier.dispose();
|
|
129
|
+
_bgDarkNotifier.dispose();
|
|
130
|
+
_landscapeNotifier.dispose();
|
|
131
|
+
_textScaleNotifier.dispose();
|
|
132
|
+
_localeNotifier.dispose();
|
|
133
|
+
_controlsTimer?.cancel();
|
|
134
|
+
super.dispose();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
void _onEnabledChanged() {
|
|
138
|
+
if (webDevicePreviewEnabledNotifier.value) {
|
|
139
|
+
_controlsTimer?.cancel();
|
|
140
|
+
_controlsTimer = Timer(const Duration(milliseconds: 800), () {
|
|
141
|
+
if (mounted) setState(() => _controlsVisible = true);
|
|
142
|
+
});
|
|
143
|
+
setState(() {}); // rebuild DevicePreview with enabled: true
|
|
144
|
+
} else {
|
|
145
|
+
_controlsTimer?.cancel();
|
|
146
|
+
setState(() => _controlsVisible = false);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
void _onBgChanged() => setState(() {});
|
|
151
|
+
|
|
152
|
+
Future<void> _bootstrap() async {
|
|
153
|
+
final prefs = await SharedPreferences.getInstance();
|
|
154
|
+
|
|
155
|
+
final savedEnabled = prefs.getBool(webDevicePreviewEnabledPrefKey) ?? false;
|
|
156
|
+
final savedPlatform = prefs.getInt(_platformPrefKey);
|
|
157
|
+
final savedIosIndex = prefs.getInt(_iosIndexPrefKey);
|
|
158
|
+
final savedAndroidIndex = prefs.getInt(_androidIndexPrefKey);
|
|
159
|
+
final savedIPadIndex = prefs.getInt(_iPadIndexPrefKey);
|
|
160
|
+
final savedBgDark = prefs.getBool(_bgDarkPrefKey);
|
|
161
|
+
final savedLandscape = prefs.getBool(_landscapePrefKey);
|
|
162
|
+
final savedTextScale = prefs.getDouble(_textScalePrefKey);
|
|
163
|
+
|
|
164
|
+
if (!mounted) return;
|
|
165
|
+
setState(() {
|
|
166
|
+
if (savedPlatform != null) _platform = savedPlatform.clamp(0, 2);
|
|
167
|
+
if (savedIosIndex != null) {
|
|
168
|
+
_iosIndex = savedIosIndex.clamp(0, _iosDevices.length - 1);
|
|
169
|
+
}
|
|
170
|
+
if (savedAndroidIndex != null) {
|
|
171
|
+
_androidIndex = savedAndroidIndex.clamp(0, _androidDevices.length - 1);
|
|
172
|
+
}
|
|
173
|
+
if (savedIPadIndex != null) {
|
|
174
|
+
_iPadIndex = savedIPadIndex.clamp(0, _iPadDevices.length - 1);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
_deviceNotifier.value = _currentDevice;
|
|
178
|
+
if (savedBgDark != null) _bgDarkNotifier.value = savedBgDark;
|
|
179
|
+
if (savedLandscape != null) _landscapeNotifier.value = savedLandscape;
|
|
180
|
+
if (savedTextScale != null && _textScaleSteps.contains(savedTextScale)) {
|
|
181
|
+
_textScaleNotifier.value = savedTextScale;
|
|
182
|
+
}
|
|
183
|
+
if (savedEnabled) webDevicePreviewEnabledNotifier.value = true;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
Future<void> _close() async {
|
|
187
|
+
final prefs = await SharedPreferences.getInstance();
|
|
188
|
+
await prefs.setBool(webDevicePreviewEnabledPrefKey, false);
|
|
189
|
+
webDevicePreviewEnabledNotifier.value = false;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
Future<void> _savePlatform() async {
|
|
193
|
+
final prefs = await SharedPreferences.getInstance();
|
|
194
|
+
await prefs.setInt(_platformPrefKey, _platform);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
Future<void> _saveDeviceIndices() async {
|
|
198
|
+
final prefs = await SharedPreferences.getInstance();
|
|
199
|
+
await prefs.setInt(_iosIndexPrefKey, _iosIndex);
|
|
200
|
+
await prefs.setInt(_androidIndexPrefKey, _androidIndex);
|
|
201
|
+
await prefs.setInt(_iPadIndexPrefKey, _iPadIndex);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
Future<void> _saveBgDark() async {
|
|
205
|
+
final prefs = await SharedPreferences.getInstance();
|
|
206
|
+
await prefs.setBool(_bgDarkPrefKey, _bgDarkNotifier.value);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
Future<void> _saveLandscape() async {
|
|
210
|
+
final prefs = await SharedPreferences.getInstance();
|
|
211
|
+
await prefs.setBool(_landscapePrefKey, _landscapeNotifier.value);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
Future<void> _saveTextScale() async {
|
|
215
|
+
final prefs = await SharedPreferences.getInstance();
|
|
216
|
+
await prefs.setDouble(_textScalePrefKey, _textScaleNotifier.value);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
Future<void> _saveLocale(AppLocale locale) async {
|
|
220
|
+
final prefs = await SharedPreferences.getInstance();
|
|
221
|
+
await prefs.setString('app_locale', locale.languageCode);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
void _setPlatform(int p) {
|
|
225
|
+
setState(() => _platform = p);
|
|
226
|
+
_deviceNotifier.value = _currentDevice;
|
|
227
|
+
unawaited(_savePlatform());
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
void _toggleFrame() {
|
|
231
|
+
_frameVisibleNotifier.value = !_frameVisibleNotifier.value;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
void _toggleBg() {
|
|
235
|
+
_bgDarkNotifier.value = !_bgDarkNotifier.value;
|
|
236
|
+
unawaited(_saveBgDark());
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
void _toggleInspector() {
|
|
240
|
+
WidgetsBinding.instance.debugShowWidgetInspectorOverride =
|
|
241
|
+
!WidgetsBinding.instance.debugShowWidgetInspectorOverride;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
void _copyInspection() {
|
|
245
|
+
devInspectorCopyTriggerNotifier.value = true;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
void _toggleLandscape() {
|
|
249
|
+
_landscapeNotifier.value = !_landscapeNotifier.value;
|
|
250
|
+
unawaited(_saveLandscape());
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
void _cycleTextScale() {
|
|
254
|
+
final idx = _textScaleSteps.indexWhere(
|
|
255
|
+
(s) => (s - _textScaleNotifier.value).abs() < 0.01,
|
|
256
|
+
);
|
|
257
|
+
_textScaleNotifier.value =
|
|
258
|
+
_textScaleSteps[(idx + 1) % _textScaleSteps.length];
|
|
259
|
+
unawaited(_saveTextScale());
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
void _cycleLocale() {
|
|
263
|
+
const locales = AppLocale.values;
|
|
264
|
+
final idx = locales.indexOf(_localeNotifier.value);
|
|
265
|
+
final next = locales[(idx + 1) % locales.length];
|
|
266
|
+
LocaleSettings.setLocale(next);
|
|
267
|
+
unawaited(Jiffy.setLocale(next.languageCode));
|
|
268
|
+
_localeNotifier.value = next;
|
|
269
|
+
unawaited(_saveLocale(next));
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
Future<void> _takeScreenshot() async {
|
|
273
|
+
final boundary = _screenshotKey.currentContext?.findRenderObject()
|
|
274
|
+
as RenderRepaintBoundary?;
|
|
275
|
+
if (boundary == null) return;
|
|
276
|
+
final dpr =
|
|
277
|
+
WidgetsBinding.instance.platformDispatcher.implicitView?.devicePixelRatio
|
|
278
|
+
?? 2.0;
|
|
279
|
+
final image = await boundary.toImage(pixelRatio: dpr);
|
|
280
|
+
final byteData = await image.toByteData(format: ui.ImageByteFormat.png);
|
|
281
|
+
if (byteData == null) return;
|
|
282
|
+
final bytes = byteData.buffer.asUint8List();
|
|
283
|
+
final blob = html.Blob([bytes], 'image/png');
|
|
284
|
+
final url = html.Url.createObjectUrlFromBlob(blob);
|
|
285
|
+
html.AnchorElement(href: url)
|
|
286
|
+
..setAttribute(
|
|
287
|
+
'download',
|
|
288
|
+
'preview_${DateTime.now().millisecondsSinceEpoch}.png',
|
|
289
|
+
)
|
|
290
|
+
..click();
|
|
291
|
+
html.Url.revokeObjectUrl(url);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
void _prev() {
|
|
295
|
+
setState(() {
|
|
296
|
+
switch (_platform) {
|
|
297
|
+
case 1:
|
|
298
|
+
_androidIndex =
|
|
299
|
+
(_androidIndex - 1 + _androidDevices.length) %
|
|
300
|
+
_androidDevices.length;
|
|
301
|
+
case 2:
|
|
302
|
+
_iPadIndex =
|
|
303
|
+
(_iPadIndex - 1 + _iPadDevices.length) % _iPadDevices.length;
|
|
304
|
+
default:
|
|
305
|
+
_iosIndex =
|
|
306
|
+
(_iosIndex - 1 + _iosDevices.length) % _iosDevices.length;
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
_deviceNotifier.value = _currentDevice;
|
|
310
|
+
unawaited(_saveDeviceIndices());
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
void _next() {
|
|
314
|
+
setState(() {
|
|
315
|
+
switch (_platform) {
|
|
316
|
+
case 1:
|
|
317
|
+
_androidIndex = (_androidIndex + 1) % _androidDevices.length;
|
|
318
|
+
case 2:
|
|
319
|
+
_iPadIndex = (_iPadIndex + 1) % _iPadDevices.length;
|
|
320
|
+
default:
|
|
321
|
+
_iosIndex = (_iosIndex + 1) % _iosDevices.length;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
_deviceNotifier.value = _currentDevice;
|
|
325
|
+
unawaited(_saveDeviceIndices());
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
@override
|
|
329
|
+
Widget build(BuildContext context) {
|
|
330
|
+
final enabled = webDevicePreviewEnabledNotifier.value;
|
|
331
|
+
// Depend on ThemeProvider so the pill icon updates when app theme changes.
|
|
332
|
+
final appIsDark = ThemeProvider.of(context).mode == ThemeMode.dark;
|
|
333
|
+
|
|
334
|
+
// ThemeData.light() in Flutter 3.x M3 uses a lavender-tinted surface.
|
|
335
|
+
// Passing backgroundColor directly avoids that and gives us an exact color.
|
|
336
|
+
final canvasColor =
|
|
337
|
+
_bgDarkNotifier.value ? const Color(0xFF1C1C1E) : Colors.white;
|
|
338
|
+
|
|
339
|
+
final preview = DevicePreview(
|
|
340
|
+
enabled: enabled,
|
|
341
|
+
isToolbarVisible: false,
|
|
342
|
+
backgroundColor: canvasColor,
|
|
343
|
+
storage: DevicePreviewStorage.none(),
|
|
344
|
+
defaultDevice: _currentDevice,
|
|
345
|
+
devices: [..._iosDevices, ..._androidDevices, ..._iPadDevices],
|
|
346
|
+
builder: (context) => ListenableBuilder(
|
|
347
|
+
listenable: _textScaleNotifier,
|
|
348
|
+
builder: (ctx, _) => MediaQuery(
|
|
349
|
+
data: MediaQuery.of(ctx).copyWith(
|
|
350
|
+
textScaler: TextScaler.linear(_textScaleNotifier.value),
|
|
351
|
+
),
|
|
352
|
+
child: _DeviceSwitchBridge(
|
|
353
|
+
deviceNotifier: _deviceNotifier,
|
|
354
|
+
frameVisibleNotifier: _frameVisibleNotifier,
|
|
355
|
+
landscapeNotifier: _landscapeNotifier,
|
|
356
|
+
child: widget.child,
|
|
357
|
+
),
|
|
358
|
+
),
|
|
359
|
+
),
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
if (!enabled) return preview;
|
|
363
|
+
|
|
364
|
+
return TapRegionSurface(
|
|
365
|
+
child: Directionality(
|
|
366
|
+
textDirection: TextDirection.ltr,
|
|
367
|
+
child: Stack(
|
|
368
|
+
fit: StackFit.expand,
|
|
369
|
+
children: [
|
|
370
|
+
RepaintBoundary(key: _screenshotKey, child: preview),
|
|
371
|
+
Positioned(
|
|
372
|
+
top: 24,
|
|
373
|
+
right: 24,
|
|
374
|
+
child: AnimatedOpacity(
|
|
375
|
+
opacity: _controlsVisible ? 1.0 : 0.0,
|
|
376
|
+
duration: const Duration(milliseconds: 400),
|
|
377
|
+
child: IgnorePointer(
|
|
378
|
+
ignoring: !_controlsVisible,
|
|
379
|
+
child: ListenableBuilder(
|
|
380
|
+
listenable: Listenable.merge([
|
|
381
|
+
_frameVisibleNotifier,
|
|
382
|
+
_bgDarkNotifier,
|
|
383
|
+
_landscapeNotifier,
|
|
384
|
+
_textScaleNotifier,
|
|
385
|
+
_localeNotifier,
|
|
386
|
+
WidgetsBinding.instance
|
|
387
|
+
.debugShowWidgetInspectorOverrideNotifier,
|
|
388
|
+
]),
|
|
389
|
+
builder: (context, child) => _PreviewControls(
|
|
390
|
+
platform: _platform,
|
|
391
|
+
deviceName: _shortName(_currentDevice.name),
|
|
392
|
+
frameVisible: _frameVisibleNotifier.value,
|
|
393
|
+
bgDark: _bgDarkNotifier.value,
|
|
394
|
+
appIsDark: appIsDark,
|
|
395
|
+
isLandscape: _landscapeNotifier.value,
|
|
396
|
+
textScale: _textScaleNotifier.value,
|
|
397
|
+
currentLocale: _localeNotifier.value,
|
|
398
|
+
inspectorEnabled: WidgetsBinding
|
|
399
|
+
.instance.debugShowWidgetInspectorOverride,
|
|
400
|
+
onPlatformChanged: _setPlatform,
|
|
401
|
+
onPrev: _prev,
|
|
402
|
+
onNext: _next,
|
|
403
|
+
onToggleFrame: _toggleFrame,
|
|
404
|
+
onToggleBg: _toggleBg,
|
|
405
|
+
onToggleAppTheme: () => ThemeProvider.of(context).toggle(),
|
|
406
|
+
onToggleLandscape: _toggleLandscape,
|
|
407
|
+
onCycleTextScale: _cycleTextScale,
|
|
408
|
+
onCycleLocale: _cycleLocale,
|
|
409
|
+
onToggleInspector: _toggleInspector,
|
|
410
|
+
onCopyInspection: _copyInspection,
|
|
411
|
+
onScreenshot: () => unawaited(_takeScreenshot()),
|
|
412
|
+
onClose: () => unawaited(_close()),
|
|
413
|
+
),
|
|
414
|
+
),
|
|
415
|
+
),
|
|
416
|
+
),
|
|
417
|
+
),
|
|
418
|
+
],
|
|
419
|
+
),
|
|
420
|
+
),
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// ---------------------------------------------------------------------------
|
|
426
|
+
// Bridge — inside DevicePreview.builder, has DevicePreviewStore in context.
|
|
427
|
+
// ---------------------------------------------------------------------------
|
|
428
|
+
|
|
429
|
+
class _DeviceSwitchBridge extends StatefulWidget {
|
|
430
|
+
const _DeviceSwitchBridge({
|
|
431
|
+
required this.deviceNotifier,
|
|
432
|
+
required this.frameVisibleNotifier,
|
|
433
|
+
required this.landscapeNotifier,
|
|
434
|
+
required this.child,
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
final ValueNotifier<DeviceInfo> deviceNotifier;
|
|
438
|
+
final ValueNotifier<bool> frameVisibleNotifier;
|
|
439
|
+
final ValueNotifier<bool> landscapeNotifier;
|
|
440
|
+
final Widget child;
|
|
441
|
+
|
|
442
|
+
@override
|
|
443
|
+
State<_DeviceSwitchBridge> createState() => _DeviceSwitchBridgeState();
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
class _DeviceSwitchBridgeState extends State<_DeviceSwitchBridge> {
|
|
447
|
+
@override
|
|
448
|
+
void initState() {
|
|
449
|
+
super.initState();
|
|
450
|
+
widget.deviceNotifier.addListener(_onDeviceChanged);
|
|
451
|
+
widget.frameVisibleNotifier.addListener(_onFrameVisibleChanged);
|
|
452
|
+
widget.landscapeNotifier.addListener(_onOrientationChanged);
|
|
453
|
+
WidgetsBinding.instance.addPostFrameCallback((_) => _syncOrientation());
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
@override
|
|
457
|
+
void dispose() {
|
|
458
|
+
widget.deviceNotifier.removeListener(_onDeviceChanged);
|
|
459
|
+
widget.frameVisibleNotifier.removeListener(_onFrameVisibleChanged);
|
|
460
|
+
widget.landscapeNotifier.removeListener(_onOrientationChanged);
|
|
461
|
+
super.dispose();
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
void _onDeviceChanged() {
|
|
465
|
+
if (!mounted) return;
|
|
466
|
+
DevicePreview.selectDevice(context, widget.deviceNotifier.value.identifier);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
void _onFrameVisibleChanged() {
|
|
470
|
+
if (!mounted) return;
|
|
471
|
+
final store = Provider.of<DevicePreviewStore>(context, listen: false);
|
|
472
|
+
if (store.data.isFrameVisible != widget.frameVisibleNotifier.value) {
|
|
473
|
+
store.toggleFrame();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
void _onOrientationChanged() => _syncOrientation();
|
|
478
|
+
|
|
479
|
+
void _syncOrientation() {
|
|
480
|
+
if (!mounted) return;
|
|
481
|
+
final store = Provider.of<DevicePreviewStore>(context, listen: false);
|
|
482
|
+
final target = widget.landscapeNotifier.value
|
|
483
|
+
? Orientation.landscape
|
|
484
|
+
: Orientation.portrait;
|
|
485
|
+
if (store.data.orientation != target) {
|
|
486
|
+
store.data = store.data.copyWith(orientation: target);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
@override
|
|
491
|
+
Widget build(BuildContext context) => widget.child;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// ---------------------------------------------------------------------------
|
|
495
|
+
// Controls pill — StatefulWidget so the platform dropdown can self-manage.
|
|
496
|
+
// ---------------------------------------------------------------------------
|
|
497
|
+
|
|
498
|
+
class _PreviewControls extends StatefulWidget {
|
|
499
|
+
const _PreviewControls({
|
|
500
|
+
required this.platform,
|
|
501
|
+
required this.deviceName,
|
|
502
|
+
required this.frameVisible,
|
|
503
|
+
required this.bgDark,
|
|
504
|
+
required this.appIsDark,
|
|
505
|
+
required this.isLandscape,
|
|
506
|
+
required this.textScale,
|
|
507
|
+
required this.currentLocale,
|
|
508
|
+
required this.inspectorEnabled,
|
|
509
|
+
required this.onPlatformChanged,
|
|
510
|
+
required this.onPrev,
|
|
511
|
+
required this.onNext,
|
|
512
|
+
required this.onToggleFrame,
|
|
513
|
+
required this.onToggleBg,
|
|
514
|
+
required this.onToggleAppTheme,
|
|
515
|
+
required this.onToggleLandscape,
|
|
516
|
+
required this.onCycleTextScale,
|
|
517
|
+
required this.onCycleLocale,
|
|
518
|
+
required this.onToggleInspector,
|
|
519
|
+
required this.onCopyInspection,
|
|
520
|
+
required this.onScreenshot,
|
|
521
|
+
required this.onClose,
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
final int platform;
|
|
525
|
+
final String deviceName;
|
|
526
|
+
final bool frameVisible;
|
|
527
|
+
final bool bgDark;
|
|
528
|
+
final bool appIsDark;
|
|
529
|
+
final bool isLandscape;
|
|
530
|
+
final double textScale;
|
|
531
|
+
final AppLocale currentLocale;
|
|
532
|
+
final bool inspectorEnabled;
|
|
533
|
+
final ValueChanged<int> onPlatformChanged;
|
|
534
|
+
final VoidCallback onPrev;
|
|
535
|
+
final VoidCallback onNext;
|
|
536
|
+
final VoidCallback onToggleFrame;
|
|
537
|
+
final VoidCallback onToggleBg;
|
|
538
|
+
final VoidCallback onToggleAppTheme;
|
|
539
|
+
final VoidCallback onToggleLandscape;
|
|
540
|
+
final VoidCallback onCycleTextScale;
|
|
541
|
+
final VoidCallback onCycleLocale;
|
|
542
|
+
final VoidCallback onToggleInspector;
|
|
543
|
+
final VoidCallback onCopyInspection;
|
|
544
|
+
final VoidCallback onScreenshot;
|
|
545
|
+
final VoidCallback onClose;
|
|
546
|
+
|
|
547
|
+
@override
|
|
548
|
+
State<_PreviewControls> createState() => _PreviewControlsState();
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
class _PreviewControlsState extends State<_PreviewControls> {
|
|
552
|
+
bool _menuOpen = false;
|
|
553
|
+
bool _toolsMenuOpen = false;
|
|
554
|
+
bool _minimized = true;
|
|
555
|
+
bool _platformBtnHovered = false;
|
|
556
|
+
bool _toolsBtnHovered = false;
|
|
557
|
+
|
|
558
|
+
static const _platformLabels = ['iOS', 'Android', 'iPad'];
|
|
559
|
+
|
|
560
|
+
static const _pillDecoration = BoxDecoration(
|
|
561
|
+
color: Color(0xFF2C2C2E),
|
|
562
|
+
borderRadius: BorderRadius.all(Radius.circular(24)),
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
static const _pillShadow = [
|
|
566
|
+
BoxShadow(
|
|
567
|
+
color: Color(0x73000000),
|
|
568
|
+
blurRadius: 20,
|
|
569
|
+
offset: Offset(0, 6),
|
|
570
|
+
),
|
|
571
|
+
];
|
|
572
|
+
|
|
573
|
+
static String _textScaleLabel(double scale) => switch (scale) {
|
|
574
|
+
1.0 => '1×',
|
|
575
|
+
1.3 => '1.3×',
|
|
576
|
+
_ => '1.5×',
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
void _toggleMenu() => setState(() {
|
|
580
|
+
_menuOpen = !_menuOpen;
|
|
581
|
+
if (_menuOpen) _toolsMenuOpen = false;
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
void _toggleToolsMenu() => setState(() {
|
|
585
|
+
_toolsMenuOpen = !_toolsMenuOpen;
|
|
586
|
+
if (_toolsMenuOpen) _menuOpen = false;
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
void _selectPlatform(int i) {
|
|
590
|
+
widget.onPlatformChanged(i);
|
|
591
|
+
setState(() {
|
|
592
|
+
_menuOpen = false;
|
|
593
|
+
_toolsMenuOpen = false;
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
void _minimize() => setState(() {
|
|
598
|
+
_minimized = true;
|
|
599
|
+
_menuOpen = false;
|
|
600
|
+
_toolsMenuOpen = false;
|
|
601
|
+
});
|
|
602
|
+
|
|
603
|
+
void _maximize() => setState(() => _minimized = false);
|
|
604
|
+
|
|
605
|
+
@override
|
|
606
|
+
Widget build(BuildContext context) {
|
|
607
|
+
return TapRegion(
|
|
608
|
+
onTapOutside: (_) {
|
|
609
|
+
if (_menuOpen || _toolsMenuOpen) {
|
|
610
|
+
setState(() {
|
|
611
|
+
_menuOpen = false;
|
|
612
|
+
_toolsMenuOpen = false;
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
child: Column(
|
|
617
|
+
crossAxisAlignment: CrossAxisAlignment.start,
|
|
618
|
+
mainAxisSize: MainAxisSize.min,
|
|
619
|
+
children: [
|
|
620
|
+
if (_minimized) _buildMinimizedPill() else _buildPill(),
|
|
621
|
+
if (_menuOpen && !_minimized) _buildMenu(),
|
|
622
|
+
if (_toolsMenuOpen && !_minimized) _buildToolsMenu(),
|
|
623
|
+
],
|
|
624
|
+
),
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
Widget _buildMinimizedPill() {
|
|
629
|
+
return Container(
|
|
630
|
+
height: 40,
|
|
631
|
+
padding: const EdgeInsets.symmetric(horizontal: 4),
|
|
632
|
+
decoration: _pillDecoration.copyWith(boxShadow: _pillShadow),
|
|
633
|
+
child: Row(
|
|
634
|
+
mainAxisSize: MainAxisSize.min,
|
|
635
|
+
children: [
|
|
636
|
+
_IconBtn(
|
|
637
|
+
icon: Icons.unfold_more_rounded,
|
|
638
|
+
onTap: _maximize,
|
|
639
|
+
),
|
|
640
|
+
_VerticalDivider(),
|
|
641
|
+
_IconBtn(
|
|
642
|
+
icon: Icons.close_rounded,
|
|
643
|
+
onTap: widget.onClose,
|
|
644
|
+
color: Colors.white54,
|
|
645
|
+
),
|
|
646
|
+
const SizedBox(width: 2),
|
|
647
|
+
],
|
|
648
|
+
),
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
Widget _buildPill() {
|
|
653
|
+
return Container(
|
|
654
|
+
height: 40,
|
|
655
|
+
padding: const EdgeInsets.symmetric(horizontal: 4),
|
|
656
|
+
decoration: _pillDecoration.copyWith(boxShadow: _pillShadow),
|
|
657
|
+
child: Row(
|
|
658
|
+
mainAxisSize: MainAxisSize.min,
|
|
659
|
+
children: [
|
|
660
|
+
// Platform selector button
|
|
661
|
+
MouseRegion(
|
|
662
|
+
onEnter: (_) => setState(() => _platformBtnHovered = true),
|
|
663
|
+
onExit: (_) => setState(() => _platformBtnHovered = false),
|
|
664
|
+
cursor: SystemMouseCursors.click,
|
|
665
|
+
child: GestureDetector(
|
|
666
|
+
onTap: _toggleMenu,
|
|
667
|
+
child: AnimatedContainer(
|
|
668
|
+
duration: const Duration(milliseconds: 160),
|
|
669
|
+
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 4),
|
|
670
|
+
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
671
|
+
decoration: BoxDecoration(
|
|
672
|
+
color: Colors.white.withValues(
|
|
673
|
+
alpha: _menuOpen ? 0.22 : (_platformBtnHovered ? 0.20 : 0.14),
|
|
674
|
+
),
|
|
675
|
+
borderRadius: BorderRadius.circular(20),
|
|
676
|
+
),
|
|
677
|
+
child: Row(
|
|
678
|
+
mainAxisSize: MainAxisSize.min,
|
|
679
|
+
children: [
|
|
680
|
+
Text(
|
|
681
|
+
_platformLabels[widget.platform],
|
|
682
|
+
style: const TextStyle(
|
|
683
|
+
color: Colors.white,
|
|
684
|
+
fontSize: 12,
|
|
685
|
+
fontWeight: FontWeight.w600,
|
|
686
|
+
),
|
|
687
|
+
),
|
|
688
|
+
const SizedBox(width: 2),
|
|
689
|
+
AnimatedRotation(
|
|
690
|
+
turns: _menuOpen ? 0.5 : 0,
|
|
691
|
+
duration: const Duration(milliseconds: 160),
|
|
692
|
+
child: const Icon(
|
|
693
|
+
Icons.keyboard_arrow_down_rounded,
|
|
694
|
+
color: Colors.white70,
|
|
695
|
+
size: 13,
|
|
696
|
+
),
|
|
697
|
+
),
|
|
698
|
+
],
|
|
699
|
+
),
|
|
700
|
+
),
|
|
701
|
+
),
|
|
702
|
+
),
|
|
703
|
+
_VerticalDivider(),
|
|
704
|
+
_IconBtn(icon: Icons.chevron_left_rounded, onTap: widget.onPrev),
|
|
705
|
+
Padding(
|
|
706
|
+
padding: const EdgeInsets.symmetric(horizontal: 8),
|
|
707
|
+
child: Text(
|
|
708
|
+
widget.deviceName,
|
|
709
|
+
style: const TextStyle(
|
|
710
|
+
color: Colors.white,
|
|
711
|
+
fontSize: 12,
|
|
712
|
+
fontWeight: FontWeight.w500,
|
|
713
|
+
letterSpacing: -0.2,
|
|
714
|
+
),
|
|
715
|
+
),
|
|
716
|
+
),
|
|
717
|
+
_IconBtn(icon: Icons.chevron_right_rounded, onTap: widget.onNext),
|
|
718
|
+
// Locale chip
|
|
719
|
+
_VerticalDivider(),
|
|
720
|
+
_PillChip(
|
|
721
|
+
label: widget.currentLocale.languageCode.toUpperCase(),
|
|
722
|
+
onTap: widget.onCycleLocale,
|
|
723
|
+
),
|
|
724
|
+
// Tools dropdown
|
|
725
|
+
_VerticalDivider(),
|
|
726
|
+
MouseRegion(
|
|
727
|
+
onEnter: (_) => setState(() => _toolsBtnHovered = true),
|
|
728
|
+
onExit: (_) => setState(() => _toolsBtnHovered = false),
|
|
729
|
+
cursor: SystemMouseCursors.click,
|
|
730
|
+
child: GestureDetector(
|
|
731
|
+
onTap: _toggleToolsMenu,
|
|
732
|
+
child: AnimatedContainer(
|
|
733
|
+
duration: const Duration(milliseconds: 160),
|
|
734
|
+
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 4),
|
|
735
|
+
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
736
|
+
decoration: BoxDecoration(
|
|
737
|
+
color: Colors.white.withValues(
|
|
738
|
+
alpha: _toolsMenuOpen ? 0.22 : (_toolsBtnHovered ? 0.20 : 0.14),
|
|
739
|
+
),
|
|
740
|
+
borderRadius: BorderRadius.circular(20),
|
|
741
|
+
),
|
|
742
|
+
child: Row(
|
|
743
|
+
mainAxisSize: MainAxisSize.min,
|
|
744
|
+
children: [
|
|
745
|
+
const Text(
|
|
746
|
+
'Tools',
|
|
747
|
+
style: TextStyle(
|
|
748
|
+
color: Colors.white,
|
|
749
|
+
fontSize: 12,
|
|
750
|
+
fontWeight: FontWeight.w600,
|
|
751
|
+
),
|
|
752
|
+
),
|
|
753
|
+
const SizedBox(width: 2),
|
|
754
|
+
AnimatedRotation(
|
|
755
|
+
turns: _toolsMenuOpen ? 0.5 : 0,
|
|
756
|
+
duration: const Duration(milliseconds: 160),
|
|
757
|
+
child: const Icon(
|
|
758
|
+
Icons.keyboard_arrow_down_rounded,
|
|
759
|
+
color: Colors.white70,
|
|
760
|
+
size: 13,
|
|
761
|
+
),
|
|
762
|
+
),
|
|
763
|
+
],
|
|
764
|
+
),
|
|
765
|
+
),
|
|
766
|
+
),
|
|
767
|
+
),
|
|
768
|
+
// Inspector group
|
|
769
|
+
_VerticalDivider(),
|
|
770
|
+
_IconBtn(
|
|
771
|
+
icon: Icons.touch_app_rounded,
|
|
772
|
+
onTap: widget.onToggleInspector,
|
|
773
|
+
color: widget.inspectorEnabled ? Colors.white : Colors.white30,
|
|
774
|
+
),
|
|
775
|
+
if (widget.inspectorEnabled)
|
|
776
|
+
_IconBtn(
|
|
777
|
+
icon: Icons.content_copy_rounded,
|
|
778
|
+
onTap: widget.onCopyInspection,
|
|
779
|
+
),
|
|
780
|
+
// Utilities: minimize · close
|
|
781
|
+
_VerticalDivider(),
|
|
782
|
+
_IconBtn(
|
|
783
|
+
icon: Icons.unfold_less_rounded,
|
|
784
|
+
onTap: _minimize,
|
|
785
|
+
color: Colors.white30,
|
|
786
|
+
),
|
|
787
|
+
_IconBtn(
|
|
788
|
+
icon: Icons.close_rounded,
|
|
789
|
+
onTap: widget.onClose,
|
|
790
|
+
color: Colors.white54,
|
|
791
|
+
),
|
|
792
|
+
const SizedBox(width: 2),
|
|
793
|
+
],
|
|
794
|
+
),
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
Widget _buildMenu() {
|
|
799
|
+
return Container(
|
|
800
|
+
margin: const EdgeInsets.only(top: 6),
|
|
801
|
+
padding: const EdgeInsets.symmetric(vertical: 4),
|
|
802
|
+
decoration: BoxDecoration(
|
|
803
|
+
color: const Color(0xFF3A3A3C),
|
|
804
|
+
borderRadius: BorderRadius.circular(12),
|
|
805
|
+
boxShadow: [
|
|
806
|
+
BoxShadow(
|
|
807
|
+
color: Colors.black.withValues(alpha: 0.4),
|
|
808
|
+
blurRadius: 16,
|
|
809
|
+
offset: const Offset(0, 4),
|
|
810
|
+
),
|
|
811
|
+
],
|
|
812
|
+
),
|
|
813
|
+
child: IntrinsicWidth(
|
|
814
|
+
child: Column(
|
|
815
|
+
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
816
|
+
mainAxisSize: MainAxisSize.min,
|
|
817
|
+
children: List.generate(_platformLabels.length, (i) {
|
|
818
|
+
final selected = widget.platform == i;
|
|
819
|
+
return _DropdownItem(
|
|
820
|
+
label: _platformLabels[i],
|
|
821
|
+
selected: selected,
|
|
822
|
+
onTap: () => _selectPlatform(i),
|
|
823
|
+
);
|
|
824
|
+
}),
|
|
825
|
+
),
|
|
826
|
+
),
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
Widget _buildToolsMenu() {
|
|
831
|
+
return Container(
|
|
832
|
+
margin: const EdgeInsets.only(top: 6),
|
|
833
|
+
padding: const EdgeInsets.symmetric(vertical: 4),
|
|
834
|
+
decoration: BoxDecoration(
|
|
835
|
+
color: const Color(0xFF3A3A3C),
|
|
836
|
+
borderRadius: BorderRadius.circular(12),
|
|
837
|
+
boxShadow: [
|
|
838
|
+
BoxShadow(
|
|
839
|
+
color: Colors.black.withValues(alpha: 0.4),
|
|
840
|
+
blurRadius: 16,
|
|
841
|
+
offset: const Offset(0, 4),
|
|
842
|
+
),
|
|
843
|
+
],
|
|
844
|
+
),
|
|
845
|
+
child: IntrinsicWidth(
|
|
846
|
+
child: Column(
|
|
847
|
+
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
848
|
+
mainAxisSize: MainAxisSize.min,
|
|
849
|
+
children: [
|
|
850
|
+
_ToolsItem(
|
|
851
|
+
icon: widget.frameVisible
|
|
852
|
+
? Icons.smartphone_rounded
|
|
853
|
+
: Icons.crop_free_rounded,
|
|
854
|
+
label: t.webDevicePreview.frame,
|
|
855
|
+
checked: widget.frameVisible,
|
|
856
|
+
onTap: widget.onToggleFrame,
|
|
857
|
+
),
|
|
858
|
+
_ToolsItem(
|
|
859
|
+
icon: Icons.contrast_rounded,
|
|
860
|
+
label: t.webDevicePreview.darkBackground,
|
|
861
|
+
checked: widget.bgDark,
|
|
862
|
+
onTap: widget.onToggleBg,
|
|
863
|
+
),
|
|
864
|
+
_ToolsItem(
|
|
865
|
+
icon: widget.appIsDark
|
|
866
|
+
? Icons.dark_mode_rounded
|
|
867
|
+
: Icons.light_mode_rounded,
|
|
868
|
+
label: t.webDevicePreview.darkTheme,
|
|
869
|
+
checked: widget.appIsDark,
|
|
870
|
+
onTap: widget.onToggleAppTheme,
|
|
871
|
+
),
|
|
872
|
+
_ToolsItem(
|
|
873
|
+
icon: widget.isLandscape
|
|
874
|
+
? Icons.stay_current_landscape_rounded
|
|
875
|
+
: Icons.stay_current_portrait_rounded,
|
|
876
|
+
label: t.webDevicePreview.landscape,
|
|
877
|
+
checked: widget.isLandscape,
|
|
878
|
+
onTap: widget.onToggleLandscape,
|
|
879
|
+
),
|
|
880
|
+
_ToolsItem(
|
|
881
|
+
icon: Icons.text_fields_rounded,
|
|
882
|
+
label: t.webDevicePreview.textScale,
|
|
883
|
+
trailingLabel: _textScaleLabel(widget.textScale),
|
|
884
|
+
onTap: widget.onCycleTextScale,
|
|
885
|
+
),
|
|
886
|
+
Divider(
|
|
887
|
+
height: 1,
|
|
888
|
+
color: Colors.white.withValues(alpha: 0.10),
|
|
889
|
+
),
|
|
890
|
+
_ToolsItem(
|
|
891
|
+
icon: Icons.photo_camera_rounded,
|
|
892
|
+
label: t.webDevicePreview.screenshot,
|
|
893
|
+
onTap: () {
|
|
894
|
+
setState(() => _toolsMenuOpen = false);
|
|
895
|
+
widget.onScreenshot();
|
|
896
|
+
},
|
|
897
|
+
),
|
|
898
|
+
],
|
|
899
|
+
),
|
|
900
|
+
),
|
|
901
|
+
);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
class _DropdownItem extends StatefulWidget {
|
|
906
|
+
const _DropdownItem({
|
|
907
|
+
required this.label,
|
|
908
|
+
required this.selected,
|
|
909
|
+
required this.onTap,
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
final String label;
|
|
913
|
+
final bool selected;
|
|
914
|
+
final VoidCallback onTap;
|
|
915
|
+
|
|
916
|
+
@override
|
|
917
|
+
State<_DropdownItem> createState() => _DropdownItemState();
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
class _DropdownItemState extends State<_DropdownItem> {
|
|
921
|
+
bool _hovered = false;
|
|
922
|
+
|
|
923
|
+
@override
|
|
924
|
+
Widget build(BuildContext context) {
|
|
925
|
+
return MouseRegion(
|
|
926
|
+
onEnter: (_) => setState(() => _hovered = true),
|
|
927
|
+
onExit: (_) => setState(() => _hovered = false),
|
|
928
|
+
cursor: SystemMouseCursors.click,
|
|
929
|
+
child: GestureDetector(
|
|
930
|
+
onTap: widget.onTap,
|
|
931
|
+
child: AnimatedContainer(
|
|
932
|
+
duration: const Duration(milliseconds: 120),
|
|
933
|
+
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
|
934
|
+
color: _hovered
|
|
935
|
+
? Colors.white.withValues(alpha: 0.10)
|
|
936
|
+
: Colors.transparent,
|
|
937
|
+
child: Text(
|
|
938
|
+
widget.label,
|
|
939
|
+
style: TextStyle(
|
|
940
|
+
color: widget.selected ? Colors.white : Colors.white54,
|
|
941
|
+
fontWeight:
|
|
942
|
+
widget.selected ? FontWeight.w600 : FontWeight.w400,
|
|
943
|
+
fontSize: 13,
|
|
944
|
+
),
|
|
945
|
+
),
|
|
946
|
+
),
|
|
947
|
+
),
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
class _PillChip extends StatefulWidget {
|
|
953
|
+
const _PillChip({
|
|
954
|
+
required this.label,
|
|
955
|
+
required this.onTap,
|
|
956
|
+
});
|
|
957
|
+
|
|
958
|
+
final String label;
|
|
959
|
+
final VoidCallback onTap;
|
|
960
|
+
|
|
961
|
+
@override
|
|
962
|
+
State<_PillChip> createState() => _PillChipState();
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
class _PillChipState extends State<_PillChip> {
|
|
966
|
+
bool _hovered = false;
|
|
967
|
+
|
|
968
|
+
@override
|
|
969
|
+
Widget build(BuildContext context) {
|
|
970
|
+
return MouseRegion(
|
|
971
|
+
onEnter: (_) => setState(() => _hovered = true),
|
|
972
|
+
onExit: (_) => setState(() => _hovered = false),
|
|
973
|
+
cursor: SystemMouseCursors.click,
|
|
974
|
+
child: GestureDetector(
|
|
975
|
+
onTap: widget.onTap,
|
|
976
|
+
child: AnimatedContainer(
|
|
977
|
+
duration: const Duration(milliseconds: 120),
|
|
978
|
+
margin: const EdgeInsets.symmetric(vertical: 4, horizontal: 4),
|
|
979
|
+
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
980
|
+
decoration: BoxDecoration(
|
|
981
|
+
color: Colors.white.withValues(alpha: _hovered ? 0.22 : 0.14),
|
|
982
|
+
borderRadius: BorderRadius.circular(20),
|
|
983
|
+
),
|
|
984
|
+
child: Text(
|
|
985
|
+
widget.label,
|
|
986
|
+
style: const TextStyle(
|
|
987
|
+
color: Colors.white,
|
|
988
|
+
fontSize: 11,
|
|
989
|
+
fontWeight: FontWeight.w600,
|
|
990
|
+
letterSpacing: 0.3,
|
|
991
|
+
),
|
|
992
|
+
),
|
|
993
|
+
),
|
|
994
|
+
),
|
|
995
|
+
);
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
class _ToolsItem extends StatefulWidget {
|
|
1000
|
+
const _ToolsItem({
|
|
1001
|
+
required this.icon,
|
|
1002
|
+
required this.label,
|
|
1003
|
+
required this.onTap,
|
|
1004
|
+
this.checked,
|
|
1005
|
+
this.trailingLabel,
|
|
1006
|
+
});
|
|
1007
|
+
|
|
1008
|
+
final IconData icon;
|
|
1009
|
+
final String label;
|
|
1010
|
+
final VoidCallback onTap;
|
|
1011
|
+
final bool? checked;
|
|
1012
|
+
final String? trailingLabel;
|
|
1013
|
+
|
|
1014
|
+
@override
|
|
1015
|
+
State<_ToolsItem> createState() => _ToolsItemState();
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
class _ToolsItemState extends State<_ToolsItem> {
|
|
1019
|
+
bool _hovered = false;
|
|
1020
|
+
|
|
1021
|
+
@override
|
|
1022
|
+
Widget build(BuildContext context) {
|
|
1023
|
+
return MouseRegion(
|
|
1024
|
+
onEnter: (_) => setState(() => _hovered = true),
|
|
1025
|
+
onExit: (_) => setState(() => _hovered = false),
|
|
1026
|
+
cursor: SystemMouseCursors.click,
|
|
1027
|
+
child: GestureDetector(
|
|
1028
|
+
onTap: widget.onTap,
|
|
1029
|
+
child: AnimatedContainer(
|
|
1030
|
+
duration: const Duration(milliseconds: 120),
|
|
1031
|
+
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 9),
|
|
1032
|
+
color: _hovered
|
|
1033
|
+
? Colors.white.withValues(alpha: 0.10)
|
|
1034
|
+
: Colors.transparent,
|
|
1035
|
+
child: Row(
|
|
1036
|
+
mainAxisSize: MainAxisSize.min,
|
|
1037
|
+
children: [
|
|
1038
|
+
Icon(widget.icon, color: Colors.white60, size: 14),
|
|
1039
|
+
const SizedBox(width: 10),
|
|
1040
|
+
Text(
|
|
1041
|
+
widget.label,
|
|
1042
|
+
style: const TextStyle(
|
|
1043
|
+
color: Colors.white,
|
|
1044
|
+
fontSize: 13,
|
|
1045
|
+
fontWeight: FontWeight.w400,
|
|
1046
|
+
),
|
|
1047
|
+
),
|
|
1048
|
+
const SizedBox(width: 16),
|
|
1049
|
+
if (widget.trailingLabel != null)
|
|
1050
|
+
Text(
|
|
1051
|
+
widget.trailingLabel!,
|
|
1052
|
+
style: const TextStyle(
|
|
1053
|
+
color: Colors.white38,
|
|
1054
|
+
fontSize: 12,
|
|
1055
|
+
fontWeight: FontWeight.w500,
|
|
1056
|
+
),
|
|
1057
|
+
)
|
|
1058
|
+
else
|
|
1059
|
+
Icon(
|
|
1060
|
+
Icons.check_rounded,
|
|
1061
|
+
size: 14,
|
|
1062
|
+
color: (widget.checked ?? false)
|
|
1063
|
+
? Colors.white
|
|
1064
|
+
: Colors.transparent,
|
|
1065
|
+
),
|
|
1066
|
+
],
|
|
1067
|
+
),
|
|
1068
|
+
),
|
|
1069
|
+
),
|
|
1070
|
+
);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
class _VerticalDivider extends StatelessWidget {
|
|
1075
|
+
@override
|
|
1076
|
+
Widget build(BuildContext context) {
|
|
1077
|
+
return Container(
|
|
1078
|
+
width: 1,
|
|
1079
|
+
height: 18,
|
|
1080
|
+
margin: const EdgeInsets.symmetric(horizontal: 4),
|
|
1081
|
+
color: Colors.white.withValues(alpha: 0.12),
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
class _IconBtn extends StatefulWidget {
|
|
1087
|
+
const _IconBtn({
|
|
1088
|
+
required this.icon,
|
|
1089
|
+
required this.onTap,
|
|
1090
|
+
this.color = Colors.white60,
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
final IconData icon;
|
|
1094
|
+
final VoidCallback onTap;
|
|
1095
|
+
final Color color;
|
|
1096
|
+
|
|
1097
|
+
@override
|
|
1098
|
+
State<_IconBtn> createState() => _IconBtnState();
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
class _IconBtnState extends State<_IconBtn> {
|
|
1102
|
+
bool _hovered = false;
|
|
1103
|
+
|
|
1104
|
+
@override
|
|
1105
|
+
Widget build(BuildContext context) {
|
|
1106
|
+
return MouseRegion(
|
|
1107
|
+
onEnter: (_) => setState(() => _hovered = true),
|
|
1108
|
+
onExit: (_) => setState(() => _hovered = false),
|
|
1109
|
+
cursor: SystemMouseCursors.click,
|
|
1110
|
+
child: GestureDetector(
|
|
1111
|
+
onTap: widget.onTap,
|
|
1112
|
+
child: AnimatedContainer(
|
|
1113
|
+
duration: const Duration(milliseconds: 120),
|
|
1114
|
+
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 8),
|
|
1115
|
+
decoration: BoxDecoration(
|
|
1116
|
+
color: _hovered
|
|
1117
|
+
? Colors.white.withValues(alpha: 0.12)
|
|
1118
|
+
: Colors.transparent,
|
|
1119
|
+
borderRadius: BorderRadius.circular(8),
|
|
1120
|
+
),
|
|
1121
|
+
child: Icon(widget.icon, color: widget.color, size: 16),
|
|
1122
|
+
),
|
|
1123
|
+
),
|
|
1124
|
+
);
|
|
1125
|
+
}
|
|
1126
|
+
}
|