From df0b2923e39e5755ef0cb2ce71d2b21821a5f607 Mon Sep 17 00:00:00 2001 From: Shreya Bhatia Date: Fri, 7 Jun 2024 15:43:30 +0530 Subject: [PATCH] Solved the range and login overflow error --- .../screens/login_screen/login_screen.dart | 452 +++++++++--------- .../profile_screen/profile_screen.dart | 2 +- 2 files changed, 228 insertions(+), 226 deletions(-) diff --git a/lib/new_ui/screens/login_screen/login_screen.dart b/lib/new_ui/screens/login_screen/login_screen.dart index 50b919d8..982a9a59 100644 --- a/lib/new_ui/screens/login_screen/login_screen.dart +++ b/lib/new_ui/screens/login_screen/login_screen.dart @@ -110,266 +110,268 @@ class _LoginScreenState extends ConsumerState { onTap: () => FocusScope.of(context).unfocus(), child: SafeArea( child: Scaffold( - body: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Padding( - padding: const EdgeInsets.all(8.0), - child: TextButton( - onPressed: () { - GoRouter.of(context).go('/main'); - }, - child: Text( - "Skip", - style: Theme.of(context) - .textTheme - .headlineSmall - ?.copyWith( - color: Theme.of(context).colorScheme.primary, - ), - ), - ), - ), - ], - ), - SizedBox(height: MediaQuery.of(context).size.height * .1), - Text( - "Welcome", - style: Theme.of(context).textTheme.headlineLarge, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - "Lets sign you in", - style: Theme.of(context).textTheme.headlineSmall, - ), - ), - // CustomAppBarForLogin( - // title: "Welcome!", - // description: "Let's sign you in.", - // ), - // LoginWidget(), - SizedBox( - height: 10, - ), - Form( - key: _formKey, - child: Column( + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( - padding: - const EdgeInsets.only(top: 30, left: 30, right: 30), - child: DecoratedBox( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), - // boxShadow: isItDarkMode - // ? shadowLightModeTextFields - // : shadowDarkModeTextFields, - ), - child: TextFormField( - controller: _emailTextEditingController, - validator: (value) { - if (value!.isEmpty) { - return 'Please enter an email'; - } - if (!isValidEmail(value)) { - return 'Please enter a Valid Email'; - } - return null; - }, - style: TextStyle( - color: Theme.of(context).colorScheme.onSecondary, - ), - decoration: InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Color(0xff353F5A), - width: 1.0, + padding: const EdgeInsets.all(8.0), + child: TextButton( + onPressed: () { + GoRouter.of(context).go('/main'); + }, + child: Text( + "Skip", + style: Theme.of(context) + .textTheme + .headlineSmall + ?.copyWith( + color: Theme.of(context).colorScheme.primary, ), - borderRadius: const BorderRadius.all( - Radius.circular(18), - ), - ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(18.0), - ), - filled: true, - hintStyle: TextStyle( - color: Color(0xff6B708C), - ), - hintText: "Email", - fillColor: Color(0xff191B22), - ), ), ), ), - SizedBox( - height: 10, - ), - Padding( - padding: - const EdgeInsets.only(top: 30, left: 30, right: 30), - child: DecoratedBox( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(18), - // boxShadow: isItDarkMode - // ? shadowLightModeTextFields - // : shadowDarkModeTextFields, - ), - child: TextFormField( - validator: (value) { - if (value!.isEmpty) { - return 'Please enter a password'; - } - return null; - }, - controller: _passwordTextEditingController, - obscureText: passwordVisible, - style: TextStyle( - color: Theme.of(context).colorScheme.onSecondary, + ], + ), + SizedBox(height: MediaQuery.of(context).size.height * .1), + Text( + "Welcome", + style: Theme.of(context).textTheme.headlineLarge, + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "Lets sign you in", + style: Theme.of(context).textTheme.headlineSmall, + ), + ), + // CustomAppBarForLogin( + // title: "Welcome!", + // description: "Let's sign you in.", + // ), + // LoginWidget(), + SizedBox( + height: 10, + ), + Form( + key: _formKey, + child: Column( + children: [ + Padding( + padding: + const EdgeInsets.only(top: 30, left: 30, right: 30), + child: DecoratedBox( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(18), + // boxShadow: isItDarkMode + // ? shadowLightModeTextFields + // : shadowDarkModeTextFields, ), - decoration: InputDecoration( - suffixIconColor: - Theme.of(context).colorScheme.onTertiary, - suffixIcon: IconButton( - onPressed: () { - setState(() { - passwordVisible = !passwordVisible; - }); - debugPrint(passwordVisible.toString()); - }, - icon: Icon(passwordVisible - ? Icons.visibility - : Icons.visibility_off), + child: TextFormField( + controller: _emailTextEditingController, + validator: (value) { + if (value!.isEmpty) { + return 'Please enter an email'; + } + if (!isValidEmail(value)) { + return 'Please enter a Valid Email'; + } + return null; + }, + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: - Theme.of(context).colorScheme.onTertiary, - width: 1.0, + decoration: InputDecoration( + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xff353F5A), + width: 1.0, + ), + borderRadius: const BorderRadius.all( + Radius.circular(18), + ), ), - borderRadius: const BorderRadius.all( - Radius.circular(18), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(18.0), ), + filled: true, + hintStyle: TextStyle( + color: Color(0xff6B708C), + ), + hintText: "Email", + fillColor: Color(0xff191B22), ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(18.0), - ), - filled: true, - hintStyle: TextStyle( - color: Theme.of(context).colorScheme.onTertiary, - ), - hintText: "Password", - fillColor: Color(0xff191B22), ), ), ), - ), - SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Padding( - padding: EdgeInsets.only(right: 30), - child: InkResponse( - borderRadius: BorderRadius.circular( - 30), // Set the desired border radius - onTap: () async { - forgotPassword(); + SizedBox( + height: 10, + ), + Padding( + padding: + const EdgeInsets.only(top: 30, left: 30, right: 30), + child: DecoratedBox( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(18), + // boxShadow: isItDarkMode + // ? shadowLightModeTextFields + // : shadowDarkModeTextFields, + ), + child: TextFormField( + validator: (value) { + if (value!.isEmpty) { + return 'Please enter a password'; + } + return null; }, - highlightShape: - BoxShape.rectangle, // Custom shape - - child: Container( - height: 20, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - 10), // Set the desired border radius + controller: _passwordTextEditingController, + obscureText: passwordVisible, + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + ), + decoration: InputDecoration( + suffixIconColor: + Theme.of(context).colorScheme.onTertiary, + suffixIcon: IconButton( + onPressed: () { + setState(() { + passwordVisible = !passwordVisible; + }); + debugPrint(passwordVisible.toString()); + }, + icon: Icon(passwordVisible + ? Icons.visibility + : Icons.visibility_off), ), - child: Center( - child: Text( - 'Reset Password', - style: TextStyle( - color: Theme.of(context) - .colorScheme - .error), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: + Theme.of(context).colorScheme.onTertiary, + width: 1.0, + ), + borderRadius: const BorderRadius.all( + Radius.circular(18), ), ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(18.0), + ), + filled: true, + hintStyle: TextStyle( + color: Theme.of(context).colorScheme.onTertiary, + ), + hintText: "Password", + fillColor: Color(0xff191B22), ), ), ), - ], - ), - !loggedInButtonPressed - ? Padding( - padding: const EdgeInsets.all(30.0), - child: ElevatedButton( - onPressed: () { - login(); + ), + SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Padding( + padding: EdgeInsets.only(right: 30), + child: InkResponse( + borderRadius: BorderRadius.circular( + 30), // Set the desired border radius + onTap: () async { + forgotPassword(); }, - style: ElevatedButton.styleFrom( - backgroundColor: - Theme.of(context).colorScheme.primary, - shape: RoundedRectangleBorder( + highlightShape: + BoxShape.rectangle, // Custom shape + + child: Container( + height: 20, + decoration: BoxDecoration( borderRadius: BorderRadius.circular( - 20.0), // Set the border radius here + 10), // Set the desired border radius ), - padding: EdgeInsets.all( - 16), // Adjust padding as needed - ), - child: Container( - width: double - .infinity, // Set width to full width - height: 30, child: Center( child: Text( - 'Log In', - style: Theme.of(context) - .textTheme - .headlineMedium! - .copyWith(color: Colors.black), + 'Reset Password', + style: TextStyle( + color: Theme.of(context) + .colorScheme + .error), ), ), ), ), - ) - : Padding( - padding: const EdgeInsets.all(30.0), - child: CircularProgressIndicator(), ), - ], + ], + ), + !loggedInButtonPressed + ? Padding( + padding: const EdgeInsets.all(30.0), + child: ElevatedButton( + onPressed: () { + login(); + }, + style: ElevatedButton.styleFrom( + backgroundColor: + Theme.of(context).colorScheme.primary, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 20.0), // Set the border radius here + ), + padding: EdgeInsets.all( + 16), // Adjust padding as needed + ), + child: Container( + width: double + .infinity, // Set width to full width + height: 30, + child: Center( + child: Text( + 'Log In', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith(color: Colors.black), + ), + ), + ), + ), + ) + : Padding( + padding: const EdgeInsets.all(30.0), + child: CircularProgressIndicator(), + ), + ], + ), ), - ), - - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "Need help signing in? ", - style: TextStyle( - color: Theme.of(context).colorScheme!.onSecondary, + + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Need help signing in? ", + style: TextStyle( + color: Theme.of(context).colorScheme!.onSecondary, + ), ), - ), - Link( - uri: Uri.parse("mailto:devsclubtsec@gmail.com"), - builder: (context, followLink) => GestureDetector( - onTap: () => followLink?.call(), - child: Text( - "Contact Us", - style: TextStyle( - color: Theme.of(context).colorScheme.primary, + Link( + uri: Uri.parse("mailto:devsclubtsec@gmail.com"), + builder: (context, followLink) => GestureDetector( + onTap: () => followLink?.call(), + child: Text( + "Contact Us", + style: TextStyle( + color: Theme.of(context).colorScheme.primary, + ), ), ), - ), - ) - ], - ) - ], + ) + ], + ) + ], + ), ), ), )); diff --git a/lib/new_ui/screens/profile_screen/profile_screen.dart b/lib/new_ui/screens/profile_screen/profile_screen.dart index 0d4d99bf..8329a7cc 100644 --- a/lib/new_ui/screens/profile_screen/profile_screen.dart +++ b/lib/new_ui/screens/profile_screen/profile_screen.dart @@ -131,7 +131,7 @@ class _ProfilePageState extends ConsumerState { setState(() { divisionList = calcDivisionList(studentData.gradyear, studentData.branch); - batchList = calcBatchList(studentData.div); + batchList = calcBatchList(studentData.div ?? divisionList[0]); }); div = divisionList.contains(studentData.div) ? studentData.div