bottomNav

This commit is contained in:
2025-01-21 18:58:52 +05:30
parent 9fee5eb24d
commit 26aaa8c4e8
7 changed files with 250 additions and 182 deletions

View File

@@ -2,169 +2,185 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:grocery_app/src/ui/bottomnavigation/bottom_bar_widget.dart';
import 'package:grocery_app/src/ui/entername/enter_fullname_screen.dart';
import 'package:grocery_app/src/ui/login/login_screen.dart';
import 'package:grocery_app/src/ui/onboarding/on_boarding_screen.dart';
import 'package:grocery_app/src/ui/otp/otp_screen.dart';
import 'package:grocery_app/src/ui/splash/splash_screen.dart';
import 'package:grocery_app/utils/constants/globle_variable.dart';
/// Route names as constants
class MyRoutes {
static GoRouter router = GoRouter(
navigatorKey: GlobalVariable.globalScaffoldKey,
initialLocation: SPLASH,
routes: [
animatedGoRoute(
path: SPLASH,
name: SPLASH,
pageBuilder: (context, state) => const SplashScreen(),
),
navigatorKey: GlobalVariable.globalScaffoldKey,
initialLocation: SPLASH,
routes: [
animatedGoRoute(
path: SPLASH,
name: SPLASH,
pageBuilder: (context, state) => const SplashScreen(),
),
animatedGoRoute(
animatedGoRoute(
path: ONBOARDING,
name: ONBOARDING,
pageBuilder: (context, state) => const OnBoardingScreen(),
),
animatedGoRoute(
path: LOGIN,
name: LOGIN,
pageBuilder: (context, state) => LoginScreen(),
),
// animatedGoRoute(
// path: SELECTACCOUNT,
// name: SELECTACCOUNT,
// pageBuilder: (context, state) => const SelectAccount(),
// ),
// animatedGoRoute(
// path: TERMANDCONDITIONS,
// name: TERMANDCONDITIONS,
// pageBuilder: (context, state) => const TermsAndConditionsScreen(),
// ),
// animatedGoRoute(
// path: SETUPBUSSINESS,
// name: SETUPBUSSINESS,
// pageBuilder: (context, state) {
// final extra = state.extra as Map<String, dynamic>?;
// final String status = extra?['status'] ?? '';
// return SetupBussiness(status: status);
// }),
// animatedGoRoute(
// path: CREATESTORE,
// name: CREATESTORE,
// pageBuilder: (context, state) => const CreateStore(),
// ),
// animatedGoRoute(
// path: UPDATESTORE,
// name: UPDATESTORE,
// pageBuilder: (context, state) {
// final extra = state.extra as Map<String, dynamic>?;
// final String status = extra?['storeId'] ?? '';
// return UpdateStoreScreen(storeId: status);
// }
// ),
animatedGoRoute(
path: LOGIN,
name: LOGIN,
pageBuilder: (context, state) => LoginScreen(),
),
// animatedGoRoute(
// path: SUBMITSCREEN,
// name: SUBMITSCREEN,
// pageBuilder: (context, state) => const PinCreated(),
// ),
// animatedGoRoute(
// path: APPROVEDSTATUS,
// name: APPROVEDSTATUS,
// pageBuilder: (context, state) => const ApprovalScreen(),
// ),
// animatedGoRoute(
// path: SIGNUP,
// name: SIGNUP,
// pageBuilder: (context, state) => LoginHostScreen(),
// ),
// animatedGoRoute(
// path: DASHBOARDSCREEN,
// name: DASHBOARDSCREEN,
// pageBuilder: (context, state) => DashboardScree(),
// ),
// animatedGoRoute(
// path: CUSTOMERORDER,
// name: CUSTOMERORDER,
// pageBuilder: (context, state) {
// // Extract data from `state.extra`
// final Map<String, dynamic> orderDetails =
// state.extra as Map<String, dynamic>;
animatedGoRoute(
path: OTPSCREEN,
name: OTPSCREEN,
pageBuilder: (context, state) => const OtpScreen(),
),
// return CustomerOrder(
// orderDetails:
// orderDetails, // Pass the data to the destination widget
// );
// },
// ),
// animatedGoRoute(
// path: PRODUCTFORMSCREEN,
// name: PRODUCTFORMSCREEN,
// pageBuilder: (context, state) => ProductFormScreen(),
// ),
// animatedGoRoute(
// path: PRODUCTDETAILS,
// name: PRODUCTDETAILS,
// pageBuilder: (context, state) {
// final Product product = state.extra as Product;
// return Productdetails(
// product: product, // Pass the `Product` object directly
// );
// },
// ),
// animatedGoRoute(
// path: TRANSACTIONHISTORY,
// name: TRANSACTIONHISTORY,
// pageBuilder: (context, state) => TransactionHistory(),
// ),
// animatedGoRoute(
// path: INSIGHTSHISTORY,
// name: INSIGHTSHISTORY,
// pageBuilder: (context, state) => InsightsHistory(),
// ),
// animatedGoRoute(
// path: DETAILSBUSSINESS,
// name: DETAILSBUSSINESS,
// pageBuilder: (context, state) => DetailsBussiness(),
// ),
// animatedGoRoute(
// path: STOREMANAGEMENT,
// name: STOREMANAGEMENT,
// pageBuilder: (context, state) => StoreManagement(),
// ),
// animatedGoRoute(
// path: SETTING,
// name: SETTING,
// pageBuilder: (context, state) => Settings(),
// ),
// animatedGoRoute(
// path: FORGETPASSWORD,
// name: FORGETPASSWORD,
// pageBuilder: (context, state) => ForgetPassword(),
// ),
// animatedGoRoute(
// path: VERIFYPASSWORD,
// name: VERIFYPASSWORD,
// pageBuilder: (context, state) => VerifyOtpForgetPassword(),
// ),
// animatedGoRoute(
// path: FORGETNEWPASSWORD,
// name: FORGETNEWPASSWORD,
// pageBuilder: (context, state) => ForgetNewPassword(),
// ),
// ],
]
);
animatedGoRoute(
path: FULLNAME,
name: FULLNAME,
pageBuilder: (context, state) => const EnterFullNameScreen(),
),
animatedGoRoute(
path: BOTTOMNAV,
name: BOTTOMNAV,
pageBuilder: (context, state) => const BottomBarWidget(),
),
// animatedGoRoute(
// path: TERMANDCONDITIONS,
// name: TERMANDCONDITIONS,
// pageBuilder: (context, state) => const TermsAndConditionsScreen(),
// ),
// animatedGoRoute(
// path: SETUPBUSSINESS,
// name: SETUPBUSSINESS,
// pageBuilder: (context, state) {
// final extra = state.extra as Map<String, dynamic>?;
// final String status = extra?['status'] ?? '';
// return SetupBussiness(status: status);
// }),
// animatedGoRoute(
// path: CREATESTORE,
// name: CREATESTORE,
// pageBuilder: (context, state) => const CreateStore(),
// ),
// animatedGoRoute(
// path: UPDATESTORE,
// name: UPDATESTORE,
// pageBuilder: (context, state) {
// final extra = state.extra as Map<String, dynamic>?;
// final String status = extra?['storeId'] ?? '';
// return UpdateStoreScreen(storeId: status);
// }
// ),
// animatedGoRoute(
// path: SUBMITSCREEN,
// name: SUBMITSCREEN,
// pageBuilder: (context, state) => const PinCreated(),
// ),
// animatedGoRoute(
// path: APPROVEDSTATUS,
// name: APPROVEDSTATUS,
// pageBuilder: (context, state) => const ApprovalScreen(),
// ),
// animatedGoRoute(
// path: SIGNUP,
// name: SIGNUP,
// pageBuilder: (context, state) => LoginHostScreen(),
// ),
// animatedGoRoute(
// path: DASHBOARDSCREEN,
// name: DASHBOARDSCREEN,
// pageBuilder: (context, state) => DashboardScree(),
// ),
// animatedGoRoute(
// path: CUSTOMERORDER,
// name: CUSTOMERORDER,
// pageBuilder: (context, state) {
// // Extract data from `state.extra`
// final Map<String, dynamic> orderDetails =
// state.extra as Map<String, dynamic>;
// return CustomerOrder(
// orderDetails:
// orderDetails, // Pass the data to the destination widget
// );
// },
// ),
// animatedGoRoute(
// path: PRODUCTFORMSCREEN,
// name: PRODUCTFORMSCREEN,
// pageBuilder: (context, state) => ProductFormScreen(),
// ),
// animatedGoRoute(
// path: PRODUCTDETAILS,
// name: PRODUCTDETAILS,
// pageBuilder: (context, state) {
// final Product product = state.extra as Product;
// return Productdetails(
// product: product, // Pass the `Product` object directly
// );
// },
// ),
// animatedGoRoute(
// path: TRANSACTIONHISTORY,
// name: TRANSACTIONHISTORY,
// pageBuilder: (context, state) => TransactionHistory(),
// ),
// animatedGoRoute(
// path: INSIGHTSHISTORY,
// name: INSIGHTSHISTORY,
// pageBuilder: (context, state) => InsightsHistory(),
// ),
// animatedGoRoute(
// path: DETAILSBUSSINESS,
// name: DETAILSBUSSINESS,
// pageBuilder: (context, state) => DetailsBussiness(),
// ),
// animatedGoRoute(
// path: STOREMANAGEMENT,
// name: STOREMANAGEMENT,
// pageBuilder: (context, state) => StoreManagement(),
// ),
// animatedGoRoute(
// path: SETTING,
// name: SETTING,
// pageBuilder: (context, state) => Settings(),
// ),
// animatedGoRoute(
// path: FORGETPASSWORD,
// name: FORGETPASSWORD,
// pageBuilder: (context, state) => ForgetPassword(),
// ),
// animatedGoRoute(
// path: VERIFYPASSWORD,
// name: VERIFYPASSWORD,
// pageBuilder: (context, state) => VerifyOtpForgetPassword(),
// ),
// animatedGoRoute(
// path: FORGETNEWPASSWORD,
// name: FORGETNEWPASSWORD,
// pageBuilder: (context, state) => ForgetNewPassword(),
// ),
// ],
]);
/// Route constants
static const SPLASH = "/";
static const FULLNAME = "/fullname";
static const BOTTOMNAV = "/bottomnav";
static const HOME = "/home";
static const SELECTACCOUNT = "/selectAccount";
static const DASHBOARD = "/dashboard";
@@ -198,8 +214,8 @@ class MyRoutes {
static const FORGETNEWPASSWORD = "/forgetnewpassword";
static const UPDATESTORE = "/updatestore";
static const UPDATESTORE = "/updatestore";
static const OTPSCREEN = "/otpscreen";
}
GoRoute animatedGoRoute({

View File

@@ -1,10 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:grocery_app/src/common_widget/textfield_widget.dart';
import 'package:grocery_app/src/core/routes/routes.dart';
import 'package:grocery_app/src/ui/bottomnavigation/bottom_bar_widget.dart';
import 'package:grocery_app/utils/constants/assets_constant.dart';
import 'package:grocery_app/utils/constants/color_constant.dart';
import 'package:grocery_app/utils/constants/string_constant.dart';
import 'package:grocery_app/utils/extensions/extensions.dart';
import 'package:grocery_app/utils/extensions/uicontext.dart';
class EnterFullNameScreen extends StatefulWidget {
@@ -15,6 +18,9 @@ class EnterFullNameScreen extends StatefulWidget {
}
class _EnterFullNameScreenState extends State<EnterFullNameScreen> {
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -42,10 +48,33 @@ class _EnterFullNameScreenState extends State<EnterFullNameScreen> {
style: context.customMedium(APPCOLOR.black333333, 18),
),
const SizedBox(height: 30),
AppTextFieldWidget(
controller: TextEditingController(),
hintText: APPSTRING.fullNameHint,
),
Form(
key: _formKey,
child: Column(
children: [
AppTextFieldWidget(
controller: TextEditingController(),
hintText: APPSTRING.firstNameHint,
onValidate: (value){
if (value == null || value.isEmpty) {
return 'Please Enter first Name';
}
return null;
},
),
AppTextFieldWidget(
controller: TextEditingController(),
hintText: APPSTRING.lastNameHint,
onValidate: (value){
if (value == null || value.isEmpty) {
return 'Please Enter last Name';
}
return null;
},
),
],
),
)
],
),
),
@@ -60,16 +89,25 @@ class _EnterFullNameScreenState extends State<EnterFullNameScreen> {
child: Center(
child: InkWell(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) {
return const BottomBarWidget();
},
));
if (_formKey.currentState?.validate() ?? false) {
context.clearAndPush( routePath: MyRoutes.BOTTOMNAV);
}
// Navigator.of(context).push(MaterialPageRoute(
// builder: (context) {
// return const BottomBarWidget();
// },
// ));
},
child: Container(
height: 50,
width: MediaQuery.sizeOf(context).width,
decoration: BoxDecoration(color: APPCOLOR.appGreen, borderRadius: BorderRadius.circular(4)),
decoration: BoxDecoration(
color: APPCOLOR.appGreen,
borderRadius: BorderRadius.circular(4)),
child: Center(
child: Text(
APPSTRING.continueBtn,

View File

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:grocery_app/src/common_widget/textfield_widget.dart';
import 'package:grocery_app/src/core/routes/routes.dart';
import 'package:grocery_app/src/ui/otp/otp_screen.dart';
import 'package:grocery_app/utils/constants/color_constant.dart';
import 'package:grocery_app/utils/constants/string_constant.dart';
@@ -80,12 +82,16 @@ class _LoginScreenState extends State<LoginScreen> {
child: InkWell(
onTap: () {
print("djkhfjdgf ${_formKey.currentState?.validate()}");
if (_formKey.currentState?.validate() ?? false) {
Navigator.of(context).push(MaterialPageRoute(
builder: (context) {
return const OtpScreen();
},
));
if (_formKey.currentState?.validate() ?? false)
{
context.push(MyRoutes.OTPSCREEN);
// Navigator.of(context).push(MaterialPageRoute(
// builder: (context)
// {
// return const OtpScreen();
// },
// ));
}
},
child: Container(

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:grocery_app/src/ui/entername/enter_fullname_screen.dart';
import 'package:grocery_app/utils/constants/assets_constant.dart';
import 'package:grocery_app/utils/constants/color_constant.dart';
@@ -9,6 +10,8 @@ import 'package:grocery_app/utils/extensions/uicontext.dart';
import 'package:otp_text_field/otp_text_field.dart';
import 'package:otp_text_field/style.dart';
import '../../core/routes/routes.dart';
class OtpScreen extends StatefulWidget {
const OtpScreen({super.key});
@@ -34,10 +37,9 @@ class _OtpScreenState extends State<OtpScreen> {
children: [
const SizedBox(height: 30),
InkWell(
onTap: ()
{
onTap: () {
Navigator.of(context).pop();
},
},
child: SvgPicture.asset(APPASSETS.back)),
const SizedBox(height: 30),
Text(
@@ -54,15 +56,17 @@ class _OtpScreenState extends State<OtpScreen> {
const SizedBox(height: 20),
OTPTextField(
length: 6,
onChanged: (c)
{
if (c.length == 6)
{
Navigator.push(context, MaterialPageRoute(
builder: (context) {
return const EnterFullNameScreen();
},
));
onChanged: (c) {
if (c.length == 6)
{
context.push(MyRoutes.FULLNAME);
// Navigator.push(context, MaterialPageRoute(
// builder: (context)
// {
// return const EnterFullNameScreen();
// },
// ));
}
},
width: MediaQuery.of(context).size.width,
@@ -79,12 +83,15 @@ class _OtpScreenState extends State<OtpScreen> {
height: 10,
),
RichText(
text: TextSpan(text: 'Didnt get the code? ', style: context.customRegular(APPCOLOR.gery48514D, 14), children: [
TextSpan(
text: 'Resend',
style: context.customRegular(APPCOLOR.appGreen, 14),
)
]))
text: TextSpan(
text: 'Didnt get the code? ',
style: context.customRegular(APPCOLOR.gery48514D, 14),
children: [
TextSpan(
text: 'Resend',
style: context.customRegular(APPCOLOR.appGreen, 14),
)
]))
],
),
),