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