router issue fixed

This commit is contained in:
VINISTAN 2024-12-19 14:21:55 +05:30
parent e1887679ce
commit 3776ba1c01
5 changed files with 230 additions and 232 deletions

View File

@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager"> <component name="ProjectRunConfigurationManager">
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter"> <configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/frontend/lib/main.dart" /> <option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
<method v="2" /> <method v="2" />
</configuration> </configuration>
</component> </component>

View File

@ -301,6 +301,7 @@ import '../presentation/Screens/auth_verification/changepassword.dart';
import '../presentation/Screens/auth_verification/confirm_password.dart'; import '../presentation/Screens/auth_verification/confirm_password.dart';
import '../presentation/Screens/auth_verification/create_new_pw.dart'; import '../presentation/Screens/auth_verification/create_new_pw.dart';
import '../presentation/Screens/auth_verification/otp_verification.dart'; import '../presentation/Screens/auth_verification/otp_verification.dart';
import '../presentation/Screens/auth_verification/registration.dart';
import '../presentation/Screens/profilepage.dart'; import '../presentation/Screens/profilepage.dart';
import '../presentation/routes/auth_routes/login_route.dart'; import '../presentation/routes/auth_routes/login_route.dart';
import '../presentation/routes/bottom_bar_routes/tab_routes/home_route.dart'; import '../presentation/routes/bottom_bar_routes/tab_routes/home_route.dart';
@ -311,13 +312,21 @@ final GoRouter router = GoRouter(
routes: [ routes: [
GoRoute( GoRoute(
path: '/', path: '/',
//builder: (context, state) => LoginRoute(), builder: (context, state) => LoginRoute(),
builder: (context, state) => MyHomePage(), //builder: (context, state) => MyHomePage(),
), ),
GoRoute( GoRoute(
path: '/myhomepage', path: '/myhomepage',
builder: (context, state) => MyHomePage(), builder: (context, state) => MyHomePage(),
), ),
GoRoute(
path: '/login',
builder: (context, state) => LoginRoute(),
),
GoRoute(
path: '/registration',
builder: (context, state) => RegisterScreen(),
),
GoRoute( GoRoute(
path: '/mailverification', path: '/mailverification',
builder: (context, state) => EmailVerificationScreen( builder: (context, state) => EmailVerificationScreen(

View File

@ -582,8 +582,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
fontSize: 16, color: Colors.white), fontSize: 16, color: Colors.white),
), ),
SizedBox(width: 8), SizedBox(width: 8),
Icon(Icons.arrow_forward, Icon(Icons.arrow_forward_ios,
color: Colors.white), color: Colors.white,size: 16,),
], ],
), ),
), ),
@ -599,6 +599,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
width: screenwidth / 1.3, width: screenwidth / 1.3,
child: ElevatedButton( child: ElevatedButton(
onPressed: () { onPressed: () {
context.go('/login');
// Add your login logic here // Add your login logic here
}, },
style: ElevatedButton.styleFrom( style: ElevatedButton.styleFrom(
@ -625,31 +626,20 @@ class _RegisterScreenState extends State<RegisterScreen> {
// ], // ],
// ), // ),
child: GestureDetector( child: Row(
onTap: () { mainAxisSize: MainAxisSize.min,
// Navigate to LoginRoute children: [
Navigator.push( Text(
context, "Login",
MaterialPageRoute( style: TextStyle(
builder: (context) => LoginRoute()), fontSize: 16,
// MaterialPageRoute(builder: (context) => LoginRoute(userId: userID)), color: Colors.white,
);
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Login",
style: TextStyle(
fontSize: 16,
color: Colors.white,
),
), ),
SizedBox(width: 8), ),
Icon(Icons.arrow_forward, SizedBox(width: 8),
color: Colors.white), Icon(Icons.arrow_forward_ios,
], color: Colors.white,size: 16,),
), ],
), ),
), ),
), ),

View File

@ -740,206 +740,205 @@ class _LoginRouteState extends State<LoginRoute> {
), ),
), ),
); );
<<<<<<< HEAD
======= // final form = Form(
final form = Form( // key: formKey,
key: formKey, // child: Column(
child: Column( // children: [
children: [ // ThemedFormField(
ThemedFormField( // hintText: context.translate(
hintText: context.translate( // 'Email',
'Email', // 'بريد إلكتروني',
'بريد إلكتروني', // ),
), // validator: FieldValidator.email(),
validator: FieldValidator.email(), // imgPath: MiscIconAssetPath.person,
imgPath: MiscIconAssetPath.person, // controller: emailCtl,
controller: emailCtl, // ),
), // 15.verticalSpace,
15.verticalSpace, // ThemedFormField(
ThemedFormField( // validator: (text) {
validator: (text) { // if (text!.length < 8) {
if (text!.length < 8) { // return 'The password must be at least 8 characters';
return 'The password must be at least 8 characters'; // }
} // return FieldValidator.password(minLength: 8)(text);
return FieldValidator.password(minLength: 8)(text); // },
}, // hintText: context.translate(
hintText: context.translate( // 'Password',
'Password', // 'كلمة المرور',
'كلمة المرور', // ),
), // imgPath: MiscIconAssetPath.lock,
imgPath: MiscIconAssetPath.lock, // controller: pwCtl,
controller: pwCtl, // isObscurable: true,
isObscurable: true, // ),
), // // 6.verticalSpace,
// 6.verticalSpace, // Align(
Align( // alignment: AlignmentDirectional.topEnd,
alignment: AlignmentDirectional.topEnd, // child: forgotPwBtn,
child: forgotPwBtn, // ),
), // 10.verticalSpace,
10.verticalSpace, // loginBtn,
loginBtn, // ],
], // ),
), // );
); // final helloAndPleaseLoginTexts = Column(
final helloAndPleaseLoginTexts = Column( // children: [
children: [ // Text(
Text( // context.translate(
context.translate( // 'Hello Again!',
'Hello Again!', // 'مرحبا مجددا!',
'مرحبا مجددا!', // ),
), // style: TextStyle(
style: TextStyle( // fontFamily: context.translate(
fontFamily: context.translate( // 'Roboto',
'Roboto', // 'NotoKufi',
'NotoKufi', // ),
), // fontSize: 40,
fontSize: 40, // fontWeight: FontWeight.w300,
fontWeight: FontWeight.w300, // ),
), // ),
), // 10.verticalSpace,
10.verticalSpace, // Text(
Text( // context.translate(
context.translate( // 'Please login to access UAEs key official statistics',
'Please login to access UAEs key official statistics', // 'يرجى تسجيل الدخول للوصول إلى الإحصاءات الرسمية الرئيسية لدولة الإمارات العربية المتحدة',
'يرجى تسجيل الدخول للوصول إلى الإحصاءات الرسمية الرئيسية لدولة الإمارات العربية المتحدة', // ),
), // textAlign: TextAlign.center,
textAlign: TextAlign.center, // style: TextStyle(
style: TextStyle( // fontFamily: context.translate(
fontFamily: context.translate( // 'Roboto',
'Roboto', // 'NotoKufi',
'NotoKufi', // ),
), // fontSize: 18,
fontSize: 18, // color: const Color(0xff898C81),
color: const Color(0xff898C81), // fontWeight: FontWeight.w700,
fontWeight: FontWeight.w700, // ),
), // ),
), // ],
], // );
); // final dontHaveAnAccountRegisterBtn = TextButton(
final dontHaveAnAccountRegisterBtn = TextButton( // onPressed: () => {
onPressed: () => { // Navigator.push(
Navigator.push( // context,
context, // MaterialPageRoute(builder: (context) => RegisterScreen()),
MaterialPageRoute(builder: (context) => RegisterScreen()), // ),
), // },
}, // child: Text.rich(
child: Text.rich( // textAlign: TextAlign.center,
textAlign: TextAlign.center, // TextSpan(
TextSpan( // style: TextStyle(
style: TextStyle( // fontFamily: context.translate(
fontFamily: context.translate( // 'Roboto',
'Roboto', // 'NotoKufi',
'NotoKufi', // ),
), // fontSize: 18,
fontSize: 18, // fontWeight: FontWeight.bold,
fontWeight: FontWeight.bold, // ),
), // children: [
children: [ // TextSpan(
TextSpan( // text: context.translate(
text: context.translate( // 'Don\'t have an account? ',
'Don\'t have an account? ', // 'ليس لديك حساب؟',
'ليس لديك حساب؟', // ),
), // style: const TextStyle(
style: const TextStyle( // color: Color(0xff898C81),
color: Color(0xff898C81), // ),
), // ),
), // const TextSpan(
const TextSpan( // text: ' ',
text: ' ', // ),
), // TextSpan(
TextSpan( // text: context.translate(
text: context.translate( // 'Register Now',
'Register Now', // 'سجل الان',
'سجل الان', // ),
), // style: TextStyle(
style: TextStyle( // color: MyTheme.topicColor(IndicatorTopic.economy).shade600,
color: MyTheme.topicColor(IndicatorTopic.economy).shade600, // ),
), // ),
), // ],
], // ),
), // ),
), // );
); // final continueAsGuestBtn = SizedBox(
final continueAsGuestBtn = SizedBox( // width: double.infinity,
width: double.infinity, // child: ElevatedButton(
child: ElevatedButton( // onPressed: () => context
onPressed: () => context // .go('/${context.language}/${BottomNavBarItem.home.routePath}'),
.go('/${context.language}/${BottomNavBarItem.home.routePath}'), // style: ButtonStyle(
style: ButtonStyle( // shape: WidgetStatePropertyAll(
shape: WidgetStatePropertyAll( // RoundedRectangleBorder(
RoundedRectangleBorder( // borderRadius: BorderRadius.circular(10),
borderRadius: BorderRadius.circular(10), // ),
), // ),
), // padding: const WidgetStatePropertyAll(
padding: const WidgetStatePropertyAll( // EdgeInsets.symmetric(vertical: 10.5),
EdgeInsets.symmetric(vertical: 10.5), // ),
), // textStyle: WidgetStatePropertyAll(
textStyle: WidgetStatePropertyAll( // TextStyle(
TextStyle( // fontFamily: context.translate(
fontFamily: context.translate( // 'Roboto',
'Roboto', // 'NotoKufi',
'NotoKufi', // ),
), // fontSize: 16,
fontSize: 16, // fontWeight: FontWeight.w600,
fontWeight: FontWeight.w600, // ),
), // ),
), // backgroundColor: WidgetStatePropertyAll(
backgroundColor: WidgetStatePropertyAll( // MyTheme.topicColor(IndicatorTopic.environment),
MyTheme.topicColor(IndicatorTopic.environment), // ),
), // foregroundColor: const WidgetStatePropertyAll(
foregroundColor: const WidgetStatePropertyAll( // Colors.white,
Colors.white, // ),
), // ),
), // child: Row(
child: Row( // mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, // children: [
children: [ // Text(
Text( // context.translate(
context.translate( // 'Continue as Guest',
'Continue as Guest', // 'استمر كضيف',
'استمر كضيف', // ),
), // ),
), // 6.horizontalSpace,
6.horizontalSpace, // const Icon(Icons.chevron_right_outlined),
const Icon(Icons.chevron_right_outlined), // ],
], // ),
), // ),
), // );
); // final fcscBanner = Image.asset(
final fcscBanner = Image.asset( // BannerAssetPath.fcsc,
BannerAssetPath.fcsc, // height: 56,
height: 56, // );
); // final screenWidth = MediaQuery.of(context).size.width;
final screenWidth = MediaQuery.of(context).size.width; // final listViewHorizontalPadding =
final listViewHorizontalPadding = // screenWidth < 700 ? 30 : 30 + (screenWidth - 700) / 2;
screenWidth < 700 ? 30 : 30 + (screenWidth - 700) / 2; // final scaffoldBody = ListView(
final scaffoldBody = ListView( // padding: EdgeInsets.symmetric(
padding: EdgeInsets.symmetric( // horizontal: listViewHorizontalPadding.toDouble(),
horizontal: listViewHorizontalPadding.toDouble(), // ),
), // children: [
children: [ // 36.verticalSpace,
36.verticalSpace, // const Align(
const Align( // alignment: AlignmentDirectional.topEnd,
alignment: AlignmentDirectional.topEnd, // child: LangToggle(),
child: LangToggle(), // ),
), // 16.verticalSpace,
16.verticalSpace, // helloAndPleaseLoginTexts,
helloAndPleaseLoginTexts, // 42.verticalSpace,
42.verticalSpace, // form,
form, // 20.verticalSpace,
20.verticalSpace, // dontHaveAnAccountRegisterBtn,
dontHaveAnAccountRegisterBtn, // 36.verticalSpace,
36.verticalSpace, // continueAsGuestBtn,
continueAsGuestBtn, // 72.verticalSpace,
72.verticalSpace, // fcscBanner,
fcscBanner, // ],
], // );
); // final bgScaffold = Scaffold(
final bgScaffold = Scaffold( // backgroundColor: Colors.white,
backgroundColor: Colors.white, // body: SafeArea(child: scaffoldBody),
body: SafeArea(child: scaffoldBody), // );
); // return bgScaffold;
return bgScaffold; // >>>>>>> b0c5ebce3deb7da2aa24b0ea5ffe684df7dfb7bf
>>>>>>> b0c5ebce3deb7da2aa24b0ea5ffe684df7dfb7bf
} }
} }

View File

@ -137,7 +137,7 @@ class BaseScaffold extends StatelessWidget {
//Map the current route to the selected index //Map the current route to the selected index
int _getSelectedIndex(String route) { int _getSelectedIndex(String route) {
switch (route) { switch (route) {
case '/': case '/myhomepage':
return 0; return 0;
case '/about': case '/about':
return 1; return 1;
@ -154,7 +154,7 @@ class BaseScaffold extends StatelessWidget {
void _onItemTapped(BuildContext context, int index) { void _onItemTapped(BuildContext context, int index) {
switch (index) { switch (index) {
case 0: case 0:
context.go('/'); context.go('/myhomepage');
break; break;
case 1: case 1:
context.go('/about'); context.go('/about');