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

View File

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

View File

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