diff --git a/lib/new_ui/screens/attendance_screen/add_attendance.dart b/lib/new_ui/screens/attendance_screen/add_attendance.dart index 0d3f8a4..fe72993 100644 --- a/lib/new_ui/screens/attendance_screen/add_attendance.dart +++ b/lib/new_ui/screens/attendance_screen/add_attendance.dart @@ -3,19 +3,22 @@ import 'package:tsec_app/new_ui/colors.dart'; import 'package:tsec_app/new_ui/screens/attendance_screen/widgets/attendanceservice.dart'; class AddAttendanceScreen extends StatefulWidget { - int? index; final bool isUpdate; Map? updatedSubject; List? attendanceList; - AddAttendanceScreen({required this.isUpdate, this.updatedSubject,this.index,this.attendanceList}); + AddAttendanceScreen( + {super.key, + required this.isUpdate, + this.updatedSubject, + this.index, + this.attendanceList}); @override State createState() => _AddAttendanceScreenState(); } class _AddAttendanceScreenState extends State { - late TextEditingController subjectController; late TextEditingController totalLecturesController; late TextEditingController attendedLecturesController; @@ -23,12 +26,20 @@ class _AddAttendanceScreenState extends State { @override void initState() { super.initState(); - subjectController = TextEditingController(text: widget.isUpdate ? widget.updatedSubject!['subject_name']:""); - totalLecturesController = TextEditingController(text: widget.isUpdate ? widget.updatedSubject!['total'].toString():""); - attendedLecturesController = TextEditingController(text: widget.isUpdate ? widget.updatedSubject!['present'].toString():""); + subjectController = TextEditingController( + text: widget.isUpdate ? widget.updatedSubject!['subject_name'] : ""); + totalLecturesController = TextEditingController( + text: + widget.isUpdate ? widget.updatedSubject!['total'].toString() : ""); + attendedLecturesController = TextEditingController( + text: widget.isUpdate + ? widget.updatedSubject!['present'].toString() + : ""); } - TextStyle inputTextFieldStyle = TextStyle(color: Colors.white,); + TextStyle inputTextFieldStyle = TextStyle( + color: Colors.white, + ); @override Widget build(BuildContext context) { @@ -39,152 +50,248 @@ class _AddAttendanceScreenState extends State { foregroundColor: Colors.white, centerTitle: true, actions: [ - if (widget.isUpdate) IconButton(onPressed: (){ - showDialog(context: context, builder: (context){ - return AlertDialog( - title: Text("Are you sure you want to delete?",), - actions: [ - InkWell( - onTap:(){ - Navigator.pop(context); - }, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 5), - width: size.width*0.3, - decoration: BoxDecoration( - color: commonbgL4ightblack, - borderRadius: BorderRadius.circular(5), - ), - child: Text("Cancel",style: TextStyle(color: Colors.white),), - ), - ), - InkWell( - onTap: () async{ - await AttendanceService.deleteSubject(widget.attendanceList!, widget.index!); - Navigator.pop(context); - Navigator.pop(context); - }, - child: Container( - alignment: Alignment.center, - padding: EdgeInsets.symmetric(vertical: 5), - width: size.width*0.3, - decoration: BoxDecoration( - color: Colors.red, - borderRadius: BorderRadius.circular(5), - ), - child: Text("Delete",style: TextStyle(color: Colors.white),), - ), - ), - ], - ); - }); - }, icon: Icon(Icons.delete,color: Colors.red,),) else SizedBox(), + if (widget.isUpdate) + IconButton( + onPressed: () { + showDialog( + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: + Theme.of(context).colorScheme.primaryContainer, + title: Text("Are you sure you want to delete?", + style: Theme.of(context).textTheme.headlineSmall!), + actions: [ + InkWell( + onTap: () { + Navigator.pop(context); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5), + width: size.width * 0.3, + decoration: BoxDecoration( + // color: Color(0xff191B22), // Background color + borderRadius: BorderRadius.circular(5), + // border: Border.all( + // color: Theme.of(context) + // .colorScheme + // .tertiary, // Border color + // width: 1.0, + // ), + ), + child: Text("Cancel", + // style: TextStyle(color: Colors.white), + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith(color: Colors.white)), + ), + ), + InkWell( + onTap: () async { + await AttendanceService.deleteSubject( + widget.attendanceList!, widget.index!); + Navigator.pop(context); + Navigator.pop(context); + }, + child: Container( + alignment: Alignment.center, + padding: EdgeInsets.symmetric(vertical: 5), + width: size.width * 0.3, + decoration: BoxDecoration( + // color: Color(0xff191B22), // Background color + borderRadius: BorderRadius.circular(5), + // border: Border.all( + // color: Theme.of(context) + // .colorScheme + // .primary, // Border color + // width: 1.0, + // ), + ), + child: Text( + "Delete", + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + color: Colors.red, + ), + ), + ), + ), + ], + ); + }); + }, + icon: Icon( + Icons.delete, + color: Colors.red, + ), + ) + else + SizedBox(), ], ), body: ListView( children: [ Padding( padding: EdgeInsets.symmetric(horizontal: 20), - child: Text("Add a Subject",style: TextStyle(color: Colors.white,fontSize: 23,fontWeight: FontWeight.bold),), + child: Text( + "Add a Subject", + style: Theme.of(context).textTheme.headlineLarge, + ), ), - SizedBox( - height: size.height*0.04, + height: size.height * 0.04, ), - Padding( padding: EdgeInsets.symmetric(horizontal: 20), - child: Text("Subject Name: ",style: TextStyle(color: Colors.white,fontSize: 17,fontWeight: FontWeight.bold),), + child: Text( + "Subject Name: ", + style: Theme.of(context).textTheme.bodySmall, + ), ), - SizedBox( - height: size.height*0.01, + height: size.height * 0.01, ), Container( - padding: EdgeInsets.symmetric(horizontal: 10), + // padding: EdgeInsets.symmetric(horizontal: 0), decoration: BoxDecoration( - color: commonbgL4ightblack, - borderRadius: BorderRadius.circular(5) + borderRadius: BorderRadius.circular(5), ), margin: EdgeInsets.symmetric(horizontal: 20), child: TextField( - style: inputTextFieldStyle, + // style: inputTextFieldStyle, controller: subjectController, + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + ), decoration: InputDecoration( - border: InputBorder.none, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xff353F5A), + width: 1.0, + ), + 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: size.height*0.04, + height: size.height * 0.04, ), - Padding( padding: EdgeInsets.symmetric(horizontal: 20), - child: Text("Attended Lectures: ",style: TextStyle(color: Colors.white,fontSize: 17,fontWeight: FontWeight.bold),), + child: Text( + "Attended Lectures: ", + style: Theme.of(context).textTheme.bodySmall, + ), ), - SizedBox( - height: size.height*0.01, + height: size.height * 0.01, ), Container( - padding: EdgeInsets.symmetric(horizontal: 10), + // padding: EdgeInsets.symmetric(horizontal: 10), decoration: BoxDecoration( - color: commonbgL4ightblack, - borderRadius: BorderRadius.circular(5) + borderRadius: BorderRadius.circular(18), ), margin: EdgeInsets.symmetric(horizontal: 20), child: TextField( - style: inputTextFieldStyle, + // style: inputTextFieldStyle, keyboardType: TextInputType.number, controller: attendedLecturesController, + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + ), decoration: InputDecoration( - border: InputBorder.none, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xff353F5A), + width: 1.0, + ), + 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: size.height*0.04, + height: size.height * 0.04, ), - Padding( padding: EdgeInsets.symmetric(horizontal: 20), - child: Text("Total Lectures: ",style: TextStyle(color: Colors.white,fontSize: 17,fontWeight: FontWeight.bold),), + child: Text( + "Total Lectures: ", + style: Theme.of(context).textTheme.bodySmall, + ), ), - SizedBox( - height: size.height*0.01, + height: size.height * 0.01, ), Container( - padding: EdgeInsets.symmetric(horizontal: 10), + // padding: EdgeInsets.symmetric(horizontal: 10), decoration: BoxDecoration( - color: commonbgL4ightblack, - borderRadius: BorderRadius.circular(5) + borderRadius: BorderRadius.circular(18), ), margin: EdgeInsets.symmetric(horizontal: 20), child: TextField( - style: inputTextFieldStyle, + // style: inputTextFieldStyle, keyboardType: TextInputType.number, controller: totalLecturesController, + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + ), decoration: InputDecoration( - border: InputBorder.none, + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xff353F5A), + width: 1.0, + ), + 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: size.height*0.325, + height: size.height * 0.305, ), - InkWell( - onTap: () async{ + onTap: () async { bool isSubjectAdded = await addSubject(); - if(isSubjectAdded){ + if (isSubjectAdded) { Navigator.pop(context); showSnackBarMessage("Subject Added Successfully", Colors.green); } @@ -196,10 +303,16 @@ class _AddAttendanceScreenState extends State { width: size.width, margin: EdgeInsets.symmetric(horizontal: 20), decoration: BoxDecoration( - color: cardcolorblue, + color: Theme.of(context).colorScheme.primary, borderRadius: BorderRadius.circular(5), ), - child: Text("Send Mail",style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold),), + child: Text( + "Add Subject", + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(color: Colors.black), + ), ), ), ], @@ -207,45 +320,58 @@ class _AddAttendanceScreenState extends State { ); } - Future addSubject() async{ - if(totalLecturesController.text.isEmpty || attendedLecturesController.text.isEmpty || subjectController.text.isEmpty){ + Future addSubject() async { + if (totalLecturesController.text.isEmpty || + attendedLecturesController.text.isEmpty || + subjectController.text.isEmpty) { showSnackBarMessage("Fields cannot be left blank", Colors.red); return false; - } - else if(totalLecturesController.text.contains(',') || totalLecturesController.text.contains('.') || attendedLecturesController.text.contains(',') || attendedLecturesController.text.contains('.')){ - showSnackBarMessage("Attended and Total Lectures can only have Numeric Charachters", Colors.red); + } else if (totalLecturesController.text.contains(',') || + totalLecturesController.text.contains('.') || + attendedLecturesController.text.contains(',') || + attendedLecturesController.text.contains('.')) { + showSnackBarMessage( + "Attended and Total Lectures can only have Numeric Charachters", + Colors.red); return false; } String subjectName = subjectController.text; - int totalLectures = - int.parse(totalLecturesController.text); - int attendedLectures = - int.parse(attendedLecturesController.text); + int totalLectures = int.parse(totalLecturesController.text); + int attendedLectures = int.parse(attendedLecturesController.text); - if(totalLectures.isNegative || attendedLectures.isNegative){ + if (totalLectures.isNegative || attendedLectures.isNegative) { showSnackBarMessage("Lectures cannot be Negative", Colors.red); return false; - }else if(attendedLectures>totalLectures){ - showSnackBarMessage("Attended Lectures cannot be greater than Total Lectures", Colors.red); + } else if (attendedLectures > totalLectures) { + showSnackBarMessage( + "Attended Lectures cannot be greater than Total Lectures", + Colors.red); return false; - } - else{ + } else { Map updatedSubject = { "subject_name": subjectName, "total": totalLectures, "present": attendedLectures }; - if(widget.isUpdate){ - await AttendanceService.updateSubject(widget.attendanceList!, widget.index!, updatedSubject); - }else { + if (widget.isUpdate) { + await AttendanceService.updateSubject( + widget.attendanceList!, widget.index!, updatedSubject); + } else { await AttendanceService.addSubject(updatedSubject); } return true; } - } - showSnackBarMessage(String text,Color color){ - ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(text,style: TextStyle(color: Colors.white),),backgroundColor: color,),); + showSnackBarMessage(String text, Color color) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + text, + style: TextStyle(color: Colors.white), + ), + backgroundColor: color, + ), + ); } } diff --git a/lib/new_ui/screens/login_screen/ResetPasswordScreen.dart b/lib/new_ui/screens/login_screen/ResetPasswordScreen.dart index 3743ab8..5fdd76f 100644 --- a/lib/new_ui/screens/login_screen/ResetPasswordScreen.dart +++ b/lib/new_ui/screens/login_screen/ResetPasswordScreen.dart @@ -2,11 +2,13 @@ import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:tsec_app/new_ui/colors.dart'; +import 'package:tsec_app/utils/form_validity.dart'; import '../../../provider/auth_provider.dart'; import '../../../utils/custom_snackbar.dart'; class ResetPasswordScreen extends ConsumerStatefulWidget { + const ResetPasswordScreen({super.key}); @override _ResetPasswordScreenState createState() => _ResetPasswordScreenState(); @@ -15,6 +17,9 @@ class ResetPasswordScreen extends ConsumerStatefulWidget { class _ResetPasswordScreenState extends ConsumerState { String emailController = ""; + final TextEditingController _emailTextEditingController = + TextEditingController(); + @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; @@ -27,66 +32,94 @@ class _ResetPasswordScreenState extends ConsumerState { body: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Padding( padding: const EdgeInsets.symmetric(horizontal: 20), - child: Text("Reset Password",style: TextStyle(color: Colors.white,fontSize: 23,fontWeight: FontWeight.bold),), + child: Text( + "Reset Password", + style: Theme.of(context).textTheme.headlineLarge, + ), ), SizedBox( height: 20, ), Padding( padding: const EdgeInsets.symmetric(horizontal: 20), - child: Text("Forgot your password? No worries! Simply enter your email address below. We'll send a link to reset your password. Once you receive the link, follow the instructions to create a new password.",style: TextStyle(color: Colors.white,fontSize: 15),), + child: Text( + "Forgot your password? No worries! \nSimply enter your email address below. We'll send a link to reset your password. Once you receive the link, follow the instructions to create a new password.", + style: Theme.of(context).textTheme.bodySmall), ), - SizedBox( height: 20, ), - - Container( - alignment: Alignment.center, - height: 50, - margin: EdgeInsets.symmetric(horizontal: 20), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(5) - ), - padding: EdgeInsets.symmetric(horizontal: 10), - child: TextField( - onChanged: (val){ - setState(() { - emailController = val; - }); - }, - style: TextStyle(fontSize: 17), - decoration: InputDecoration( - border: InputBorder.none, - hintText: "Enter Email" + Padding( + padding: const EdgeInsets.only(top: 10, left: 20, right: 20), + child: DecoratedBox( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(18), + ), + child: TextField( + onChanged: (val) { + setState(() { + emailController = val; + }); + }, + style: TextStyle( + color: Theme.of(context).colorScheme.onSecondary, + ), + decoration: InputDecoration( + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Color(0xff353F5A), + width: 1.0, + ), + 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), + ), ), ), ), - Spacer(), - InkWell( splashFactory: NoSplash.splashFactory, - onTap: emailController.isNotEmpty ? ()async{ - //Form Logic - await forgotPassword(emailController); - } : (){ - print("Please Enter Email"); - }, + onTap: emailController.isNotEmpty + ? () async { + //Form Logic + await forgotPassword(emailController); + } + : () { + print("Please Enter Email"); + }, child: Container( alignment: Alignment.center, height: 45, width: size.width, margin: EdgeInsets.symmetric(horizontal: 20), + padding: EdgeInsets.symmetric(vertical: 10), decoration: BoxDecoration( - color: emailController.isNotEmpty ? cardcolorblue : Colors.grey.shade800, - borderRadius: BorderRadius.circular(5), + color: emailController.isNotEmpty + // ? Color(0xff353F5A) + ? Theme.of(context).colorScheme.primary + : Colors.grey.shade800, + borderRadius: BorderRadius.circular(18), ), - child: Text("Send Mail",style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold),), + child: Text("Send Mail", + // style: + // TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith(color: Colors.black)), ), ), SizedBox( diff --git a/lib/new_ui/screens/login_screen/login_screen.dart b/lib/new_ui/screens/login_screen/login_screen.dart index 979a143..c2a2490 100644 --- a/lib/new_ui/screens/login_screen/login_screen.dart +++ b/lib/new_ui/screens/login_screen/login_screen.dart @@ -19,7 +19,7 @@ import 'package:url_launcher/link.dart'; // import 'widgets/custom_login_widget.dart'; class LoginScreen extends ConsumerStatefulWidget { - const LoginScreen({Key? key}) : super(key: key); + const LoginScreen({super.key}); @override _LoginScreenState createState() => _LoginScreenState(); @@ -47,8 +47,6 @@ class _LoginScreenState extends ConsumerState { super.dispose(); } - - Future login() async { if (_formKey.currentState!.validate()) { setState(() { @@ -149,8 +147,8 @@ class _LoginScreenState extends ConsumerState { child: Column( children: [ Padding( - padding: - const EdgeInsets.only(top: 30, left: 30, right: 30), + padding: const EdgeInsets.only( + top: 30, left: 30, right: 30), child: DecoratedBox( decoration: BoxDecoration( borderRadius: BorderRadius.circular(18), @@ -170,7 +168,8 @@ class _LoginScreenState extends ConsumerState { return null; }, style: TextStyle( - color: Theme.of(context).colorScheme.onSecondary, + color: + Theme.of(context).colorScheme.onSecondary, ), decoration: InputDecoration( enabledBorder: OutlineInputBorder( @@ -199,8 +198,8 @@ class _LoginScreenState extends ConsumerState { height: 10, ), Padding( - padding: - const EdgeInsets.only(top: 30, left: 30, right: 30), + padding: const EdgeInsets.only( + top: 30, left: 30, right: 30), child: DecoratedBox( decoration: BoxDecoration( borderRadius: BorderRadius.circular(18), @@ -218,7 +217,8 @@ class _LoginScreenState extends ConsumerState { controller: _passwordTextEditingController, obscureText: passwordVisible, style: TextStyle( - color: Theme.of(context).colorScheme.onSecondary, + color: + Theme.of(context).colorScheme.onSecondary, ), decoration: InputDecoration( suffixIconColor: @@ -236,8 +236,9 @@ class _LoginScreenState extends ConsumerState { ), enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: - Theme.of(context).colorScheme.onTertiary, + color: Theme.of(context) + .colorScheme + .onTertiary, width: 1.0, ), borderRadius: const BorderRadius.all( @@ -249,7 +250,8 @@ class _LoginScreenState extends ConsumerState { ), filled: true, hintStyle: TextStyle( - color: Theme.of(context).colorScheme.onTertiary, + color: + Theme.of(context).colorScheme.onTertiary, ), hintText: "Password", fillColor: Color(0xff191B22), @@ -270,11 +272,17 @@ class _LoginScreenState extends ConsumerState { 30), // Set the desired border radius onTap: () async { //forgotPassword(); - Navigator.push(context, MaterialPageRoute(builder: (context)=> ResetPasswordScreen(),),); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + ResetPasswordScreen(), + ), + ); }, highlightShape: BoxShape.rectangle, // Custom shape - + child: Container( height: 20, decoration: BoxDecoration( @@ -312,7 +320,7 @@ class _LoginScreenState extends ConsumerState { padding: EdgeInsets.all( 16), // Adjust padding as needed ), - child: Container( + child: SizedBox( width: double .infinity, // Set width to full width height: 30, @@ -335,18 +343,19 @@ class _LoginScreenState extends ConsumerState { ], ), ), - + Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text( "Need help signing in? ", style: TextStyle( - color: Theme.of(context).colorScheme!.onSecondary, + color: Theme.of(context).colorScheme.onSecondary, ), ), Link( - uri: Uri.parse("mailto:devsclubtsec@gmail.com?subject=Request%20for%20Login%20Credentials&body=Dear%20Team,%0D%0A%0D%0AI%20want%20to%20request%20for%20TSEC%20App%20login%20Credentials.%0D%0A%0D%0AMy%20Details%20are:%0D%0AFull%20Name%20(Surname_First_Lastname):%0D%0AEmail:%0D%0APhone%20Number:%0D%0AGraduation%20Year:%0D%0ABranch:%0D%0ADiv%20(C2):%0D%0ABatch%20(C21):%0D%0A%0D%0AThank%20You."), + uri: Uri.parse( + "mailto:devsclubtsec@gmail.com?subject=Request%20for%20Login%20Credentials&body=Dear%20Team,%0D%0A%0D%0AI%20want%20to%20request%20for%20TSEC%20App%20login%20Credentials.%0D%0A%0D%0AMy%20Details%20are:%0D%0AFull%20Name%20(Surname_First_Lastname):%0D%0AEmail:%0D%0APhone%20Number:%0D%0AGraduation%20Year:%0D%0ABranch:%0D%0ADiv%20(C2):%0D%0ABatch%20(C21):%0D%0A%0D%0AThank%20You."), builder: (context, followLink) => GestureDetector( onTap: () => followLink?.call(), child: Text( diff --git a/lib/new_ui/screens/profile_screen/profile_screen.dart b/lib/new_ui/screens/profile_screen/profile_screen.dart index b7a3a03..aa9af97 100644 --- a/lib/new_ui/screens/profile_screen/profile_screen.dart +++ b/lib/new_ui/screens/profile_screen/profile_screen.dart @@ -33,7 +33,7 @@ import 'package:intl/intl.dart'; class ProfilePage extends ConsumerStatefulWidget { bool justLoggedIn; - ProfilePage({Key? key, required this.justLoggedIn}) : super(key: key); + ProfilePage({super.key, required this.justLoggedIn}); @override ConsumerState createState() => _ProfilePageState(); @@ -307,13 +307,14 @@ class _ProfilePageState extends ConsumerState { editProfileImage(data); }, elevation: 2.0, - fillColor: Color(0xFFF5F6F9), + // fillColor: Color(0xFFF5F6F9), + fillColor: Theme.of(context).colorScheme.primary, + padding: EdgeInsets.all(3.0), + shape: CircleBorder(side: BorderSide(color: Colors.black)), child: Icon( Icons.edit, color: Colors.black, ), - padding: EdgeInsets.all(3.0), - shape: CircleBorder(side: BorderSide(color: Colors.black)), )), ], ), @@ -336,7 +337,7 @@ class _ProfilePageState extends ConsumerState { scrolledUnderElevation: 0, actions: [ Padding( - padding: const EdgeInsets.all(8), + padding: const EdgeInsets.all(4), child: TextButton( style: TextButton.styleFrom( // backgroundColor: Theme.of(context).colorScheme.background, @@ -348,73 +349,106 @@ class _ProfilePageState extends ConsumerState { ), child: Icon( Icons.arrow_forward, - color: Colors.white, + color: Theme.of(context).colorScheme.primary, ), onPressed: () async { - if(data.isStudent) { + if (data.isStudent) { showDialog( - context: context, - builder: (context) { - return AlertDialog( - - content: SizedBox( - child: Container( - height: MediaQuery.of(context).size.height* 0.25, - padding: const EdgeInsets.all(5.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - RichText( - text: TextSpan( - text: 'Are you in division ', - style: Theme.of(context).textTheme.bodyLarge?.copyWith( - color: Colors.white, + context: context, + builder: (context) { + return AlertDialog( + backgroundColor: Theme.of(context) + .colorScheme + .primaryContainer, + content: SizedBox( + child: Container( + height: MediaQuery.of(context).size.height * + 0.20, + padding: const EdgeInsets.all(5.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceAround, + children: [ + RichText( + text: TextSpan( + text: 'Are you in division ', + style: Theme.of(context) + .textTheme + .bodyLarge + ?.copyWith(color: Colors.white), + children: [ + TextSpan( + text: div, + style: const TextStyle( + fontWeight: + FontWeight.bold)), + const TextSpan( + text: ' and batch '), + TextSpan( + text: batch, + style: const TextStyle( + fontWeight: + FontWeight.bold)), + const TextSpan( + text: + ' ? Please check your details once.'), + ], ), - children: [ - TextSpan(text: div, style: const TextStyle(fontWeight: FontWeight.bold)), - const TextSpan(text: ' and batch '), - TextSpan(text: batch, style: const TextStyle(fontWeight: FontWeight.bold)), - const TextSpan(text: ' ? Please check your details once.'), - ], ), - ), - Container( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - child: TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: const Text("Cancel") + Container( + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Container( + child: TextButton( + onPressed: () { + Navigator.of(context) + .pop(); + }, + child: Text("Cancel", + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + color: Theme.of( + context) + .colorScheme + .tertiary))), ), - ), - Container( - child: TextButton( - onPressed: () async { - bool changesSaved = await saveChanges(ref); - if (changesSaved) GoRouter.of(context).go('/main'); - }, - child: const Text("Proceed") + Container( + child: TextButton( + onPressed: () async { + bool changesSaved = + await saveChanges( + ref); + if (changesSaved) + GoRouter.of(context) + .go('/main'); + }, + child: Text("Proceed", + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + color: Theme.of( + context) + .colorScheme + .primary))), ), - ), - ], + ], + ), ), - ), - ], + ], + ), ), ), - ), - ); - } - ); - } - else { + ); + }); + } else { bool changesSaved = await saveChanges(ref); if (changesSaved) GoRouter.of(context).go('/main'); } - }, ), ), @@ -425,7 +459,9 @@ class _ProfilePageState extends ConsumerState { child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ - SizedBox(height: 50,), + SizedBox( + height: 50, + ), Stack( clipBehavior: Clip.none, alignment: Alignment.center, @@ -435,9 +471,9 @@ class _ProfilePageState extends ConsumerState { // color: Theme.of(context).colorScheme.background, color: commonbgblack, borderRadius: BorderRadius.only( - // topLeft: Radius.circular(25.0), - // topRight: Radius.circular(25.0), - ), + // topLeft: Radius.circular(25.0), + // topRight: Radius.circular(25.0), + ), ), height: MediaQuery.of(context).size.height * .74, child: SingleChildScrollView( @@ -450,11 +486,13 @@ class _ProfilePageState extends ConsumerState { children: [ Row( crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, children: [ Expanded( child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, children: [ Container( // width: MediaQuery.of(context).size.width*0.6, @@ -462,8 +500,10 @@ class _ProfilePageState extends ConsumerState { data.isStudent ? data.studentModel!.name : data.facultyModel!.name, - style: TextStyle(fontWeight: FontWeight.bold,fontSize: 18,color: Colors.white), - + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 18, + color: Colors.white), ), ), data.isStudent @@ -492,11 +532,9 @@ class _ProfilePageState extends ConsumerState { }); }, elevation: 2.0, - fillColor: Color(0xFFF5F6F9), - child: Icon( - Icons.edit, - color: Colors.black, - ), + // fillColor: Color(0xFFF5F6F9), + fillColor: + Theme.of(context).colorScheme.primary, constraints: BoxConstraints.tightFor( width: 50, // Set the width height: 50.0, // Set the height @@ -504,53 +542,66 @@ class _ProfilePageState extends ConsumerState { shape: CircleBorder( side: BorderSide(color: Colors.black), ), + child: Icon( + Icons.edit, + color: Colors.black, + ), ), secondChild: !editMode - ? SizedBox() - : Row(children: [ - RawMaterialButton( - onPressed: () { - clearValues(data); - }, - elevation: 2.0, - fillColor: Color(0xFFF5F6F9), - child: Icon( - Icons.close, - color: Colors.black, - ), - constraints: BoxConstraints.tightFor( - width: 40, // Set the width - height: 40.0, // Set the height - ), - shape: CircleBorder( - side: BorderSide(color: Colors.black), - ), - ), - SizedBox( - width: 5, - ), - RawMaterialButton( - onPressed: () async { - bool changesSaved = - await saveChanges(ref); - // if (changesSaved) - // GoRouter.of(context).go('/main'); - }, - elevation: 2.0, - fillColor: Color(0xFFF5F6F9), - child: Icon( - Icons.check, - color: Colors.black, - ), - constraints: BoxConstraints.tightFor( - width: 40, // Set the width - height: 40.0, // Set the height - ), - shape: CircleBorder( - side: BorderSide(color: Colors.black), - ), - ) - ]), + ? SizedBox() + : Row(children: [ + RawMaterialButton( + onPressed: () { + clearValues(data); + }, + elevation: 2.0, + fillColor: Color(0xFFF5F6F9), + constraints: + BoxConstraints.tightFor( + width: 40, // Set the width + height: 40.0, // Set the height + ), + shape: CircleBorder( + side: BorderSide( + color: Colors.black), + ), + child: Icon( + Icons.close, + color: Colors.black, + ), + ), + SizedBox( + width: 5, + ), + RawMaterialButton( + onPressed: () async { + bool changesSaved = + await saveChanges(ref); + // if (changesSaved) + // GoRouter.of(context).go('/main'); + }, + elevation: 2.0, + // fillColor: Color(0xFFF5F6F9), + // fillColor: Color.fromARGB( + // 255, 32, 208, 138), + fillColor: Theme.of(context) + .colorScheme + .primary, + constraints: + BoxConstraints.tightFor( + width: 40, // Set the width + height: 40.0, // Set the height + ), + shape: CircleBorder( + side: BorderSide( + color: Colors.black), + ), + child: Icon( + Icons.check, + color: Colors.black, + ), + ) + ]), ) ], ), @@ -601,8 +652,8 @@ class _ProfilePageState extends ConsumerState { await showDatePicker( context: context, initialDate: DateTime.now() - .subtract( - Duration(days: 20 * 365)), + .subtract(Duration( + days: 20 * 365)), firstDate: DateTime(1960), lastDate: DateTime(2010), ); @@ -656,8 +707,10 @@ class _ProfilePageState extends ConsumerState { if (newValue != null) { setState(() { div = newValue; - batchList = calcBatchList( - newValue, branch); + batchList = + calcBatchList( + newValue, + branch); batch = null; }); } @@ -708,7 +761,8 @@ class _ProfilePageState extends ConsumerState { ProfileField( labelName: "Designation", enabled: editMode, - controller: designationController, + controller: + designationController, // onChanged: (val) { // setState(() { // phoneNum = val; @@ -761,7 +815,8 @@ class _ProfilePageState extends ConsumerState { labelName: "Experience", enabled: editMode, // value: address, - controller: experienceController, + controller: + experienceController, validator: (value) { if (value!.isEmpty) { return 'Please enter a value'; @@ -789,11 +844,23 @@ class _ProfilePageState extends ConsumerState { ), ), ), - TextButton(onPressed: (){ - showDialog(context: context, builder: (contextOfDialog){ - return ChangePasswordDialog(ctx1: context,); - }); - }, child: Text("Change password", style: TextStyle(color: Colors.blueAccent),)) + TextButton( + onPressed: () { + showDialog( + context: context, + builder: (contextOfDialog) { + return ChangePasswordDialog( + ctx1: context, + ); + }); + }, + child: Text( + "Change password", + style: TextStyle( + color: Theme.of(context) + .colorScheme + .primary), + )) ], ), ) diff --git a/lib/new_ui/screens/profile_screen/widgets/change_password_dialog.dart b/lib/new_ui/screens/profile_screen/widgets/change_password_dialog.dart index 5cdca62..1335a27 100644 --- a/lib/new_ui/screens/profile_screen/widgets/change_password_dialog.dart +++ b/lib/new_ui/screens/profile_screen/widgets/change_password_dialog.dart @@ -11,10 +11,11 @@ class ChangePasswordDialog extends ConsumerWidget { final TextEditingController newPasswordController = TextEditingController(); - final TextEditingController confirmPasswordController = TextEditingController(); + final TextEditingController confirmPasswordController = + TextEditingController(); - String? validatePassword(){ - if(newPasswordController.text != confirmPasswordController.text){ + String? validatePassword() { + if (newPasswordController.text != confirmPasswordController.text) { return "Passwords do not match"; } return null; @@ -22,17 +23,22 @@ class ChangePasswordDialog extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - final _formKey = GlobalKey(); + final formKey = GlobalKey(); return AlertDialog( + backgroundColor: Theme.of(context).colorScheme.primaryContainer, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(15), ), - title: Text('Change Password'), + title: Text('Change Password', + style: Theme.of(context) + .textTheme + .headlineMedium + ?.copyWith(color: Theme.of(context).colorScheme.primary)), content: Container( //padding: const EdgeInsets.all(16), child: Form( autovalidateMode: AutovalidateMode.onUserInteraction, - key: _formKey, + key: formKey, child: Column( mainAxisSize: MainAxisSize.min, children: [ @@ -55,7 +61,9 @@ class ChangePasswordDialog extends ConsumerWidget { errorStyle: TextStyle(fontSize: 12), focusColor: Colors.red, fillColor: Colors.transparent, - border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), labelText: 'Old Password', ), ), @@ -65,7 +73,7 @@ class ChangePasswordDialog extends ConsumerWidget { if (value == null || value.isEmpty) { return 'Please enter some text'; } - if(value != confirmPasswordController.text){ + if (value != confirmPasswordController.text) { return "Passwords do not match"; } return null; @@ -77,10 +85,10 @@ class ChangePasswordDialog extends ConsumerWidget { errorStyle: TextStyle(fontSize: 12), focusColor: Colors.red, fillColor: Colors.transparent, - border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)), - labelText: 'New Password', - errorText: validatePassword() - ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10)), + labelText: 'New Password', + errorText: validatePassword()), ), const SizedBox(height: 16), TextFormField( @@ -88,7 +96,7 @@ class ChangePasswordDialog extends ConsumerWidget { if (value == null || value.isEmpty) { return 'Please enter some text'; } - if(value != newPasswordController.text){ + if (value != newPasswordController.text) { return "Passwords do not match"; } return null; @@ -100,11 +108,11 @@ class ChangePasswordDialog extends ConsumerWidget { errorStyle: TextStyle(fontSize: 12), focusColor: Colors.red, fillColor: Colors.transparent, - border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10)), labelText: 'Confirm Password', errorText: validatePassword(), ), - ), const SizedBox(height: 16), Row( @@ -114,16 +122,29 @@ class ChangePasswordDialog extends ConsumerWidget { onPressed: () { Navigator.of(context).pop(); }, - child: Text('Cancel'), + child: Text( + 'Cancel', + style: Theme.of(context).textTheme.headlineMedium, + ), ), TextButton( onPressed: () { - if(_formKey.currentState!.validate()){ - ref.watch(authProvider.notifier).changePassword(oldPasswordController.text, newPasswordController.text, ctx1); + if (formKey.currentState!.validate()) { + ref.watch(authProvider.notifier).changePassword( + oldPasswordController.text, + newPasswordController.text, + ctx1); Navigator.of(context).pop(); } }, - child: Text('Change'), + child: Text( + 'Change', + style: Theme.of(context) + .textTheme + .headlineMedium + ?.copyWith( + color: Theme.of(context).colorScheme.primary), + ), ), ], ), diff --git a/lib/widgets/my_textfield.dart b/lib/widgets/my_textfield.dart new file mode 100644 index 0000000..7ef94fc --- /dev/null +++ b/lib/widgets/my_textfield.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; +import 'package:tsec_app/utils/form_validity.dart'; + +class MyTextfield extends StatelessWidget { + final TextEditingController controller; + final String hintText; + const MyTextfield({ + super.key, + required this.controller, + required this.hintText, + }); + + @override + Widget build(BuildContext context) { + return 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: controller, + 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, + ), + borderRadius: const BorderRadius.all( + Radius.circular(18), + ), + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(18.0), + ), + filled: true, + hintStyle: TextStyle( + color: Color(0xff6B708C), + ), + hintText: hintText, + fillColor: Color(0xff191B22), + ), + ), + ), + ); + } +}