From 5be9097964463406ac79b7ccb30d9ea3cb3ce8b1 Mon Sep 17 00:00:00 2001 From: VINISTAN Date: Thu, 19 Dec 2024 15:16:51 +0530 Subject: [PATCH] routing fix --- lib/config/my_router.dart | 9 +- .../routes/auth_routes/login_route.dart | 126 ++++++++++-------- 2 files changed, 78 insertions(+), 57 deletions(-) diff --git a/lib/config/my_router.dart b/lib/config/my_router.dart index cdfe3b13..5b056bc0 100644 --- a/lib/config/my_router.dart +++ b/lib/config/my_router.dart @@ -311,8 +311,13 @@ 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: '/login', + builder: (context, state) => LoginRoute(), + ), GoRoute( path: '/myhomepage', diff --git a/lib/presentation/routes/auth_routes/login_route.dart b/lib/presentation/routes/auth_routes/login_route.dart index cbf28f0a..0359ab44 100644 --- a/lib/presentation/routes/auth_routes/login_route.dart +++ b/lib/presentation/routes/auth_routes/login_route.dart @@ -515,8 +515,14 @@ class _LoginRouteState extends State { bool _obscurePassword = true; @override Widget build(BuildContext context) { - double screenheight = MediaQuery.of(context).size.height; - double screenwidth = MediaQuery.of(context).size.width; + double screenheight = MediaQuery + .of(context) + .size + .height; + double screenwidth = MediaQuery + .of(context) + .size + .width; return Scaffold( body: Padding( padding: const EdgeInsets.all(20.0), @@ -533,20 +539,20 @@ class _LoginRouteState extends State { fontSize: 32, fontWeight: FontWeight.w400), ), SizedBox(height: 5), - Text('Please login to access',style: TextStyle( + Text('Please login to access', style: TextStyle( fontFamily: context.translate( 'Roboto', 'NotoKufi', ), color: Color(0xFF898C81), fontSize: 18, fontWeight: FontWeight.bold),), - Text("UAE's key official statistics",style: TextStyle( - fontFamily: context.translate( - 'Roboto', - 'NotoKufi', - ), - color: Color(0xFF898C81), - fontSize: 16, fontWeight: FontWeight.bold),), + Text("UAE's key official statistics", style: TextStyle( + fontFamily: context.translate( + 'Roboto', + 'NotoKufi', + ), + color: Color(0xFF898C81), + fontSize: 16, fontWeight: FontWeight.bold),), SizedBox(height: 10), // Display this if registration is pending approval @@ -556,16 +562,20 @@ class _LoginRouteState extends State { decoration: InputDecoration( hintText: "Username", //hintText: _showHints[0] ? 'Username' : null, - prefixIcon: Image.asset("assets/icons/misc/person.png",scale: 2,color: Colors.lightBlueAccent,), - border: OutlineInputBorder(borderRadius: BorderRadius.circular(15)), + prefixIcon: Image.asset( + "assets/icons/misc/person.png", scale: 2, + color: Colors.lightBlueAccent,), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15)), focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), - borderSide: BorderSide(color: Colors.blue.shade900,) + borderRadius: BorderRadius.circular(10), + borderSide: BorderSide(color: Colors.blue.shade900,) ), enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), // Keep rounded corners + borderRadius: BorderRadius.circular(10), + // Keep rounded corners borderSide: BorderSide( - color: Colors.blue,// Default border color + color: Colors.blue, // Default border color width: 1.0, // Border width when not focused ), ), @@ -583,8 +593,10 @@ class _LoginRouteState extends State { // obscureText: _obscurePassword, decoration: InputDecoration( hintText: "Password", - // hintText: _showHints[2] ? 'Enter your password' : null, - prefixIcon: Image.asset("assets/icons/misc/lock.png",scale: 2,color: Colors.lightBlueAccent,), + // hintText: _showHints[2] ? 'Enter your password' : null, + prefixIcon: Image.asset( + "assets/icons/misc/lock.png", scale: 2, + color: Colors.lightBlueAccent,), suffixIcon: IconButton( icon: Icon( _obscurePassword @@ -598,16 +610,18 @@ class _LoginRouteState extends State { }); }, ), - border: OutlineInputBorder(borderRadius: BorderRadius.circular(15)), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15)), focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), - borderSide: BorderSide(color: Colors.blue.shade900,), + borderRadius: BorderRadius.circular(10), + borderSide: BorderSide(color: Colors.blue.shade900,), ), enabledBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), // Keep rounded corners + borderRadius: BorderRadius.circular(10), + // Keep rounded corners borderSide: BorderSide( - color: Colors.blue,// Default border color + color: Colors.blue, // Default border color width: 1.0, // Border width when not focused ), ), @@ -620,14 +634,16 @@ class _LoginRouteState extends State { SizedBox(height: 10), Row(mainAxisAlignment: MainAxisAlignment.end, - children: [Text("Forgot Password?", - style: TextStyle(color: Color(0xFF985400),fontWeight: FontWeight.bold - ),)],), + children: [Text("Forgot Password?", + style: TextStyle( + color: Color(0xFF985400), fontWeight: FontWeight.bold + ),) + ],), SizedBox(height: 20), SizedBox( width: screenwidth, child: ElevatedButton( - onPressed: (){ + onPressed: () { context.go('/profile'); }, //_registerUser, @@ -648,33 +664,33 @@ class _LoginRouteState extends State { ), SizedBox(width: 8), Icon(Icons.arrow_forward_ios, - color: Colors.white, + color: Colors.white, size: 10, ), ], ), ), ), - SizedBox(height: screenheight/20), + SizedBox(height: screenheight / 20), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - "Don't have an account? ", - style: TextStyle( - fontFamily: context.translate( - 'Roboto', - 'NotoKufi', - ), - color: Color(0xFF898C81), - fontSize: 18, fontWeight: FontWeight.bold), - ), - InkWell( - onTap: (){ - context.go('/registration'); - }, - child: Text( - " Register Now", + Text( + "Don't have an account? ", + style: TextStyle( + fontFamily: context.translate( + 'Roboto', + 'NotoKufi', + ), + color: Color(0xFF898C81), + fontSize: 18, fontWeight: FontWeight.bold), + ), + InkWell( + onTap: () { + context.go('/registration'); + }, + child: Text( + " Register Now", style: TextStyle( fontFamily: context.translate( 'Roboto', @@ -682,12 +698,12 @@ class _LoginRouteState extends State { ), color: Color(0xFF985400), fontSize: 18, fontWeight: FontWeight.bold), + ), ), - ), - ],), + ],), SizedBox( - height: screenheight/20, + height: screenheight / 20, ), SizedBox( width: screenwidth, @@ -714,13 +730,13 @@ class _LoginRouteState extends State { ), SizedBox(width: 8), Icon(Icons.arrow_forward_ios, - color: Colors.white,size: 10,), + color: Colors.white, size: 10,), ], ), ), ), SizedBox( - height: screenheight/15, + height: screenheight / 15, ), Center( child: Container( @@ -729,7 +745,8 @@ class _LoginRouteState extends State { decoration: BoxDecoration( image: DecorationImage( image: AssetImage( - "assets/splash_screen/logo.png"), // Background image asset + "assets/splash_screen/logo.png"), + // Background image asset fit: BoxFit.fill, ), ), @@ -740,8 +757,8 @@ class _LoginRouteState extends State { ), ), ); -<<<<<<< HEAD -======= + + final form = Form( key: formKey, child: Column( @@ -940,6 +957,5 @@ class _LoginRouteState extends State { body: SafeArea(child: scaffoldBody), ); return bgScaffold; ->>>>>>> b0c5ebce3deb7da2aa24b0ea5ffe684df7dfb7bf } -} +