auth changes

This commit is contained in:
mohammad
2024-08-06 16:40:03 +03:00
parent 1f5a119c60
commit e88be3cf17
4 changed files with 46 additions and 28 deletions

View File

@ -98,6 +98,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
String newPassword = '';
String maskedEmail = '';
String otpCode = '';
String validate = '';
static Token token = Token.emptyConstructor();
static UserModel? user;
bool showValidationMessage = false;
@ -118,6 +119,7 @@ class AuthBloc extends Bloc<AuthEvent, AuthState> {
),
);
} catch (failure) {
validate='Something went wrong';
emit(const LoginFailure(error: 'Something went wrong'));
// emit(LoginFailure(error: failure.toString()));
return;

View File

@ -49,7 +49,7 @@ class ForgetPasswordWebPage extends StatelessWidget {
child: ListView(
children: [
Container(
padding:const EdgeInsets.all(50) ,
padding:const EdgeInsets.all(30) ,
margin: const EdgeInsets.all(90),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.3),
@ -92,12 +92,12 @@ class ForgetPasswordWebPage extends StatelessWidget {
fontSize: 24,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 20),
const SizedBox(height: 10),
Text(
'Please fill in your account information to\nretrieve your password',
style: smallTextStyle,
),
const SizedBox(height: 20),
const SizedBox(height: 10),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@ -226,18 +226,27 @@ class ForgetPasswordWebPage extends StatelessWidget {
height: 10,
),
const SizedBox(height: 20.0),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.2,
child: DefaultButton(
backgroundColor: ColorsManager.btnColor,
child: const Text('Submit'),
onPressed: () {
if (forgetBloc.forgetFormKey.currentState!.validate()) {
forgetBloc.add(ChangePasswordEvent());
}
},
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.2,
child: DefaultButton(
backgroundColor: ColorsManager.btnColor,
child: const Text('Submit'),
onPressed: () {
if (forgetBloc.forgetFormKey.currentState!.validate()) {
forgetBloc.add(ChangePasswordEvent());
}
},
),
),
],
),
const SizedBox(height: 10.0),
SizedBox(child: Text(forgetBloc.validate,
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),),
SizedBox(height: 10,),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.2,

View File

@ -7,7 +7,6 @@ import 'package:syncrow_web/utils/responsive_layout.dart';
class LoginPage extends StatelessWidget {
const LoginPage({super.key});
@override
Widget build(BuildContext context) {
return const ResponsiveLayout(

View File

@ -22,7 +22,7 @@ class LoginWebPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
body: BlocProvider(
create: (BuildContext context) => AuthBloc()..add(RegionInitialEvent()),
create: (BuildContext context) => AuthBloc(),
child: BlocConsumer<AuthBloc, AuthState>(
listener: (context, state) {
if (state is LoginSuccess) {
@ -54,14 +54,15 @@ class LoginWebPage extends StatelessWidget {
Widget _buildLoginForm(BuildContext context,AuthState state) {
final loginBloc = BlocProvider.of<AuthBloc>(context);
Size size= MediaQuery.of(context).size;
return FirstLayer(
second: Center(
child: ListView(
shrinkWrap: true,
children: [
Container(
padding:const EdgeInsets.all(50) ,
margin: const EdgeInsets.all(90),
padding: EdgeInsets.all(size.width*0.02) ,
margin: EdgeInsets.all(size.width*0.09),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.3),
borderRadius: const BorderRadius.all(Radius.circular(20)),
@ -89,12 +90,14 @@ class LoginWebPage extends StatelessWidget {
child: Form(
key: loginBloc.loginFormKey,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 50, vertical: 25),
padding: EdgeInsets.symmetric(
horizontal: size.width*0.040,
vertical: size.width*0.003),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const SizedBox(height: 15),
const SizedBox(height: 40),
const Text(
'Login',
style: TextStyle(
@ -102,7 +105,7 @@ class LoginWebPage extends StatelessWidget {
fontSize: 24,
fontWeight: FontWeight.bold),
),
const SizedBox(height: 40),
SizedBox(height: size.height*0.03),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
@ -121,7 +124,7 @@ class LoginWebPage extends StatelessWidget {
decoration: textBoxDecoration()!.copyWith(
hintText: null,),
hint: SizedBox(
width: MediaQuery.sizeOf(context).width * 0.11,
width: size.width * 0.11,
child: const Align(
alignment: Alignment.centerLeft,
child: Text(
@ -142,7 +145,7 @@ class LoginWebPage extends StatelessWidget {
}).toList(),
onChanged: (String? value) {
print(value);
},
},
),
)
],
@ -224,7 +227,7 @@ class LoginWebPage extends StatelessWidget {
),
),
const SizedBox(
height: 32,
height: 20,
),
Row(
children: [
@ -242,7 +245,7 @@ class LoginWebPage extends StatelessWidget {
),
),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.16,
width:size.width * 0.14,
child: RichText(
text: TextSpan(
text: 'Agree to ',
@ -283,9 +286,9 @@ class LoginWebPage extends StatelessWidget {
),
],
),
const SizedBox(height: 30.0),
const SizedBox(height: 20.0),
SizedBox(
width: MediaQuery.sizeOf(context).width * 0.2,
width:size.width * 0.2,
child: DefaultButton(
backgroundColor: loginBloc.isChecked?
ColorsManager.btnColor:ColorsManager.grayColor,
@ -301,7 +304,12 @@ class LoginWebPage extends StatelessWidget {
},
),
),
const SizedBox(height: 15.0),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [ SizedBox(child: Text(loginBloc.validate,
style: const TextStyle(fontWeight: FontWeight.w700,color: ColorsManager.red ),),)],)
],
),
),