create-flutterinit 0.1.0
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/bin/index.ts +3 -0
- package/package.json +46 -0
- package/templates/base/.cursor/rules/flutter-project.mdc.hbs +132 -0
- package/templates/base/AGENTS.md.hbs +137 -0
- package/templates/base/DESIGN.md.hbs +149 -0
- package/templates/base/README.md.hbs +19 -0
- package/templates/base/SETUP.md.hbs +253 -0
- package/templates/base/analysis_options.yaml +88 -0
- package/templates/base/assets/.keep +1 -0
- package/templates/base/assets/icons/apple.svg +1 -0
- package/templates/base/assets/icons/facebook.svg +1 -0
- package/templates/base/assets/icons/google.svg +1 -0
- package/templates/base/assets/images/.gitkeep +0 -0
- package/templates/base/flutter_native_splash.yaml.hbs +8 -0
- package/templates/base/lib/main.dart.hbs +43 -0
- package/templates/base/lib/src/app.dart.hbs +105 -0
- package/templates/base/lib/src/config/app_config.dart.hbs +112 -0
- package/templates/base/lib/src/extensions/collection_extension.dart.hbs +55 -0
- package/templates/base/lib/src/extensions/context_extension.dart.hbs +167 -0
- package/templates/base/lib/src/extensions/date_time_extension.dart.hbs +40 -0
- package/templates/base/lib/src/extensions/extensions.dart.hbs +6 -0
- package/templates/base/lib/src/extensions/num_extension.dart.hbs +14 -0
- package/templates/base/lib/src/extensions/string_extension.dart.hbs +91 -0
- package/templates/base/lib/src/extensions/widget_extension.dart.hbs +47 -0
- package/templates/base/lib/src/imports/core_imports.dart.hbs +50 -0
- package/templates/base/lib/src/imports/imports.dart.hbs +2 -0
- package/templates/base/lib/src/imports/packages_imports.dart.hbs +110 -0
- package/templates/base/lib/src/routing/(isGetX)@app_bindings.dart.hbs +23 -0
- package/templates/base/lib/src/routing/app_router.dart.hbs +252 -0
- package/templates/base/lib/src/routing/app_routes.dart.hbs +46 -0
- package/templates/base/lib/src/routing/global_navigator.dart.hbs +15 -0
- package/templates/base/lib/src/services/auth_service.dart.hbs +78 -0
- package/templates/base/lib/src/services/copy_service.dart.hbs +16 -0
- package/templates/base/lib/src/services/internet_connection_service.dart.hbs +10 -0
- package/templates/base/lib/src/services/services.dart.hbs +45 -0
- package/templates/base/lib/src/shared/app_assets.dart.hbs +15 -0
- package/templates/base/lib/src/shared/enums/app_status.dart.hbs +40 -0
- package/templates/base/lib/src/shared/enums/button_enums.dart.hbs +22 -0
- package/templates/base/lib/src/shared/enums/enums.dart.hbs +3 -0
- package/templates/base/lib/src/shared/enums/snack_bar_type.dart.hbs +22 -0
- package/templates/base/lib/src/shared/helpers/format_number.dart.hbs +18 -0
- package/templates/base/lib/src/shared/helpers/imports.dart.hbs +3 -0
- package/templates/base/lib/src/shared/helpers/show_app_sheet.dart.hbs +42 -0
- package/templates/base/lib/src/shared/helpers/show_dialog.dart.hbs +49 -0
- package/templates/base/lib/src/shared/helpers/show_toast.dart.hbs +92 -0
- package/templates/base/lib/src/shared/hooks/hooks.dart.hbs +13 -0
- package/templates/base/lib/src/shared/hooks/use_copy.dart.hbs +41 -0
- package/templates/base/lib/src/shared/hooks/use_timer.dart.hbs +158 -0
- package/templates/base/lib/src/shared/shared.dart.hbs +12 -0
- package/templates/base/lib/src/shared/widgets/app_button.dart.hbs +144 -0
- package/templates/base/lib/src/shared/widgets/app_card.dart.hbs +126 -0
- package/templates/base/lib/src/shared/widgets/app_divider.dart.hbs +88 -0
- package/templates/base/lib/src/shared/widgets/app_empty_state.dart.hbs +73 -0
- package/templates/base/lib/src/shared/widgets/app_error_widget.dart.hbs +69 -0
- package/templates/base/lib/src/shared/widgets/app_icon.dart.hbs +25 -0
- package/templates/base/lib/src/shared/widgets/app_loading.dart.hbs +54 -0
- package/templates/base/lib/src/shared/widgets/app_text_field.dart.hbs +89 -0
- package/templates/base/lib/src/shared/widgets/app_top_bar.dart.hbs +105 -0
- package/templates/base/lib/src/shared/widgets/common_image.dart.hbs +120 -0
- package/templates/base/lib/src/shared/widgets/toast/imports.dart.hbs +4 -0
- package/templates/base/lib/src/shared/widgets/toast/raw_toast.dart.hbs +109 -0
- package/templates/base/lib/src/shared/widgets/toast/toast.dart.hbs +142 -0
- package/templates/base/lib/src/shared/widgets/toast/toast_card.dart.hbs +57 -0
- package/templates/base/lib/src/shared/widgets/widgets.dart.hbs +14 -0
- package/templates/base/lib/src/shared/wrappers/(isRiverpod,isProvider,isBloc,isGetX,isMobX)@state_wrapper.dart.hbs +51 -0
- package/templates/base/lib/src/shared/wrappers/(supportsLocalization)@localization_wrapper.dart.hbs +25 -0
- package/templates/base/lib/src/shared/wrappers/(usesScreenutil)@screen_util_wrapper.dart.hbs +27 -0
- package/templates/base/lib/src/shared/wrappers/(usesSkeletonizer)@skeleton_wrapper.dart.hbs +81 -0
- package/templates/base/lib/src/shared/wrappers/session_listener_wrapper.dart.hbs +258 -0
- package/templates/base/lib/src/shared/wrappers/wrappers.dart.hbs +15 -0
- package/templates/base/lib/src/theme/app_borders.dart.hbs +70 -0
- package/templates/base/lib/src/theme/app_curves.dart.hbs +69 -0
- package/templates/base/lib/src/theme/app_durations.dart.hbs +48 -0
- package/templates/base/lib/src/theme/app_shadows.dart.hbs +73 -0
- package/templates/base/lib/src/theme/app_spacing.dart.hbs +80 -0
- package/templates/base/lib/src/theme/color_schemes.dart.hbs +126 -0
- package/templates/base/lib/src/theme/text_theme.dart.hbs +167 -0
- package/templates/base/lib/src/theme/theme.dart.hbs +431 -0
- package/templates/base/lib/src/theme/theme_constants.dart.hbs +20 -0
- package/templates/base/lib/src/utils/app_utils.dart.hbs +46 -0
- package/templates/base/lib/src/utils/debouncer.dart.hbs +31 -0
- package/templates/base/lib/src/utils/error_handler.dart.hbs +14 -0
- package/templates/base/lib/src/utils/failure.dart.hbs +30 -0
- package/templates/base/lib/src/utils/input_formatters.dart.hbs +27 -0
- package/templates/base/lib/src/utils/logger.dart.hbs +37 -0
- package/templates/base/lib/src/utils/platform_info.dart.hbs +13 -0
- package/templates/base/lib/src/utils/task_runner.dart.hbs +42 -0
- package/templates/base/lib/src/utils/typedefs.dart.hbs +6 -0
- package/templates/base/lib/src/utils/utils.dart.hbs +9 -0
- package/templates/base/pubspec.yaml.hbs +256 -0
- package/templates/base/test/widget_test.dart.hbs +56 -0
- package/templates/overlays/architecture/clean/architecture.md +6 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/data/models/user_model.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/data/repositories/auth_repository_impl.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/domain/entities/user.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/domain/repositories/auth_repository.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isBloc)@auth_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isBloc)@session_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isGetX)@auth_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isGetX)@session_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isMobX)@auth_store.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isMobX)@session_store.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isNoneState)@session_manager.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isProvider,isRiverpod)@auth_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/providers/(isProvider,isRiverpod)@session_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/screens/forgot_password_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/screens/login_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/auth/presentation/screens/signup_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/home/presentation/screens/home_page.dart.hbs +1 -0
- package/templates/overlays/architecture/clean/lib/src/features/onboarding/presentation/screens/onboarding_page.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/architecture.md +5 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/data/models/user_model.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/data/repositories/auth_repository_impl.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/domain/entities/user.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/domain/repositories/auth_repository.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isBloc)@auth_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isBloc)@session_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isGetX)@auth_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isGetX)@session_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isMobX)@auth_store.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isMobX)@session_store.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isNoneState)@session_manager.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isProvider,isRiverpod)@auth_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/providers/(isProvider,isRiverpod)@session_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/screens/forgot_password_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/screens/login_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/auth/presentation/screens/signup_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/home/presentation/screens/home_page.dart.hbs +1 -0
- package/templates/overlays/architecture/feature-first/lib/src/features/onboarding/presentation/screens/onboarding_page.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/architecture.md +6 -0
- package/templates/overlays/architecture/layer-first/lib/src/data/datasources/local/.gitkeep +0 -0
- package/templates/overlays/architecture/layer-first/lib/src/data/datasources/remote/.gitkeep +0 -0
- package/templates/overlays/architecture/layer-first/lib/src/data/models/user_model.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/data/repositories/auth_repository_impl.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/domain/entities/user.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/domain/repositories/auth_repository.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/domain/usecases/auth/.gitkeep +0 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isBloc)@auth_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isBloc)@session_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isGetX)@auth_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isGetX)@session_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isMobX)@auth_store.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isMobX)@session_store.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isNoneState)@auth_view_model.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isNoneState)@session_manager.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isProvider,isRiverpod)@auth_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/providers/(isProvider,isRiverpod)@session_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/screens/auth/forgot_password_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/screens/auth/login_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/screens/auth/signup_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/screens/home/home_page.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/screens/onboarding/onboarding_page.dart.hbs +1 -0
- package/templates/overlays/architecture/layer-first/lib/src/presentation/widgets/.gitkeep +0 -0
- package/templates/overlays/architecture/mvc/architecture.md +5 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isBloc)@auth_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isBloc)@session_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isGetX)@auth_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isGetX)@session_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isMobX)@auth_store.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isMobX)@session_store.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isNoneState)@session_manager.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isProvider,isRiverpod)@auth_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/controllers/auth/(isProvider,isRiverpod)@session_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/models/user_model.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/services/auth_repository.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/services/auth_repository_impl.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/views/auth/forgot_password_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/views/auth/login_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/views/auth/signup_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/views/home/home_page.dart.hbs +1 -0
- package/templates/overlays/architecture/mvc/lib/src/views/onboarding/onboarding_page.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/architecture.md +6 -0
- package/templates/overlays/architecture/mvvm/lib/src/data/models/user_model.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/data/repositories/auth_repository.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/data/repositories/auth_repository_impl.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isBloc)@bloc/auth_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isBloc)@bloc/session_bloc.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isGetX)@controllers/auth_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isGetX)@controllers/session_controller.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isMobX)@stores/auth_store.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isMobX)@stores/session_store.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isNoneState)@view_models/auth_view_model.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isNoneState)@view_models/session_manager.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isProvider,isRiverpod)@providers/auth_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/(isProvider,isRiverpod)@providers/session_provider.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/forgot_password_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/login_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/auth/signup_screen.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/home/home_page.dart.hbs +1 -0
- package/templates/overlays/architecture/mvvm/lib/src/ui/onboarding/onboarding_page.dart.hbs +1 -0
- package/templates/overlays/backend/appwrite/lib/src/services/(usesAppwriteAuth)@auth_service.dart.hbs +101 -0
- package/templates/overlays/backend/custom/lib/src/services/auth_service.dart.hbs +158 -0
- package/templates/overlays/backend/firebase/lib/src/services/(usesFirebaseAuth)@auth_service.dart.hbs +96 -0
- package/templates/overlays/backend/supabase/lib/src/services/(usesSupabaseAuth)@auth_service.dart.hbs +97 -0
- package/templates/overlays/device/app_version_update/lib/src/services/(usesAppVersionUpdate)@version_update_service.dart.hbs +118 -0
- package/templates/overlays/device/device_info/lib/src/services/(usesDeviceInfoPlus)@device_info_service.dart.hbs +54 -0
- package/templates/overlays/extras/dotenv/.env.hbs +33 -0
- package/templates/overlays/extras/flavors/lib/src/flavors.dart.hbs +15 -0
- package/templates/overlays/extras/localization/assets/translations/en.json.hbs +47 -0
- package/templates/overlays/media/lib/src/services/(usesImagePicker,usesFilePicker)@media_service.dart.hbs +148 -0
- package/templates/overlays/networking/cached_image/lib/src/shared/widgets/app_cached_image.dart.hbs +160 -0
- package/templates/overlays/networking/dio/lib/src/services/(usesDio)@dio_service.dart.hbs +50 -0
- package/templates/overlays/networking/http/lib/src/services/(usesHttp)@http_service.dart.hbs +82 -0
- package/templates/overlays/storage/hive/lib/src/services/(usesHive)@hive_service.dart.hbs +59 -0
- package/templates/overlays/storage/secure_storage/lib/src/services/(usesSecureStorage)@secure_storage_service.dart.hbs +39 -0
- package/templates/overlays/storage/shared_preferences/lib/src/services/(usesSharedPreferences)@storage_service.dart.hbs +53 -0
- package/templates/overlays/utilities/geolocator/lib/src/services/(usesGeolocator)@location_service.dart.hbs +78 -0
- package/templates/overlays/utilities/path_provider/lib/src/services/(usesPathProvider)@path_service.dart.hbs +30 -0
- package/templates/overlays/utilities/permission_handler/lib/src/services/(usesPermissionHandler)@permission_service.dart.hbs +28 -0
- package/templates/overlays/utilities/permission_handler/lib/src/shared/hooks/use_permission.dart.hbs +44 -0
- package/templates/overlays/utilities/share_plus/lib/src/services/(usesSharePlus)@share_service.dart.hbs +22 -0
- package/templates/overlays/utilities/share_plus/lib/src/shared/hooks/use_share.dart.hbs +26 -0
- package/templates/overlays/utilities/url_launcher/lib/src/services/(usesUrlLauncher)@url_launcher_service.dart.hbs +37 -0
- package/templates/overlays/utilities/url_launcher/lib/src/shared/hooks/use_launch_url.dart.hbs +52 -0
- package/templates/partials/features/auth/auth_logic.hbs +611 -0
- package/templates/partials/features/auth/auth_repository.hbs +32 -0
- package/templates/partials/features/auth/auth_repository_impl.hbs +116 -0
- package/templates/partials/features/auth/forgot_password_screen.hbs +368 -0
- package/templates/partials/features/auth/login_screen.hbs +540 -0
- package/templates/partials/features/auth/session_provider.hbs +437 -0
- package/templates/partials/features/auth/signup_screen.hbs +511 -0
- package/templates/partials/features/auth/user_model.hbs +23 -0
- package/templates/partials/features/home/home_page.hbs +156 -0
- package/templates/partials/features/onboarding/onboarding_page.hbs +264 -0
- package/templates/partials/llm/add-feature-workflow.hbs +38 -0
- package/templates/partials/llm/architecture-rules.hbs +92 -0
- package/templates/partials/llm/backend-rules.hbs +30 -0
- package/templates/partials/llm/build-runner-note.hbs +15 -0
- package/templates/partials/llm/design-quick-ref.hbs +14 -0
- package/templates/partials/llm/design-quick-reference.hbs +14 -0
- package/templates/partials/llm/navigation-rules.hbs +27 -0
- package/templates/partials/llm/networking-rules.hbs +16 -0
- package/templates/partials/llm/packages-list.hbs +26 -0
- package/templates/partials/llm/services-conventions.hbs +20 -0
- package/templates/partials/llm/stack-summary.hbs +22 -0
- package/templates/partials/llm/state-management-rules.hbs +40 -0
- package/templates/partials/state_label.hbs +1 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
import 'package:{{flags.appSnake}}/src/imports/core_imports.dart';
|
|
2
|
+
import 'package:{{flags.appSnake}}/src/imports/packages_imports.dart';
|
|
3
|
+
|
|
4
|
+
{{#if flags.isRiverpod}}
|
|
5
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/{{else if (eq architecture "mvc")}}controllers/auth/{{else if (eq architecture "mvvm")}}ui/auth/providers/{{else}}features/auth/presentation/providers/{{/if}}auth_provider.dart';
|
|
6
|
+
{{else if flags.isBloc}}
|
|
7
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/{{else if (eq architecture "mvc")}}controllers/auth/{{else if (eq architecture "mvvm")}}ui/auth/bloc/{{else}}features/auth/presentation/providers/{{/if}}auth_bloc.dart';
|
|
8
|
+
{{else if flags.isProvider}}
|
|
9
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/{{else if (eq architecture "mvc")}}controllers/auth/{{else if (eq architecture "mvvm")}}ui/auth/providers/{{else}}features/auth/presentation/providers/{{/if}}auth_provider.dart';
|
|
10
|
+
{{else if flags.isGetX}}
|
|
11
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/controllers/auth/{{else if (eq architecture "mvc")}}controllers/auth/{{else if (eq architecture "mvvm")}}ui/auth/controllers/{{else}}features/auth/presentation/controllers/{{/if}}auth_controller.dart';
|
|
12
|
+
{{else if flags.isMobX}}
|
|
13
|
+
{{#if flags.usesFlutterHooks}}
|
|
14
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/{{else if (eq architecture "mvc")}}controllers/auth/{{else if (eq architecture "mvvm")}}ui/auth/stores/{{else}}features/auth/presentation/providers/{{/if}}auth_store.dart';
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{else}}
|
|
17
|
+
{{#if flags.usesFlutterHooks}}
|
|
18
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/{{else if (eq architecture "mvc")}}controllers/auth/{{else if (eq architecture "mvvm")}}ui/auth/view_models/{{else}}features/auth/presentation/providers/{{/if}}auth_view_model.dart';
|
|
19
|
+
{{/if}}
|
|
20
|
+
{{/if}}
|
|
21
|
+
|
|
22
|
+
{{#if (eq flags.routerPackage "auto_route")}}
|
|
23
|
+
@RoutePage()
|
|
24
|
+
{{/if}}
|
|
25
|
+
{{#if flags.usesFlutterHooks}}
|
|
26
|
+
class SignupScreen extends {{#if flags.isRiverpod}}HookConsumerWidget{{else}}HookWidget{{/if}} {
|
|
27
|
+
const SignupScreen({super.key});
|
|
28
|
+
|
|
29
|
+
@override
|
|
30
|
+
Widget build(BuildContext context, {{#if flags.isRiverpod}}WidgetRef ref{{/if}}) {
|
|
31
|
+
final formKey = useMemoized(() => GlobalKey<FormState>());
|
|
32
|
+
final nameController = useTextEditingController();
|
|
33
|
+
final emailController = useTextEditingController();
|
|
34
|
+
final passwordController = useTextEditingController();
|
|
35
|
+
final confirmPasswordController = useTextEditingController();
|
|
36
|
+
final obscurePassword = useState(true);
|
|
37
|
+
final obscureConfirmPassword = useState(true);
|
|
38
|
+
|
|
39
|
+
{{#if flags.isRiverpod}}
|
|
40
|
+
final isLoading = ref.watch(authControllerProvider);
|
|
41
|
+
{{else if flags.isBloc}}
|
|
42
|
+
final isLoading = context.select((AuthBloc bloc) => bloc.state.isLoading);
|
|
43
|
+
{{else if flags.isProvider}}
|
|
44
|
+
final isLoading = context.select((AuthProvider p) => p.isLoading);
|
|
45
|
+
{{else if flags.isGetX}}
|
|
46
|
+
final controller = Get.find<AuthController>();
|
|
47
|
+
final isLoading = controller.isLoading.value;
|
|
48
|
+
{{else if flags.isMobX}}
|
|
49
|
+
final authStore = useMemoized(() => AuthStore(repository: AuthRepositoryImpl()), []);
|
|
50
|
+
final isLoading = authStore.isLoading;
|
|
51
|
+
{{else if flags.isNoneState}}
|
|
52
|
+
final viewModel = useMemoized(() => AuthViewModel(repository: AuthRepositoryImpl()), []);
|
|
53
|
+
useListenable(viewModel);
|
|
54
|
+
final isLoading = viewModel.isLoading;
|
|
55
|
+
{{else}}
|
|
56
|
+
final isLoadingState = useState(false);
|
|
57
|
+
final isLoading = isLoadingState.value;
|
|
58
|
+
{{/if}}
|
|
59
|
+
|
|
60
|
+
final cs = context.theme.colorScheme;
|
|
61
|
+
final tt = context.theme.textTheme;
|
|
62
|
+
|
|
63
|
+
Future<void> handleSignup() async {
|
|
64
|
+
if (!(formKey.currentState?.validate() ?? false)) return;
|
|
65
|
+
|
|
66
|
+
{{#if flags.isRiverpod}}
|
|
67
|
+
ref.read(authControllerProvider.notifier).signUp(
|
|
68
|
+
context: context,
|
|
69
|
+
name: nameController.text,
|
|
70
|
+
email: emailController.text,
|
|
71
|
+
password: passwordController.text,
|
|
72
|
+
);
|
|
73
|
+
{{else if flags.isBloc}}
|
|
74
|
+
context.read<AuthBloc>().add(
|
|
75
|
+
SignUpRequested(
|
|
76
|
+
context: context,
|
|
77
|
+
name: nameController.text,
|
|
78
|
+
email: emailController.text,
|
|
79
|
+
password: passwordController.text,
|
|
80
|
+
),
|
|
81
|
+
);
|
|
82
|
+
{{else if flags.isProvider}}
|
|
83
|
+
context.read<AuthProvider>().signUp(
|
|
84
|
+
context: context,
|
|
85
|
+
name: nameController.text,
|
|
86
|
+
email: emailController.text,
|
|
87
|
+
password: passwordController.text,
|
|
88
|
+
);
|
|
89
|
+
{{else if flags.isGetX}}
|
|
90
|
+
controller.signUp(
|
|
91
|
+
context: context,
|
|
92
|
+
name: nameController.text,
|
|
93
|
+
email: emailController.text,
|
|
94
|
+
password: passwordController.text,
|
|
95
|
+
);
|
|
96
|
+
{{else if flags.isMobX}}
|
|
97
|
+
authStore.signUp(
|
|
98
|
+
context: context,
|
|
99
|
+
name: nameController.text.trim(),
|
|
100
|
+
email: emailController.text.trim(),
|
|
101
|
+
password: passwordController.text.trim(),
|
|
102
|
+
);
|
|
103
|
+
{{else if flags.isNoneState}}
|
|
104
|
+
viewModel.signUp(
|
|
105
|
+
context: context,
|
|
106
|
+
name: nameController.text.trim(),
|
|
107
|
+
email: emailController.text.trim(),
|
|
108
|
+
password: passwordController.text.trim(),
|
|
109
|
+
);
|
|
110
|
+
{{else}}
|
|
111
|
+
isLoadingState.value = true;
|
|
112
|
+
try {
|
|
113
|
+
final result = await AuthService.instance.signUp(
|
|
114
|
+
name: nameController.text.trim(),
|
|
115
|
+
email: emailController.text.trim(),
|
|
116
|
+
password: passwordController.text.trim(),
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
result.fold(
|
|
120
|
+
(failure) {
|
|
121
|
+
if (context.mounted) {
|
|
122
|
+
showToast(context, message: failure.message, status: 'error');
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
(user) {
|
|
126
|
+
if (context.mounted) {
|
|
127
|
+
{{#if (eq flags.routerPackage "go_router")}}
|
|
128
|
+
context.go(AppRoutes.home);
|
|
129
|
+
{{else if (eq flags.routerPackage "auto_route")}}
|
|
130
|
+
context.replaceRoute(const HomeRoute());
|
|
131
|
+
{{else}}
|
|
132
|
+
Navigator.pushReplacementNamed(context, AppRoutes.home);
|
|
133
|
+
{{/if}}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
} catch (e) {
|
|
138
|
+
if (context.mounted) {
|
|
139
|
+
showToast(context, message: e.toString(), status: 'error');
|
|
140
|
+
}
|
|
141
|
+
} finally {
|
|
142
|
+
isLoadingState.value = false;
|
|
143
|
+
}
|
|
144
|
+
{{/if}}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
{{#if flags.isGetX}}
|
|
148
|
+
return Obx(() => _SignupView(
|
|
149
|
+
{{else}}
|
|
150
|
+
return _SignupView(
|
|
151
|
+
{{/if}}
|
|
152
|
+
formKey: formKey,
|
|
153
|
+
nameController: nameController,
|
|
154
|
+
emailController: emailController,
|
|
155
|
+
passwordController: passwordController,
|
|
156
|
+
confirmPasswordController: confirmPasswordController,
|
|
157
|
+
obscurePassword: obscurePassword.value,
|
|
158
|
+
obscureConfirmPassword: obscureConfirmPassword.value,
|
|
159
|
+
isLoading: isLoading,
|
|
160
|
+
onToggleObscure: () => obscurePassword.value = !obscurePassword.value,
|
|
161
|
+
onToggleConfirmObscure: () => obscureConfirmPassword.value = !obscureConfirmPassword.value,
|
|
162
|
+
onSignup: handleSignup,
|
|
163
|
+
cs: cs,
|
|
164
|
+
tt: tt,
|
|
165
|
+
);
|
|
166
|
+
{{#if flags.isGetX}}
|
|
167
|
+
);
|
|
168
|
+
{{/if}}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
{{else}}
|
|
172
|
+
class SignupScreen extends {{#if flags.isRiverpod}}ConsumerStatefulWidget{{else}}StatefulWidget{{/if}} {
|
|
173
|
+
const SignupScreen({super.key});
|
|
174
|
+
|
|
175
|
+
@override
|
|
176
|
+
{{#if flags.isRiverpod}}
|
|
177
|
+
ConsumerState<SignupScreen> createState() => _SignupScreenState();
|
|
178
|
+
{{else}}
|
|
179
|
+
State<SignupScreen> createState() => _SignupScreenState();
|
|
180
|
+
{{/if}}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
class _SignupScreenState extends {{#if flags.isRiverpod}}ConsumerState<SignupScreen>{{else}}State<SignupScreen>{{/if}} {
|
|
184
|
+
final _formKey = GlobalKey<FormState>();
|
|
185
|
+
final _nameController = TextEditingController();
|
|
186
|
+
final _emailController = TextEditingController();
|
|
187
|
+
final _passwordController = TextEditingController();
|
|
188
|
+
final _confirmPasswordController = TextEditingController();
|
|
189
|
+
bool _obscurePassword = true;
|
|
190
|
+
bool _obscureConfirmPassword = true;
|
|
191
|
+
{{#if (or flags.isNoneState flags.isMobX)}}
|
|
192
|
+
bool _isLoading = false;
|
|
193
|
+
{{/if}}
|
|
194
|
+
|
|
195
|
+
@override
|
|
196
|
+
void dispose() {
|
|
197
|
+
_nameController.dispose();
|
|
198
|
+
_emailController.dispose();
|
|
199
|
+
_passwordController.dispose();
|
|
200
|
+
_confirmPasswordController.dispose();
|
|
201
|
+
super.dispose();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@override
|
|
205
|
+
Widget build(BuildContext context) {
|
|
206
|
+
{{#if flags.isRiverpod}}
|
|
207
|
+
final isLoading = ref.watch(authControllerProvider);
|
|
208
|
+
{{else if flags.isBloc}}
|
|
209
|
+
final isLoading = context.select((AuthBloc bloc) => bloc.state.isLoading);
|
|
210
|
+
{{else if flags.isProvider}}
|
|
211
|
+
final isLoading = context.select((AuthProvider p) => p.isLoading);
|
|
212
|
+
{{else if flags.isGetX}}
|
|
213
|
+
final controller = Get.find<AuthController>();
|
|
214
|
+
{{else if flags.isMobX}}
|
|
215
|
+
final isLoading = _isLoading;
|
|
216
|
+
{{else}}
|
|
217
|
+
final isLoading = _isLoading;
|
|
218
|
+
{{/if}}
|
|
219
|
+
|
|
220
|
+
final cs = context.theme.colorScheme;
|
|
221
|
+
final tt = context.theme.textTheme;
|
|
222
|
+
|
|
223
|
+
Future<void> handleSignup() async {
|
|
224
|
+
if (!(_formKey.currentState?.validate() ?? false)) return;
|
|
225
|
+
|
|
226
|
+
{{#if (or flags.isNoneState flags.isMobX)}}
|
|
227
|
+
setState(() => _isLoading = true);
|
|
228
|
+
{{/if}}
|
|
229
|
+
|
|
230
|
+
{{#if flags.isRiverpod}}
|
|
231
|
+
ref.read(authControllerProvider.notifier).signUp(
|
|
232
|
+
context: context,
|
|
233
|
+
name: _nameController.text,
|
|
234
|
+
email: _emailController.text,
|
|
235
|
+
password: _passwordController.text,
|
|
236
|
+
);
|
|
237
|
+
{{else if flags.isBloc}}
|
|
238
|
+
context.read<AuthBloc>().add(
|
|
239
|
+
SignUpRequested(
|
|
240
|
+
context: context,
|
|
241
|
+
name: _nameController.text,
|
|
242
|
+
email: _emailController.text,
|
|
243
|
+
password: _passwordController.text,
|
|
244
|
+
),
|
|
245
|
+
);
|
|
246
|
+
{{else if flags.isProvider}}
|
|
247
|
+
context.read<AuthProvider>().signUp(
|
|
248
|
+
context: context,
|
|
249
|
+
name: _nameController.text,
|
|
250
|
+
email: _emailController.text,
|
|
251
|
+
password: _passwordController.text,
|
|
252
|
+
);
|
|
253
|
+
{{else if flags.isGetX}}
|
|
254
|
+
controller.signUp(
|
|
255
|
+
context: context,
|
|
256
|
+
name: _nameController.text,
|
|
257
|
+
email: _emailController.text,
|
|
258
|
+
password: _passwordController.text,
|
|
259
|
+
);
|
|
260
|
+
{{else}}
|
|
261
|
+
try {
|
|
262
|
+
final result = await AuthService.instance.signUp(
|
|
263
|
+
name: _nameController.text.trim(),
|
|
264
|
+
email: _emailController.text.trim(),
|
|
265
|
+
password: _passwordController.text.trim(),
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
result.fold(
|
|
269
|
+
(failure) {
|
|
270
|
+
if (context.mounted) {
|
|
271
|
+
showToast(context, message: failure.message, status: 'error');
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
(user) {
|
|
275
|
+
if (context.mounted) {
|
|
276
|
+
{{#if (eq flags.routerPackage "go_router")}}
|
|
277
|
+
context.go(AppRoutes.home);
|
|
278
|
+
{{else if (eq flags.routerPackage "auto_route")}}
|
|
279
|
+
context.replaceRoute(const HomeRoute());
|
|
280
|
+
{{else}}
|
|
281
|
+
Navigator.pushReplacementNamed(context, AppRoutes.home);
|
|
282
|
+
{{/if}}
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
);
|
|
286
|
+
} catch (e) {
|
|
287
|
+
if (context.mounted) {
|
|
288
|
+
showToast(context, message: e.toString(), status: 'error');
|
|
289
|
+
}
|
|
290
|
+
} finally {
|
|
291
|
+
if (context.mounted) setState(() => _isLoading = false);
|
|
292
|
+
}
|
|
293
|
+
{{/if}}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
{{#if flags.isGetX}}
|
|
297
|
+
return Obx(() {
|
|
298
|
+
final isLoading = controller.isLoading.value;
|
|
299
|
+
return _SignupView(
|
|
300
|
+
formKey: _formKey,
|
|
301
|
+
nameController: _nameController,
|
|
302
|
+
emailController: _emailController,
|
|
303
|
+
passwordController: _passwordController,
|
|
304
|
+
confirmPasswordController: _confirmPasswordController,
|
|
305
|
+
obscurePassword: _obscurePassword,
|
|
306
|
+
obscureConfirmPassword: _obscureConfirmPassword,
|
|
307
|
+
isLoading: isLoading,
|
|
308
|
+
onToggleObscure: () => setState(() => _obscurePassword = !_obscurePassword),
|
|
309
|
+
onToggleConfirmObscure: () => setState(() => _obscureConfirmPassword = !_obscureConfirmPassword),
|
|
310
|
+
onSignup: handleSignup,
|
|
311
|
+
cs: cs,
|
|
312
|
+
tt: tt,
|
|
313
|
+
);
|
|
314
|
+
});
|
|
315
|
+
{{else}}
|
|
316
|
+
return _SignupView(
|
|
317
|
+
formKey: _formKey,
|
|
318
|
+
nameController: _nameController,
|
|
319
|
+
emailController: _emailController,
|
|
320
|
+
passwordController: _passwordController,
|
|
321
|
+
confirmPasswordController: _confirmPasswordController,
|
|
322
|
+
obscurePassword: _obscurePassword,
|
|
323
|
+
obscureConfirmPassword: _obscureConfirmPassword,
|
|
324
|
+
isLoading: isLoading,
|
|
325
|
+
onToggleObscure: () => setState(() => _obscurePassword = !_obscurePassword),
|
|
326
|
+
onToggleConfirmObscure: () => setState(() => _obscureConfirmPassword = !_obscureConfirmPassword),
|
|
327
|
+
onSignup: handleSignup,
|
|
328
|
+
cs: cs,
|
|
329
|
+
tt: tt,
|
|
330
|
+
);
|
|
331
|
+
{{/if}}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
{{/if}}
|
|
335
|
+
|
|
336
|
+
class _SignupView extends StatelessWidget {
|
|
337
|
+
const _SignupView({
|
|
338
|
+
required this.formKey,
|
|
339
|
+
required this.nameController,
|
|
340
|
+
required this.emailController,
|
|
341
|
+
required this.passwordController,
|
|
342
|
+
required this.confirmPasswordController,
|
|
343
|
+
required this.obscurePassword,
|
|
344
|
+
required this.obscureConfirmPassword,
|
|
345
|
+
required this.isLoading,
|
|
346
|
+
required this.onToggleObscure,
|
|
347
|
+
required this.onToggleConfirmObscure,
|
|
348
|
+
required this.onSignup,
|
|
349
|
+
required this.cs,
|
|
350
|
+
required this.tt,
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
final GlobalKey<FormState> formKey;
|
|
354
|
+
final TextEditingController nameController;
|
|
355
|
+
final TextEditingController emailController;
|
|
356
|
+
final TextEditingController passwordController;
|
|
357
|
+
final TextEditingController confirmPasswordController;
|
|
358
|
+
final bool obscurePassword;
|
|
359
|
+
final bool obscureConfirmPassword;
|
|
360
|
+
final bool isLoading;
|
|
361
|
+
final VoidCallback onToggleObscure;
|
|
362
|
+
final VoidCallback onToggleConfirmObscure;
|
|
363
|
+
final VoidCallback onSignup;
|
|
364
|
+
final ColorScheme cs;
|
|
365
|
+
final TextTheme tt;
|
|
366
|
+
|
|
367
|
+
@override
|
|
368
|
+
Widget build(BuildContext context) {
|
|
369
|
+
return Scaffold(
|
|
370
|
+
body: SafeArea(
|
|
371
|
+
child: Center(
|
|
372
|
+
child: SingleChildScrollView(
|
|
373
|
+
padding: EdgeInsets.symmetric(horizontal: {{res 'AppSpacing.lg' 'w' flags.usesScreenutil}}),
|
|
374
|
+
child: Column(
|
|
375
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
376
|
+
children: [
|
|
377
|
+
SizedBox(height: {{res 'AppSpacing.xl' 'h' flags.usesScreenutil}}),
|
|
378
|
+
Text(
|
|
379
|
+
{{#if flags.supportsLocalization}}'auth.sign_up'.tr(){{else}}'Create Account'{{/if}},
|
|
380
|
+
style: tt.headlineMedium?.copyWith(fontWeight: FontWeight.bold),
|
|
381
|
+
),
|
|
382
|
+
SizedBox(height: {{res 'AppSpacing.sm' 'h' flags.usesScreenutil}}),
|
|
383
|
+
Text(
|
|
384
|
+
{{#if flags.supportsLocalization}}'auth.sign_up_subtitle'.tr(){{else}}'Join us and start your journey'{{/if}},
|
|
385
|
+
textAlign: TextAlign.center,
|
|
386
|
+
style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant),
|
|
387
|
+
),
|
|
388
|
+
SizedBox(height: {{res 'AppSpacing.xxxl' 'h' flags.usesScreenutil}}),
|
|
389
|
+
Form(
|
|
390
|
+
key: formKey,
|
|
391
|
+
child: Column(
|
|
392
|
+
children: [
|
|
393
|
+
AppTextField(
|
|
394
|
+
controller: nameController,
|
|
395
|
+
enabled: !isLoading,
|
|
396
|
+
label: {{#if flags.supportsLocalization}}'auth.name'.tr(){{else}}'Full Name'{{/if}},
|
|
397
|
+
prefixIcon: const Icon({{#if flags.usesIconsaxPlus}}IconsaxPlusBold.user{{else}}Icons.person_outline{{/if}}),
|
|
398
|
+
validator: (v) {
|
|
399
|
+
if (AppUtils.isBlank(v)) {
|
|
400
|
+
return {{#if flags.supportsLocalization}}'auth.name_required'.tr(){{else}}'Name is required'{{/if}};
|
|
401
|
+
}
|
|
402
|
+
return null;
|
|
403
|
+
},
|
|
404
|
+
),
|
|
405
|
+
SizedBox(height: {{res 'AppSpacing.md' 'h' flags.usesScreenutil}}),
|
|
406
|
+
AppTextField(
|
|
407
|
+
controller: emailController,
|
|
408
|
+
enabled: !isLoading,
|
|
409
|
+
label: {{#if flags.supportsLocalization}}'auth.email'.tr(){{else}}'Email'{{/if}},
|
|
410
|
+
prefixIcon: const Icon({{#if flags.usesIconsaxPlus}}IconsaxPlusBold.sms{{else}}Icons.email_outlined{{/if}}),
|
|
411
|
+
validator: (v) {
|
|
412
|
+
if (AppUtils.isBlank(v)) {
|
|
413
|
+
return {{#if flags.supportsLocalization}}'auth.email_required'.tr(){{else}}'Email is required'{{/if}};
|
|
414
|
+
}
|
|
415
|
+
if (!AppUtils.isValidEmail(v!)) {
|
|
416
|
+
return {{#if flags.supportsLocalization}}'auth.email_invalid'.tr(){{else}}'Enter a valid email'{{/if}};
|
|
417
|
+
}
|
|
418
|
+
return null;
|
|
419
|
+
},
|
|
420
|
+
),
|
|
421
|
+
SizedBox(height: {{res 'AppSpacing.md' 'h' flags.usesScreenutil}}),
|
|
422
|
+
AppTextField(
|
|
423
|
+
controller: passwordController,
|
|
424
|
+
enabled: !isLoading,
|
|
425
|
+
label: {{#if flags.supportsLocalization}}'auth.password'.tr(){{else}}'Password'{{/if}},
|
|
426
|
+
obscureText: obscurePassword,
|
|
427
|
+
prefixIcon: const Icon({{#if flags.usesIconsaxPlus}}IconsaxPlusBold.lock{{else}}Icons.lock_outline{{/if}}),
|
|
428
|
+
suffixIcon: IconButton(
|
|
429
|
+
icon: Icon(obscurePassword ? Icons.visibility_off : Icons.visibility),
|
|
430
|
+
onPressed: onToggleObscure,
|
|
431
|
+
),
|
|
432
|
+
validator: (v) {
|
|
433
|
+
if (AppUtils.isBlank(v)) {
|
|
434
|
+
return {{#if flags.supportsLocalization}}'auth.password_required'.tr(){{else}}'Password is required'{{/if}};
|
|
435
|
+
}
|
|
436
|
+
if (v!.length < 6) {
|
|
437
|
+
return {{#if flags.supportsLocalization}}'auth.password_too_short'.tr(){{else}}'Password must be at least 6 characters'{{/if}};
|
|
438
|
+
}
|
|
439
|
+
return null;
|
|
440
|
+
},
|
|
441
|
+
),
|
|
442
|
+
SizedBox(height: {{res 'AppSpacing.md' 'h' flags.usesScreenutil}}),
|
|
443
|
+
AppTextField(
|
|
444
|
+
controller: confirmPasswordController,
|
|
445
|
+
enabled: !isLoading,
|
|
446
|
+
label: {{#if flags.supportsLocalization}}'auth.confirm_password'.tr(){{else}}'Confirm Password'{{/if}},
|
|
447
|
+
obscureText: obscureConfirmPassword,
|
|
448
|
+
prefixIcon: const Icon({{#if flags.usesIconsaxPlus}}IconsaxPlusBold.lock{{else}}Icons.lock_outline{{/if}}),
|
|
449
|
+
suffixIcon: IconButton(
|
|
450
|
+
icon: Icon(obscureConfirmPassword ? Icons.visibility_off : Icons.visibility),
|
|
451
|
+
onPressed: onToggleConfirmObscure,
|
|
452
|
+
),
|
|
453
|
+
validator: (v) {
|
|
454
|
+
if (AppUtils.isBlank(v)) {
|
|
455
|
+
return {{#if flags.supportsLocalization}}'auth.confirm_password_required'.tr(){{else}}'Confirm password is required'{{/if}};
|
|
456
|
+
}
|
|
457
|
+
if (v != passwordController.text) {
|
|
458
|
+
return {{#if flags.supportsLocalization}}'auth.passwords_do_not_match'.tr(){{else}}'Passwords do not match'{{/if}};
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
461
|
+
},
|
|
462
|
+
),
|
|
463
|
+
SizedBox(height: {{res 'AppSpacing.lg' 'h' flags.usesScreenutil}}),
|
|
464
|
+
AppButton(
|
|
465
|
+
label: 'Sign Up',
|
|
466
|
+
isLoading: isLoading,
|
|
467
|
+
onPressed: isLoading ? null : onSignup,
|
|
468
|
+
width: ButtonSize.large,
|
|
469
|
+
isFullWidth: false,
|
|
470
|
+
),
|
|
471
|
+
],
|
|
472
|
+
),
|
|
473
|
+
),
|
|
474
|
+
SizedBox(height: {{res 'AppSpacing.xxxl' 'h' flags.usesScreenutil}}),
|
|
475
|
+
InkWell(
|
|
476
|
+
onTap: () {
|
|
477
|
+
{{#if (eq flags.routerPackage "go_router")}}
|
|
478
|
+
context.push(AppRoutes.login);
|
|
479
|
+
{{else if (eq flags.routerPackage "auto_route")}}
|
|
480
|
+
context.pushRoute(const LoginRoute());
|
|
481
|
+
{{else if flags.isGetX}}
|
|
482
|
+
Get.toNamed(AppRoutes.login);
|
|
483
|
+
{{else}}
|
|
484
|
+
Navigator.pushNamed(context, AppRoutes.login);
|
|
485
|
+
{{/if}}
|
|
486
|
+
},
|
|
487
|
+
child: RichText(
|
|
488
|
+
text: TextSpan(
|
|
489
|
+
text: {{#if flags.supportsLocalization}}'auth.already_have_account'.tr(){{else}}'Already have an account? '{{/if}},
|
|
490
|
+
style: tt.bodyMedium?.copyWith(color: cs.onSurfaceVariant),
|
|
491
|
+
children: [
|
|
492
|
+
TextSpan(
|
|
493
|
+
text: {{#if flags.supportsLocalization}}'auth.log_in'.tr(){{else}}'Log In'{{/if}},
|
|
494
|
+
style: TextStyle(
|
|
495
|
+
color: cs.primary,
|
|
496
|
+
fontWeight: FontWeight.bold,
|
|
497
|
+
),
|
|
498
|
+
),
|
|
499
|
+
],
|
|
500
|
+
),
|
|
501
|
+
),
|
|
502
|
+
),
|
|
503
|
+
SizedBox(height: {{res 'AppSpacing.xl' 'h' flags.usesScreenutil}}),
|
|
504
|
+
],
|
|
505
|
+
),
|
|
506
|
+
),
|
|
507
|
+
),
|
|
508
|
+
),
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import 'package:equatable/equatable.dart';
|
|
2
|
+
|
|
3
|
+
class AppUser extends Equatable {
|
|
4
|
+
final String id;
|
|
5
|
+
final String email;
|
|
6
|
+
final String? name;
|
|
7
|
+
final String? photoUrl;
|
|
8
|
+
|
|
9
|
+
const AppUser({
|
|
10
|
+
required this.id,
|
|
11
|
+
required this.email,
|
|
12
|
+
this.name,
|
|
13
|
+
this.photoUrl,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
factory AppUser.empty() => const AppUser(id: '', email: '');
|
|
17
|
+
|
|
18
|
+
bool get isEmpty => id.isEmpty;
|
|
19
|
+
bool get isNotEmpty => id.isNotEmpty;
|
|
20
|
+
|
|
21
|
+
@override
|
|
22
|
+
List<Object?> get props => [id, email, name, photoUrl];
|
|
23
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import 'package:{{flags.appSnake}}/src/imports/core_imports.dart';
|
|
2
|
+
import 'package:{{flags.appSnake}}/src/imports/packages_imports.dart';
|
|
3
|
+
|
|
4
|
+
{{#if flags.isRiverpod}}
|
|
5
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/session_provider.dart{{else if (eq architecture "mvc")}}controllers/auth/session_provider.dart{{else if (eq architecture "mvvm")}}ui/auth/providers/session_provider.dart{{else}}features/auth/presentation/providers/session_provider.dart{{/if}}';
|
|
6
|
+
{{else if flags.isBloc}}
|
|
7
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/session_bloc.dart{{else if (eq architecture "mvc")}}controllers/auth/session_bloc.dart{{else if (eq architecture "mvvm")}}ui/auth/bloc/session_bloc.dart{{else}}features/auth/presentation/providers/session_bloc.dart{{/if}}';
|
|
8
|
+
{{else if flags.isGetX}}
|
|
9
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/session_controller.dart{{else if (eq architecture "mvc")}}controllers/auth/session_controller.dart{{else if (eq architecture "mvvm")}}ui/auth/controllers/session_controller.dart{{else}}features/auth/presentation/providers/session_controller.dart{{/if}}';
|
|
10
|
+
{{else if flags.isMobX}}
|
|
11
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/session_store.dart{{else if (eq architecture "mvc")}}controllers/auth/session_store.dart{{else if (eq architecture "mvvm")}}ui/auth/stores/session_store.dart{{else}}features/auth/presentation/providers/session_store.dart{{/if}}';
|
|
12
|
+
{{else if flags.isProvider}}
|
|
13
|
+
import 'package:{{flags.appSnake}}/src/{{#if (eq architecture "layer-first")}}presentation/providers/session_provider.dart{{else if (eq architecture "mvc")}}controllers/auth/session_provider.dart{{else if (eq architecture "mvvm")}}ui/auth/providers/session_provider.dart{{else}}features/auth/presentation/providers/session_provider.dart{{/if}}';
|
|
14
|
+
{{/if}}
|
|
15
|
+
|
|
16
|
+
{{#if (eq flags.routerPackage "auto_route")}}
|
|
17
|
+
@RoutePage()
|
|
18
|
+
{{/if}}
|
|
19
|
+
|
|
20
|
+
{{#if flags.usesFlutterHooks}}
|
|
21
|
+
{{#if flags.isRiverpod}}
|
|
22
|
+
class HomePage extends HookConsumerWidget {
|
|
23
|
+
{{else}}
|
|
24
|
+
class HomePage extends HookWidget {
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{else}}
|
|
27
|
+
{{#if flags.isRiverpod}}
|
|
28
|
+
class HomePage extends ConsumerWidget {
|
|
29
|
+
{{else}}
|
|
30
|
+
class HomePage extends StatelessWidget {
|
|
31
|
+
{{/if}}
|
|
32
|
+
{{/if}}
|
|
33
|
+
const HomePage({super.key});
|
|
34
|
+
|
|
35
|
+
@override
|
|
36
|
+
{{#if flags.isRiverpod}}
|
|
37
|
+
Widget build(BuildContext context, WidgetRef ref) {
|
|
38
|
+
{{else}}
|
|
39
|
+
Widget build(BuildContext context) {
|
|
40
|
+
{{/if}}
|
|
41
|
+
final theme = context.theme;
|
|
42
|
+
final colorScheme = theme.colorScheme;
|
|
43
|
+
final textTheme = theme.textTheme;
|
|
44
|
+
|
|
45
|
+
{{#if flags.isRiverpod}}
|
|
46
|
+
final session = ref.watch(sessionProvider);
|
|
47
|
+
{{else if flags.isBloc}}
|
|
48
|
+
final session = context.watch<SessionBloc>().state;
|
|
49
|
+
{{else if flags.isGetX}}
|
|
50
|
+
final session = Get.find<SessionController>();
|
|
51
|
+
{{else if flags.isProvider}}
|
|
52
|
+
final session = context.watch<SessionProvider>();
|
|
53
|
+
{{else if flags.isMobX}}
|
|
54
|
+
final session = context.watch<SessionStore>();
|
|
55
|
+
{{/if}}
|
|
56
|
+
{{#unless (or flags.isGetX flags.isMobX)}}
|
|
57
|
+
{{#if (or flags.isRiverpod flags.isBloc flags.isProvider)}}final{{else}}const{{/if}} user = {{#if flags.isRiverpod}}session.user{{else if flags.isBloc}}session.user{{else if flags.isProvider}}session.user{{else}}null{{/if}};
|
|
58
|
+
{{/unless}}
|
|
59
|
+
|
|
60
|
+
return Scaffold(
|
|
61
|
+
backgroundColor: colorScheme.surface,
|
|
62
|
+
appBar: AppTopBar(
|
|
63
|
+
title: {{#if flags.supportsLocalization}}'home.home_title'.tr(){{else}}'Home'{{/if}},
|
|
64
|
+
),
|
|
65
|
+
body: SafeArea(
|
|
66
|
+
child: Padding(
|
|
67
|
+
padding: EdgeInsets.all({{res 'AppSpacing.xl' 'w' flags.usesScreenutil}}),
|
|
68
|
+
child: Column(
|
|
69
|
+
mainAxisAlignment: MainAxisAlignment.center,
|
|
70
|
+
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
71
|
+
children: [
|
|
72
|
+
AppIcon(
|
|
73
|
+
icon: {{#if flags.usesIconsaxPlus}}IconsaxPlusLinear.home{{else if flags.usesFlutterRemix}}FlutterRemix.home_line{{else if flags.usesHugeicons}}HugeIcons.strokeRoundedHome01{{else}}Icons.home_rounded{{/if}},
|
|
74
|
+
size: {{res 60 'sp' flags.usesScreenutil}},
|
|
75
|
+
color: colorScheme.primary,
|
|
76
|
+
),
|
|
77
|
+
SizedBox(height: {{res 'AppSpacing.lg' 'h' flags.usesScreenutil}}),
|
|
78
|
+
{{#if flags.isGetX}}
|
|
79
|
+
Obx(() {
|
|
80
|
+
final user = session.user.value;
|
|
81
|
+
return Text(
|
|
82
|
+
user?.name ?? user?.email ?? ({{#if flags.supportsLocalization}}'home.welcome_home'.tr(){{else}}'Welcome Home!'{{/if}}),
|
|
83
|
+
textAlign: TextAlign.center,
|
|
84
|
+
style: textTheme.headlineMedium?.copyWith(
|
|
85
|
+
fontWeight: FontWeight.w900,
|
|
86
|
+
color: colorScheme.onSurface,
|
|
87
|
+
fontSize: {{res 28 'sp' flags.usesScreenutil}},
|
|
88
|
+
),
|
|
89
|
+
);
|
|
90
|
+
}),
|
|
91
|
+
{{else if flags.isMobX}}
|
|
92
|
+
Observer(builder: (_) {
|
|
93
|
+
final user = session.user;
|
|
94
|
+
return Text(
|
|
95
|
+
user?.name ?? user?.email ?? ({{#if flags.supportsLocalization}}'home.welcome_home'.tr(){{else}}'Welcome Home!'{{/if}}),
|
|
96
|
+
textAlign: TextAlign.center,
|
|
97
|
+
style: textTheme.headlineMedium?.copyWith(
|
|
98
|
+
fontWeight: FontWeight.w900,
|
|
99
|
+
color: colorScheme.onSurface,
|
|
100
|
+
fontSize: {{res 28 'sp' flags.usesScreenutil}},
|
|
101
|
+
),
|
|
102
|
+
);
|
|
103
|
+
}),
|
|
104
|
+
{{else}}
|
|
105
|
+
Text(
|
|
106
|
+
user?.name ?? user?.email ?? ({{#if flags.supportsLocalization}}'home.welcome_home'.tr(){{else}}'Welcome Home!'{{/if}}),
|
|
107
|
+
textAlign: TextAlign.center,
|
|
108
|
+
style: textTheme.headlineMedium?.copyWith(
|
|
109
|
+
fontWeight: FontWeight.w900,
|
|
110
|
+
color: colorScheme.onSurface,
|
|
111
|
+
fontSize: {{res 28 'sp' flags.usesScreenutil}},
|
|
112
|
+
),
|
|
113
|
+
),
|
|
114
|
+
{{/if}}
|
|
115
|
+
SizedBox(height: {{res 'AppSpacing.md' 'h' flags.usesScreenutil}}),
|
|
116
|
+
{{#if flags.isGetX}}
|
|
117
|
+
Obx(() {
|
|
118
|
+
final user = session.user.value;
|
|
119
|
+
return Text(
|
|
120
|
+
user != null && user.name != null ? user.email : ({{#if flags.supportsLocalization}}'home.home_subtitle'.tr(){{else}}'You have successfully completed the onboarding process.'{{/if}}),
|
|
121
|
+
textAlign: TextAlign.center,
|
|
122
|
+
style: textTheme.bodyMedium?.copyWith(
|
|
123
|
+
color: colorScheme.onSurfaceVariant,
|
|
124
|
+
fontSize: {{res 14 'sp' flags.usesScreenutil}},
|
|
125
|
+
),
|
|
126
|
+
);
|
|
127
|
+
}),
|
|
128
|
+
{{else if flags.isMobX}}
|
|
129
|
+
Observer(builder: (_) {
|
|
130
|
+
final user = session.user;
|
|
131
|
+
return Text(
|
|
132
|
+
user != null && user.name != null ? user.email : ({{#if flags.supportsLocalization}}'home.home_subtitle'.tr(){{else}}'You have successfully completed the onboarding process.'{{/if}}),
|
|
133
|
+
textAlign: TextAlign.center,
|
|
134
|
+
style: textTheme.bodyMedium?.copyWith(
|
|
135
|
+
color: colorScheme.onSurfaceVariant,
|
|
136
|
+
fontSize: {{res 14 'sp' flags.usesScreenutil}},
|
|
137
|
+
),
|
|
138
|
+
);
|
|
139
|
+
}),
|
|
140
|
+
{{else}}
|
|
141
|
+
Text(
|
|
142
|
+
user != null && user.name != null ? user.email : ({{#if flags.supportsLocalization}}'home.home_subtitle'.tr(){{else}}'You have successfully completed the onboarding process.'{{/if}}),
|
|
143
|
+
textAlign: TextAlign.center,
|
|
144
|
+
style: textTheme.bodyMedium?.copyWith(
|
|
145
|
+
color: colorScheme.onSurfaceVariant,
|
|
146
|
+
fontSize: {{res 14 'sp' flags.usesScreenutil}},
|
|
147
|
+
),
|
|
148
|
+
),
|
|
149
|
+
{{/if}}
|
|
150
|
+
],
|
|
151
|
+
),
|
|
152
|
+
),
|
|
153
|
+
),
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|