authentication completed

This commit is contained in:
2025-01-25 18:56:57 +05:30
parent d9ddf69827
commit 9e559bdded
15 changed files with 704 additions and 205 deletions

View File

@@ -20,12 +20,9 @@ class EnterFullNameScreen extends StatefulWidget {
}
class _EnterFullNameScreenState extends State<EnterFullNameScreen> {
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
final pageNotifier = Provider.of<AuthProvider>(context, listen: false);
return Scaffold(
@@ -60,8 +57,8 @@ class _EnterFullNameScreenState extends State<EnterFullNameScreen> {
AppTextFieldWidget(
controller: pageNotifier.name,
hintText: APPSTRING.firstNameHint,
onValidate: (value){
if (value == null || value.isEmpty) {
onValidate: (value) {
if (value == null || value.isEmpty) {
return 'Please Enter first Name';
}
return null;
@@ -70,15 +67,14 @@ class _EnterFullNameScreenState extends State<EnterFullNameScreen> {
AppTextFieldWidget(
controller: pageNotifier.lastName,
hintText: APPSTRING.lastNameHint,
onValidate: (value){
if (value == null || value.isEmpty) {
onValidate: (value) {
if (value == null || value.isEmpty) {
return 'Please Enter last Name';
}
return null;
},
),
AppTextFieldWidget(
AppTextFieldWidget(
controller: pageNotifier.email,
hintText: APPSTRING.emailHint,
onValidate: (value) {
@@ -88,17 +84,16 @@ class _EnterFullNameScreenState extends State<EnterFullNameScreen> {
return null;
},
),
AppTextFieldWidget(
controller: pageNotifier.address,
hintText: APPSTRING.addressHint,
onValidate: (value) {
if (value == null || value.isEmpty)
{
return 'Please Enter address';
}
return null;
},
),
// AppTextFieldWidget(
// controller: pageNotifier.address,
// hintText: APPSTRING.addressHint,
// onValidate: (value) {
// if (value == null || value.isEmpty) {
// return 'Please Enter address';
// }
// return null;
// },
// ),
],
),
)
@@ -115,15 +110,14 @@ class _EnterFullNameScreenState extends State<EnterFullNameScreen> {
padding: context.bodyAllPadding.copyWith(bottom: 20),
child: Center(
child: InkWell(
onTap: ()
{
onTap: () async {
if (_formKey.currentState?.validate() ?? false) {
final success = await pageNotifier.customerRegister(context);
if (_formKey.currentState?.validate() ?? false)
{
context.clearAndPush( routePath: MyRoutes.BOTTOMNAV);
if (success) {
context.clearAndPush(routePath: MyRoutes.BOTTOMNAV);
}
}
// Navigator.of(context).push(MaterialPageRoute(
// builder: (context) {

View File

@@ -158,7 +158,8 @@ class _HomeScreenState extends State<HomeScreen> {
mainAxisSpacing: 5,
childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 1.2),
),
itemBuilder: (context, index) {
itemBuilder: (context, index)
{
return InkWell(
onTap: () {},
child: SizedBox(

View File

@@ -27,7 +27,7 @@ class _OnBoardingScreenState extends State<OnBoardingScreen> {
skipFunction() {
SharedPrefUtils.setFreshInstall(isFresh: false).then(
(value) => context.clearAndPush(routePath: MyRoutes.BOTTOMNAV, args: 0),
(value) => context.clearAndPush(routePath: MyRoutes.LOGIN, args: 0),
);
// Navigator.pushReplacement(context, MaterialPageRoute(
@@ -221,10 +221,11 @@ class _OnBoardingScreenState extends State<OnBoardingScreen> {
),
Stack(
children: [
Image.asset(APPASSETS.onBoardMan),
Positioned(
top: 10,
top: 20,
right: 0,
child: InkWell(
child: GestureDetector(
onTap: () {
skipFunction();
},
@@ -236,15 +237,14 @@ class _OnBoardingScreenState extends State<OnBoardingScreen> {
style:
context.customMedium(APPCOLOR.appGreen, 14),
),
const SizedBox(
width: 10,
),
const SizedBox(width: 10),
Container(
height: 35,
width: 35,
decoration: BoxDecoration(
color: APPCOLOR.appGreen,
borderRadius: BorderRadius.circular(90)),
color: APPCOLOR.appGreen,
borderRadius: BorderRadius.circular(90),
),
child: const Center(
child: Icon(
Icons.arrow_forward,
@@ -257,7 +257,6 @@ class _OnBoardingScreenState extends State<OnBoardingScreen> {
),
),
),
Image.asset(APPASSETS.onBoardMan),
Positioned(
bottom: 100,
right: 0,

View File

@@ -73,13 +73,13 @@ class _OtpScreenState extends State<OtpScreen> {
OTPTextField(
length: 6,
onChanged: (c) {
if (c.length == 6) {
Navigator.push(context, MaterialPageRoute(
builder: (context) {
return const EnterFullNameScreen();
},
));
}
// if (c.length == 6) {
// Navigator.push(context, MaterialPageRoute(
// builder: (context) {
// return const EnterFullNameScreen();
// },
// ));
// }
},
width: MediaQuery.of(context).size.width,
fieldWidth: 50,
@@ -92,15 +92,16 @@ class _OtpScreenState extends State<OtpScreen> {
onCompleted: (pin) async {
final success = await pageNotifier.verifiOtp(pin, context);
if (success) {
if (success)
{
context.push(MyRoutes.FULLNAME);
} else {
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// backgroundColor: Colors.grey,
// content: Text("Failed to send OTP. Please try again."),
// ),
// );
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
backgroundColor: Colors.grey,
content: Text("Failed to send OTP. Please try again."),
),
);
}
},
),

View File

@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:grocery_app/src/core/routes/routes.dart';
import 'package:grocery_app/src/ui/onboarding/on_boarding_screen.dart';
import 'package:grocery_app/utils/constants/assets_constant.dart';
import 'package:grocery_app/utils/constants/shared_pref_utils.dart';
import 'package:grocery_app/utils/extensions/extensions.dart';
import 'package:grocery_app/utils/extensions/uicontext.dart';
@@ -25,7 +26,20 @@ class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
// couting();
Future.delayed(const Duration(seconds: 2), () async {
if (await SharedPrefUtils.isFreshInstall()) {
context.clearAndPush(routePath: MyRoutes.ONBOARDING);
} else
{
print("kdsbfjhdkjfdfghv ${await SharedPrefUtils.getToken()}");
if (await SharedPrefUtils.getToken() == "1" ||
await SharedPrefUtils.getToken() == null) {
// context.clearAndPush(routePath: MyRoutes.SELECTACCOUNT);
} else {
context.clearAndPush(routePath: MyRoutes.BOTTOMNAV);
}
}
});
Future.delayed(const Duration(seconds: 2), () async {
context.clearAndPush(routePath: MyRoutes.ONBOARDING);