mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 08:14:55 +00:00
notes modified
This commit is contained in:
@ -1 +1,2 @@
|
|||||||
extensions:
|
extensions:
|
||||||
|
- provider: true
|
||||||
@ -243,7 +243,7 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyOtp() async {
|
verifyOtp(bool isForgotPass ) async {
|
||||||
emit(AuthLoginLoading());
|
emit(AuthLoginLoading());
|
||||||
try {
|
try {
|
||||||
final response = await AuthenticationAPI.verifyPassCode(
|
final response = await AuthenticationAPI.verifyPassCode(
|
||||||
@ -251,7 +251,7 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
if (response['statusCode'] == 200) {
|
if (response['statusCode'] == 200) {
|
||||||
emailController.text = email;
|
emailController.text = email;
|
||||||
passwordController.text = signUpPassword;
|
passwordController.text = signUpPassword;
|
||||||
await login();
|
isForgotPass?(){}: await login();
|
||||||
emit(AuthOtpSuccess());
|
emit(AuthOtpSuccess());
|
||||||
} else {
|
} else {
|
||||||
emit(AuthLoginError(message: 'Something went wrong'));
|
emit(AuthLoginError(message: 'Something went wrong'));
|
||||||
|
|||||||
@ -2,18 +2,17 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
||||||
import 'package:syncrow_app/features/auth/view/otp_view.dart';
|
import 'package:syncrow_app/features/auth/view/otp_view.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/default_button.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
||||||
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/utils/context_extension.dart';
|
import 'package:syncrow_app/utils/context_extension.dart';
|
||||||
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
import '../../../generated/assets.dart';
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
import '../../../navigation/routing_constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/styles_manager.dart';
|
||||||
import '../../../utils/resource_manager/constants.dart';
|
|
||||||
import '../../../utils/resource_manager/font_manager.dart';
|
|
||||||
import '../../../utils/resource_manager/styles_manager.dart';
|
|
||||||
import '../../shared_widgets/default_button.dart';
|
|
||||||
import '../../shared_widgets/text_widgets/body_medium.dart';
|
|
||||||
import '../../shared_widgets/text_widgets/title_medium.dart';
|
|
||||||
import '../bloc/auth_cubit.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class checkEmailPage extends StatelessWidget {
|
class checkEmailPage extends StatelessWidget {
|
||||||
@ -23,25 +22,26 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
final formKey = AuthCubit.get(context).checkemailFormKey;
|
final formKey = AuthCubit.get(context).checkemailFormKey;
|
||||||
|
|
||||||
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
|
||||||
statusBarBrightness: Brightness.light, statusBarIconBrightness: Brightness.light));
|
statusBarBrightness: Brightness.light,
|
||||||
|
statusBarIconBrightness: Brightness.light));
|
||||||
return BlocConsumer<AuthCubit, AuthState>(
|
return BlocConsumer<AuthCubit, AuthState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is AuthError) {
|
if (state is AuthError) {
|
||||||
// ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
// SnackBar(
|
SnackBar(
|
||||||
// content: Text(state.message),
|
content: Text(state.message),
|
||||||
// ),
|
),
|
||||||
// );
|
);
|
||||||
}
|
} else if (state is AuthSignUpSuccess) {
|
||||||
else if (state is AuthSignUpSuccess) {
|
Navigator.push(
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const OtpView(
|
context,
|
||||||
isForgetPage: true,),
|
MaterialPageRoute(
|
||||||
));
|
builder: (context) => const OtpView(
|
||||||
|
isForgetPage: true,
|
||||||
// Navigator.popAndPushNamed(context, Routes.otpRoute);
|
),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Stack(
|
body: Stack(
|
||||||
@ -71,103 +71,143 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
SafeArea(
|
SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
right: Constants.defaultPadding,
|
right: Constants.defaultPadding,
|
||||||
left: Constants.defaultPadding,
|
left: Constants.defaultPadding,
|
||||||
top: Constants.defaultPadding,
|
top: Constants.defaultPadding,
|
||||||
),
|
),
|
||||||
child: Form(key: formKey,child: SingleChildScrollView(
|
child: Form(
|
||||||
child: Center(
|
key: formKey,
|
||||||
child: Column(
|
child: SingleChildScrollView(
|
||||||
children: [
|
child: Center(
|
||||||
Center(
|
child: Column(
|
||||||
child: SvgPicture.asset(
|
children: [
|
||||||
Assets.assetsImagesLogo,
|
Center(
|
||||||
width: 160,
|
child: SvgPicture.asset(
|
||||||
),
|
Assets.assetsImagesLogo,
|
||||||
),
|
width: 160,
|
||||||
Center(
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
SizedBox(height: MediaQuery.sizeOf(context).height/5.5,),
|
|
||||||
TitleMedium(
|
|
||||||
text: 'Forgot password?',
|
|
||||||
style: context.titleMedium.copyWith(
|
|
||||||
fontWeight: FontsManager.extraBold,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(
|
),
|
||||||
height: 20,
|
Center(
|
||||||
),
|
child: Column(
|
||||||
const BodyMedium(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
text: "Enter email address",
|
|
||||||
fontColor: Colors.white,
|
|
||||||
),
|
|
||||||
TextFormField(
|
|
||||||
// autovalidateMode: AutovalidateMode.disabled,
|
|
||||||
textInputAction: TextInputAction.done,
|
|
||||||
keyboardType: TextInputType.text,
|
|
||||||
scrollPadding: EdgeInsets.zero,
|
|
||||||
autocorrect: false,
|
|
||||||
enableSuggestions: false,
|
|
||||||
autofillHints: const [AutofillHints.email],
|
|
||||||
validator: AuthCubit.get(context).emailAddressValidator,
|
|
||||||
onTapOutside: (event) {
|
|
||||||
FocusScope.of(context).unfocus();
|
|
||||||
},
|
|
||||||
onChanged: (value) {
|
|
||||||
AuthCubit.get(context).email = value;
|
|
||||||
},
|
|
||||||
decoration:
|
|
||||||
defaultInputDecoration(context, hint: "Example@email.com"),
|
|
||||||
),
|
|
||||||
SizedBox(height: 50,),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
SizedBox(
|
||||||
child: DefaultButton(
|
height:
|
||||||
isDone: state is AuthLoginSuccess,
|
MediaQuery.sizeOf(context).height /
|
||||||
isLoading: state is AuthLoading,
|
5.5,
|
||||||
customButtonStyle: ButtonStyle(
|
),
|
||||||
backgroundColor: MaterialStateProperty.all(
|
TitleMedium(
|
||||||
Colors.black.withOpacity(.25),
|
text: 'Forgot password?',
|
||||||
),
|
style: context.titleMedium.copyWith(
|
||||||
foregroundColor: MaterialStateProperty.all(
|
fontWeight: FontsManager.extraBold,
|
||||||
Colors.white,
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
const BodyMedium(
|
||||||
|
text: "Enter email address",
|
||||||
|
fontColor: Colors.white,
|
||||||
|
),
|
||||||
|
TextFormField(
|
||||||
|
textInputAction: TextInputAction.done,
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
scrollPadding: EdgeInsets.zero,
|
||||||
|
autocorrect: false,
|
||||||
|
enableSuggestions: false,
|
||||||
|
autofillHints: const [
|
||||||
|
AutofillHints.email
|
||||||
|
],
|
||||||
|
validator: AuthCubit.get(context)
|
||||||
|
.emailAddressValidator,
|
||||||
|
onTapOutside: (event) {
|
||||||
|
FocusScope.of(context).unfocus();
|
||||||
|
},
|
||||||
|
onChanged: (value) {
|
||||||
|
AuthCubit.get(context).email = value;
|
||||||
|
},
|
||||||
|
decoration: defaultInputDecoration(
|
||||||
|
context,
|
||||||
|
hint: "Example@email.com"),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 20,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: DefaultButton(
|
||||||
|
isDone: state is AuthLoginSuccess,
|
||||||
|
isLoading: state is AuthLoading,
|
||||||
|
customButtonStyle: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
MaterialStateProperty.all(
|
||||||
|
Colors.black.withOpacity(.25),
|
||||||
|
),
|
||||||
|
foregroundColor:
|
||||||
|
MaterialStateProperty.all(
|
||||||
|
Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: const Text(
|
||||||
|
'Send Code',
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
AuthCubit.get(context)
|
||||||
|
.showValidationMessage = true;
|
||||||
|
if (formKey.currentState!
|
||||||
|
.validate()) {
|
||||||
|
if ((state is! AuthLoading)) {
|
||||||
|
AuthCubit.get(context)
|
||||||
|
.sendOtp();
|
||||||
|
FocusScope.of(context)
|
||||||
|
.unfocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: const Text(
|
],
|
||||||
'Send Code',
|
),
|
||||||
),
|
Padding(
|
||||||
onPressed: () {
|
padding: EdgeInsets.only(top: MediaQuery.sizeOf(context).height/5.5),
|
||||||
AuthCubit.get(context).showValidationMessage = true;
|
child: Row(
|
||||||
if (formKey.currentState!.validate()) {
|
mainAxisAlignment:
|
||||||
if ((state is! AuthLoading)) {
|
MainAxisAlignment.center,
|
||||||
AuthCubit.get(context).sendOtp();
|
children: <Widget>[
|
||||||
FocusScope.of(context).unfocus();
|
BodyLarge(
|
||||||
}
|
text: "Do you have an account? ",
|
||||||
}
|
style: context.displaySmall
|
||||||
},
|
.copyWith(color: Colors.white),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: BodyLarge(
|
||||||
|
text: "Sign in",
|
||||||
|
style:
|
||||||
|
context.displaySmall.copyWith(
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontsManager.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
|
),
|
||||||
// const LoginForm(),
|
],
|
||||||
// const LoginDivider(),
|
|
||||||
// const LoginWithGoogleFacebook(),
|
|
||||||
// const DontHaveAnAccount(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
),)
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -176,5 +216,3 @@ class checkEmailPage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,18 +2,17 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
||||||
import 'package:syncrow_app/features/auth/view/login_view.dart';
|
import 'package:syncrow_app/features/auth/view/login_view.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/default_button.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/title_medium.dart';
|
||||||
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/utils/context_extension.dart';
|
import 'package:syncrow_app/utils/context_extension.dart';
|
||||||
import '../../../generated/assets.dart';
|
import 'package:syncrow_app/utils/helpers/custom_page_route.dart';
|
||||||
import '../../../utils/helpers/custom_page_route.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
import '../../../utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
import '../../../utils/resource_manager/font_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/styles_manager.dart';
|
||||||
import '../../../utils/resource_manager/styles_manager.dart';
|
|
||||||
import '../../shared_widgets/default_button.dart';
|
|
||||||
import '../../shared_widgets/text_widgets/body_medium.dart';
|
|
||||||
import '../../shared_widgets/text_widgets/title_medium.dart';
|
|
||||||
import '../bloc/auth_cubit.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class CreateNewPasswordPage extends StatefulWidget {
|
class CreateNewPasswordPage extends StatefulWidget {
|
||||||
const CreateNewPasswordPage({super.key,});
|
const CreateNewPasswordPage({super.key,});
|
||||||
@ -30,12 +29,7 @@ class _CreateNewPasswordPageState extends State<CreateNewPasswordPage> {
|
|||||||
return BlocConsumer<AuthCubit, AuthState>(
|
return BlocConsumer<AuthCubit, AuthState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is AuthForgetPassSuccess) {
|
if (state is AuthForgetPassSuccess) {
|
||||||
Future.delayed(const Duration(seconds: 2), () {
|
Navigator.of(context).pop();
|
||||||
Navigator.pushReplacement(
|
|
||||||
context,
|
|
||||||
CustomPageRoute(builder: (context) => const LoginView()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
@ -89,7 +83,7 @@ class _CreateNewPasswordPageState extends State<CreateNewPasswordPage> {
|
|||||||
height: 40,
|
height: 40,
|
||||||
),
|
),
|
||||||
TitleMedium(
|
TitleMedium(
|
||||||
text: 'Create new account',
|
text: 'Create new password',
|
||||||
style: context.titleMedium.copyWith(
|
style: context.titleMedium.copyWith(
|
||||||
fontWeight: FontsManager.extraBold,
|
fontWeight: FontsManager.extraBold,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
@ -100,7 +94,6 @@ class _CreateNewPasswordPageState extends State<CreateNewPasswordPage> {
|
|||||||
),
|
),
|
||||||
Form(
|
Form(
|
||||||
key: createNewPasswordKey,
|
key: createNewPasswordKey,
|
||||||
// autovalidateMode: AutovalidateMode.disabled,
|
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -111,7 +104,6 @@ class _CreateNewPasswordPageState extends State<CreateNewPasswordPage> {
|
|||||||
fontColor: Colors.white,
|
fontColor: Colors.white,
|
||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
// autovalidateMode: AutovalidateMode.disabled,
|
|
||||||
textInputAction: TextInputAction.done,
|
textInputAction: TextInputAction.done,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
scrollPadding: EdgeInsets.zero,
|
scrollPadding: EdgeInsets.zero,
|
||||||
|
|||||||
@ -18,8 +18,8 @@ import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
|||||||
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';
|
||||||
|
|
||||||
class OtpView extends StatefulWidget {
|
class OtpView extends StatefulWidget {
|
||||||
final bool? isForgetPage;
|
final bool isForgetPage;
|
||||||
const OtpView({super.key,this.isForgetPage});
|
const OtpView({super.key,this.isForgetPage=false});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<OtpView> createState() => _OtpViewState();
|
State<OtpView> createState() => _OtpViewState();
|
||||||
@ -121,7 +121,7 @@ class _OtpViewState extends State<OtpView> {
|
|||||||
if (state is AuthOtpSuccess) {
|
if (state is AuthOtpSuccess) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
widget.isForgetPage==true?
|
widget.isForgetPage?
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const CreateNewPasswordPage(),)):
|
Navigator.push(context, MaterialPageRoute(builder: (context) => const CreateNewPasswordPage(),)):
|
||||||
Navigator.popAndPushNamed(context, Routes.homeRoute);
|
Navigator.popAndPushNamed(context, Routes.homeRoute);
|
||||||
}
|
}
|
||||||
@ -304,7 +304,7 @@ class _OtpViewState extends State<OtpView> {
|
|||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if ((state is! AuthLoading)) {
|
if ((state is! AuthLoading)) {
|
||||||
AuthCubit.get(context).verifyOtp();
|
AuthCubit.get(context).verifyOtp(widget.isForgetPage);
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,10 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:syncrow_app/features/auth/view/check_email_page.dart';
|
||||||
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
|
||||||
import 'package:syncrow_app/navigation/routing_constants.dart';
|
|
||||||
import 'package:syncrow_app/utils/context_extension.dart';
|
import 'package:syncrow_app/utils/context_extension.dart';
|
||||||
|
|
||||||
import '../check_email_page.dart';
|
|
||||||
|
|
||||||
class ForgetPassword extends StatelessWidget {
|
class ForgetPassword extends StatelessWidget {
|
||||||
const ForgetPassword({
|
const ForgetPassword({
|
||||||
super.key,
|
super.key,
|
||||||
@ -17,7 +15,6 @@ class ForgetPassword extends StatelessWidget {
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// Navigator.popAndPushNamed(context, Routes.otpRoute);
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => const checkEmailPage(),));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => const checkEmailPage(),));
|
||||||
},
|
},
|
||||||
child: BodyMedium(
|
child: BodyMedium(
|
||||||
|
|||||||
Reference in New Issue
Block a user