Skip to content

Commit

Permalink
feat: auth logic and UI, UX for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
vkprogrammer-001 committed Jun 5, 2024
1 parent e448755 commit ad30014
Show file tree
Hide file tree
Showing 12 changed files with 1,035 additions and 472 deletions.
Binary file added assets/logo_auth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions devtools_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:
104 changes: 22 additions & 82 deletions lib/presentation/authentication/desktop/login_view_desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:monumento/application/authentication/login_register/login_regist
import 'package:monumento/service_locator.dart';
import 'package:monumento/utils/app_colors.dart';
import 'package:monumento/utils/app_text_styles.dart';
import 'package:monumento/utils/constants.dart';

class LoginViewDesktop extends StatefulWidget {
const LoginViewDesktop({super.key});
Expand Down Expand Up @@ -125,70 +126,27 @@ class _LoginViewDesktopState extends State<LoginViewDesktop> {
const SizedBox(
height: 22,
),
TextFormField(
controller: emailController,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter email.';
} else if (!value.contains('@')) {
return 'Please enter a valid email.';
}
return null;
},
autovalidateMode:
AutovalidateMode.onUserInteraction,
decoration: InputDecoration(
labelText: 'Email',
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondary,
),
),
floatingLabelStyle: AppTextStyles.s14(
color: AppColor.appSecondary,
fontType: FontType.MEDIUM,
),
border: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondaryBlack,
),
),
),
),
CustomUI.customTextField(
emailController, 'Email', false, (value) {
if (value == null || value.isEmpty) {
return 'Please enter email.';
} else if (!value.contains('@')) {
return 'Please enter a valid email.';
}
return null;
}, AutovalidateMode.onUserInteraction),
const SizedBox(
height: 16,
),
TextFormField(
controller: passwordController,
obscureText: true,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter password.';
} else if (value.length < 6) {
return 'Password must be at least 6 characters.';
}
return null;
},
autovalidateMode:
AutovalidateMode.onUserInteraction,
decoration: InputDecoration(
labelText: 'Password',
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondary,
),
),
floatingLabelStyle: AppTextStyles.s14(
color: AppColor.appSecondary,
fontType: FontType.MEDIUM,
),
border: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondaryBlack,
),
),
),
),
CustomUI.customTextField(
passwordController, 'Password', true, (value) {
if (value == null || value.isEmpty) {
return 'Please enter password.';
} else if (value.length < 6) {
return 'Password must be at least 6 characters.';
}
return null;
}, AutovalidateMode.onUserInteraction),
const SizedBox(
height: 16,
),
Expand Down Expand Up @@ -216,17 +174,8 @@ class _LoginViewDesktopState extends State<LoginViewDesktop> {
height: 48,
),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
backgroundColor: AppColor.appPrimary,
padding:
const EdgeInsets.symmetric(vertical: 20),
),
onPressed: () {
width: double.infinity,
child: CustomUI.customElevatedButton(() {
if (formKey.currentState!.validate()) {
locator<LoginRegisterBloc>().add(
LoginWithEmailPressed(
Expand All @@ -248,16 +197,7 @@ class _LoginViewDesktopState extends State<LoginViewDesktop> {
),
);
}
},
child: Text(
'Login',
style: AppTextStyles.s14(
color: AppColor.appSecondary,
fontType: FontType.MEDIUM,
),
),
),
),
}, 'Login')),
const SizedBox(
height: 26,
),
Expand Down
118 changes: 25 additions & 93 deletions lib/presentation/authentication/desktop/onboarding_view_desktop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:image_picker/image_picker.dart';
import 'package:monumento/application/authentication/login_register/login_register_bloc.dart';
import 'package:monumento/service_locator.dart';
import 'package:monumento/utils/app_colors.dart';
import 'package:monumento/utils/app_text_styles.dart';
import 'package:monumento/utils/constants.dart';

class OnboardingViewDesktop extends StatefulWidget {
const OnboardingViewDesktop({super.key});
Expand Down Expand Up @@ -94,116 +94,48 @@ class _OnboardingViewDesktopState extends State<OnboardingViewDesktop> {
image = img;
});
},
child: CircleAvatar(
radius: 40,
backgroundColor: AppColor.appGreyAccent,
child: image != null
? Image.file(File(image!.path))
: SvgPicture.asset(
child: image != null
? CircleAvatar(
radius: 40,
backgroundImage:
FileImage(File(image!.path)))
: CircleAvatar(
radius: 40,
backgroundColor: AppColor.appGreyAccent,
child: SvgPicture.asset(
'assets/icons/ic_user.svg',
),
),
),
),
const SizedBox(
height: 22,
),
TextFormField(
controller: nameController,
decoration: InputDecoration(
labelText: 'Name',
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondary,
),
),
floatingLabelStyle: AppTextStyles.s14(
color: AppColor.appSecondary,
fontType: FontType.MEDIUM,
),
border: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondaryBlack,
),
),
),
),
CustomUI.customTextField(
nameController, 'Name', false, null, null),
const SizedBox(
height: 16,
),
TextFormField(
controller: usernameController,
decoration: InputDecoration(
labelText: 'Username',
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondary,
),
),
floatingLabelStyle: AppTextStyles.s14(
color: AppColor.appSecondary,
fontType: FontType.MEDIUM,
),
border: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondaryBlack,
),
),
),
),
CustomUI.customTextField(usernameController,
'Username', false, null, null),
const SizedBox(
height: 16,
),
TextFormField(
controller: statusController,
decoration: InputDecoration(
labelText: 'Status',
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondary,
),
),
floatingLabelStyle: AppTextStyles.s14(
color: AppColor.appSecondary,
fontType: FontType.MEDIUM,
),
border: const OutlineInputBorder(
borderSide: BorderSide(
color: AppColor.appSecondaryBlack,
),
),
),
),
CustomUI.customTextField(
statusController, 'Status', false, null, null),
const SizedBox(
height: 48,
),
SizedBox(
width: double.infinity,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
child: CustomUI.customElevatedButton(() {
locator<LoginRegisterBloc>().add(
SaveOnboardingDetails(
name: nameController.text,
status: statusController.text,
username: usernameController.text,
),
backgroundColor: AppColor.appPrimary,
padding:
const EdgeInsets.symmetric(vertical: 20),
),
onPressed: () {
locator<LoginRegisterBloc>().add(
SaveOnboardingDetails(
name: nameController.text,
status: statusController.text,
username: usernameController.text,
),
);
},
child: Text(
'Continue',
style: AppTextStyles.s14(
color: AppColor.appSecondary,
fontType: FontType.MEDIUM,
),
),
),
);
}, 'Continue'),
),
const SizedBox(
height: 26,
Expand Down
Loading

0 comments on commit ad30014

Please sign in to comment.