Compare commits

...

11 Commits

112 changed files with 2180 additions and 521 deletions

View File

@@ -1,3 +0,0 @@
{
"workspaceRoot": "../.."
}

View File

@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"flutter_secure_storage_macos","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"flutter_secure_storage_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"flutter_secure_storage_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false}],"web":[{"name":"flutter_secure_storage_web","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2025-11-10 13:39:20.696891","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"flutter_secure_storage_macos","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"flutter_secure_storage_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"flutter_secure_storage_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false}],"web":[{"name":"flutter_secure_storage_web","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2025-12-04 12:33:12.174628","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}}

2
.idea/modules.xml generated
View File

@@ -5,11 +5,13 @@
<module fileurl="file://$PROJECT_DIR$/modules/auth/melos_auth.iml" filepath="$PROJECT_DIR$/modules/auth/melos_auth.iml" /> <module fileurl="file://$PROJECT_DIR$/modules/auth/melos_auth.iml" filepath="$PROJECT_DIR$/modules/auth/melos_auth.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/dashboard_shell/melos_dashboard_shell.iml" filepath="$PROJECT_DIR$/modules/dashboard_shell/melos_dashboard_shell.iml" /> <module fileurl="file://$PROJECT_DIR$/modules/dashboard_shell/melos_dashboard_shell.iml" filepath="$PROJECT_DIR$/modules/dashboard_shell/melos_dashboard_shell.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/design_system/melos_design_system.iml" filepath="$PROJECT_DIR$/packages/design_system/melos_design_system.iml" /> <module fileurl="file://$PROJECT_DIR$/packages/design_system/melos_design_system.iml" filepath="$PROJECT_DIR$/packages/design_system/melos_design_system.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/fonts/melos_fonts.iml" filepath="$PROJECT_DIR$/packages/fonts/melos_fonts.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/home/melos_home.iml" filepath="$PROJECT_DIR$/modules/home/melos_home.iml" /> <module fileurl="file://$PROJECT_DIR$/modules/home/melos_home.iml" filepath="$PROJECT_DIR$/modules/home/melos_home.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/navigation/melos_navigation.iml" filepath="$PROJECT_DIR$/packages/navigation/melos_navigation.iml" /> <module fileurl="file://$PROJECT_DIR$/packages/navigation/melos_navigation.iml" filepath="$PROJECT_DIR$/packages/navigation/melos_navigation.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/notifications/melos_notifications.iml" filepath="$PROJECT_DIR$/modules/notifications/melos_notifications.iml" /> <module fileurl="file://$PROJECT_DIR$/modules/notifications/melos_notifications.iml" filepath="$PROJECT_DIR$/modules/notifications/melos_notifications.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/profile/melos_profile.iml" filepath="$PROJECT_DIR$/modules/profile/melos_profile.iml" /> <module fileurl="file://$PROJECT_DIR$/modules/profile/melos_profile.iml" filepath="$PROJECT_DIR$/modules/profile/melos_profile.iml" />
<module fileurl="file://$PROJECT_DIR$/apps/mobile_app/melos_sf_app_platform.iml" filepath="$PROJECT_DIR$/apps/mobile_app/melos_sf_app_platform.iml" /> <module fileurl="file://$PROJECT_DIR$/apps/mobile_app/melos_sf_app_platform.iml" filepath="$PROJECT_DIR$/apps/mobile_app/melos_sf_app_platform.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/sf_infrastructure/melos_sf_infrastructure.iml" filepath="$PROJECT_DIR$/packages/sf_infrastructure/melos_sf_infrastructure.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/sf_localizations/melos_sf_localizations.iml" filepath="$PROJECT_DIR$/packages/sf_localizations/melos_sf_localizations.iml" /> <module fileurl="file://$PROJECT_DIR$/packages/sf_localizations/melos_sf_localizations.iml" filepath="$PROJECT_DIR$/packages/sf_localizations/melos_sf_localizations.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/sf_shared/melos_sf_shared.iml" filepath="$PROJECT_DIR$/packages/sf_shared/melos_sf_shared.iml" /> <module fileurl="file://$PROJECT_DIR$/packages/sf_shared/melos_sf_shared.iml" filepath="$PROJECT_DIR$/packages/sf_shared/melos_sf_shared.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/utils/melos_utils.iml" filepath="$PROJECT_DIR$/packages/utils/melos_utils.iml" /> <module fileurl="file://$PROJECT_DIR$/packages/utils/melos_utils.iml" filepath="$PROJECT_DIR$/packages/utils/melos_utils.iml" />

View File

@@ -0,0 +1,7 @@
<!-- Generated by Melos -->
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Flutter Test -&gt; 'sf_infrastructure'" type="FlutterTestConfigType" factoryName="Flutter Test">
<option name="testDir" value="$PROJECT_DIR$/packages/sf_infrastructure/test" />
<method v="2" />
</configuration>
</component>

2
apps/mobile_app/.env Normal file
View File

@@ -0,0 +1,2 @@
API_BASE_URL=https://api-neki-b2b.neki.es/gateway/api/
API_ORIGIN =https://neki-b2b.neki.es

View File

@@ -0,0 +1,8 @@
import 'package:flutter_dotenv/flutter_dotenv.dart';
class Env {
static String get apiBaseUrl => dotenv.env['API_BASE_URL'] ?? '';
static String get apiOrigin => dotenv.env['API_ORIGIN'] ?? '';
// static String get apiKey => dotenv.env['API_KEY'] ?? '';
}

View File

@@ -0,0 +1,12 @@
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'env.dart';
class QuestiaEnvConfig implements EnvConfig {
@override
String get apiBaseUrl => Env.apiBaseUrl;
@override
String get apiOrigin => Env.apiOrigin;
// @override
// String get apiKey => Env.apiKey;
}

View File

@@ -1,9 +1,13 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:sf_app_platform/config/env/questia_env_config.dart';
import 'package:sf_app_platform/navigation/app_router.dart'; import 'package:sf_app_platform/navigation/app_router.dart';
import 'package:navigation/navigation_module.dart'; import 'package:navigation/navigation_module.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'package:sf_localizations/sf_localizations.dart'; import 'package:sf_localizations/sf_localizations.dart';
Future<void> main() async { Future<void> main() async {
@@ -11,7 +15,9 @@ Future<void> main() async {
navigationModule(); navigationModule();
configureAppRouter(); configureAppRouter();
themePackages(); themePackages();
await dotenv.load(fileName: '.env');
await configureDependencies(QuestiaEnvConfig(), log: kDebugMode);
runApp(const ProviderScope(child: PlatformApp())); runApp(const ProviderScope(child: PlatformApp()));
} }
@@ -48,4 +54,4 @@ class PlatformApp extends ConsumerWidget {
}, },
); );
} }
} }

View File

@@ -15,7 +15,7 @@ late final GoRouter appRouter;
void configureAppRouter() { void configureAppRouter() {
appRouter = GoRouter( appRouter = GoRouter(
navigatorKey: rootNavigatorKey, navigatorKey: rootNavigatorKey,
initialLocation: AppRoutes.onboarding, initialLocation: AppRoutes.login,
debugLogDiagnostics: true, debugLogDiagnostics: true,
routes: [ routes: [
GoRoute( GoRoute(
@@ -35,13 +35,13 @@ void configureAppRouter() {
), ),
GoRoute( GoRoute(
path: AppRoutes.linkPhone, path: AppRoutes.linkPhone,
name: 'link_phone', name: 'request_link_phone',
pageBuilder: LinkPhoneBuilder().buildPage, pageBuilder: RequestLinkPhoneBuilder().buildPage,
), ),
GoRoute( GoRoute(
path: AppRoutes.phoneCode, path: AppRoutes.phoneCode,
name: 'phone_code', name: 'Verify_link_phone_code',
pageBuilder: PhoneCodeBuilder().buildPage, pageBuilder: VerifyLinkPhoneCodeBuilder().buildPage,
), ),
GoRoute( GoRoute(
path: AppRoutes.recoverPassword, path: AppRoutes.recoverPassword,

View File

@@ -168,6 +168,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
country_code_picker:
dependency: transitive
description:
name: country_code_picker
sha256: f0411f4833b6f98e8b7215f4fa3813bcc88e50f13925f70a170dbd36e3e447f5
url: "https://pub.dev"
source: hosted
version: "3.4.1"
coverage: coverage:
dependency: transitive dependency: transitive
description: description:
@@ -214,6 +222,30 @@ packages:
relative: true relative: true
source: path source: path
version: "0.0.1" version: "0.0.1"
diacritic:
dependency: transitive
description:
name: diacritic
sha256: "12981945ec38931748836cd76f2b38773118d0baef3c68404bdfde9566147876"
url: "https://pub.dev"
source: hosted
version: "0.1.6"
dio:
dependency: transitive
description:
name: dio
sha256: d90ee57923d1828ac14e492ca49440f65477f4bb1263575900be731a3dac66a9
url: "https://pub.dev"
source: hosted
version: "5.9.0"
dio_web_adapter:
dependency: transitive
description:
name: dio_web_adapter
sha256: "7586e476d70caecaf1686d21eee7247ea43ef5c345eab9e0cc3583ff13378d78"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
equatable: equatable:
dependency: transitive dependency: transitive
description: description:
@@ -259,6 +291,14 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_dotenv:
dependency: "direct main"
description:
name: flutter_dotenv
sha256: d4130c4a43e0b13fefc593bc3961f2cb46e30cb79e253d4a526b1b5d24ae1ce4
url: "https://pub.dev"
source: hosted
version: "6.0.0"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
@@ -284,10 +324,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_svg name: flutter_svg
sha256: b9c2ad5872518a27507ab432d1fb97e8813b05f0fc693f9d40fad06d073e0678 sha256: "87fbd7c534435b6c5d9d98b01e1fd527812b82e68ddd8bd35fc45ed0fa8f0a95"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.2.3"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@@ -298,6 +338,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
fonts:
dependency: "direct main"
description:
path: "../../packages/fonts"
relative: true
source: path
version: "0.0.1"
freezed: freezed:
dependency: transitive dependency: transitive
description: description:
@@ -590,6 +637,13 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.3" version: "3.0.3"
sf_infrastructure:
dependency: "direct main"
description:
path: "../../packages/sf_infrastructure"
relative: true
source: path
version: "0.0.1"
sf_localizations: sf_localizations:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -874,4 +928,4 @@ packages:
version: "3.1.3" version: "3.1.3"
sdks: sdks:
dart: ">=3.9.2 <4.0.0" dart: ">=3.9.2 <4.0.0"
flutter: ">=3.29.0" flutter: ">=3.32.0"

View File

@@ -57,12 +57,15 @@ dependencies:
path: ../../packages/sf_localizations path: ../../packages/sf_localizations
fonts: fonts:
path: ../../packages/fonts path: ../../packages/fonts
sf_infrastructure:
path: ../../packages/sf_infrastructure
#dependencies go here #dependencies go here
cupertino_icons: ^1.0.8 cupertino_icons: ^1.0.8
flutter_svg: ^2.2.1 flutter_svg: ^2.2.1
go_router_builder: ^4.1.1 go_router_builder: ^4.1.1
build_runner: ^2.7.1 build_runner: ^2.7.1
flutter_dotenv: ^6.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@@ -89,7 +92,7 @@ flutter:
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets:
- assets/images/ui/ - assets/images/ui/
- .env
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images # https://flutter.dev/to/resolution-aware-images

View File

@@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: auth,dashboard_shell,design_system,home,navigation,notifications,profile,sf_shared,utils,sf_localizations # melos_managed_dependency_overrides: auth,dashboard_shell,design_system,home,navigation,notifications,profile,sf_shared,utils,sf_localizations,fonts,sf_infrastructure
dependency_overrides: dependency_overrides:
auth: auth:
path: ../../modules/auth path: ../../modules/auth
@@ -6,6 +6,8 @@ dependency_overrides:
path: ../../modules/dashboard_shell path: ../../modules/dashboard_shell
design_system: design_system:
path: ../../packages/design_system path: ../../packages/design_system
fonts:
path: ../../packages/fonts
home: home:
path: ../../modules/home path: ../../modules/home
navigation: navigation:
@@ -14,6 +16,8 @@ dependency_overrides:
path: ../../modules/notifications path: ../../modules/notifications
profile: profile:
path: ../../modules/profile path: ../../modules/profile
sf_infrastructure:
path: ../../packages/sf_infrastructure
sf_localizations: sf_localizations:
path: ../../packages/sf_localizations path: ../../packages/sf_localizations
sf_shared: sf_shared:

View File

@@ -1,8 +1,8 @@
export 'src/device_sign_up/link_watch/create_profile_screen.dart'; export 'src/features/device_sign_up/link_watch/create_profile_screen.dart';
export 'src/onboarding/onboarding_builder.dart'; export 'src/features/onboarding/onboarding_builder.dart';
export 'src/login/link_phone_builder.dart'; export 'src/features/link_phone/presentation/request_phone/request_link_phone_builder.dart';
export 'src/login/phone_code_builder.dart'; export 'src/features/link_phone/presentation/verify_code/verify_link_phone_code_builder.dart';
export 'src/login/login_builder.dart'; export 'src/features/login/login_builder.dart';
export 'src/recover_password/recover_password_builder.dart'; export 'src/features/recover_password/recover_password_builder.dart';
export 'src/device_sign_up/device_signup_builder.dart'; export 'src/features/device_sign_up/device_signup_builder.dart';
export 'src/sign_up/signup_builder.dart'; export 'src/features/sign_up/signup_builder.dart';

View File

@@ -0,0 +1,5 @@
abstract class AuthRemoteDatasource {
Future<void> requestPhoneCode({required String phone});
Future<void> verifyPhoneCode({required String phone, required String code});
}

View File

@@ -0,0 +1,56 @@
import 'package:dio/dio.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
import 'auth_remote_datasource.dart';
class AuthRemoteDatasourceImpl implements AuthRemoteDatasource {
AuthRemoteDatasourceImpl(this._repository);
final QuestiaRepository _repository;
@override
Future<void> requestPhoneCode({required String phone}) async {
try {
await _repository.post<void>(
'/auth/link-phone/request-code',
body: <String, dynamic>{'phone': phone},
);
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: error.response?.data ?? 'Error to request phone code',
);
}
}
@override
Future<void> verifyPhoneCode({
required String phone,
required String code,
}) async {
try {
await _repository.post<void>(
'/auth/link-phone/verify-code',
body: <String, dynamic>{'phone': phone, 'code': code},
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error in verification code');
}
}
Exception _mapDioError(DioException error, {required String defaultMessage}) {
final responseData = error.response?.data;
String message = defaultMessage;
if (responseData is Map<String, dynamic>) {
final serverMessage = responseData['message'];
if (serverMessage is String && serverMessage.isNotEmpty) {
message = serverMessage;
}
} else if (error.message != null && error.message!.isNotEmpty) {
message = error.message!;
}
return Exception(message);
}
}

View File

@@ -0,0 +1,18 @@
import 'package:auth/src/core/data/datasource/auth_remote_datasource.dart';
import 'package:auth/src/core/domain/repositories/auth_repository.dart';
class AuthRepositoryImpl implements AuthRepository {
const AuthRepositoryImpl(this._remote);
final AuthRemoteDatasource _remote;
@override
Future<void> requestPhoneCode({required String phone}) {
return _remote.requestPhoneCode(phone: phone);
}
@override
Future<void> verifyPhoneCode({required String phone, required String code}) {
return _remote.verifyPhoneCode(phone: phone, code: code);
}
}

View File

@@ -0,0 +1,5 @@
abstract class AuthRepository {
Future<void> requestPhoneCode({required String phone});
Future<void> verifyPhoneCode({required String phone, required String code});
}

View File

@@ -0,0 +1,9 @@
import 'package:auth/src/core/data/datasource/auth_remote_datasource.dart';
import 'package:auth/src/core/data/datasource/auth_remote_datasource_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
final authRemoteDatasourceProvider = Provider<AuthRemoteDatasource>((ref) {
final questiaRepository = getIt<QuestiaRepository>();
return AuthRemoteDatasourceImpl(questiaRepository);
});

View File

@@ -0,0 +1,9 @@
import 'package:auth/src/core/data/repositories/auth_repository_impl.dart';
import 'package:auth/src/core/domain/repositories/auth_repository.dart';
import 'package:auth/src/core/providers/auth_remote_datasource_provider.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final authRepositoryProvider = Provider<AuthRepository>((ref) {
final remote = ref.read(authRemoteDatasourceProvider);
return AuthRepositoryImpl(remote);
});

View File

@@ -1,4 +1,4 @@
import 'package:auth/src/device_sign_up/device_signup_screen.dart'; import 'package:auth/src/features/device_sign_up/device_signup_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';

View File

@@ -1,24 +1,25 @@
import 'package:auth/auth.dart'; import 'package:auth/auth.dart';
import 'package:auth/src/device_sign_up/add_kid_screen.dart'; import 'package:auth/src/features/device_sign_up/add_kid_screen.dart';
import 'package:auth/src/device_sign_up/link_watch/link_watch_screen.dart'; import 'package:auth/src/features/device_sign_up/link_watch/link_watch_screen.dart';
import 'package:auth/src/device_sign_up/link_watch/link_watch_previous_screen.dart'; import 'package:auth/src/features/device_sign_up/link_watch/link_watch_previous_screen.dart';
import 'package:auth/src/sign_up/account_created_screen.dart'; import 'package:auth/src/features/sign_up/account_created_screen.dart';
import 'package:auth/src/widgets/layouts/form_step_layout.dart'; import 'package:auth/src/widgets/layouts/form_step_layout.dart';
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart'; import 'package:navigation/navigation.dart';
class DeviceSignupScreen extends ConsumerStatefulWidget{ class DeviceSignupScreen extends ConsumerStatefulWidget {
final NavigationContract navigationContract; final NavigationContract navigationContract;
const DeviceSignupScreen({super.key, required this.navigationContract}); const DeviceSignupScreen({super.key, required this.navigationContract});
@override @override
ConsumerState<DeviceSignupScreen> createState() => DeviceSignupScreenState(navigationContract); ConsumerState<DeviceSignupScreen> createState() =>
DeviceSignupScreenState(navigationContract);
} }
class DeviceSignupScreenState extends ConsumerState<DeviceSignupScreen>{ class DeviceSignupScreenState extends ConsumerState<DeviceSignupScreen> {
late int currentStep; late int currentStep;
final NavigationContract navigationContract; final NavigationContract navigationContract;
@@ -34,37 +35,46 @@ class DeviceSignupScreenState extends ConsumerState<DeviceSignupScreen>{
return getSteps()[currentStep]; return getSteps()[currentStep];
} }
List<Widget> getSteps(){ List<Widget> getSteps() {
final theme = ref.watch(themePortProvider); final theme = ref.watch(themePortProvider);
final continueBtn = Container( final continueBtn = Container(
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
child: PrimaryButton( child: PrimaryButton(
onPressed: ()=>{setState(() { onPressed: () => {
currentStep++; setState(() {
})}, currentStep++;
}),
},
text: "Continuar", text: "Continuar",
color: theme.getColorFor(ThemeCode.buttonPrimary) color: theme.getColorFor(ThemeCode.buttonPrimary),
) ),
); );
return [ return [
AddKidScreen(nextStep: ()=>{setState(() { AddKidScreen(
currentStep++; nextStep: () => {
})}), setState(() {
currentStep++;
}),
},
),
FormStepLayout( FormStepLayout(
title: "Crea su perfil", title: "Crea su perfil",
subtitle: "Necesitamos estos datos para crear su cuenta y gestionar sus pagos y gastos", subtitle:
"Necesitamos estos datos para crear su cuenta y gestionar sus pagos y gastos",
currentStep: 1, currentStep: 1,
numSteps: 3, numSteps: 3,
body: [CreateProfileScreen()], body: [CreateProfileScreen()],
footer: [Container( footer: [
padding: EdgeInsets.all(24), Container(
color: theme.getColorFor(ThemeCode.backgroundPrimary), padding: EdgeInsets.all(24),
child: continueBtn color: theme.getColorFor(ThemeCode.backgroundPrimary),
)], child: continueBtn,
nextStep: ()=>{}, ),
previousStep: ()=>{} ],
nextStep: () => {},
previousStep: () => {},
), ),
FormStepLayout( FormStepLayout(
title: "Vincula su correa y su reloj", title: "Vincula su correa y su reloj",
@@ -72,28 +82,31 @@ class DeviceSignupScreenState extends ConsumerState<DeviceSignupScreen>{
numSteps: 3, numSteps: 3,
body: [LinkWatchPreviousScreen()], body: [LinkWatchPreviousScreen()],
footer: [continueBtn], footer: [continueBtn],
nextStep: ()=>{}, nextStep: () => {},
previousStep: ()=>{} previousStep: () => {},
), ),
FormStepLayout( FormStepLayout(
title: "Vincula su correa\ny su reloj", title: "Vincula su correa\ny su reloj",
currentStep: 2, currentStep: 2,
numSteps: 3, numSteps: 3,
body: [LinkWatchScreen(step:1)], body: [LinkWatchScreen(step: 1)],
footer: [continueBtn], footer: [continueBtn],
nextStep: ()=>{}, nextStep: () => {},
previousStep: ()=>{} previousStep: () => {},
), ),
FormStepLayout( FormStepLayout(
title: "Vincula su correa\ny su reloj", title: "Vincula su correa\ny su reloj",
currentStep: 2, currentStep: 2,
numSteps: 3, numSteps: 3,
body: [LinkWatchScreen(step:2)], body: [LinkWatchScreen(step: 2)],
footer: [continueBtn], footer: [continueBtn],
nextStep: ()=>{}, nextStep: () => {},
previousStep: ()=>{} previousStep: () => {},
),
AccountCreatedScreen(
navigationContract: navigationContract,
kidAccount: true,
), ),
AccountCreatedScreen(navigationContract: navigationContract, kidAccount: true)
]; ];
} }
} }

View File

@@ -0,0 +1,5 @@
abstract class LinkPhoneUseCase {
Future<void> requestCode({required String phone});
Future<void> verifyCode({required String phone, required String code});
}

View File

@@ -0,0 +1,20 @@
import 'package:auth/src/core/domain/repositories/auth_repository.dart';
import 'package:auth/src/features/link_phone/domain/use_cases/link_phone_use_case.dart';
class LinkPhoneUseCaseImpl implements LinkPhoneUseCase {
LinkPhoneUseCaseImpl(this._repository);
final AuthRepository _repository;
@override
Future<void> requestCode({required String phone}) async {
// return _repository.requestPhoneCode(phone: phone);
await Future<void>.delayed(const Duration(milliseconds: 500));
}
@override
Future<void> verifyCode({required String phone, required String code}) async {
// return _repository.verifyPhoneCode(phone: phone, code: code);
await Future<void>.delayed(const Duration(milliseconds: 500));
}
}

View File

@@ -0,0 +1,9 @@
import 'package:auth/src/core/providers/auth_repository_provider.dart';
import 'package:auth/src/features/link_phone/domain/use_cases/link_phone_use_case.dart';
import 'package:auth/src/features/link_phone/domain/use_cases/link_phone_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final linkPhoneUseCaseProvider = Provider.autoDispose<LinkPhoneUseCase>((ref) {
final authRepository = ref.read(authRepositoryProvider);
return LinkPhoneUseCaseImpl(authRepository);
});

View File

@@ -1,18 +1,18 @@
import 'package:auth/src/login/presentation/link_phone_screen.dart'; import 'package:auth/src/features/link_phone/presentation/request_phone/request_link_phone_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:navigation/navigation.dart'; import 'package:navigation/navigation.dart';
class LinkPhoneBuilder { class RequestLinkPhoneBuilder {
const LinkPhoneBuilder(); const RequestLinkPhoneBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) { Page<void> buildPage(BuildContext context, GoRouterState state) {
final NavigationContract navigationContract = GetIt.I<NavigationContract>(); final NavigationContract navigationContract = GetIt.I<NavigationContract>();
return MaterialPage<void>( return MaterialPage<void>(
key: state.pageKey, key: state.pageKey,
child: LinkPhoneScreen(navigationContract: navigationContract), child: RequestLinkPhoneScreen(navigationContract: navigationContract),
); );
} }
} }

View File

@@ -0,0 +1,110 @@
import 'package:auth/src/features/link_phone/presentation/state/link_phone_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
class RequestLinkPhoneScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const RequestLinkPhoneScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final viewModel = ref.read(linkPhoneViewModelProvider.notifier);
final viewState = ref.watch(linkPhoneViewModelProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
context.translate(I18n.linkPhoneTitle),
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 30,
fontWeight: FontWeight.w500,
letterSpacing: 0,
),
),
const SizedBox(height: 24),
Text(
context.translate(I18n.linkPhoneSubtitle),
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16, letterSpacing: 0),
),
const SizedBox(height: 48),
Column(
spacing: 8,
children: [
Align(
alignment: Alignment.bottomLeft,
child: Text(
context.translate(I18n.mobilePhone),
style: const TextStyle(fontSize: 14, letterSpacing: 0),
),
),
Row(
spacing: 10,
children: [
CountryPrefixPicker(
headerText: context.translate(I18n.selectYourCountry),
initialCountryCode: viewState.dialCode,
onChanged: (country) {
viewModel.updateDialCode(
country.dialCode ?? viewState.dialCode,
);
},
),
Expanded(
child: CustomTextField(
controller: viewModel.phoneNumberController,
hint: context.translate(I18n.phoneNumber),
numeric: true,
),
),
],
),
],
),
const SizedBox(height: 16),
if (viewState.errorMessage.isNotEmpty) ...[
const SizedBox(height: 4),
Text(
viewState.errorMessage,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color.fromRGBO(239, 17, 17, 1),
fontSize: 12,
),
),
],
const SizedBox(height: 24),
PrimaryButton(
onPressed: () async {
await viewModel.requestCode();
final updatedState = ref.read(linkPhoneViewModelProvider);
if (updatedState.errorMessage.isEmpty) {
navigationContract.pushTo(AppRoutes.phoneCode);
}
},
text: context.translate(I18n.next),
color: theme.getColorFor(ThemeCode.buttonPrimary),
),
],
),
),
);
}
}

View File

@@ -0,0 +1,148 @@
import 'package:auth/src/features/link_phone/presentation/providers/link_phone_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:auth/src/features/link_phone/domain/use_cases/link_phone_use_case.dart';
import 'package:auth/src/features/link_phone/presentation/state/link_phone_view_state.dart';
final linkPhoneViewModelProvider =
NotifierProvider.autoDispose<LinkPhoneViewModel, LinkPhoneViewState>(
LinkPhoneViewModel.new,
);
class LinkPhoneViewModel extends Notifier<LinkPhoneViewState> {
late final LinkPhoneUseCase _linkPhoneUseCase;
late final TextEditingController phoneNumberController;
late final TextEditingController codeController;
@override
LinkPhoneViewState build() {
_linkPhoneUseCase = ref.read(linkPhoneUseCaseProvider);
phoneNumberController = TextEditingController();
phoneNumberController.addListener(_onPhoneNumberChanged);
codeController = TextEditingController();
ref.onDispose(disposeControllers);
return const LinkPhoneViewState();
}
void _onPhoneNumberChanged() {
final raw = phoneNumberController.text;
state = state.copyWith(
phoneNumber: raw,
errorMessage: '',
codeVerified: false,
);
}
void updateDialCode(String dialCode) {
state = state.copyWith(
dialCode: dialCode,
errorMessage: '',
codeVerified: false,
);
}
void updateCode(String code) {
codeController.text = code;
state = state.copyWith(errorMessage: '', codeVerified: false);
}
Future<void> requestCode() async {
final trimmedNumber = state.phoneNumber.trim();
if (trimmedNumber.isEmpty) {
state = state.copyWith(
errorMessage: 'errorMessagePhoneIsEmpty',
codeVerified: false,
);
return;
}
final fullPhone = '${state.dialCode}$trimmedNumber';
state = state.copyWith(
isLoading: true,
errorMessage: '',
codeRequested: false,
codeVerified: false,
);
try {
await _linkPhoneUseCase.requestCode(phone: fullPhone);
if (!ref.mounted) return;
state = state.copyWith(
isLoading: false,
errorMessage: '',
codeRequested: true,
);
} catch (e) {
if (!ref.mounted) return;
state = state.copyWith(
isLoading: false,
errorMessage: e.toString(),
codeRequested: false,
codeVerified: false,
);
}
}
Future<void> verifyCode() async {
final dialCode = state.dialCode;
final phoneNumber = state.phoneNumber.trim();
final code = codeController.text.trim();
final fullPhone = '$dialCode$phoneNumber';
if (phoneNumber.isEmpty) {
state = state.copyWith(
errorMessage: 'errorMessagePhoneIsEmpty',
codeVerified: false,
);
return;
}
if (code.isEmpty) {
state = state.copyWith(
errorMessage: 'errorMessageCodeIsEmpty',
codeVerified: false,
);
return;
}
state = state.copyWith(
isLoading: true,
errorMessage: '',
codeVerified: false,
);
try {
await _linkPhoneUseCase.verifyCode(phone: fullPhone, code: code);
if (!ref.mounted) return;
state = state.copyWith(
isLoading: false,
errorMessage: '',
codeVerified: true,
);
} catch (e) {
if (!ref.mounted) return;
state = state.copyWith(
isLoading: false,
errorMessage: e.toString(),
codeVerified: false,
);
}
}
void disposeControllers() {
phoneNumberController.removeListener(_onPhoneNumberChanged);
phoneNumberController.dispose();
codeController.dispose();
}
}

View File

@@ -0,0 +1,15 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'link_phone_view_state.freezed.dart';
@freezed
abstract class LinkPhoneViewState with _$LinkPhoneViewState {
const factory LinkPhoneViewState({
@Default('') String phoneNumber,
@Default('+34') String dialCode,
@Default('') String errorMessage,
@Default(false) bool isLoading,
@Default(false) bool codeRequested,
@Default(false) bool codeVerified,
}) = _LinkPhoneViewState;
}

View File

@@ -0,0 +1,286 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'link_phone_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$LinkPhoneViewState {
String get phoneNumber; String get dialCode; String get errorMessage; bool get isLoading; bool get codeRequested; bool get codeVerified;
/// Create a copy of LinkPhoneViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LinkPhoneViewStateCopyWith<LinkPhoneViewState> get copyWith => _$LinkPhoneViewStateCopyWithImpl<LinkPhoneViewState>(this as LinkPhoneViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LinkPhoneViewState&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.codeRequested, codeRequested) || other.codeRequested == codeRequested)&&(identical(other.codeVerified, codeVerified) || other.codeVerified == codeVerified));
}
@override
int get hashCode => Object.hash(runtimeType,phoneNumber,dialCode,errorMessage,isLoading,codeRequested,codeVerified);
@override
String toString() {
return 'LinkPhoneViewState(phoneNumber: $phoneNumber, dialCode: $dialCode, errorMessage: $errorMessage, isLoading: $isLoading, codeRequested: $codeRequested, codeVerified: $codeVerified)';
}
}
/// @nodoc
abstract mixin class $LinkPhoneViewStateCopyWith<$Res> {
factory $LinkPhoneViewStateCopyWith(LinkPhoneViewState value, $Res Function(LinkPhoneViewState) _then) = _$LinkPhoneViewStateCopyWithImpl;
@useResult
$Res call({
String phoneNumber, String dialCode, String errorMessage, bool isLoading, bool codeRequested, bool codeVerified
});
}
/// @nodoc
class _$LinkPhoneViewStateCopyWithImpl<$Res>
implements $LinkPhoneViewStateCopyWith<$Res> {
_$LinkPhoneViewStateCopyWithImpl(this._self, this._then);
final LinkPhoneViewState _self;
final $Res Function(LinkPhoneViewState) _then;
/// Create a copy of LinkPhoneViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? phoneNumber = null,Object? dialCode = null,Object? errorMessage = null,Object? isLoading = null,Object? codeRequested = null,Object? codeVerified = null,}) {
return _then(_self.copyWith(
phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
as String,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,codeRequested: null == codeRequested ? _self.codeRequested : codeRequested // ignore: cast_nullable_to_non_nullable
as bool,codeVerified: null == codeVerified ? _self.codeVerified : codeVerified // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// Adds pattern-matching-related methods to [LinkPhoneViewState].
extension LinkPhoneViewStatePatterns on LinkPhoneViewState {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LinkPhoneViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _LinkPhoneViewState() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LinkPhoneViewState value) $default,){
final _that = this;
switch (_that) {
case _LinkPhoneViewState():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LinkPhoneViewState value)? $default,){
final _that = this;
switch (_that) {
case _LinkPhoneViewState() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String phoneNumber, String dialCode, String errorMessage, bool isLoading, bool codeRequested, bool codeVerified)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _LinkPhoneViewState() when $default != null:
return $default(_that.phoneNumber,_that.dialCode,_that.errorMessage,_that.isLoading,_that.codeRequested,_that.codeVerified);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String phoneNumber, String dialCode, String errorMessage, bool isLoading, bool codeRequested, bool codeVerified) $default,) {final _that = this;
switch (_that) {
case _LinkPhoneViewState():
return $default(_that.phoneNumber,_that.dialCode,_that.errorMessage,_that.isLoading,_that.codeRequested,_that.codeVerified);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String phoneNumber, String dialCode, String errorMessage, bool isLoading, bool codeRequested, bool codeVerified)? $default,) {final _that = this;
switch (_that) {
case _LinkPhoneViewState() when $default != null:
return $default(_that.phoneNumber,_that.dialCode,_that.errorMessage,_that.isLoading,_that.codeRequested,_that.codeVerified);case _:
return null;
}
}
}
/// @nodoc
class _LinkPhoneViewState implements LinkPhoneViewState {
const _LinkPhoneViewState({this.phoneNumber = '', this.dialCode = '+34', this.errorMessage = '', this.isLoading = false, this.codeRequested = false, this.codeVerified = false});
@override@JsonKey() final String phoneNumber;
@override@JsonKey() final String dialCode;
@override@JsonKey() final String errorMessage;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final bool codeRequested;
@override@JsonKey() final bool codeVerified;
/// Create a copy of LinkPhoneViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$LinkPhoneViewStateCopyWith<_LinkPhoneViewState> get copyWith => __$LinkPhoneViewStateCopyWithImpl<_LinkPhoneViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LinkPhoneViewState&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.codeRequested, codeRequested) || other.codeRequested == codeRequested)&&(identical(other.codeVerified, codeVerified) || other.codeVerified == codeVerified));
}
@override
int get hashCode => Object.hash(runtimeType,phoneNumber,dialCode,errorMessage,isLoading,codeRequested,codeVerified);
@override
String toString() {
return 'LinkPhoneViewState(phoneNumber: $phoneNumber, dialCode: $dialCode, errorMessage: $errorMessage, isLoading: $isLoading, codeRequested: $codeRequested, codeVerified: $codeVerified)';
}
}
/// @nodoc
abstract mixin class _$LinkPhoneViewStateCopyWith<$Res> implements $LinkPhoneViewStateCopyWith<$Res> {
factory _$LinkPhoneViewStateCopyWith(_LinkPhoneViewState value, $Res Function(_LinkPhoneViewState) _then) = __$LinkPhoneViewStateCopyWithImpl;
@override @useResult
$Res call({
String phoneNumber, String dialCode, String errorMessage, bool isLoading, bool codeRequested, bool codeVerified
});
}
/// @nodoc
class __$LinkPhoneViewStateCopyWithImpl<$Res>
implements _$LinkPhoneViewStateCopyWith<$Res> {
__$LinkPhoneViewStateCopyWithImpl(this._self, this._then);
final _LinkPhoneViewState _self;
final $Res Function(_LinkPhoneViewState) _then;
/// Create a copy of LinkPhoneViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? phoneNumber = null,Object? dialCode = null,Object? errorMessage = null,Object? isLoading = null,Object? codeRequested = null,Object? codeVerified = null,}) {
return _then(_LinkPhoneViewState(
phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
as String,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,codeRequested: null == codeRequested ? _self.codeRequested : codeRequested // ignore: cast_nullable_to_non_nullable
as bool,codeVerified: null == codeVerified ? _self.codeVerified : codeVerified // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
// dart format on

View File

@@ -1,18 +1,18 @@
import 'package:auth/src/login/presentation/phone_code_screen.dart'; import 'package:auth/src/features/link_phone/presentation/verify_code/verify_link_phone_code_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:navigation/navigation.dart'; import 'package:navigation/navigation.dart';
class PhoneCodeBuilder { class VerifyLinkPhoneCodeBuilder {
const PhoneCodeBuilder(); const VerifyLinkPhoneCodeBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) { Page<void> buildPage(BuildContext context, GoRouterState state) {
final NavigationContract navigationContract = GetIt.I<NavigationContract>(); final NavigationContract navigationContract = GetIt.I<NavigationContract>();
return MaterialPage<void>( return MaterialPage<void>(
key: state.pageKey, key: state.pageKey,
child: PhoneCodeScreen(navigationContract: navigationContract), child: VerifyLinkPhoneCodeScreen(navigationContract: navigationContract),
); );
} }
} }

View File

@@ -0,0 +1,118 @@
import 'package:auth/src/features/link_phone/presentation/state/link_phone_view_model.dart';
import 'package:auth/src/features/link_phone/presentation/widgets/link_phone_code_input.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:navigation/navigation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_localizations/sf_localizations.dart';
class VerifyLinkPhoneCodeScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const VerifyLinkPhoneCodeScreen({
super.key,
required this.navigationContract,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final viewModel = ref.read(linkPhoneViewModelProvider.notifier);
final viewState = ref.watch(linkPhoneViewModelProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 48,
children: [
Column(
children: [
Text(
context.translate(I18n.connect),
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
),
const SizedBox(height: 24),
Text.rich(
TextSpan(
text: context.translate(I18n.verificationCodeSentTo),
children: [
TextSpan(
text: '${viewState.dialCode}${viewState.phoneNumber}',
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18,
),
),
],
),
textAlign: TextAlign.center,
),
const SizedBox(height: 48),
Text(
context.translate(I18n.enterCodeHere),
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 24),
LinkPhoneCodeInput(
length: 6,
onCodeChanged: viewModel.updateCode,
),
if (viewState.errorMessage.isNotEmpty) ...[
const SizedBox(height: 8),
Text(
viewState.errorMessage,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color.fromRGBO(239, 17, 17, 1),
fontSize: 12,
),
),
],
],
),
Column(
children: [
PrimaryButton(
onPressed: () async {
await viewModel.verifyCode();
final updatedState = ref.read(linkPhoneViewModelProvider);
if (updatedState.codeVerified) {
navigationContract.pushTo(AppRoutes.login);
}
},
text: context.translate(I18n.enter),
color: theme.getColorFor(ThemeCode.buttonPrimary),
),
const SizedBox(height: 24),
Text(
context.translate(I18n.didNotReceiveIt),
style: TextStyle(
fontSize: 18,
letterSpacing: 0,
height: 1.5,
),
),
const SizedBox(height: 8),
CustomTextButton(
onPressed: () => navigationContract.goBack(),
text: context.translate(I18n.tryAgain),
size: 18,
weight: FontWeight.w500,
),
],
),
],
),
),
),
);
}
}

View File

@@ -0,0 +1,86 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class LinkPhoneCodeInput extends StatefulWidget {
const LinkPhoneCodeInput({
super.key,
this.length = 6,
required this.onCodeChanged,
});
final int length;
final ValueChanged<String> onCodeChanged;
@override
State<LinkPhoneCodeInput> createState() => _LinkPhoneCodeInputState();
}
class _LinkPhoneCodeInputState extends State<LinkPhoneCodeInput> {
late final List<TextEditingController> _controllers;
late final List<FocusNode> _focusNodes;
@override
void initState() {
super.initState();
_controllers = List<TextEditingController>.generate(
widget.length,
(_) => TextEditingController(),
);
_focusNodes = List<FocusNode>.generate(widget.length, (_) => FocusNode());
}
@override
void dispose() {
for (final controller in _controllers) {
controller.dispose();
}
for (final node in _focusNodes) {
node.dispose();
}
super.dispose();
}
void _onDigitChanged(int index, String value) {
if (value.length > 1) {
final single = value.characters.last;
_controllers[index].text = single;
_controllers[index].selection = TextSelection.fromPosition(
TextPosition(offset: single.length),
);
}
if (value.isNotEmpty && index < widget.length - 1) {
_focusNodes[index + 1].requestFocus();
} else if (value.isEmpty && index > 0) {
_focusNodes[index - 1].requestFocus();
}
final code = _controllers.map((c) => c.text).join();
widget.onCodeChanged(code);
}
@override
Widget build(BuildContext context) {
return Row(
spacing: 8,
children: List<Widget>.generate(widget.length, (int i) {
return Expanded(
child: TextField(
controller: _controllers[i],
focusNode: _focusNodes[i],
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
textAlign: TextAlign.center,
decoration: const InputDecoration(
hintText: '0',
counterText: '',
border: OutlineInputBorder(),
),
maxLength: 1,
onChanged: (value) => _onDigitChanged(i, value),
),
);
}),
);
}
}

View File

@@ -1,4 +1,4 @@
import 'package:auth/src/login/presentation/login_screen.dart'; import 'package:auth/src/features/login/presentation/login_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';

View File

@@ -1,5 +1,5 @@
import 'package:auth/src/login/presentation/loading_google_screen.dart'; import 'package:auth/src/features/login/presentation/loading_google_screen.dart';
import 'package:auth/src/sign_up/signup_screen.dart'; import 'package:auth/src/features/sign_up/signup_screen.dart';
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -15,7 +15,7 @@ class LoginScreen extends ConsumerStatefulWidget {
ConsumerState<ConsumerStatefulWidget> createState() => _LoginScreenState(); ConsumerState<ConsumerStatefulWidget> createState() => _LoginScreenState();
} }
class _LoginScreenState extends ConsumerState<LoginScreen>{ class _LoginScreenState extends ConsumerState<LoginScreen> {
bool passwordVisible = false; bool passwordVisible = false;
@override @override
@@ -28,7 +28,11 @@ class _LoginScreenState extends ConsumerState<LoginScreen>{
Column( Column(
spacing: 8, spacing: 8,
children: [ children: [
Icon(Icons.check, color: theme.getColorFor(ThemeCode.buttonPrimary), size: 50), Icon(
Icons.check,
color: theme.getColorFor(ThemeCode.buttonPrimary),
size: 50,
),
Text( Text(
// context.translate(I18n.example) // context.translate(I18n.example)
"¡Te damos la bienvenida!", "¡Te damos la bienvenida!",
@@ -51,43 +55,48 @@ class _LoginScreenState extends ConsumerState<LoginScreen>{
spacing: 12, spacing: 12,
children: [ children: [
CustomTextField( CustomTextField(
showPassword: passwordVisible, showPassword: passwordVisible,
label: "Contraseña", label: "Contraseña",
hint: "********" hint: "********",
), ),
Align( Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: CustomTextButton( child: CustomTextButton(
text: "¿Has olvidado la contraseña?", text: "¿Has olvidado la contraseña?",
onPressed: () => onPressed: () => widget.navigationContract.pushTo(
widget.navigationContract.pushTo(AppRoutes.recoverPassword), AppRoutes.recoverPassword,
),
size: 16, size: 16,
)), ),
),
], ],
) ),
], ],
), ),
PrimaryButton( PrimaryButton(
onPressed: () => widget.navigationContract.goTo(AppRoutes.dashboardHome), onPressed: () =>
text: "Iniciar sesión", widget.navigationContract.goTo(AppRoutes.dashboardHome),
color: theme.getColorFor(ThemeCode.buttonPrimary) text: "Iniciar sesión",
color: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
Container( Container(
padding: EdgeInsets.only(top: 24), padding: EdgeInsets.only(top: 24),
child: Column( child: Column(
spacing: 24, spacing: 24,
children: [ children: [
Stack(children: [ Stack(
Divider(endIndent: 74, indent: 74), children: [
Align( Divider(endIndent: 74, indent: 74),
Align(
alignment: Alignment.center, alignment: Alignment.center,
child: Container( child: Container(
padding: const EdgeInsets.symmetric(horizontal: 14), padding: const EdgeInsets.symmetric(horizontal: 14),
color: theme.getColorFor(ThemeCode.backgroundPrimary), color: theme.getColorFor(ThemeCode.backgroundPrimary),
child: Text("o continúa con"), child: Text("o continúa con"),
) ),
) ),
]), ],
),
Row( Row(
spacing: 20, spacing: 20,
children: [ children: [
@@ -105,7 +114,7 @@ class _LoginScreenState extends ConsumerState<LoginScreen>{
label: "Google", label: "Google",
), ),
SecondaryButton( SecondaryButton(
onPressed: ()=>{}, onPressed: () => {},
radius: 16, radius: 16,
padding: 44, padding: 44,
icon: Icons.apple, icon: Icons.apple,
@@ -121,18 +130,23 @@ class _LoginScreenState extends ConsumerState<LoginScreen>{
spacing: 8, spacing: 8,
children: [ children: [
Text( Text(
"¿No tienes cuenta?", "¿No tienes cuenta?",
style: TextStyle(fontSize: 18, letterSpacing: 0) style: TextStyle(fontSize: 18, letterSpacing: 0),
), ),
TextButton( TextButton(
onPressed: () => widget.navigationContract.goTo(AppRoutes.signup), onPressed: () =>
widget.navigationContract.goTo(AppRoutes.signup),
child: Text( child: Text(
"Crear una ahora", "Crear una ahora",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500, letterSpacing: 0) style: TextStyle(
) fontSize: 18,
fontWeight: FontWeight.w500,
letterSpacing: 0,
),
),
), ),
], ],
) ),
], ],
), ),
]; ];
@@ -153,8 +167,8 @@ class _LoginScreenState extends ConsumerState<LoginScreen>{
itemCount: content.length, itemCount: content.length,
), ),
), ),
) ),
) ),
); );
} }
} }

View File

@@ -1,4 +1,4 @@
import 'package:auth/src/onboarding/presentation/onboarding_screen.dart'; import 'package:auth/src/features/onboarding/presentation/onboarding_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';

View File

@@ -0,0 +1,126 @@
import 'package:auth/src/features/onboarding/domain/onboarding_page.dart';
import 'package:auth/src/features/onboarding/presentation/onboarding_view_model.dart';
import 'package:auth/src/features/onboarding/presentation/widgets/onboarding_content.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
final onboardingPageControllerProvider = Provider.autoDispose<PageController>((
ref,
) {
final controller = PageController();
ref.onDispose(controller.dispose);
return controller;
});
class OnboardingScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const OnboardingScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(onBoardingViewModelProvider);
final viewModel = ref.read(onBoardingViewModelProvider.notifier);
final pageController = ref.watch(onboardingPageControllerProvider);
final isLast = state.cardIndex >= onboardingPages.length - 1;
void goToNext() {
if (isLast) {
navigationContract.goTo(AppRoutes.linkPhone);
} else {
pageController.nextPage(
duration: const Duration(milliseconds: 400),
curve: Curves.easeOut,
);
}
}
return Scaffold(
backgroundColor: Colors.white,
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
children: [
Expanded(
child: PageView.builder(
controller: pageController,
itemCount: onboardingPages.length,
onPageChanged: viewModel.onPageChanged,
itemBuilder: (context, index) {
final page = onboardingPages[index];
return OnboardingContent(
image: page.image,
title: page.title,
subtitle: page.subtitle,
);
},
),
),
StepIndicator(
current: state.cardIndex + 1,
total: onboardingPages.length,
color: const Color(0xFF4A4A4A),
),
const SizedBox(height: 38),
Container(
padding: const EdgeInsets.symmetric(horizontal: 24),
width: double.infinity,
child: TextButton(
onPressed: goToNext,
style: TextButton.styleFrom(
backgroundColor: isLast
? const Color(0xFF329E95)
: const Color(0xFF333333),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(
vertical: 16,
horizontal: 24,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18),
),
),
child: Text(
isLast
? context.translate(I18n.start)
: context.translate(I18n.next),
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(height: 8),
SizedBox(
height: 48,
child: Center(
child: isLast
? const SizedBox.shrink()
: TextButton(
onPressed: () =>
navigationContract.goTo(AppRoutes.linkPhone),
child: Text(
context.translate(I18n.skip),
style: TextStyle(
color: Color(0xFF333333),
decoration: TextDecoration.underline,
fontWeight: FontWeight.w500,
fontSize: 18,
),
),
),
),
),
const SizedBox(height: 48),
],
),
),
);
}
}

View File

@@ -1,6 +1,6 @@
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:auth/src/onboarding/presentation/onboarding_view_state.dart'; import 'package:auth/src/features/onboarding/presentation/onboarding_view_state.dart';
final onBoardingViewModelProvider = final onBoardingViewModelProvider =
NotifierProvider.autoDispose<OnBoardingViewModel, OnboardingViewState>( NotifierProvider.autoDispose<OnBoardingViewModel, OnboardingViewState>(

View File

@@ -1,4 +1,4 @@
import 'package:auth/src/recover_password/presentation/sent_screen.dart'; import 'package:auth/src/features/recover_password/presentation/sent_screen.dart';
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:navigation/navigation.dart'; import 'package:navigation/navigation.dart';
@@ -47,26 +47,30 @@ class RestorePasswordScreen extends ConsumerWidget {
spacing: 8, spacing: 8,
children: [ children: [
Align( Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: Text( child: Text(
"Teléfono móvil", "Teléfono móvil",
style: TextStyle(fontSize: 14, letterSpacing: 0), style: TextStyle(fontSize: 14, letterSpacing: 0),
) ),
), ),
Row( Row(
spacing: 10, spacing: 10,
children: [ children: [
CustomDropdown( CustomDropdown(
value: 0, value: 0,
items: [Icon(Icons.outlined_flag), Icon(Icons.outlined_flag), Icon(Icons.outlined_flag)], items: [
onChanged: (value)=> {}, Icon(Icons.outlined_flag),
Icon(Icons.outlined_flag),
Icon(Icons.outlined_flag),
],
onChanged: (value) => {},
width: 80, width: 80,
), ),
Expanded( Expanded(
child: CustomTextField( child: CustomTextField(
hint: "Teléfono", hint: "Teléfono",
numeric: true numeric: true,
) ),
), ),
], ],
), ),
@@ -75,11 +79,14 @@ class RestorePasswordScreen extends ConsumerWidget {
Row( Row(
spacing: 20, spacing: 20,
children: [ children: [
Expanded( child: SecondaryButton( Expanded(
child: SecondaryButton(
onPressed: () => {Navigator.pop(context)}, onPressed: () => {Navigator.pop(context)},
text: "Volver" text: "Volver",
)), ),
Expanded( child: PrimaryButton( ),
Expanded(
child: PrimaryButton(
onPressed: () => { onPressed: () => {
Navigator.push( Navigator.push(
context, context,
@@ -90,8 +97,9 @@ class RestorePasswordScreen extends ConsumerWidget {
}, },
text: "Enviar", text: "Enviar",
size: 16, size: 16,
color: theme.getColorFor(ThemeCode.buttonSecondary) color: theme.getColorFor(ThemeCode.buttonSecondary),
)), ),
),
], ],
), ),
], ],

View File

@@ -1,4 +1,4 @@
import 'package:auth/src/recover_password/presentation/new_password_screen.dart'; import 'package:auth/src/features/recover_password/presentation/new_password_screen.dart';
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -6,10 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
class SentScreen extends ConsumerWidget { class SentScreen extends ConsumerWidget {
final String format; final String format;
const SentScreen({ const SentScreen({super.key, required this.format});
super.key,
required this.format
});
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
@@ -27,7 +24,11 @@ class SentScreen extends ConsumerWidget {
Text( Text(
"Recuperar contraseña", "Recuperar contraseña",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontWeight: FontWeight.w500, fontSize: 30, letterSpacing: 0), style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: 30,
letterSpacing: 0,
),
), ),
Row( Row(
spacing: 10, spacing: 10,
@@ -38,9 +39,9 @@ class SentScreen extends ConsumerWidget {
color: theme.getColorFor(ThemeCode.buttonPrimary), color: theme.getColorFor(ThemeCode.buttonPrimary),
), ),
Text( Text(
format=="email" format == "email"
?"Correo enviado correctamente" ? "Correo enviado correctamente"
:"SMS enviado correctamente", : "SMS enviado correctamente",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
), ),
Spacer(), Spacer(),
@@ -50,16 +51,16 @@ class SentScreen extends ConsumerWidget {
spacing: 16, spacing: 16,
children: [ children: [
Text( Text(
format=="email" format == "email"
?"Revisa tu email y haz clic en el enlace para crear una nueva contraseña." ? "Revisa tu email y haz clic en el enlace para crear una nueva contraseña."
:"Revisa tu móvil y sigue las instrucciones para crear una nueva contraseña.", : "Revisa tu móvil y sigue las instrucciones para crear una nueva contraseña.",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 18, letterSpacing: 0), style: TextStyle(fontSize: 18, letterSpacing: 0),
), ),
Text( Text(
format=="email" format == "email"
?"Si no recibes el correo en unos minutos, revisa tu carpeta de spam o pulsa \"Reenviar correo\"." ? "Si no recibes el correo en unos minutos, revisa tu carpeta de spam o pulsa \"Reenviar correo\"."
:"Si no recibes el SMS en unos minutos, asegúrate de tener cobertura o pulsa \"Reenviar SMS \".", : "Si no recibes el SMS en unos minutos, asegúrate de tener cobertura o pulsa \"Reenviar SMS \".",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(fontSize: 14, letterSpacing: 0), style: TextStyle(fontSize: 14, letterSpacing: 0),
), ),
@@ -68,22 +69,22 @@ class SentScreen extends ConsumerWidget {
Row( Row(
spacing: 10, spacing: 10,
children: [ children: [
Expanded( child: SecondaryButton( Expanded(
onPressed: () => {}, child: SecondaryButton(
text: format=="email" onPressed: () => {},
?"Reenviar correo" text: format == "email"
:"Reenviar SMS" ? "Reenviar correo"
)), : "Reenviar SMS",
),
),
Expanded( Expanded(
child: PrimaryButton( child: PrimaryButton(
onPressed: ()=>Navigator.push( onPressed: () => Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (_) => NewPasswordScreen()),
builder: (_) => NewPasswordScreen(),
),
), ),
text: "Continuar", text: "Continuar",
color: theme.getColorFor(ThemeCode.buttonSecondary) color: theme.getColorFor(ThemeCode.buttonSecondary),
), ),
), ),
], ],

View File

@@ -1,4 +1,4 @@
import 'package:auth/src/recover_password/presentation/restore_password_screen.dart'; import 'package:auth/src/features/recover_password/presentation/restore_password_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';

View File

@@ -1,4 +1,4 @@
import 'package:auth/src/sign_up/signup_screen.dart'; import 'package:auth/src/features/sign_up/signup_screen.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';

View File

@@ -1,9 +1,9 @@
import 'package:auth/src/widgets/layouts/form_step_layout.dart'; import 'package:auth/src/widgets/layouts/form_step_layout.dart';
import 'package:design_system/design_system.dart'; import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:auth/src/sign_up/signup_address_screen.dart'; import 'package:auth/src/features/sign_up/signup_address_screen.dart';
import 'package:auth/src/sign_up/signup_personal_screen.dart'; import 'package:auth/src/features/sign_up/signup_personal_screen.dart';
import 'package:auth/src/sign_up/signup_user_screen.dart'; import 'package:auth/src/features/sign_up/signup_user_screen.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:navigation/navigation.dart'; import 'package:navigation/navigation.dart';
@@ -13,10 +13,7 @@ import 'account_created_screen.dart';
class SignupScreen extends ConsumerStatefulWidget { class SignupScreen extends ConsumerStatefulWidget {
NavigationContract navigationContract; NavigationContract navigationContract;
SignupScreen({ SignupScreen({super.key, required this.navigationContract});
super.key,
required this.navigationContract
});
@override @override
ConsumerState<SignupScreen> createState() => _SignupScreenState(); ConsumerState<SignupScreen> createState() => _SignupScreenState();
@@ -37,8 +34,9 @@ class _SignupScreenState extends ConsumerState<SignupScreen> {
return [ return [
FormStepLayout( FormStepLayout(
title: "Crea tu usuario", title: "Crea tu usuario",
subtitle: "Con tu email y tu número podremos mantenerte siempre informado", subtitle:
supertitle: "Usuario y contacto", "Con tu email y tu número podremos mantenerte siempre informado",
supertitle: "Usuario y contacto",
currentStep: 1, currentStep: 1,
numSteps: 3, numSteps: 3,
body: [SignupPersonalScreen()], body: [SignupPersonalScreen()],
@@ -46,20 +44,26 @@ class _SignupScreenState extends ConsumerState<SignupScreen> {
Row( Row(
spacing: 16, spacing: 16,
children: [ children: [
Expanded(child: SecondaryButton( Expanded(
onPressed: ()=>{}, child: SecondaryButton(
text: "Atrás", onPressed: () => {},
size: 16, text: "Atrás",
)), size: 16,
Expanded(child: PrimaryButton( ),
onPressed: ()=>{setState(() { ),
currentStep++; Expanded(
})}, child: PrimaryButton(
text: "Siguiente", onPressed: () => {
size: 16, setState(() {
color: theme.getColorFor(ThemeCode.buttonSecondary) currentStep++;
)) }),
] },
text: "Siguiente",
size: 16,
color: theme.getColorFor(ThemeCode.buttonSecondary),
),
),
],
), ),
CheckboxListTile( CheckboxListTile(
value: acceptTerms, value: acceptTerms,
@@ -74,42 +78,57 @@ class _SignupScreenState extends ConsumerState<SignupScreen> {
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
activeColor: theme.getColorFor(ThemeCode.buttonPrimary), activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
) ),
], ],
nextStep: ()=>{setState(() { nextStep: () => {
currentStep++; setState(() {
})}, currentStep++;
previousStep: ()=>{}, }),
},
previousStep: () => {},
), ),
FormStepLayout( FormStepLayout(
title: "Tu dirección", title: "Tu dirección",
subtitle: "Tu dirección nos ayudará a verificar y mantener la seguridad de tu cuenta", subtitle:
"Tu dirección nos ayudará a verificar y mantener la seguridad de tu cuenta",
supertitle: "Domicilio", supertitle: "Domicilio",
currentStep: 2, currentStep: 2,
numSteps: 3, numSteps: 3,
body: [SignupAddressScreen()], body: [SignupAddressScreen()],
nextStep: ()=>{setState(() { nextStep: () => {
currentStep++; setState(() {
})}, currentStep++;
previousStep: ()=>{setState(() { }),
currentStep--; },
})}, previousStep: () => {
setState(() {
currentStep--;
}),
},
), ),
FormStepLayout( FormStepLayout(
title: "Identifícate", title: "Identifícate",
subtitle: "Contraseña mínima de 8 caracteres, con una mayúscula, un número y un carácter especial", subtitle:
"Contraseña mínima de 8 caracteres, con una mayúscula, un número y un carácter especial",
supertitle: "Usuario y contacto", supertitle: "Usuario y contacto",
currentStep: 3, currentStep: 3,
numSteps: 3, numSteps: 3,
body: [SignupUserScreen()], body: [SignupUserScreen()],
nextStep: ()=>{setState(() { nextStep: () => {
currentStep++; setState(() {
})}, currentStep++;
previousStep: ()=>{setState(() { }),
currentStep--; },
})}, previousStep: () => {
setState(() {
currentStep--;
}),
},
),
AccountCreatedScreen(
navigationContract: widget.navigationContract,
kidAccount: false,
), ),
AccountCreatedScreen(navigationContract: widget.navigationContract, kidAccount: false)
]; ];
} }
} }

View File

@@ -1,78 +0,0 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:navigation/navigation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class LinkPhoneScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const LinkPhoneScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
// TextEditingController phoneController = TextEditingController();
// String? phone;
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 24),
child: Expanded(
child: Center(
child: Column(
spacing: 48,
children: [
Spacer(flex: 8),
Text(
"¡Nos alegra mucho tenerte por aquí!",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 30, fontWeight: FontWeight.w500, letterSpacing: 0),
),
Text(
"Para poder entrar de forma segura, te vamos a enviar un código al teléfono",
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16, letterSpacing: 0),
),
Column(
spacing: 8,
children: [
Align(alignment: Alignment.bottomLeft, child: Text(
"Teléfono móvil",
style: TextStyle(fontSize: 14, letterSpacing: 0),
)),
Row(
spacing: 10,
children: [
CustomDropdown(
value: 0,
items: [Icon(Icons.outlined_flag), Icon(Icons.outlined_flag), Icon(Icons.outlined_flag)],
onChanged: (value)=> {},
width: 80,
),
Expanded(
child: CustomTextField(
hint: "Teléfono",
numeric: true
)
),
],
),
],
),
PrimaryButton(
onPressed: () => navigationContract.pushTo(AppRoutes.phoneCode),
text: "Siguiente",
color: theme.getColorFor(ThemeCode.buttonPrimary),
),
Spacer(flex: 10)
],
),
),
),
),
));
}
}

View File

@@ -1,110 +0,0 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:navigation/navigation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
class PhoneCodeScreen extends ConsumerWidget {
// final String phone;
final NavigationContract navigationContract;
PhoneCodeScreen({super.key, required this.navigationContract});
// class PhoneCodeScreenState extends State<PhoneCodeScreen> {
final focusNodes = List<FocusNode>.generate(6, (int i) {
return FocusNode();
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: Container(
margin: EdgeInsets.all(30),
child: Expanded(
child: Center(
child: Column(
spacing: 48,
children: [
Spacer(flex: 8),
Column(
spacing: 24,
children: [
Text(
"Conéctate",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 30),
),
Text.rich(
TextSpan(
text: "Hemos enviado el código al ",
children: [
TextSpan(
// text: widget.phone,
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
),
Text("Introduce el código aquí"),
Row(
spacing: 8,
children: List<Widget>.generate(6, (int i) {
return Expanded(
child: TextField(
focusNode: focusNodes[i],
keyboardType: TextInputType.number,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
textAlign: TextAlign.center,
decoration: InputDecoration(
hintText: "0",
counterText: "",
border: OutlineInputBorder(),
),
maxLength: 1,
onChanged: (String value) => {
value != ""
? focusNodes[i + 1].requestFocus()
: focusNodes[i - 1].requestFocus(),
},
),
);
}),
),
],
),
Column(
spacing: 24,
children: [
PrimaryButton(
onPressed: () => {navigationContract.pushTo(AppRoutes.login)},
text: "Entrar",
color: theme.getColorFor(ThemeCode.buttonPrimary),
),
Column(
spacing: 8,
children: [
Text(
"¿No lo has recibido?",
style: TextStyle(fontSize: 18, letterSpacing: 0, height: 1.5),
),
CustomTextButton(
onPressed: () => {},
text: "Volver a intentarlo",
size: 18,
weight: FontWeight.w500,
),
],
)
],
),
Spacer(flex: 10),
],
),
),
),
),
);
}
}

View File

@@ -1,128 +0,0 @@
import 'package:auth/src/onboarding/domain/onboarding_page.dart';
import 'package:auth/src/onboarding/presentation/onboarding_view_model.dart';
import 'package:auth/src/onboarding/presentation/widgets/onboarding_content.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
final onboardingPageControllerProvider = Provider.autoDispose<PageController>((
ref,
) {
final controller = PageController();
ref.onDispose(controller.dispose);
return controller;
});
class OnboardingScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const OnboardingScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(onBoardingViewModelProvider);
final viewModel = ref.read(onBoardingViewModelProvider.notifier);
final pageController = ref.watch(onboardingPageControllerProvider);
final isLast = state.cardIndex >= onboardingPages.length - 1;
void goToNext() {
if (isLast) {
navigationContract.goTo(AppRoutes.linkPhone);
} else {
pageController.nextPage(
duration: const Duration(milliseconds: 400),
curve: Curves.easeOut,
);
}
}
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
children: [
Expanded(
child: PageView.builder(
controller: pageController,
itemCount: onboardingPages.length,
onPageChanged: viewModel.onPageChanged,
itemBuilder: (context, index) {
final page = onboardingPages[index];
return OnboardingContent(
image: page.image,
title: page.title,
subtitle: page.subtitle,
);
},
),
),
StepIndicator(
current: state.cardIndex,
total: onboardingPages.length,
color: const Color(0xFF4A4A4A),
),
const SizedBox(height: 38),
Container(
padding: const EdgeInsets.symmetric(horizontal: 24),
width: double.infinity,
child: TextButton(
onPressed: goToNext,
style: TextButton.styleFrom(
backgroundColor: isLast
? const Color(0xFF329E95)
: const Color(0xFF333333),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(
vertical: 16,
horizontal: 24,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18),
),
),
child: Text(
isLast
? context.translate(I18n.start)
: context.translate(I18n.next),
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(height: 8),
SizedBox(
height: 48,
child: Center(
child: isLast
? const SizedBox.shrink()
: TextButton(
onPressed: () =>
navigationContract.goTo(AppRoutes.linkPhone),
child: Text(
context.translate(I18n.skip),
style: TextStyle(
color: Color(0xFF333333),
decoration: TextDecoration.underline,
fontWeight: FontWeight.w500,
fontSize: 18,
),
),
),
),
),
const SizedBox(height: 36),
],
),
),
),
);
}
}

View File

@@ -22,6 +22,8 @@ dependencies:
path: ../../packages/navigation path: ../../packages/navigation
sf_localizations: sf_localizations:
path: ../../packages/sf_localizations path: ../../packages/sf_localizations
sf_infrastructure:
path: ../../packages/sf_infrastructure
#dependencies go here #dependencies go here
flutter_svg: ^2.2.1 flutter_svg: ^2.2.1
get_it: ^9.0.5 get_it: ^9.0.5
@@ -29,6 +31,8 @@ dependencies:
flutter_riverpod: ^3.0.3 flutter_riverpod: ^3.0.3
freezed_annotation: ^3.1.0 freezed_annotation: ^3.1.0
freezed: ^3.2.3 freezed: ^3.2.3
dio: ^5.9.0
country_code_picker: ^3.4.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View File

@@ -1,9 +1,11 @@
# melos_managed_dependency_overrides: dashboard_shell,design_system,home,notifications,profile,sf_shared,navigation,utils,sf_localizations # melos_managed_dependency_overrides: dashboard_shell,design_system,home,notifications,profile,sf_shared,navigation,utils,sf_localizations,fonts,sf_infrastructure
dependency_overrides: dependency_overrides:
dashboard_shell: dashboard_shell:
path: ../dashboard_shell path: ../dashboard_shell
design_system: design_system:
path: ../../packages/design_system path: ../../packages/design_system
fonts:
path: ../../packages/fonts
home: home:
path: ../home path: ../home
navigation: navigation:
@@ -12,6 +14,8 @@ dependency_overrides:
path: ../notifications path: ../notifications
profile: profile:
path: ../profile path: ../profile
sf_infrastructure:
path: ../../packages/sf_infrastructure
sf_localizations: sf_localizations:
path: ../../packages/sf_localizations path: ../../packages/sf_localizations
sf_shared: sf_shared:

View File

@@ -1,9 +1,11 @@
# melos_managed_dependency_overrides: auth,design_system,home,notifications,profile,sf_shared,navigation,utils,sf_localizations # melos_managed_dependency_overrides: auth,design_system,home,notifications,profile,sf_shared,navigation,utils,sf_localizations,fonts,sf_infrastructure
dependency_overrides: dependency_overrides:
auth: auth:
path: ../auth path: ../auth
design_system: design_system:
path: ../../packages/design_system path: ../../packages/design_system
fonts:
path: ../../packages/fonts
home: home:
path: ../home path: ../home
navigation: navigation:
@@ -12,6 +14,8 @@ dependency_overrides:
path: ../notifications path: ../notifications
profile: profile:
path: ../profile path: ../profile
sf_infrastructure:
path: ../../packages/sf_infrastructure
sf_localizations: sf_localizations:
path: ../../packages/sf_localizations path: ../../packages/sf_localizations
sf_shared: sf_shared:

View File

@@ -1,4 +1,4 @@
# melos_managed_dependency_overrides: auth,dashboard_shell,design_system,notifications,profile,sf_shared,navigation,utils,sf_localizations # melos_managed_dependency_overrides: auth,dashboard_shell,design_system,notifications,profile,sf_shared,navigation,utils,sf_localizations,fonts,sf_infrastructure
dependency_overrides: dependency_overrides:
auth: auth:
path: ../auth path: ../auth
@@ -6,12 +6,16 @@ dependency_overrides:
path: ../dashboard_shell path: ../dashboard_shell
design_system: design_system:
path: ../../packages/design_system path: ../../packages/design_system
fonts:
path: ../../packages/fonts
navigation: navigation:
path: ../../packages/navigation path: ../../packages/navigation
notifications: notifications:
path: ../notifications path: ../notifications
profile: profile:
path: ../profile path: ../profile
sf_infrastructure:
path: ../../packages/sf_infrastructure
sf_localizations: sf_localizations:
path: ../../packages/sf_localizations path: ../../packages/sf_localizations
sf_shared: sf_shared:

View File

@@ -1,7 +1,9 @@
# melos_managed_dependency_overrides: design_system,sf_shared,utils # melos_managed_dependency_overrides: design_system,sf_shared,utils,fonts
dependency_overrides: dependency_overrides:
design_system: design_system:
path: ../../packages/design_system path: ../../packages/design_system
fonts:
path: ../../packages/fonts
sf_shared: sf_shared:
path: ../../packages/sf_shared path: ../../packages/sf_shared
utils: utils:

View File

@@ -1,7 +1,9 @@
# melos_managed_dependency_overrides: design_system,notifications,sf_shared,utils # melos_managed_dependency_overrides: design_system,notifications,sf_shared,utils,fonts
dependency_overrides: dependency_overrides:
design_system: design_system:
path: ../../packages/design_system path: ../../packages/design_system
fonts:
path: ../../packages/fonts
notifications: notifications:
path: ../notifications path: ../notifications
sf_shared: sf_shared:

View File

@@ -9,4 +9,5 @@ export 'src/snackbars/snackbar.dart';
export 'src/buttons/primary_button.dart'; export 'src/buttons/primary_button.dart';
export 'src/buttons/secondary_button.dart'; export 'src/buttons/secondary_button.dart';
export 'src/buttons/custom_text_button.dart'; export 'src/buttons/custom_text_button.dart';
export 'src/dropdowns/dropdown.dart'; export 'src/dropdowns/dropdown.dart';
export 'src/dropdowns/country_prefix_picker.dart';

View File

@@ -0,0 +1,81 @@
import 'package:country_code_picker/country_code_picker.dart';
import 'package:flutter/material.dart';
class CountryPrefixPicker extends StatelessWidget {
const CountryPrefixPicker({
super.key,
required this.onChanged,
required this.headerText,
this.initialCountryCode = '+34',
this.radius = 12,
this.width = 90,
this.height = 55,
this.borderColor = const Color(0xFF4B4B4B),
this.backgroundColor = Colors.white,
});
final ValueChanged<CountryCode> onChanged;
final String initialCountryCode;
final String headerText;
final double radius;
final double width;
final double height;
final Color borderColor;
final Color backgroundColor;
@override
Widget build(BuildContext context) {
return SizedBox(
width: width,
height: height,
child: CountryCodePicker(
headerText: headerText,
onChanged: onChanged,
initialSelection: initialCountryCode,
showFlag: false,
showDropDownButton: false,
hideMainText: true,
padding: EdgeInsets.zero,
builder: (CountryCode? country) {
if (country == null) {
return const SizedBox.shrink();
}
return InputDecorator(
decoration: InputDecoration(
isDense: false,
contentPadding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 16,
),
filled: true,
fillColor: backgroundColor,
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(radius)),
borderSide: BorderSide(color: borderColor),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(radius)),
borderSide: BorderSide(color: borderColor),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (country.flagUri != null)
Image.asset(
country.flagUri!,
package: 'country_code_picker',
width: 24,
height: 24,
fit: BoxFit.cover,
),
const Icon(Icons.arrow_drop_down, size: 24),
],
),
);
},
),
);
}
}

View File

@@ -9,6 +9,7 @@ class CustomTextField extends StatefulWidget {
final int? lines; final int? lines;
final ValueChanged<String>? onChanged; final ValueChanged<String>? onChanged;
final int? length; final int? length;
final TextEditingController? controller;
const CustomTextField({ const CustomTextField({
super.key, super.key,
@@ -19,6 +20,7 @@ class CustomTextField extends StatefulWidget {
this.lines, this.lines,
this.length, this.length,
this.onChanged, this.onChanged,
this.controller,
}); });
@override @override
@@ -47,6 +49,7 @@ class CustomTextFieldState extends State<CustomTextField> {
), ),
), ),
TextFormField( TextFormField(
controller: widget.controller,
keyboardType: widget.numeric keyboardType: widget.numeric
? TextInputType.number ? TextInputType.number
: TextInputType.text, : TextInputType.text,

View File

@@ -24,7 +24,7 @@ class StepIndicator extends StatelessWidget{
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: isActive ? color : Colors.white, color: isActive ? color : Colors.white,
border: Border.all(color: color, width: 2), border: Border.all(color: color),
), ),
); );
}), }),

View File

@@ -16,6 +16,7 @@ dependencies:
path: ../utils path: ../utils
flutter_riverpod: ^3.0.3 flutter_riverpod: ^3.0.3
get_it: ^9.0.5 get_it: ^9.0.5
country_code_picker: ^3.4.1
fonts: fonts:
path: ../../packages/fonts path: ../../packages/fonts

View File

@@ -1,4 +1,6 @@
# melos_managed_dependency_overrides: utils # melos_managed_dependency_overrides: utils,fonts
dependency_overrides: dependency_overrides:
utils: utils:
path: ../utils path: ../utils
fonts:
path: ../fonts

View File

@@ -0,0 +1,31 @@
Extension Discovery Cache
=========================
This folder is used by `package:extension_discovery` to cache lists of
packages that contains extensions for other packages.
DO NOT USE THIS FOLDER
----------------------
* Do not read (or rely) the contents of this folder.
* Do write to this folder.
If you're interested in the lists of extensions stored in this folder use the
API offered by package `extension_discovery` to get this information.
If this package doesn't work for your use-case, then don't try to read the
contents of this folder. It may change, and will not remain stable.
Use package `extension_discovery`
---------------------------------
If you want to access information from this folder.
Feel free to delete this folder
-------------------------------
Files in this folder act as a cache, and the cache is discarded if the files
are older than the modification time of `.dart_tool/package_config.json`.
Hence, it should never be necessary to clear this cache manually, if you find a
need to do please file a bug.

View File

@@ -0,0 +1 @@
{"version":2,"entries":[{"package":"fonts","rootUri":"../","packageUri":"lib/"}]}

View File

@@ -0,0 +1,58 @@
{
"configVersion": 2,
"packages": [
{
"name": "characters",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/characters-1.4.0",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "collection",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/collection-1.19.1",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "flutter",
"rootUri": "file:///Users/juliandalcalaf/Development/flutter/packages/flutter",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "material_color_utilities",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/material_color_utilities-0.11.1",
"packageUri": "lib/",
"languageVersion": "2.17"
},
{
"name": "meta",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/meta-1.16.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "sky_engine",
"rootUri": "file:///Users/juliandalcalaf/Development/flutter/bin/cache/pkg/sky_engine",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "vector_math",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/vector_math-2.2.0",
"packageUri": "lib/",
"languageVersion": "3.1"
},
{
"name": "fonts",
"rootUri": "../",
"packageUri": "lib/",
"languageVersion": "3.9"
}
],
"generator": "pub",
"generatorVersion": "3.9.2",
"flutterRoot": "file:///Users/juliandalcalaf/Development/flutter",
"flutterVersion": "3.35.7",
"pubCache": "file:///Users/juliandalcalaf/.pub-cache"
}

View File

@@ -0,0 +1,60 @@
{
"roots": [
"fonts"
],
"packages": [
{
"name": "fonts",
"version": "0.0.1",
"dependencies": [
"flutter"
],
"devDependencies": []
},
{
"name": "flutter",
"version": "0.0.0",
"dependencies": [
"characters",
"collection",
"material_color_utilities",
"meta",
"sky_engine",
"vector_math"
]
},
{
"name": "sky_engine",
"version": "0.0.0",
"dependencies": []
},
{
"name": "vector_math",
"version": "2.2.0",
"dependencies": []
},
{
"name": "meta",
"version": "1.16.0",
"dependencies": []
},
{
"name": "material_color_utilities",
"version": "0.11.1",
"dependencies": [
"collection"
]
},
{
"name": "collection",
"version": "1.19.1",
"dependencies": []
},
{
"name": "characters",
"version": "1.4.0",
"dependencies": []
}
],
"configVersion": 1
}

View File

@@ -0,0 +1 @@
3.35.7

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/example/.idea" />
<excludeFolder url="file://$MODULE_DIR$/example/.pub" />
<excludeFolder url="file://$MODULE_DIR$/example/build" />
<excludeFolder url="file://$MODULE_DIR$/example/android/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/example/android/.idea" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/Flutter" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/Pods" />
<excludeFolder url="file://$MODULE_DIR$/example/ios/.symlinks" />
<excludeFolder url="file://$MODULE_DIR$/example/macos/Flutter" />
<excludeFolder url="file://$MODULE_DIR$/example/macos/Pods" />
<excludeFolder url="file://$MODULE_DIR$/example/macos/.symlinks" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

View File

@@ -0,0 +1,55 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
characters:
dependency: transitive
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
url: "https://pub.dev"
source: hosted
version: "1.4.0"
collection:
dependency: transitive
description:
name: collection
sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76"
url: "https://pub.dev"
source: hosted
version: "1.19.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
url: "https://pub.dev"
source: hosted
version: "1.16.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://pub.dev"
source: hosted
version: "2.2.0"
sdks:
dart: ">=3.9.2 <4.0.0"

View File

@@ -17,4 +17,9 @@ flutter:
fonts: fonts:
- asset: lib/fonts/stolzl_regular.otf - asset: lib/fonts/stolzl_regular.otf
- asset: lib/fonts/stolzl_bold.otf - asset: lib/fonts/stolzl_bold.otf
- asset: lib/fonts/stolzl_medium.otf
- asset: lib/fonts/stolzl_light.otf
- asset: lib/fonts/stolzl_book.otf
- asset: lib/fonts/stolzl_thin.otf
weight: 500 weight: 500

View File

@@ -2,8 +2,8 @@ class AppRoutes {
static const login = '/login'; static const login = '/login';
static const signup = '/signup'; static const signup = '/signup';
static const onboarding = '/onboarding'; static const onboarding = '/onboarding';
static const linkPhone = '/link_phone'; static const linkPhone = '/request_link_phone';
static const phoneCode = '/phone_code'; static const phoneCode = '/verify_link_phone_code';
static const deviceSignup = '/device_signup'; static const deviceSignup = '/device_signup';
static const recoverPassword = '/recover_password'; static const recoverPassword = '/recover_password';

31
packages/sf_infrastructure/.gitignore vendored Normal file
View File

@@ -0,0 +1,31 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.flutter-plugins-dependencies
/build/
/coverage/

View File

@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "adc901062556672b4138e18a4dc62a4be8f4b3c2"
channel: "stable"
project_type: package

View File

@@ -0,0 +1,3 @@
## 0.0.1
* TODO: Describe initial release.

View File

@@ -0,0 +1 @@
TODO: Add your license here.

View File

@@ -0,0 +1,39 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/to/develop-packages).
-->
TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
## Features
TODO: List what your package can do. Maybe include images, gifs, or videos.
## Getting started
TODO: List prerequisites and provide or point to information on how to
start using the package.
## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
```dart
const like = 'sample';
```
## Additional information
TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.

View File

@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

View File

@@ -0,0 +1,27 @@
import 'package:dio/dio.dart';
import 'package:get_it/get_it.dart';
import 'src/network/dio_client.dart';
import 'src/env/env_contract.dart';
import 'src/api/questia_api.dart';
import 'src/repositories/questia_repository_impl.dart';
import 'src/repositories/questia_repository.dart';
export 'src/repositories/questia_repository.dart';
final getIt = GetIt.instance;
Future<void> configureDependencies(EnvConfig env, {bool log = false}) async {
getIt.registerLazySingleton<Dio>(
() => buildDioClient(
baseUrl: env.apiBaseUrl,
origin: env.apiOrigin,
// apiKey: env.apiKey,
log: log,
),
);
getIt.registerLazySingleton<QuestiaApi>(() => QuestiaApi(getIt<Dio>()));
getIt.registerLazySingleton<QuestiaRepository>(
() => QuestiaRepositoryImpl(getIt<QuestiaApi>()),
);
}

View File

@@ -0,0 +1,2 @@
export 'src/env/env_contract.dart';
export 'configure_dependencies.dart';

View File

@@ -0,0 +1,79 @@
import 'package:dio/dio.dart';
class QuestiaApi {
final Dio _dio;
QuestiaApi(this._dio);
Future<Response<T>> get<T>(
String path, {
Map<String, dynamic>? queryParameters,
Options? options,
CancelToken? cancelToken,
ProgressCallback? onReceiveProgress,
}) {
return _dio.get<T>(
path,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
onReceiveProgress: onReceiveProgress,
);
}
Future<Response<T>> post<T>(
String path, {
dynamic data,
Map<String, dynamic>? queryParameters,
Options? options,
CancelToken? cancelToken,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) {
return _dio.post<T>(
path,
data: data,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
Future<Response<T>> put<T>(
String path, {
dynamic data,
Map<String, dynamic>? queryParameters,
Options? options,
CancelToken? cancelToken,
ProgressCallback? onSendProgress,
ProgressCallback? onReceiveProgress,
}) {
return _dio.put<T>(
path,
data: data,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
onSendProgress: onSendProgress,
onReceiveProgress: onReceiveProgress,
);
}
Future<Response<T>> delete<T>(
String path, {
dynamic data,
Map<String, dynamic>? queryParameters,
Options? options,
CancelToken? cancelToken,
}) {
return _dio.delete<T>(
path,
data: data,
queryParameters: queryParameters,
options: options,
cancelToken: cancelToken,
);
}
}

View File

@@ -0,0 +1,5 @@
abstract class EnvConfig {
String get apiBaseUrl;
String get apiOrigin;
// String get apiKey;
}

Some files were not shown because too many files have changed in this diff Show More