diff --git a/lib/config/ThemeApp.dart b/lib/config/theme_app.dart similarity index 100% rename from lib/config/ThemeApp.dart rename to lib/config/theme_app.dart diff --git a/lib/core/data/local/StorageValue.dart b/lib/core/data/local/storage_value.dart similarity index 92% rename from lib/core/data/local/StorageValue.dart rename to lib/core/data/local/storage_value.dart index e102264..e78c744 100644 --- a/lib/core/data/local/StorageValue.dart +++ b/lib/core/data/local/storage_value.dart @@ -1,8 +1,7 @@ import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/log/log.dart'; class StorageValue { - static const String _authToken = "auth_token"; static const String _refreshToken = "refresh_token"; static const String _email = "email"; @@ -15,8 +14,7 @@ class StorageValue { : storage = const FlutterSecureStorage( aOptions: AndroidOptions(encryptedSharedPreferences: true)); - factory StorageValue.getInstance() => - _singleton ??= StorageValue._internal(); + factory StorageValue.getInstance() => _singleton ??= StorageValue._internal(); Future _setValue(String key, String value) async { try { diff --git a/lib/core/log/Log.dart b/lib/core/log/log.dart similarity index 100% rename from lib/core/log/Log.dart rename to lib/core/log/log.dart diff --git a/lib/core/network/app_interceptors.dart b/lib/core/network/app_interceptors.dart index d33c847..4f3e451 100644 --- a/lib/core/network/app_interceptors.dart +++ b/lib/core/network/app_interceptors.dart @@ -1,5 +1,5 @@ -import 'package:aranduapp/core/data/local/StorageValue.dart'; -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/data/local/storage_value.dart'; +import 'package:aranduapp/core/log/log.dart'; import 'package:aranduapp/core/network/token_manager/auth_service.dart'; import 'package:aranduapp/core/network/token_manager/model/refresh_token_response.dart'; import 'package:dio/dio.dart'; @@ -13,7 +13,7 @@ class AppInterceptors extends Interceptor { Log.w(token); if (token != null) { - options.headers['Authorization'] = 'Bearer $token'; + options.headers['Authorization'] = 'Bearer $token'; } else { Log.w('Token não encontrado'); } @@ -27,8 +27,7 @@ class AppInterceptors extends Interceptor { try { Log.i('Token expirado. Tentando atualizar o token...'); - RefreshTokenResponse tokens = - await AuthService().refreshToken(); + RefreshTokenResponse tokens = await AuthService().refreshToken(); final requestOptions = err.requestOptions; diff --git a/lib/core/network/base_api.dart b/lib/core/network/base_api.dart index 3c06739..2d446f2 100644 --- a/lib/core/network/base_api.dart +++ b/lib/core/network/base_api.dart @@ -1,4 +1,4 @@ -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/log/log.dart'; import 'package:aranduapp/core/network/app_interceptors.dart'; import 'package:dio/dio.dart'; @@ -53,7 +53,6 @@ class BaseApi { } } - Future patch({required String path, Object? data}) async { try { return await _dio.patch(path, data: data); @@ -63,8 +62,6 @@ class BaseApi { } } - - Future put({required String path, Object? data}) async { try { return await _dio.put(path, data: data); @@ -73,5 +70,4 @@ class BaseApi { rethrow; } } - } diff --git a/lib/core/network/token_manager/auth_service.dart b/lib/core/network/token_manager/auth_service.dart index 44b103f..af9256b 100644 --- a/lib/core/network/token_manager/auth_service.dart +++ b/lib/core/network/token_manager/auth_service.dart @@ -1,5 +1,5 @@ -import 'package:aranduapp/core/data/local/StorageValue.dart'; -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/data/local/storage_value.dart'; +import 'package:aranduapp/core/log/log.dart'; import 'package:aranduapp/core/network/base_api.dart'; import 'package:aranduapp/core/network/token_manager/model/refresh_token_response.dart'; import 'package:dio/dio.dart'; diff --git a/lib/main.dart b/lib/main.dart index 623bad5..5a41dd4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,6 @@ -import 'package:aranduapp/config/ThemeApp.dart'; +import 'package:aranduapp/config/theme_app.dart'; +import 'package:aranduapp/ui/welcome/view/welcome_view.dart'; import 'package:aranduapp/core/di/locator.dart'; -import 'package:aranduapp/ui/welcome/view/WelcomeView.dart'; import 'package:flutter/material.dart'; void main() { diff --git a/lib/ui/edit_password/view/edit_password_view.dart b/lib/ui/edit_password/view/edit_password_view.dart index 933bd2f..09c8975 100644 --- a/lib/ui/edit_password/view/edit_password_view.dart +++ b/lib/ui/edit_password/view/edit_password_view.dart @@ -1,9 +1,9 @@ -import 'package:aranduapp/ui/edit_password/viewmodel/edit_password_viewmode.dart'; -import 'package:aranduapp/ui/shared/requestbutton.dart'; +import 'package:aranduapp/ui/edit_password/viewmodel/edit_password_viewmodel.dart'; +import 'package:aranduapp/ui/shared/request_button.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:aranduapp/ui/shared/TextPassword.dart'; +import 'package:aranduapp/ui/shared/text_password.dart'; class EditPassword extends StatelessWidget { const EditPassword({super.key}); diff --git a/lib/ui/edit_password/viewmodel/edit_password_viewmode.dart b/lib/ui/edit_password/viewmodel/edit_password_viewmodel.dart similarity index 100% rename from lib/ui/edit_password/viewmodel/edit_password_viewmode.dart rename to lib/ui/edit_password/viewmodel/edit_password_viewmodel.dart diff --git a/lib/ui/edit_profile/model/EditProfileResponse.dart b/lib/ui/edit_profile/model/edit_profile_response.dart similarity index 100% rename from lib/ui/edit_profile/model/EditProfileResponse.dart rename to lib/ui/edit_profile/model/edit_profile_response.dart diff --git a/lib/ui/edit_profile/view/edit_profile_view.dart b/lib/ui/edit_profile/view/edit_profile_view.dart index 3664156..45c5cab 100644 --- a/lib/ui/edit_profile/view/edit_profile_view.dart +++ b/lib/ui/edit_profile/view/edit_profile_view.dart @@ -1,7 +1,7 @@ import 'package:aranduapp/ui/edit_profile/viewmodel/edit_profile_viewmodel.dart'; -import 'package:aranduapp/ui/shared/TextEmail.dart'; -import 'package:aranduapp/ui/shared/TextName.dart'; -import 'package:aranduapp/ui/shared/requestbutton.dart'; +import 'package:aranduapp/ui/shared/text_email.dart'; +import 'package:aranduapp/ui/shared/text_name.dart'; +import 'package:aranduapp/ui/shared/request_button.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -25,7 +25,6 @@ class EditProfileScreen extends StatelessWidget { EditProfileViewModel viewModel = Provider.of(context); return Scaffold( - appBar: AppBar( backgroundColor: Theme.of(context).colorScheme.surface, elevation: 0, @@ -55,7 +54,6 @@ class EditProfileScreen extends StatelessWidget { ], ), )); - } Widget _buildForm(BuildContext context, EditProfileViewModel viewModel) { @@ -88,23 +86,18 @@ class EditProfileScreen extends StatelessWidget { ); } - Widget _saveButton(BuildContext context, EditProfileViewModel viewModel) { return Requestbutton( command: viewModel.editCommand, nameButton: "Salvar", onErrorCallback: (e) { - ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(e)), - ); }, onSuccessCallback: () { ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text( - 'Usuario atualizado com sucesso. ')), + const SnackBar(content: Text('Usuario atualizado com sucesso. ')), ); }); } diff --git a/lib/ui/home/view/HomeView.dart b/lib/ui/home/view/home_view.dart similarity index 100% rename from lib/ui/home/view/HomeView.dart rename to lib/ui/home/view/home_view.dart diff --git a/lib/ui/login/model/LoginRequest.dart b/lib/ui/login/model/login_request.dart similarity index 100% rename from lib/ui/login/model/LoginRequest.dart rename to lib/ui/login/model/login_request.dart diff --git a/lib/ui/login/model/LoginResponse.dart b/lib/ui/login/model/login_response.dart similarity index 100% rename from lib/ui/login/model/LoginResponse.dart rename to lib/ui/login/model/login_response.dart diff --git a/lib/ui/login/service/login_service.dart b/lib/ui/login/service/login_service.dart index 60303bb..b888c36 100644 --- a/lib/ui/login/service/login_service.dart +++ b/lib/ui/login/service/login_service.dart @@ -1,9 +1,9 @@ -import 'package:aranduapp/core/data/local/StorageValue.dart'; -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/data/local/storage_value.dart'; +import 'package:aranduapp/core/log/log.dart'; import 'package:aranduapp/core/network/base_api.dart'; import 'package:aranduapp/core/network/token_manager/auth_service.dart'; -import 'package:aranduapp/ui/login/model/LoginRequest.dart'; -import 'package:aranduapp/ui/login/model/LoginResponse.dart'; +import 'package:aranduapp/ui/login/model/login_request.dart'; +import 'package:aranduapp/ui/login/model/login_response.dart'; import 'package:dio/dio.dart'; class LoginService { diff --git a/lib/ui/login/view/login_view.dart b/lib/ui/login/view/login_view.dart index cde42d9..c5ea304 100644 --- a/lib/ui/login/view/login_view.dart +++ b/lib/ui/login/view/login_view.dart @@ -1,7 +1,7 @@ -import 'package:aranduapp/core/log/Log.dart'; -import 'package:aranduapp/ui/navbar/view/navBarView.dart'; -import 'package:aranduapp/ui/shared/TextAndLink.dart'; -import 'package:aranduapp/ui/shared/requestbutton.dart'; +import 'package:aranduapp/core/log/log.dart'; +import 'package:aranduapp/ui/navbar/view/navbar_view.dart'; +import 'package:aranduapp/ui/shared/text_and_link.dart'; +import 'package:aranduapp/ui/shared/request_button.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:provider/provider.dart'; @@ -12,11 +12,11 @@ import 'package:aranduapp/ui/login/viewmodel/login_viewmodel.dart'; import 'package:aranduapp/ui/recover_account/view/recover_account_view.dart'; import 'package:aranduapp/ui/register_account/view/register_account_view.dart'; -import 'package:aranduapp/ui/shared/TitleSlogan.dart'; -import 'package:aranduapp/ui/shared/TextEmail.dart'; -import 'package:aranduapp/ui/shared/ErrorPopUp.dart'; -import 'package:aranduapp/ui/shared/TextPassword.dart'; -import 'package:aranduapp/ui/shared/OrDivider.dart'; +import 'package:aranduapp/ui/shared/title_slogan.dart'; +import 'package:aranduapp/ui/shared/text_email.dart'; +import 'package:aranduapp/ui/shared/error_popup.dart'; +import 'package:aranduapp/ui/shared/text_password.dart'; +import 'package:aranduapp/ui/shared/or_divider.dart'; class Login extends StatelessWidget { const Login({super.key}); diff --git a/lib/ui/login/viewmodel/login_viewmodel.dart b/lib/ui/login/viewmodel/login_viewmodel.dart index 759a3d7..b60cae1 100644 --- a/lib/ui/login/viewmodel/login_viewmodel.dart +++ b/lib/ui/login/viewmodel/login_viewmodel.dart @@ -1,14 +1,13 @@ -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/log/log.dart'; import 'package:aranduapp/core/state/command.dart'; import 'package:async/async.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:local_auth/local_auth.dart'; import 'package:aranduapp/ui/login/service/login_service.dart'; -import 'package:aranduapp/ui/login/model/LoginRequest.dart'; +import 'package:aranduapp/ui/login/model/login_request.dart'; class LoginViewModel extends ChangeNotifier { - late Command0 loginCommand; late Command0 validadeTokenCommand; @@ -20,7 +19,6 @@ class LoginViewModel extends ChangeNotifier { : formKey = GlobalKey(), emailController = TextEditingController(), passwordController = TextEditingController() { - loginCommand = Command0(loginWithEmailAndPassword); validadeTokenCommand = Command0(validateToken); diff --git a/lib/ui/navbar/view/navBarView.dart b/lib/ui/navbar/view/navbar_view.dart similarity index 89% rename from lib/ui/navbar/view/navBarView.dart rename to lib/ui/navbar/view/navbar_view.dart index 2460990..d0ef919 100644 --- a/lib/ui/navbar/view/navBarView.dart +++ b/lib/ui/navbar/view/navbar_view.dart @@ -1,9 +1,9 @@ -import 'package:aranduapp/ui/home/view/HomeView.dart'; -import 'package:aranduapp/ui/profile/view/ProfileView.dart'; +import 'package:aranduapp/ui/home/view/home_view.dart'; +import 'package:aranduapp/ui/profile/view/profile_view.dart'; //import 'package:aranduapp/ui/profile/view/profileView.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:aranduapp/ui/navbar/model/navBarViewModel.dart'; +import 'package:aranduapp/ui/navbar/viewmodel/navbar_viewmodel.dart'; class NavbarView extends StatelessWidget { const NavbarView({super.key}); diff --git a/lib/ui/navbar/model/navBarViewModel.dart b/lib/ui/navbar/viewmodel/navbar_viewmodel.dart similarity index 100% rename from lib/ui/navbar/model/navBarViewModel.dart rename to lib/ui/navbar/viewmodel/navbar_viewmodel.dart diff --git a/lib/ui/onboarding/view/onboarding_view.dart b/lib/ui/onboarding/view/onboarding_view.dart index 8f06575..a994f3e 100644 --- a/lib/ui/onboarding/view/onboarding_view.dart +++ b/lib/ui/onboarding/view/onboarding_view.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import '../viewModel/onboarding_view_model.dart'; +import '../viewmodel/onboarding_viewmodel.dart'; class OnboardingView extends StatelessWidget { const OnboardingView({super.key}); diff --git a/lib/ui/onboarding/viewModel/onboarding_view_model.dart b/lib/ui/onboarding/viewmodel/onboarding_viewmodel.dart similarity index 100% rename from lib/ui/onboarding/viewModel/onboarding_view_model.dart rename to lib/ui/onboarding/viewmodel/onboarding_viewmodel.dart diff --git a/lib/ui/profile/view/ProfileView.dart b/lib/ui/profile/view/profile_view.dart similarity index 96% rename from lib/ui/profile/view/ProfileView.dart rename to lib/ui/profile/view/profile_view.dart index 5af2483..a83074d 100644 --- a/lib/ui/profile/view/ProfileView.dart +++ b/lib/ui/profile/view/profile_view.dart @@ -2,8 +2,8 @@ import 'package:aranduapp/ui/edit_password/view/edit_password_view.dart'; import 'package:provider/provider.dart'; import 'package:flutter/material.dart'; -import 'package:aranduapp/ui/shared/ProfileHeader.dart'; -import 'package:aranduapp/ui/profile/viewModel/ProfileViewModel.dart'; +import 'package:aranduapp/ui/shared/profile_header.dart'; +import 'package:aranduapp/ui/profile/viewmodel/profile_viewmodel.dart'; import 'package:aranduapp/ui/edit_profile/view/edit_profile_view.dart'; class Profile extends StatelessWidget { @@ -102,7 +102,6 @@ class Profile extends StatelessWidget { ); } - Widget _setting(BuildContext context) { return Card( child: Column( diff --git a/lib/ui/profile/viewModel/ProfileViewModel.dart b/lib/ui/profile/viewmodel/profile_viewmodel.dart similarity index 100% rename from lib/ui/profile/viewModel/ProfileViewModel.dart rename to lib/ui/profile/viewmodel/profile_viewmodel.dart diff --git a/lib/ui/recover_account/model/RecoverAccountRequest.dart b/lib/ui/recover_account/model/recover_account_request.dart similarity index 100% rename from lib/ui/recover_account/model/RecoverAccountRequest.dart rename to lib/ui/recover_account/model/recover_account_request.dart diff --git a/lib/ui/recover_account/service/RecoverAccountService.dart b/lib/ui/recover_account/service/RecoverAccountService.dart deleted file mode 100644 index 2ab2331..0000000 --- a/lib/ui/recover_account/service/RecoverAccountService.dart +++ /dev/null @@ -1,17 +0,0 @@ -import 'package:aranduapp/core/network/base_api.dart'; -import 'package:aranduapp/ui/recover_account/model/RecoverAccountRequest.dart'; - -class RecoverAccountService { - - - static Future forgetPassword(RecoverAccountRequest recoverAccountRequest) async { - - await BaseApi.getInstance(auth:false).post( - path: '/auth/forgot-password', - data: { - 'email' : recoverAccountRequest.email, - } - ); - } - -} diff --git a/lib/ui/recover_account/service/recover_account_service.dart b/lib/ui/recover_account/service/recover_account_service.dart new file mode 100644 index 0000000..70715b6 --- /dev/null +++ b/lib/ui/recover_account/service/recover_account_service.dart @@ -0,0 +1,12 @@ +import 'package:aranduapp/core/network/base_api.dart'; +import 'package:aranduapp/ui/recover_account/model/recover_account_request.dart'; + +class RecoverAccountService { + static Future forgetPassword( + RecoverAccountRequest recoverAccountRequest) async { + await BaseApi.getInstance(auth: false) + .post(path: '/auth/forgot-password', data: { + 'email': recoverAccountRequest.email, + }); + } +} diff --git a/lib/ui/recover_account/view/recover_account_view.dart b/lib/ui/recover_account/view/recover_account_view.dart index 11199c0..5baf84c 100644 --- a/lib/ui/recover_account/view/recover_account_view.dart +++ b/lib/ui/recover_account/view/recover_account_view.dart @@ -1,10 +1,10 @@ -import 'package:aranduapp/core/log/Log.dart'; -import 'package:aranduapp/ui/recover_account/viewModel/recover_account_view_model.dart'; -import 'package:aranduapp/ui/shared/ErrorPopUp.dart'; -import 'package:aranduapp/ui/shared/TextAndLink.dart'; -import 'package:aranduapp/ui/shared/TextEmail.dart'; -import 'package:aranduapp/ui/shared/TitleSlogan.dart'; -import 'package:aranduapp/ui/shared/requestbutton.dart'; +import 'package:aranduapp/core/log/log.dart'; +import 'package:aranduapp/ui/recover_account/viewmodel/recover_account_viewmodel.dart'; +import 'package:aranduapp/ui/shared/error_popup.dart'; +import 'package:aranduapp/ui/shared/text_and_link.dart'; +import 'package:aranduapp/ui/shared/text_email.dart'; +import 'package:aranduapp/ui/shared/title_slogan.dart'; +import 'package:aranduapp/ui/shared/request_button.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; diff --git a/lib/ui/recover_account/viewModel/recover_account_view_model.dart b/lib/ui/recover_account/viewmodel/recover_account_viewmodel.dart similarity index 78% rename from lib/ui/recover_account/viewModel/recover_account_view_model.dart rename to lib/ui/recover_account/viewmodel/recover_account_viewmodel.dart index ae77d83..3ac1f12 100644 --- a/lib/ui/recover_account/viewModel/recover_account_view_model.dart +++ b/lib/ui/recover_account/viewmodel/recover_account_viewmodel.dart @@ -1,7 +1,7 @@ -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/log/log.dart'; import 'package:aranduapp/core/state/command.dart'; -import 'package:aranduapp/ui/recover_account/model/RecoverAccountRequest.dart'; -import 'package:aranduapp/ui/recover_account/service/RecoverAccountService.dart'; +import 'package:aranduapp/ui/recover_account/model/recover_account_request.dart'; +import 'package:aranduapp/ui/recover_account/service/recover_account_service.dart'; import 'package:async/async.dart'; import 'package:flutter/material.dart'; diff --git a/lib/ui/register_account/view/register_account_view.dart b/lib/ui/register_account/view/register_account_view.dart index a5c9877..2dad65c 100644 --- a/lib/ui/register_account/view/register_account_view.dart +++ b/lib/ui/register_account/view/register_account_view.dart @@ -1,19 +1,19 @@ import 'package:aranduapp/ui/login/view/login_view.dart'; -import 'package:aranduapp/ui/shared/OrDivider.dart'; -import 'package:aranduapp/ui/shared/TextAndLink.dart'; -import 'package:aranduapp/ui/shared/TextName.dart'; -import 'package:aranduapp/ui/shared/requestbutton.dart'; +import 'package:aranduapp/ui/shared/or_divider.dart'; +import 'package:aranduapp/ui/shared/text_and_link.dart'; +import 'package:aranduapp/ui/shared/text_name.dart'; +import 'package:aranduapp/ui/shared/request_button.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/log/log.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:aranduapp/ui/register_account/viewModel/register_view_model.dart'; +import 'package:aranduapp/ui/register_account/viewmodel/register_viewmodel.dart'; -import 'package:aranduapp/ui/shared/TitleSlogan.dart'; -import 'package:aranduapp/ui/shared/TextEmail.dart'; -import 'package:aranduapp/ui/shared/ErrorPopUp.dart'; -import 'package:aranduapp/ui/shared/TextPassword.dart'; +import 'package:aranduapp/ui/shared/title_slogan.dart'; +import 'package:aranduapp/ui/shared/text_email.dart'; +import 'package:aranduapp/ui/shared/error_popup.dart'; +import 'package:aranduapp/ui/shared/text_password.dart'; class RegisterAccount extends StatelessWidget { const RegisterAccount({super.key}); diff --git a/lib/ui/register_account/viewModel/register_view_model.dart b/lib/ui/register_account/viewmodel/register_viewmodel.dart similarity index 100% rename from lib/ui/register_account/viewModel/register_view_model.dart rename to lib/ui/register_account/viewmodel/register_viewmodel.dart diff --git a/lib/ui/shared/ErrorPopUp.dart b/lib/ui/shared/error_popup.dart similarity index 70% rename from lib/ui/shared/ErrorPopUp.dart rename to lib/ui/shared/error_popup.dart index 8dbdc82..2ea1d96 100644 --- a/lib/ui/shared/ErrorPopUp.dart +++ b/lib/ui/shared/error_popup.dart @@ -1,19 +1,16 @@ import 'package:flutter/material.dart'; -import 'package:aranduapp/core/log/Log.dart'; +import 'package:aranduapp/core/log/log.dart'; class ErrorPopUp extends StatelessWidget { - final Widget content; const ErrorPopUp({super.key, required this.content}); @override Widget build(BuildContext context) { - return AlertDialog ( - title: Align( - + return AlertDialog( + title: Align( alignment: Alignment.centerLeft, - child: Icon( Icons.error, size: 40, @@ -23,11 +20,7 @@ class ErrorPopUp extends StatelessWidget { content: content, actions: [ TextButton( - - onPressed: () => { - Log.d('tap'), - Navigator.pop(context, 'OK') - }, + onPressed: () => {Log.d('tap'), Navigator.pop(context, 'OK')}, child: const Text('OK'), ), ], diff --git a/lib/ui/shared/OrDivider.dart b/lib/ui/shared/or_divider.dart similarity index 100% rename from lib/ui/shared/OrDivider.dart rename to lib/ui/shared/or_divider.dart diff --git a/lib/ui/shared/ProfileHeader.dart b/lib/ui/shared/profile_header.dart similarity index 100% rename from lib/ui/shared/ProfileHeader.dart rename to lib/ui/shared/profile_header.dart diff --git a/lib/ui/shared/requestbutton.dart b/lib/ui/shared/request_button.dart similarity index 100% rename from lib/ui/shared/requestbutton.dart rename to lib/ui/shared/request_button.dart diff --git a/lib/ui/shared/TextAndLink.dart b/lib/ui/shared/text_and_link.dart similarity index 100% rename from lib/ui/shared/TextAndLink.dart rename to lib/ui/shared/text_and_link.dart diff --git a/lib/ui/shared/TextEmail.dart b/lib/ui/shared/text_email.dart similarity index 100% rename from lib/ui/shared/TextEmail.dart rename to lib/ui/shared/text_email.dart diff --git a/lib/ui/shared/TextName.dart b/lib/ui/shared/text_name.dart similarity index 100% rename from lib/ui/shared/TextName.dart rename to lib/ui/shared/text_name.dart diff --git a/lib/ui/shared/TextPassword.dart b/lib/ui/shared/text_password.dart similarity index 100% rename from lib/ui/shared/TextPassword.dart rename to lib/ui/shared/text_password.dart diff --git a/lib/ui/shared/TitleSlogan.dart b/lib/ui/shared/title_slogan.dart similarity index 100% rename from lib/ui/shared/TitleSlogan.dart rename to lib/ui/shared/title_slogan.dart diff --git a/lib/ui/welcome/view/WelcomeView.dart b/lib/ui/welcome/view/welcome_view.dart similarity index 100% rename from lib/ui/welcome/view/WelcomeView.dart rename to lib/ui/welcome/view/welcome_view.dart diff --git a/test/ui/Shared/ErrorPopUp_test.dart b/test/ui/Shared/error_popup_test.dart similarity index 94% rename from test/ui/Shared/ErrorPopUp_test.dart rename to test/ui/Shared/error_popup_test.dart index 3bee757..0408597 100644 --- a/test/ui/Shared/ErrorPopUp_test.dart +++ b/test/ui/Shared/error_popup_test.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:aranduapp/ui/shared/ErrorPopUp.dart'; +import 'package:aranduapp/ui/shared/error_popup.dart'; void main() { testWidgets('Testa ErrorPopUp', (WidgetTester tester) async { diff --git a/test/ui/Shared/requestbutton.dart b/test/ui/Shared/request_button.dart similarity index 100% rename from test/ui/Shared/requestbutton.dart rename to test/ui/Shared/request_button.dart diff --git a/test/ui/Shared/TextEmail_test.dart b/test/ui/Shared/text_email_test.dart similarity index 73% rename from test/ui/Shared/TextEmail_test.dart rename to test/ui/Shared/text_email_test.dart index fb07c2e..ad59c50 100644 --- a/test/ui/Shared/TextEmail_test.dart +++ b/test/ui/Shared/text_email_test.dart @@ -1,4 +1,4 @@ -import 'package:aranduapp/ui/shared/TextEmail.dart'; +import 'package:aranduapp/ui/shared/text_email.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -29,9 +29,12 @@ void main() { // Teste de validação para diferentes casos await testEmail("", "E-mail Obrigatório."); // Campo vazio - await testEmail("joaozinhi", "Opa, E-mail inválido!\n(Ex: exemplo@gmail.com)"); // Sem '@' - await testEmail("joaozinhi@", "Opa, E-mail inválido!\n(Ex: exemplo@gmail.com)"); // Sem domínio - await testEmail("joao@domain", "Opa, E-mail inválido!\n(Ex: exemplo@gmail.com)"); // Sem extensão + await testEmail("joaozinhi", + "Opa, E-mail inválido!\n(Ex: exemplo@gmail.com)"); // Sem '@' + await testEmail("joaozinhi@", + "Opa, E-mail inválido!\n(Ex: exemplo@gmail.com)"); // Sem domínio + await testEmail("joao@domain", + "Opa, E-mail inválido!\n(Ex: exemplo@gmail.com)"); // Sem extensão await testEmail("joao@example.com", null); // Entrada válida }); } diff --git a/test/ui/Shared/TextName_test.dart b/test/ui/Shared/text_name_test.dart similarity index 76% rename from test/ui/Shared/TextName_test.dart rename to test/ui/Shared/text_name_test.dart index b18e1ae..5ef6b97 100644 --- a/test/ui/Shared/TextName_test.dart +++ b/test/ui/Shared/text_name_test.dart @@ -1,4 +1,4 @@ -import 'package:aranduapp/ui/shared/TextName.dart'; +import 'package:aranduapp/ui/shared/text_name.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -27,8 +27,10 @@ void main() { // Teste de validação para diferentes casos de nome await testName("", 'Nome Obrigatório.'); // Campo vazio - await testName(" a", 'Opa, seu Nome está pequeno!\nacrescente mais caracteres. (Ex: Ana)'); // Nome com menos de 3 caracteres - await testName("Jo", 'Opa, seu Nome está pequeno!\nacrescente mais um caractere. (Ex: Ana)'); // Nome com 2 caracteres + await testName(" a", + 'Opa, seu Nome está pequeno!\nacrescente mais caracteres. (Ex: Ana)'); // Nome com menos de 3 caracteres + await testName("Jo", + 'Opa, seu Nome está pequeno!\nacrescente mais um caractere. (Ex: Ana)'); // Nome com 2 caracteres await testName("João", null); // Nome válido await testName("Maria", null); // Outro nome válido }); diff --git a/test/ui/Shared/TextPassword_test.dart b/test/ui/Shared/text_password_test.dart similarity index 94% rename from test/ui/Shared/TextPassword_test.dart rename to test/ui/Shared/text_password_test.dart index 95172d9..1312436 100644 --- a/test/ui/Shared/TextPassword_test.dart +++ b/test/ui/Shared/text_password_test.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -import 'package:aranduapp/ui/shared/TextPassword.dart'; +import 'package:aranduapp/ui/shared/text_password.dart'; void main() { // Testa a validação da senha no widget TextPassWord @@ -33,7 +33,8 @@ void main() { } // Testa senhas inválidas, válidas e campo vazio - await testPassword('12345', "Senha deve ter no mínimo 8 caracteres.\n(Ex: @abd1234)"); // Senha muito curta + await testPassword('12345', + "Senha deve ter no mínimo 8 caracteres.\n(Ex: @abd1234)"); // Senha muito curta await testPassword('validPassword123', null); // Senha válida await testPassword('', 'Senha Obrigatória.'); // Campo vazio }); diff --git a/test/ui/login/view/login_view_test.dart b/test/ui/login/view/login_view_test.dart index 995fd31..6113b52 100644 --- a/test/ui/login/view/login_view_test.dart +++ b/test/ui/login/view/login_view_test.dart @@ -1,9 +1,9 @@ import 'package:aranduapp/core/state/command.dart'; import 'package:aranduapp/ui/login/view/login_view.dart'; import 'package:aranduapp/ui/login/viewmodel/login_viewmodel.dart'; -import 'package:aranduapp/ui/navbar/view/navBarView.dart'; -import 'package:aranduapp/ui/shared/TextEmail.dart'; -import 'package:aranduapp/ui/shared/TextPassword.dart'; +import 'package:aranduapp/ui/navbar/view/navbar_view.dart'; +import 'package:aranduapp/ui/shared/text_email.dart'; +import 'package:aranduapp/ui/shared/text_password.dart'; import 'package:async/async.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; diff --git a/test/ui/recover_account/view/recover_account_test.dart b/test/ui/recover_account/view/recover_account_test.dart index 599ded6..f3371a0 100644 --- a/test/ui/recover_account/view/recover_account_test.dart +++ b/test/ui/recover_account/view/recover_account_test.dart @@ -1,8 +1,8 @@ import 'package:aranduapp/core/state/command.dart'; -import 'package:aranduapp/ui/shared/TextAndLink.dart'; -import 'package:aranduapp/ui/shared/TextEmail.dart'; -import 'package:aranduapp/ui/shared/TitleSlogan.dart'; -import 'package:aranduapp/ui/shared/requestbutton.dart'; +import 'package:aranduapp/ui/shared/text_and_link.dart'; +import 'package:aranduapp/ui/shared/text_email.dart'; +import 'package:aranduapp/ui/shared/title_slogan.dart'; +import 'package:aranduapp/ui/shared/request_button.dart'; import 'package:async/async.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -10,7 +10,7 @@ import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; import 'package:aranduapp/ui/recover_account/view/recover_account_view.dart'; -import 'package:aranduapp/ui/recover_account/viewModel/recover_account_view_model.dart'; +import 'package:aranduapp/ui/recover_account/viewmodel/recover_account_viewmodel.dart'; @GenerateNiceMocks([MockSpec(), MockSpec()]) import 'recover_account_test.mocks.dart'; @@ -28,7 +28,6 @@ void main() { when(mockViewModel.formKey).thenReturn(GlobalKey()); when(mockViewModel.emailController).thenReturn(TextEditingController()); - }); Widget createLoginScreen(MockRecoverAccountViewModel mockViewModel) { @@ -42,10 +41,8 @@ void main() { ); } - testWidgets('Register Account screen displays fields and send button', (WidgetTester tester) async { - await tester.pumpWidget(createLoginScreen(mockViewModel)); await tester.pump(); @@ -55,8 +52,6 @@ void main() { expect(find.byType(TextAndLink), findsOneWidget); }); - - testWidgets('Recover account sending request', (WidgetTester tester) async { await tester.pumpWidget(createLoginScreen(mockViewModel)); @@ -68,19 +63,14 @@ void main() { verify(mockCommand0.execute()).called(1); }); - testWidgets('Recover account user input', (WidgetTester tester) async { - await tester.pumpWidget(createLoginScreen(mockViewModel)); const email = 'test@example.com'; - await tester.enterText(find.byType(TextEmail), email); await tester.pumpAndSettle(); expect(mockViewModel.emailController.text, email); }); - - } diff --git a/test/ui/recover_account/view/recover_account_test.mocks.dart b/test/ui/recover_account/view/recover_account_test.mocks.dart index 33c99e3..a4c3251 100644 --- a/test/ui/recover_account/view/recover_account_test.mocks.dart +++ b/test/ui/recover_account/view/recover_account_test.mocks.dart @@ -6,7 +6,7 @@ import 'dart:async' as _i6; import 'package:aranduapp/core/state/command.dart' as _i3; -import 'package:aranduapp/ui/recover_account/viewModel/recover_account_view_model.dart' +import 'package:aranduapp/ui/recover_account/viewmodel/recover_account_viewmodel.dart' as _i5; import 'package:async/async.dart' as _i4; import 'package:flutter/material.dart' as _i1; diff --git a/test/ui/register_account/view/register_account_view_test.dart b/test/ui/register_account/view/register_account_view_test.dart index 8bc36cf..aa51f64 100644 --- a/test/ui/register_account/view/register_account_view_test.dart +++ b/test/ui/register_account/view/register_account_view_test.dart @@ -1,10 +1,10 @@ import 'package:aranduapp/core/state/command.dart'; import 'package:aranduapp/ui/register_account/view/register_account_view.dart'; -import 'package:aranduapp/ui/shared/ErrorPopUp.dart'; -import 'package:aranduapp/ui/shared/TextAndLink.dart'; -import 'package:aranduapp/ui/shared/TextEmail.dart'; -import 'package:aranduapp/ui/shared/TextPassword.dart'; -import 'package:aranduapp/ui/shared/TitleSlogan.dart'; +import 'package:aranduapp/ui/shared/error_popup.dart'; +import 'package:aranduapp/ui/shared/text_and_link.dart'; +import 'package:aranduapp/ui/shared/text_email.dart'; +import 'package:aranduapp/ui/shared/text_password.dart'; +import 'package:aranduapp/ui/shared/title_slogan.dart'; import 'package:async/async.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -13,7 +13,7 @@ import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; @GenerateNiceMocks([MockSpec(), MockSpec()]) -import 'package:aranduapp/ui/register_account/viewModel/register_view_model.dart'; +import 'package:aranduapp/ui/register_account/viewmodel/register_viewmodel.dart'; import 'register_account_view_test.mocks.dart'; @@ -99,7 +99,8 @@ void main() { expect(mockViewModel.emailController.text, email); }); - testWidgets('Checkbox shows correct value when initially unchecked', (WidgetTester tester) async { + testWidgets('Checkbox shows correct value when initially unchecked', + (WidgetTester tester) async { when(mockViewModel.isTermsAccepted).thenReturn(false); await tester.pumpWidget(createLoginScreen(mockViewModel)); @@ -113,8 +114,8 @@ void main() { verify(mockViewModel.setToggleTermsAccepted(true)).called(1); }); - - testWidgets('Checkbox shows correct value when initially checked', (WidgetTester tester) async { + testWidgets('Checkbox shows correct value when initially checked', + (WidgetTester tester) async { when(mockViewModel.isTermsAccepted).thenReturn(true); await tester.pumpWidget(createLoginScreen(mockViewModel)); diff --git a/test/ui/register_account/view/register_account_view_test.mocks.dart b/test/ui/register_account/view/register_account_view_test.mocks.dart index f785872..8e92c49 100644 --- a/test/ui/register_account/view/register_account_view_test.mocks.dart +++ b/test/ui/register_account/view/register_account_view_test.mocks.dart @@ -6,7 +6,7 @@ import 'dart:async' as _i6; import 'package:aranduapp/core/state/command.dart' as _i3; -import 'package:aranduapp/ui/register_account/viewModel/register_view_model.dart' +import 'package:aranduapp/ui/register_account/viewmodel/register_viewmodel.dart' as _i5; import 'package:async/async.dart' as _i4; import 'package:flutter/material.dart' as _i1;