From 4c760bd27748be59522e094ee0faf85c84fd5869 Mon Sep 17 00:00:00 2001 From: SayedZeeshanHyder Date: Sun, 13 Oct 2024 12:53:18 +0530 Subject: [PATCH 1/2] Added Showcase and fixed Address length --- lib/main.dart | 25 +- .../attendance_screen/attendance_screen.dart | 474 ++++++++++-------- .../coming_soon_screen/coming_soon.dart | 2 +- .../guidelines_screen/guidelinesscreen.dart | 105 ++-- .../home_screen/widgets/home_widget.dart | 97 ++-- .../screens/main_screen/main_screen.dart | 115 +++-- .../railway_screen/railway_screen.dart | 123 +++-- lib/new_ui/showcasekeys.dart | 8 + lib/screens/tpc_screen.dart | 139 ----- lib/screens/tpc_screen/internships.dart | 92 ++++ lib/screens/tpc_screen/tpc_screen.dart | 143 ++++++ lib/services/sharedprefsfordot.dart | 49 ++ pubspec.lock | 12 +- pubspec.yaml | 3 +- 14 files changed, 837 insertions(+), 550 deletions(-) create mode 100644 lib/new_ui/showcasekeys.dart delete mode 100644 lib/screens/tpc_screen.dart create mode 100644 lib/screens/tpc_screen/internships.dart create mode 100644 lib/screens/tpc_screen/tpc_screen.dart diff --git a/lib/main.dart b/lib/main.dart index 8825dbad..6e2ac76c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -8,6 +8,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import 'package:showcaseview/showcaseview.dart'; import 'package:tsec_app/models/event_model/event_model.dart'; import 'package:tsec_app/new_ui/router.dart'; import 'package:tsec_app/new_ui/screens/home_screen/home_screen.dart'; @@ -170,16 +171,20 @@ class _TSECAppState extends ConsumerState { @override Widget build(BuildContext context) { final _themeMode = ref.watch(themeProvider); - return MaterialApp.router( - debugShowCheckedModeBanner: false, - builder: (context, child) => - MediaQuery(data: getTextScale(context), child: child!), - routeInformationProvider: _routes.routeInformationProvider, - routeInformationParser: _routes.routeInformationParser, - routerDelegate: _routes.routerDelegate, - title: 'TSEC App', - themeMode: ThemeMode.dark, - darkTheme: darkTheme, + return ShowCaseWidget( + builder: (context) => Builder( + builder: (context) => MaterialApp.router( + debugShowCheckedModeBanner: false, + builder: (context, child) => + MediaQuery(data: getTextScale(context), child: child!), + routeInformationProvider: _routes.routeInformationProvider, + routeInformationParser: _routes.routeInformationParser, + routerDelegate: _routes.routerDelegate, + title: 'TSEC App', + themeMode: ThemeMode.dark, + darkTheme: darkTheme, + ), + ), ); } } \ No newline at end of file diff --git a/lib/new_ui/screens/attendance_screen/attendance_screen.dart b/lib/new_ui/screens/attendance_screen/attendance_screen.dart index 04f7d3bb..dd131857 100644 --- a/lib/new_ui/screens/attendance_screen/attendance_screen.dart +++ b/lib/new_ui/screens/attendance_screen/attendance_screen.dart @@ -3,10 +3,14 @@ import 'package:flutter/services.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; +import 'package:showcaseview/showcaseview.dart'; import 'package:tsec_app/new_ui/colors.dart'; import 'package:tsec_app/new_ui/screens/attendance_screen/widgets/attendance_subject_widget.dart'; import 'package:tsec_app/new_ui/screens/attendance_screen/widgets/attendanceservice.dart'; import 'package:tsec_app/provider/auth_provider.dart'; +import 'package:tsec_app/services/sharedprefsfordot.dart'; + +import '../../showcasekeys.dart'; class AttendanceScreen extends StatefulWidget { const AttendanceScreen({super.key}); @@ -39,6 +43,18 @@ class _AttendanceScreenState extends State { }); } + @override + void initState() { + super.initState(); + bool isNotesVisited = SharedPreferencesForDot.isNotesVisited(); + if(!isNotesVisited) { + WidgetsBinding.instance.addPostFrameCallback( + (_) => + ShowCaseWidget.of(context).startShowCase([addNotesFloatButton],),); + SharedPreferencesForDot.visitNotes(); + } + } + @override Widget build(BuildContext context) { var size = MediaQuery.of(context).size; @@ -119,12 +135,16 @@ class _AttendanceScreenState extends State { color: Colors.white, fontSize: 4), ), Text( - '${((circularMap["attendedLectures"] / circularMap["totalLectures"]) * 100).toStringAsFixed(2)}%', + circularMap["totalLectures"] != 0 + ? '${((circularMap["attendedLectures"] / circularMap["totalLectures"]) * 100).toStringAsFixed(2)}%' + : "0%", style: TextStyle( color: Colors.white, fontSize: 25), ), Text( - '${circularMap["attendedLectures"]}/${circularMap["totalLectures"]}', + circularMap["totalLectures"] != 0 + ? '${circularMap["attendedLectures"]}/${circularMap["totalLectures"]}' + : "0%", style: TextStyle( color: Colors.white, fontSize: 15), ), @@ -204,7 +224,8 @@ class _AttendanceScreenState extends State { }, enabled: isEnabled, controller: subjectNameController, - style: TextStyle(color: Colors.white), + style: + TextStyle(color: Colors.white), decoration: InputDecoration( labelText: 'Subject Name', border: OutlineInputBorder( @@ -217,7 +238,8 @@ class _AttendanceScreenState extends State { EdgeInsets.symmetric( horizontal: 15, vertical: 10), - errorStyle: TextStyle(fontSize: 12), + errorStyle: + TextStyle(fontSize: 12), ), ), SizedBox(height: 20), @@ -228,16 +250,23 @@ class _AttendanceScreenState extends State { if (val == null || val.isEmpty) { return "Please enter some value"; - } else if (totalLectures.isNotEmpty && - int.parse(val) > int.parse(totalLectures)) { + } else if (totalLectures + .isNotEmpty && + int.parse(val) > + int.parse( + totalLectures)) { return "Please enter correct value"; } }, keyboardType: TextInputType.number, - inputFormatters: [FilteringTextInputFormatter.digitsOnly], + inputFormatters: [ + FilteringTextInputFormatter + .digitsOnly + ], controller: attendedLecturesController, - style: TextStyle(color: Colors.white), + style: + TextStyle(color: Colors.white), enabled: isEnabled, decoration: InputDecoration( labelText: 'Attended Lectures', @@ -246,7 +275,8 @@ class _AttendanceScreenState extends State { BorderRadius.circular(10), ), filled: true, - errorStyle: TextStyle(fontSize: 12), + errorStyle: + TextStyle(fontSize: 12), focusColor: Colors.red, fillColor: Colors.transparent, contentPadding: @@ -260,19 +290,26 @@ class _AttendanceScreenState extends State { enabled: isEnabled, validator: (val) { String attendedLectures = - attendedLecturesController.text; + attendedLecturesController + .text; if (val == null || val.isEmpty) { return "Please enter some value"; - } else if (attendedLectures.isNotEmpty && + } else if (attendedLectures + .isNotEmpty && int.parse(val) < - int.parse(attendedLectures)) { + int.parse( + attendedLectures)) { return "Please enter correct value"; } }, keyboardType: TextInputType.number, - inputFormatters: [FilteringTextInputFormatter.digitsOnly], + inputFormatters: [ + FilteringTextInputFormatter + .digitsOnly + ], controller: totalLecturesController, - style: TextStyle(color: Colors.white), + style: + TextStyle(color: Colors.white), decoration: InputDecoration( labelText: 'Total Lectures Till Now', @@ -281,7 +318,8 @@ class _AttendanceScreenState extends State { BorderRadius.circular(10), ), filled: true, - errorStyle: TextStyle(fontSize: 12), + errorStyle: + TextStyle(fontSize: 12), focusColor: Colors.red, fillColor: Colors.transparent, contentPadding: @@ -296,8 +334,8 @@ class _AttendanceScreenState extends State { ), actions: [ TextButton( - onPressed: () { - if(isEnabled) { + onPressed: () { + if (isEnabled) { isEnabled = false; if (_updateformKey.currentState! .validate()) { @@ -316,9 +354,10 @@ class _AttendanceScreenState extends State { "present": attendedLectures }; - AttendanceService - .updateSubject(attendanceList, - index, updatedSubject); + AttendanceService.updateSubject( + attendanceList, + index, + updatedSubject); Navigator.of(context).pop(); } @@ -351,15 +390,12 @@ class _AttendanceScreenState extends State { .update({'attendance': attendanceList}); } }*/ - - }, child: Text('Update', style: TextStyle(color: Colors.blue)), ), TextButton( - onPressed: () { - + onPressed: () { AttendanceService.deleteSubject( attendanceList, index); @@ -433,13 +469,17 @@ class _AttendanceScreenState extends State { MainAxisAlignment.spaceBetween, children: [ Text( - '${attendanceInfo['present']}/${attendanceInfo['total']}', + attendanceInfo['total'] != 0 + ? '${attendanceInfo['present']}/${attendanceInfo['total']}' + : "0%", style: TextStyle( color: Colors.white, fontSize: 14), ), Text( - '${(attendanceInfo['present'] / attendanceInfo['total'] * 100).toInt()}%', + attendanceInfo['total'] != 0 + ? '${(attendanceInfo['present'] / attendanceInfo['total'] * 100).toInt()}%' + : "0%", style: TextStyle( color: Colors.white, fontSize: 20, @@ -451,8 +491,10 @@ class _AttendanceScreenState extends State { height: 10, ), LinearProgressIndicator( - value: attendanceInfo['present'] / - attendanceInfo['total'], + value: attendanceInfo['total'] + ? attendanceInfo['present'] / + attendanceInfo['total'] + : 0, backgroundColor: Colors.white, valueColor: const AlwaysStoppedAnimation( @@ -548,174 +590,185 @@ class _AttendanceScreenState extends State { ), ); }), - floatingActionButton: FloatingActionButton( - onPressed: () { - showDialog( - context: context, - builder: (BuildContext context) { - TextEditingController subjectNameController = - TextEditingController(); - TextEditingController totalLecturesController = - TextEditingController(); - TextEditingController attendedLecturesController = - TextEditingController(); - - final _formKey = GlobalKey(); - - return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: - BorderRadius.circular(15), // Increased corner radius - ), - title: Text( - 'Add Subject', - style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), - ), - content: Form( - key: _formKey, - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10.0), - child: SingleChildScrollView( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TextFormField( - validator: (val) { - if (val == null || val.isEmpty) { - return "Please enter some value"; - } - }, - style: TextStyle(color: Colors.white), - // Set text color to white - controller: subjectNameController, - decoration: InputDecoration( - focusColor: Colors.red, - labelText: 'Subject Name', - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), + floatingActionButton: Showcase( + key: addNotesFloatButton, + description: 'Click here to add Notes', + descTextStyle: TextStyle(fontSize: 15), + child: FloatingActionButton( + onPressed: () { + showDialog( + context: context, + builder: (BuildContext context) { + TextEditingController subjectNameController = + TextEditingController(); + TextEditingController totalLecturesController = + TextEditingController(); + TextEditingController attendedLecturesController = + TextEditingController(); + + final _formKey = GlobalKey(); + + print("Clicked"); + return AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(15), // Increased corner radius + ), + title: Text( + 'Add Subject', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18), + ), + content: Form( + key: _formKey, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextFormField( + validator: (val) { + if (val == null || val.isEmpty) { + return "Please enter some value"; + } + }, + style: TextStyle(color: Colors.white), + // Set text color to white + controller: subjectNameController, + decoration: InputDecoration( + focusColor: Colors.red, + labelText: 'Subject Name', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), + filled: true, + fillColor: Colors.transparent, + errorStyle: TextStyle(fontSize: 12), + contentPadding: EdgeInsets.symmetric( + horizontal: 15, vertical: 10), ), - filled: true, - fillColor: Colors.transparent, - errorStyle: TextStyle(fontSize: 12), - contentPadding: EdgeInsets.symmetric( - horizontal: 15, vertical: 10), ), - ), - SizedBox(height: 20), - TextFormField( - validator: (val) { - String totalLectures = - totalLecturesController.text; - - if (val == null || val.isEmpty) { - return "Please enter some value"; - } else if (totalLectures.isNotEmpty && - int.parse(val) > int.parse(totalLectures)) { - return "Please enter correct value"; - } - }, - style: TextStyle(color: Colors.white), - // Set text color to white - controller: attendedLecturesController, - keyboardType: TextInputType.number, - inputFormatters: [FilteringTextInputFormatter.digitsOnly], - decoration: InputDecoration( - labelText: 'Attended Lectures', - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), + SizedBox(height: 20), + TextFormField( + validator: (val) { + String totalLectures = + totalLecturesController.text; + + if (val == null || val.isEmpty) { + return "Please enter some value"; + } else if (totalLectures.isNotEmpty && + int.parse(val) > int.parse(totalLectures)) { + return "Please enter correct value"; + } + }, + style: TextStyle(color: Colors.white), + // Set text color to white + controller: attendedLecturesController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly + ], + decoration: InputDecoration( + labelText: 'Attended Lectures', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), + filled: true, + fillColor: Colors.transparent, + errorStyle: TextStyle(fontSize: 12), + contentPadding: EdgeInsets.symmetric( + horizontal: 15, vertical: 10), ), - filled: true, - fillColor: Colors.transparent, - errorStyle: TextStyle(fontSize: 12), - contentPadding: EdgeInsets.symmetric( - horizontal: 15, vertical: 10), ), - ), - SizedBox(height: 20), - TextFormField( - validator: (val) { - int attendedLectures = - int.parse(attendedLecturesController.text) ?? 0; - if (val == null || val.isEmpty) { - return "Please enter some value"; - } else if (attendedLectures !=0 && - int.parse(val) < - attendedLectures) { - return "Please enter correct value"; - } - }, - style: TextStyle(color: Colors.white), - // Set text color to white - controller: totalLecturesController, - keyboardType: TextInputType.number, - inputFormatters: [FilteringTextInputFormatter.digitsOnly], - decoration: InputDecoration( - labelText: 'Total Lectures Till Now', - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(10), + SizedBox(height: 20), + TextFormField( + validator: (val) { + int attendedLectures = int.parse( + attendedLecturesController.text) ?? + 0; + if (val == null || val.isEmpty) { + return "Please enter some value"; + } else if (attendedLectures != 0 && + int.parse(val) < attendedLectures) { + return "Please enter correct value"; + } + }, + style: TextStyle(color: Colors.white), + // Set text color to white + controller: totalLecturesController, + keyboardType: TextInputType.number, + inputFormatters: [ + FilteringTextInputFormatter.digitsOnly + ], + decoration: InputDecoration( + labelText: 'Total Lectures Till Now', + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + ), + filled: true, + fillColor: Colors.transparent, + contentPadding: EdgeInsets.symmetric( + horizontal: 15, vertical: 10), + errorStyle: TextStyle(fontSize: 12), ), - filled: true, - fillColor: Colors.transparent, - contentPadding: EdgeInsets.symmetric( - horizontal: 15, vertical: 10), - errorStyle: TextStyle(fontSize: 12), ), - ), - ], + ], + ), ), ), ), - ), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text('Cancel', style: TextStyle(color: Colors.red)), - ), - TextButton( - onPressed: () { - if (_formKey.currentState!.validate()) { - String subjectName = subjectNameController.text; - int totalLectures = - int.parse(totalLecturesController.text); - int attendedLectures = - int.parse(attendedLecturesController.text); - - Map updatedSubject = { - "subject_name": subjectName, - "total": totalLectures, - "present": attendedLectures - }; - AttendanceService.addSubject(updatedSubject); - /*FirebaseFirestore.instance - .collection("Attendance") - .doc(FirebaseAuth.instance.currentUser!.uid) - .set({ - 'attendance': FieldValue.arrayUnion([{ - 'subject_name': subjectName, - 'total': totalLectures, - 'present': attendedLectures - }]) - }, SetOptions(merge: true)); - _fetchAndSetAttendance();*/ + actions: [ + TextButton( + onPressed: () { Navigator.of(context).pop(); - } - }, - child: Text('Add', style: TextStyle(color: Colors.blue)), - ), - ], - ); - }, - ); - }, - shape: CircleBorder( - side: BorderSide( - color: commonbgL4ightblack, - width: 0.5), // Customize the border color and width + }, + child: + Text('Cancel', style: TextStyle(color: Colors.red)), + ), + TextButton( + onPressed: () { + if (_formKey.currentState!.validate()) { + String subjectName = subjectNameController.text; + int totalLectures = + int.parse(totalLecturesController.text); + int attendedLectures = + int.parse(attendedLecturesController.text); + + Map updatedSubject = { + "subject_name": subjectName, + "total": totalLectures, + "present": attendedLectures + }; + AttendanceService.addSubject(updatedSubject); + /*FirebaseFirestore.instance + .collection("Attendance") + .doc(FirebaseAuth.instance.currentUser!.uid) + .set({ + 'attendance': FieldValue.arrayUnion([{ + 'subject_name': subjectName, + 'total': totalLectures, + 'present': attendedLectures + }]) + }, SetOptions(merge: true)); + _fetchAndSetAttendance();*/ + Navigator.of(context).pop(); + } + }, + child: Text('Add', style: TextStyle(color: Colors.blue)), + ), + ], + ); + }, + ); + }, + shape: CircleBorder( + side: BorderSide( + color: commonbgL4ightblack, + width: 0.5), // Customize the border color and width + ), + backgroundColor: commonbgLightblack, + child: Icon(Icons.add, color: Colors.blue), ), - backgroundColor: commonbgLightblack, - child: Icon(Icons.add, color: Colors.blue), ), ); } @@ -761,34 +814,37 @@ String getTextForCard(int at, int tt) { double total = tt.toDouble(); int toAttend = 0; - if (attended / total == 0.75) { - return "You are Just on track, keep it up !"; - } else if (attended / total > 0.75) { - while (1 == 1) { - double t = (attended) / (total + 1); - if (t >= 0.75) { - total++; - toAttend--; - } else { - break; + try { + if (attended / total == 0.75) { + return "You are Just on track, keep it up !"; + } else if (attended / total > 0.75) { + while (1 == 1) { + double t = (attended) / (total + 1); + if (t >= 0.75) { + total++; + toAttend--; + } else { + break; + } } - } - } else { - while (1 == 1) { - double t = (attended + 1) / (total + 1); - if (t <= 0.75) { - total++; - attended++; - toAttend++; - } else { - break; + } else { + while (1 == 1) { + double t = (attended + 1) / (total + 1); + if (t <= 0.75) { + total++; + attended++; + toAttend++; + } else { + break; + } } } - } - if (toAttend <= 0) { - return "You are on track, keep it up !"; + if (toAttend <= 0) { + return "You are on track, keep it up !"; + } + } catch (e) { + return "Your presence in next ${toAttend} classes is crucial"; } - return "Your presence in next ${toAttend} classes is crucial"; } diff --git a/lib/new_ui/screens/coming_soon_screen/coming_soon.dart b/lib/new_ui/screens/coming_soon_screen/coming_soon.dart index 359b6443..5f2525cd 100644 --- a/lib/new_ui/screens/coming_soon_screen/coming_soon.dart +++ b/lib/new_ui/screens/coming_soon_screen/coming_soon.dart @@ -1,6 +1,6 @@ import 'dart:async'; import 'dart:ui'; -import 'package:flutter/material.dart'; +import 'package:flutter/material.dart' hide CarouselController,CarouselView; import 'package:lottie/lottie.dart'; import 'package:carousel_slider/carousel_slider.dart'; import 'package:tsec_app/new_ui/screens/main_screen/widgets/common_basic_appbar.dart'; diff --git a/lib/new_ui/screens/guidelines_screen/guidelinesscreen.dart b/lib/new_ui/screens/guidelines_screen/guidelinesscreen.dart index d883d0db..03ccdeea 100644 --- a/lib/new_ui/screens/guidelines_screen/guidelinesscreen.dart +++ b/lib/new_ui/screens/guidelines_screen/guidelinesscreen.dart @@ -1,9 +1,12 @@ import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:showcaseview/showcaseview.dart'; import 'package:tsec_app/new_ui/screens/guidelines_screen/widgets/FAQCard.dart'; import 'package:tsec_app/new_ui/screens/guidelines_screen/widgets/guidelines_card.dart'; -import 'package:tsec_app/services/localnotificationservice.dart'; + +import '../../../services/sharedprefsfordot.dart'; +import '../../showcasekeys.dart'; class GuideLinesScreen extends StatefulWidget { @override @@ -11,14 +14,23 @@ class GuideLinesScreen extends StatefulWidget { } class _GuideLinesScreenState extends State { + List guideLines = []; List faqs = []; @override void initState() { + super.initState(); setGuidelines(); setFAQ(); + bool isFirstRailway = SharedPreferencesForDot.isFirstGuide(); + if(!isFirstRailway) { + WidgetsBinding.instance.addPostFrameCallback((_) => + ShowCaseWidget.of(context).startShowCase([infoKey]) + ); + SharedPreferencesForDot.firstTimeGuide(); + } } setGuidelines() { @@ -72,53 +84,58 @@ class _GuideLinesScreenState extends State { ), ), ), - IconButton( - icon: Icon(Icons.info_outline, color: Colors.white), - onPressed: () { - showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10), - ), - title: Text( - "FAQ", - style: TextStyle(color: Colors.white,fontWeight: FontWeight.w700,fontSize: 20, - shadows: [Shadow(offset: Offset(1.0, 1.0),blurRadius: 3.0,color: Colors.blue,), - ], + Showcase( + key: infoKey, + description: 'Click here to for more information', + descTextStyle: TextStyle(fontSize: 15), + child: IconButton( + icon: Icon(Icons.info_outline, color: Colors.white), + onPressed: () { + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), ), - ), - content: Container( - width: double.maxFinite, - height: 400, - child: ListView.builder( - padding: EdgeInsets.zero, - itemCount: faqs.length, - itemBuilder: (context, index) { - Map faq = faqs[index]; - return FAQCard( - faqContent: faq["content"], - faqTitle: faq["title"], - ); - }, + title: Text( + "FAQ", + style: TextStyle(color: Colors.white,fontWeight: FontWeight.w700,fontSize: 20, + shadows: [Shadow(offset: Offset(1.0, 1.0),blurRadius: 3.0,color: Colors.blue,), + ], + ), ), - ), - actions: [ - TextButton( - child: Text( - "Close", - style: TextStyle(fontSize: 15), + content: Container( + width: double.maxFinite, + height: 400, + child: ListView.builder( + padding: EdgeInsets.zero, + itemCount: faqs.length, + itemBuilder: (context, index) { + Map faq = faqs[index]; + return FAQCard( + faqContent: faq["content"], + faqTitle: faq["title"], + ); + }, ), - onPressed: () { - Navigator.of(context).pop(); - }, ), - ], - ); - }, - ); - }, + actions: [ + TextButton( + child: Text( + "Close", + style: TextStyle(fontSize: 15), + ), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); + }, + ), ), ], ), diff --git a/lib/new_ui/screens/home_screen/widgets/home_widget.dart b/lib/new_ui/screens/home_screen/widgets/home_widget.dart index 210b4b6d..99bec8f9 100644 --- a/lib/new_ui/screens/home_screen/widgets/home_widget.dart +++ b/lib/new_ui/screens/home_screen/widgets/home_widget.dart @@ -3,33 +3,25 @@ import 'package:carousel_slider/carousel_slider.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; -import 'package:flutter/material.dart'; +import 'package:flutter/material.dart' hide CarouselController,CarouselView; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; +import 'package:showcaseview/showcaseview.dart'; import 'package:tsec_app/models/event_model/event_model.dart'; import 'package:tsec_app/models/user_model/user_model.dart'; import 'package:tsec_app/new_ui/colors.dart'; import 'package:tsec_app/new_ui/screens/AnnouncementScreen/announcementscreen.dart'; -import 'package:tsec_app/new_ui/screens/home_screen/widgets/container_icon_with_label.dart'; -// import 'package:tsec_app/new_ui/screens/home_screen/widgets/expanded_card.dart'; import 'package:tsec_app/provider/auth_provider.dart'; import 'package:tsec_app/provider/event_provider.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:shimmer_animation/shimmer_animation.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:tsec_app/models/student_model/student_model.dart'; -import 'package:tsec_app/models/user_model/user_model.dart'; -import 'package:tsec_app/provider/auth_provider.dart'; import 'package:tsec_app/screens/departmentlist_screen/department_list.dart'; import 'package:tsec_app/new_ui/screens/timetable_screen/widgets/card_display.dart'; -import 'package:tsec_app/utils/notification_type.dart'; -import 'package:tsec_app/utils/timetable_util.dart'; import 'package:date_picker_timeline/date_picker_timeline.dart'; -import 'package:tsec_app/widgets/custom_scaffold.dart'; -import 'package:intl/intl.dart'; + +import '../../../showcasekeys.dart'; extension StringExtension on String { String toTitleCase() { @@ -49,6 +41,7 @@ class HomeWidget extends ConsumerStatefulWidget { } class _HomeWidgetState extends ConsumerState { + List eventList = []; bool shouldLoop = true; late FirebaseMessaging _firebaseMessaging; @@ -177,8 +170,6 @@ class _HomeWidgetState extends ConsumerState { } }); - - } super.initState(); @@ -517,47 +508,51 @@ class _HomeWidgetState extends ConsumerState { ), - //DATE SELECTOR if(_onlyUserLoggedIn) - Padding( - padding: const EdgeInsets.fromLTRB(0, 7, 0, 20), - child: Container( - width: _size.width * 0.9, - // color: Colors.red, - height: 70, - // could have used _size but fuck it whore-licks - child: ClipRRect( - borderRadius: BorderRadius.circular(10.0), - child: Container( - decoration: BoxDecoration( - border: Border.all(color: timePickerBorder, width: 1.0), // Change the color and width as needed - borderRadius: BorderRadius.circular(10.0), - color: timePickerBg, - ), - child: DatePicker( - DateTime.now(), - width: 45, - monthTextStyle: _theme.textTheme.headlineSmall!.copyWith( - fontSize: 11, - color: Colors.grey, - ), - dayTextStyle: _theme.textTheme.headlineSmall!.copyWith( - fontSize: 11, - color: Colors.grey, + Showcase( + key: timeTableKey, + description: 'Select date to view Timetable', + descTextStyle: TextStyle(fontSize: 15), + child: Padding( + padding: const EdgeInsets.fromLTRB(0, 7, 0, 20), + child: Container( + width: _size.width * 0.9, + // color: Colors.red, + height: 70, + // could have used _size but fuck it whore-licks + child: ClipRRect( + borderRadius: BorderRadius.circular(10.0), + child: Container( + decoration: BoxDecoration( + border: Border.all(color: timePickerBorder, width: 1.0), // Change the color and width as needed + borderRadius: BorderRadius.circular(10.0), + color: timePickerBg, ), - dateTextStyle: _theme.textTheme.titleSmall!.copyWith( - fontSize: 11, - color: Colors.grey, + child: DatePicker( + DateTime.now(), + width: 45, + monthTextStyle: _theme.textTheme.headlineSmall!.copyWith( + fontSize: 11, + color: Colors.grey, + ), + dayTextStyle: _theme.textTheme.headlineSmall!.copyWith( + fontSize: 11, + color: Colors.grey, + ), + dateTextStyle: _theme.textTheme.titleSmall!.copyWith( + fontSize: 11, + color: Colors.grey, + ), + initialSelectedDate: DateTime.now(), + selectionColor: oldDateSelectBlue, + selectedTextColor: Colors.white, + onDateChange: (selectedDate) { + ref + .read(dayProvider.notifier) + .update((state) => selectedDate); + }, ), - initialSelectedDate: DateTime.now(), - selectionColor: oldDateSelectBlue, - selectedTextColor: Colors.white, - onDateChange: (selectedDate) { - ref - .read(dayProvider.notifier) - .update((state) => selectedDate); - }, ), ), ), diff --git a/lib/new_ui/screens/main_screen/main_screen.dart b/lib/new_ui/screens/main_screen/main_screen.dart index 6e8e9179..14378607 100644 --- a/lib/new_ui/screens/main_screen/main_screen.dart +++ b/lib/new_ui/screens/main_screen/main_screen.dart @@ -8,6 +8,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; +import 'package:showcaseview/showcaseview.dart'; import 'package:tsec_app/models/user_model/user_model.dart'; import 'package:tsec_app/new_ui/colors.dart'; import 'package:tsec_app/new_ui/screens/attendance_screen/attendance_screen.dart'; @@ -23,6 +24,7 @@ import 'package:tsec_app/new_ui/screens/railway_screen/railway_screen.dart'; import 'package:tsec_app/new_ui/screens/railway_screen/railwayform.dart'; import 'package:tsec_app/new_ui/screens/launch_screen/launch_screen.dart'; import 'package:tsec_app/new_ui/screens/timetable_screen/timetable_screen.dart'; +import 'package:tsec_app/new_ui/showcasekeys.dart'; import 'package:tsec_app/provider/appbar_title_provider.dart'; import 'package:tsec_app/provider/auth_provider.dart'; import 'package:tsec_app/provider/railway_concession_provider.dart'; @@ -30,7 +32,8 @@ import 'package:tsec_app/new_ui/screens/committees_screen/committees_screen.dart import 'package:tsec_app/screens/departmentlist_screen/department_list.dart'; import 'package:tsec_app/screens/notification_screen/notification_screen.dart'; import 'package:tsec_app/new_ui/screens/committees_screen/old_committees_screen.dart'; -import 'package:tsec_app/screens/tpc_screen.dart'; +import 'package:tsec_app/screens/tpc_screen/tpc_screen.dart'; +import 'package:tsec_app/services/auth_service.dart'; import 'package:url_launcher/link.dart'; import '../../../services/sharedprefsfordot.dart'; @@ -50,6 +53,7 @@ class MainScreen extends ConsumerStatefulWidget { class _MainScreenState extends ConsumerState { final GlobalKey _scaffoldKey = new GlobalKey(); + String currentBottomNavPage = "home"; int currentPage = 0; int currentDrawerPage = 0; @@ -71,9 +75,6 @@ class _MainScreenState extends ConsumerState { void initState() { UserModel? user = ref.read(userModelProvider); - - - if (user != null && user.isStudent) { //student login widgetMap = { @@ -143,6 +144,26 @@ class _MainScreenState extends ConsumerState { }); + bool isFirstHome = SharedPreferencesForDot.isFirstHome(); + if(!isFirstHome) { + WidgetsBinding.instance.addPostFrameCallback((_) => + ShowCaseWidget.of(context).startShowCase( + [notificationBellKey, logoutKey]) + ); + SharedPreferencesForDot.firstHomeVisited(); + } + + if(user!= null && user.isStudent){ + bool isFirstTime = SharedPreferencesForDot.isFirstTimeTable(); + if(!isFirstTime){ + WidgetsBinding.instance.addPostFrameCallback((_) => + ShowCaseWidget.of(context).startShowCase( + [timeTableKey]) + ); + SharedPreferencesForDot.firstTimeTableVisited(); + } + } + super.initState(); } @@ -351,18 +372,23 @@ class _MainScreenState extends ConsumerState { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Flexible( - flex: 1, - child: GestureDetector( - onTap: () { - _scaffoldKey.currentState?.openDrawer(); - }, - child: Padding( - padding: const EdgeInsets.all(0), - child: Image.asset( - 'assets/images/new_app_bar/icon_ham.png', - width: 39, - height: 39, + Showcase( + key: logoutKey, + description: 'You can Login from the Drawer Panel', + descTextStyle: TextStyle(fontSize: 15), + child: Flexible( + flex: 1, + child: GestureDetector( + onTap: () { + _scaffoldKey.currentState?.openDrawer(); + }, + child: Padding( + padding: const EdgeInsets.all(0), + child: Image.asset( + 'assets/images/new_app_bar/icon_ham.png', + width: 39, + height: 39, + ), ), ), ), @@ -371,33 +397,38 @@ class _MainScreenState extends ConsumerState { Text(getTitle(data), style: TextStyle( color: Colors.white, fontSize: size.width * 0.055),), Spacer(), - Flexible( - flex: 1, - child: GestureDetector( - onTap: () { - Navigator.push(context, MaterialPageRoute(builder: ( - context) => NotificationScreen(),),); - }, - child: Stack( - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(0, 6, 0, 0), - child: Image.asset( - 'assets/images/new_app_bar/icon_bell.png', - width: 45, - height: 45, + Showcase( + key: notificationBellKey, + descTextStyle: TextStyle(fontSize: 15), + description: 'View Notification from here', + child: Flexible( + flex: 1, + child: GestureDetector( + onTap: () { + Navigator.push(context, MaterialPageRoute(builder: ( + context) => NotificationScreen(),),); + }, + child: Stack( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(0, 6, 0, 0), + child: Image.asset( + 'assets/images/new_app_bar/icon_bell.png', + width: 45, + height: 45, + ), ), - ), - (SharedPreferencesForDot.getNoOfNewNotification() - SharedPreferencesForDot.getNoOfNotification() != 0) ? - Positioned(right: 0,top: 0, - child: Container( - height: 17, - width: 17, - alignment: Alignment.center, - decoration: BoxDecoration(color: oldDateSelectBlue,shape: BoxShape.circle) - ,child: Text("${SharedPreferencesForDot.getNoOfNewNotification() - SharedPreferencesForDot.getNoOfNotification()}",style: TextStyle(color: Colors.white,fontSize: 9),) - ,),) : SizedBox(), - ], + (SharedPreferencesForDot.getNoOfNewNotification() - SharedPreferencesForDot.getNoOfNotification() != 0) ? + Positioned(right: 0,top: 0, + child: Container( + height: 17, + width: 17, + alignment: Alignment.center, + decoration: BoxDecoration(color: oldDateSelectBlue,shape: BoxShape.circle) + ,child: Text("${SharedPreferencesForDot.getNoOfNewNotification() - SharedPreferencesForDot.getNoOfNotification()}",style: TextStyle(color: Colors.white,fontSize: 9),) + ,),) : SizedBox(), + ], + ), ), ), ), diff --git a/lib/new_ui/screens/railway_screen/railway_screen.dart b/lib/new_ui/screens/railway_screen/railway_screen.dart index 9f96ecb6..a9cd6ae8 100644 --- a/lib/new_ui/screens/railway_screen/railway_screen.dart +++ b/lib/new_ui/screens/railway_screen/railway_screen.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:image_picker/image_picker.dart'; import 'package:intl/intl.dart'; +import 'package:showcaseview/showcaseview.dart'; import 'package:tsec_app/models/concession_details_model/concession_details_model.dart'; import 'package:tsec_app/models/concession_request_model/concession_request_model.dart'; // import 'package:tsec_app/models/concession_request_model/concession_request_model.dart'; @@ -21,6 +22,7 @@ import 'package:tsec_app/new_ui/screens/railway_screen/widgets/concession_status import 'package:tsec_app/new_ui/screens/railway_screen/widgets/railway_dropdown_search.dart'; import 'package:tsec_app/new_ui/screens/railway_screen/widgets/railway_dropdown_field.dart'; import 'package:tsec_app/new_ui/screens/railway_screen/widgets/stepperwidget.dart'; +import 'package:tsec_app/new_ui/showcasekeys.dart'; import 'package:tsec_app/provider/auth_provider.dart'; import 'package:tsec_app/provider/concession_provider.dart'; import 'package:tsec_app/provider/concession_request_provider.dart'; @@ -457,6 +459,15 @@ class _RailwayConcessionScreenState ref.read(concessionRequestProvider.notifier).getConcessionRequestData(); }); + bool isFirstRailway = SharedPreferencesForDot.isFirstRailway(); + print("Is Railway applied = $isFirstRailway"); + if(!isFirstRailway) { + WidgetsBinding.instance.addPostFrameCallback((_) => + ShowCaseWidget.of(context).startShowCase([seeGuidleinesKey]) + ); + SharedPreferencesForDot.firstRailwayVisited(); + } + } @@ -712,32 +723,37 @@ class _RailwayConcessionScreenState style: TextStyle(color: Colors.white),),), Positioned(top: 15,child: InkWell( onTap: ()=>Navigator.push(context, MaterialPageRoute(builder: (context)=> GuideLinesScreen(),),), - child: Container( - width: size.width*0.75, - decoration: BoxDecoration( - color: oldDateSelectBlue, - borderRadius: BorderRadius.circular(size.width*0.05), - border: Border.all(color: Colors.white), - boxShadow: [ - BoxShadow(offset: Offset.fromDirection(2),spreadRadius: 2,color: Colors.black,blurRadius: 2) - ], - ), - alignment: Alignment.center, - height: 60, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Row( - children: [ - Image.asset('assets/images/icons/box_imp.png',width: 16,), - SizedBox(width: 10.0,), - Expanded( - child: Text( - futurePassMessage(concessionDetails), - style: const TextStyle(color: Colors.white),), - ) - ], - ), + child: Showcase( + key: seeGuidleinesKey, + description: 'Click here to view guidelines', + descTextStyle: TextStyle(fontSize: 15), + child: Container( + width: size.width*0.75, + decoration: BoxDecoration( + color: oldDateSelectBlue, + borderRadius: BorderRadius.circular(size.width*0.05), + border: Border.all(color: Colors.white), + boxShadow: [ + BoxShadow(offset: Offset.fromDirection(2),spreadRadius: 2,color: Colors.black,blurRadius: 2) + ], + ), + alignment: Alignment.center, + height: 60, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Row( + children: [ + Image.asset('assets/images/icons/box_imp.png',width: 16,), + SizedBox(width: 10.0,), + Expanded( + child: Text( + futurePassMessage(concessionDetails), + style: const TextStyle(color: Colors.white),), + ) + ], + ), + ), ), ), ),), @@ -903,32 +919,37 @@ class _RailwayConcessionScreenState SizedBox(height: 20.0,), GestureDetector( onTap: ()=>Navigator.push(context, MaterialPageRoute(builder: (context)=> GuideLinesScreen(),),), - child: Container( - width: size.width*0.75, - decoration: BoxDecoration( - color: oldDateSelectBlue, - borderRadius: BorderRadius.circular(size.width*0.05), - border: Border.all(color: Colors.white), - boxShadow: [ - BoxShadow(offset: Offset.fromDirection(2),spreadRadius: 2,color: Colors.black,blurRadius: 2) - ], - ), - alignment: Alignment.center, - height: 60, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: - Row( - children: [ - Image.asset('assets/images/icons/box_imp.png',width: 16,), - SizedBox(width: 10.0,), - Expanded( - child: Text( - futurePassMessage(concessionDetails), - style: const TextStyle(color: Colors.white),), - ) - ], - ), + child: Showcase( + key: seeGuidleinesKey, + description: 'Click here to view guidelines', + descTextStyle: TextStyle(fontSize: 15), + child: Container( + width: size.width*0.75, + decoration: BoxDecoration( + color: oldDateSelectBlue, + borderRadius: BorderRadius.circular(size.width*0.05), + border: Border.all(color: Colors.white), + boxShadow: [ + BoxShadow(offset: Offset.fromDirection(2),spreadRadius: 2,color: Colors.black,blurRadius: 2) + ], + ), + alignment: Alignment.center, + height: 60, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: + Row( + children: [ + Image.asset('assets/images/icons/box_imp.png',width: 16,), + SizedBox(width: 10.0,), + Expanded( + child: Text( + futurePassMessage(concessionDetails), + style: const TextStyle(color: Colors.white),), + ) + ], + ), + ), ), ), ), diff --git a/lib/new_ui/showcasekeys.dart b/lib/new_ui/showcasekeys.dart new file mode 100644 index 00000000..237c4231 --- /dev/null +++ b/lib/new_ui/showcasekeys.dart @@ -0,0 +1,8 @@ +import 'package:flutter/material.dart'; + +GlobalKey notificationBellKey = GlobalKey(); +GlobalKey timeTableKey = GlobalKey(); +GlobalKey infoKey = GlobalKey(); +GlobalKey logoutKey = GlobalKey(); +GlobalKey addNotesFloatButton = GlobalKey(); +GlobalKey seeGuidleinesKey = GlobalKey(); \ No newline at end of file diff --git a/lib/screens/tpc_screen.dart b/lib/screens/tpc_screen.dart deleted file mode 100644 index d49ed8ab..00000000 --- a/lib/screens/tpc_screen.dart +++ /dev/null @@ -1,139 +0,0 @@ -import 'dart:convert'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:tsec_app/new_ui/screens/main_screen/widgets/common_basic_appbar.dart'; - -import '../models/company_model/company_model.dart'; -import '../utils/image_assets.dart'; -import '../widgets/custom_app_bar.dart'; -import '../widgets/custom_scaffold.dart'; - -class TPCScreen extends StatefulWidget { - const TPCScreen({Key? key}) : super(key: key); - - @override - _TPCScreenState createState() => _TPCScreenState(); -} - -class _TPCScreenState extends State { - late final Future> _companys; - Future> _getCompanys() async { - final data = await rootBundle.loadString("assets/data/companies.json"); - final json = jsonDecode(data) as List; - return json.map((e) => CompanyModel.fromJson(e)).toList(); - } - - @override - void initState() { - super.initState(); - _companys = _getCompanys(); - } - - List getCompanyCards(List _companys) { - List list = []; - for (var i = 0; i < _companys.length; i++) { - list.add( - Padding( - padding: const EdgeInsets.only( - top: 10, - bottom: 10, - left: 1.25, - right: 1.25, - ), - child: SizedBox( - child: Card( - color: Theme.of(context).colorScheme.primaryContainer, - semanticContainer: true, - clipBehavior: Clip.antiAliasWithSaveLayer, - child: Padding( - padding: const EdgeInsets.all(10.0), - child: Wrap( - children: [ - Padding( - padding: const EdgeInsets.only( - top: 15.0, - left: 15.0, - right: 15.0, - bottom: 15, - ), - child: CachedNetworkImage( - imageUrl: _companys[i].image, - height: 40, - width: 140, - fit: BoxFit.scaleDown, - ), - ), - Divider(color: Colors.grey.withOpacity(0.7)), - Padding( - padding: const EdgeInsets.only( - top: 5.0, - left: 15.0, - right: 15.0, - ), - child: SizedBox( - width: double.infinity, - child: FittedBox( - child: Text(_companys[i].name, - textAlign: TextAlign.center, - // style: const TextStyle( - // fontSize: 16, - // ), - style: - Theme.of(context).textTheme.headlineMedium), - fit: BoxFit.scaleDown, - ), - ), - ), - ], - ), - ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - elevation: 5, - margin: const EdgeInsets.all(10), - ), - ), - ), - ); - } - return list; - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: CommonAppbar(), - body: NestedScrollView( - headerSliverBuilder: (_, __) => [ - // SliverToBoxAdapter( - // child: CustomAppBar( - // title: "Training & Placement Cell", - // image: Image.asset(ImageAssets.tpo), - // ), - // ) - ], - body: FutureBuilder>( - future: _companys, - builder: (context, snapshot) { - if (snapshot.hasData) { - final data = snapshot.data!; - return GridView.count( - // physics: const NeverScrollableScrollPhysics(), - scrollDirection: Axis.vertical, - crossAxisCount: - (MediaQuery.of(context).size.width / 250).ceil(), - children: getCompanyCards(data), - ); - } - return const Center( - child: CircularProgressIndicator(), - ); - }, - ), - ), - ); - } -} diff --git a/lib/screens/tpc_screen/internships.dart b/lib/screens/tpc_screen/internships.dart new file mode 100644 index 00000000..06494ac6 --- /dev/null +++ b/lib/screens/tpc_screen/internships.dart @@ -0,0 +1,92 @@ +import 'package:flutter/material.dart'; +import 'package:tsec_app/new_ui/colors.dart'; +import 'package:tsec_app/new_ui/screens/main_screen/widgets/common_basic_appbar.dart'; + +class InternShips extends StatelessWidget { + const InternShips({super.key}); + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return Scaffold( + + appBar: AppBar( + shadowColor: Colors.transparent, + backgroundColor: Colors.transparent, + toolbarHeight: 80, + title: Text("Internships", + style: Theme.of(context) + .textTheme + .headlineLarge! + .copyWith(fontSize: 15, color: Colors.white), + maxLines: 1, + overflow: TextOverflow.fade,), + centerTitle: true, + iconTheme: IconThemeData(color: Colors.white), + ), + body: ListView.builder( + itemCount: 5, + itemBuilder: (context, index) { + return InternshipCard(); + } + ), + ); + } +} + +class InternshipCard extends StatelessWidget { + const InternshipCard({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.symmetric(horizontal: 15,vertical: 5), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: Theme.of(context).colorScheme.primaryContainer, + ), + child: Theme( + data: ThemeData( + splashColor: Colors.transparent, + highlightColor: Colors.transparent, + ), + child: ExpansionTile( + collapsedTextColor: Colors.white, + collapsedIconColor: Colors.white, + childrenPadding: EdgeInsets.symmetric(horizontal: 15), + textColor: Colors.white, + title: Text("Title",style: TextStyle(fontWeight: FontWeight.bold),), + expandedCrossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("Message can be longer so just writing it long enough to get an over view kitna lamba hoga",style: TextStyle(color: Colors.white),), + SizedBox( + height: 5, + ), + Container(alignment: Alignment.centerRight,child: Text("- Zeeshan",style: TextStyle(color: Colors.white),),), + + SizedBox( + height: 15, + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5) + ), + child: Card( + child: ListTile( + leading: Icon(Icons.picture_as_pdf,), + title: Text("Document Attached"), + trailing: Icon(Icons.link), + ), + ), + ), + + SizedBox( + height: 10, + ), + ], + ), + ), + ); + } +} + diff --git a/lib/screens/tpc_screen/tpc_screen.dart b/lib/screens/tpc_screen/tpc_screen.dart new file mode 100644 index 00000000..f26fcdbd --- /dev/null +++ b/lib/screens/tpc_screen/tpc_screen.dart @@ -0,0 +1,143 @@ +import 'dart:convert'; + +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:tsec_app/new_ui/screens/main_screen/widgets/common_basic_appbar.dart'; + +import '../../models/company_model/company_model.dart'; +import '../../utils/image_assets.dart'; +import '../../widgets/custom_app_bar.dart'; +import '../../widgets/custom_scaffold.dart'; +import 'internships.dart'; + +class TPCScreen extends StatefulWidget { + const TPCScreen({Key? key}) : super(key: key); + + @override + _TPCScreenState createState() => _TPCScreenState(); +} + +class _TPCScreenState extends State { + late final Future> _companys; + Future> _getCompanys() async { + final data = await rootBundle.loadString("assets/data/companies.json"); + final json = jsonDecode(data) as List; + return json.map((e) => CompanyModel.fromJson(e)).toList(); + } + + @override + void initState() { + super.initState(); + _companys = _getCompanys(); + } + + List getCompanyCards(List _companys) { + List list = []; + for (var i = 0; i < _companys.length; i++) { + list.add( + InkWell( + //onTap: ()=> Navigator.push(context, MaterialPageRoute(builder: (context)=> InternShips(),),), + child: Padding( + padding: const EdgeInsets.only( + top: 10, + bottom: 10, + left: 1.25, + right: 1.25, + ), + child: SizedBox( + child: Card( + color: Theme.of(context).colorScheme.primaryContainer, + semanticContainer: true, + clipBehavior: Clip.antiAliasWithSaveLayer, + child: Padding( + padding: const EdgeInsets.all(10.0), + child: Wrap( + children: [ + Padding( + padding: const EdgeInsets.only( + top: 15.0, + left: 15.0, + right: 15.0, + bottom: 15, + ), + child: CachedNetworkImage( + imageUrl: _companys[i].image, + height: 40, + width: 140, + fit: BoxFit.scaleDown, + ), + ), + Divider(color: Colors.grey.withOpacity(0.7)), + Padding( + padding: const EdgeInsets.only( + top: 5.0, + left: 15.0, + right: 15.0, + ), + child: SizedBox( + width: double.infinity, + child: FittedBox( + child: Text(_companys[i].name, + textAlign: TextAlign.center, + // style: const TextStyle( + // fontSize: 16, + // ), + style: + Theme.of(context).textTheme.headlineMedium), + fit: BoxFit.scaleDown, + ), + ), + ), + ], + ), + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + elevation: 5, + margin: const EdgeInsets.all(10), + ), + ), + ), + ), + ); + } + return list; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: CommonAppbar(), + body: NestedScrollView( + headerSliverBuilder: (_, __) => [ + // SliverToBoxAdapter( + // child: CustomAppBar( + // title: "Training & Placement Cell", + // image: Image.asset(ImageAssets.tpo), + // ), + // ) + ], + body: FutureBuilder>( + future: _companys, + builder: (context, snapshot) { + if (snapshot.hasData) { + final data = snapshot.data!; + return GridView.count( + // physics: const NeverScrollableScrollPhysics(), + scrollDirection: Axis.vertical, + crossAxisCount: + (MediaQuery.of(context).size.width / 250).ceil(), + children: getCompanyCards(data), + ); + } + return const Center( + child: CircularProgressIndicator(), + ); + }, + ), + ), + ); + } +} diff --git a/lib/services/sharedprefsfordot.dart b/lib/services/sharedprefsfordot.dart index 81154a56..14340378 100644 --- a/lib/services/sharedprefsfordot.dart +++ b/lib/services/sharedprefsfordot.dart @@ -62,4 +62,53 @@ class SharedPreferencesForDot{ return prefs.getBool("railwayDot") ?? false; } + + + + + + + + + + // ShowCase Prefs + static bool isFirstHome(){ + return prefs.getBool('firstHome') ?? false; + } + + static firstHomeVisited(){ + prefs.setBool('firstHome',true); + } + + static bool isFirstRailway(){ + return prefs.getBool('firstRailway') ?? false; + } + + static void firstRailwayVisited() async{ + await prefs.setBool('firstRailway',true); + } + + static bool isFirstTimeTable(){ + return prefs.getBool('firstTime') ?? false; + } + + static void firstTimeTableVisited() async{ + await prefs.setBool('firstTime',true); + } + + static bool isFirstGuide(){ + return prefs.getBool('firstGuide') ?? false; + } + + static void firstTimeGuide() async{ + await prefs.setBool('firstGuide',true); + } + + static bool isNotesVisited(){ + return prefs.getBool('notesVisited') ?? false; + } + + static void visitNotes()async{ + await prefs.setBool('notesVisited',true); + } } \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index f4bf5f81..165cddd7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -892,10 +892,10 @@ packages: dependency: "direct main" description: name: path_provider - sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" path_provider_android: dependency: transitive description: @@ -1120,6 +1120,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0+1" + showcaseview: + dependency: "direct main" + description: + name: showcaseview + sha256: f236c1f44b286e1ba888f8701adca067af92c33e29ea937d0fe9b4a29d4cd41e + url: "https://pub.dev" + source: hosted + version: "3.0.0" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index ffb7d8cc..fff9e36b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,6 +25,7 @@ environment: dependencies: + showcaseview: ^3.0.0 cached_network_image: ^3.2.3 carousel_slider: ^4.1.1 cloud_firestore: ^4.2.0 @@ -48,7 +49,7 @@ dependencies: json_annotation: ^4.6.0 lottie: ^2.3.2 open_file: ^3.2.1 - path_provider: ^2.0.12 + path_provider: ^2.1.4 permission_handler: ^10.2.0 shared_preferences: ^2.0.15 textfield_search: ^0.10.0 From e29ccc4be676033a4539eaffd1621629451b074e Mon Sep 17 00:00:00 2001 From: SayedZeeshanHyder Date: Tue, 26 Nov 2024 18:59:10 +0530 Subject: [PATCH 2/2] Added AaddingSubjectScreen , Fixed divide by Zero and other attendance bugs, Added Reset Password Screen, Made toUpperCase to railway form fields --- .../attendance_screen/add_attendance.dart | 251 ++++++++++++++++++ .../attendance_screen/attendance_screen.dart | 60 ++++- .../widgets/attendanceservice.dart | 2 +- .../login_screen/ResetPasswordScreen.dart | 121 +++++++++ .../screens/login_screen/login_screen.dart | 24 +- .../screens/railway_screen/railwayform.dart | 28 +- 6 files changed, 442 insertions(+), 44 deletions(-) create mode 100644 lib/new_ui/screens/attendance_screen/add_attendance.dart create mode 100644 lib/new_ui/screens/login_screen/ResetPasswordScreen.dart diff --git a/lib/new_ui/screens/attendance_screen/add_attendance.dart b/lib/new_ui/screens/attendance_screen/add_attendance.dart new file mode 100644 index 00000000..0d3f8a45 --- /dev/null +++ b/lib/new_ui/screens/attendance_screen/add_attendance.dart @@ -0,0 +1,251 @@ +import 'package:flutter/material.dart'; +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}); + + @override + State createState() => _AddAttendanceScreenState(); +} + +class _AddAttendanceScreenState extends State { + + late TextEditingController subjectController; + late TextEditingController totalLecturesController; + late TextEditingController attendedLecturesController; + + @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():""); + } + + TextStyle inputTextFieldStyle = TextStyle(color: Colors.white,); + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.transparent, + 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(), + ], + ), + body: ListView( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 20), + child: Text("Add a Subject",style: TextStyle(color: Colors.white,fontSize: 23,fontWeight: FontWeight.bold),), + ), + + SizedBox( + 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),), + ), + + SizedBox( + height: size.height*0.01, + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 10), + decoration: BoxDecoration( + color: commonbgL4ightblack, + borderRadius: BorderRadius.circular(5) + ), + margin: EdgeInsets.symmetric(horizontal: 20), + child: TextField( + style: inputTextFieldStyle, + controller: subjectController, + decoration: InputDecoration( + border: InputBorder.none, + ), + ), + ), + + + SizedBox( + 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),), + ), + + SizedBox( + height: size.height*0.01, + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 10), + decoration: BoxDecoration( + color: commonbgL4ightblack, + borderRadius: BorderRadius.circular(5) + ), + margin: EdgeInsets.symmetric(horizontal: 20), + child: TextField( + style: inputTextFieldStyle, + keyboardType: TextInputType.number, + controller: attendedLecturesController, + decoration: InputDecoration( + border: InputBorder.none, + ), + ), + ), + + + SizedBox( + 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),), + ), + + SizedBox( + height: size.height*0.01, + ), + Container( + padding: EdgeInsets.symmetric(horizontal: 10), + decoration: BoxDecoration( + color: commonbgL4ightblack, + borderRadius: BorderRadius.circular(5) + ), + margin: EdgeInsets.symmetric(horizontal: 20), + child: TextField( + style: inputTextFieldStyle, + keyboardType: TextInputType.number, + controller: totalLecturesController, + decoration: InputDecoration( + border: InputBorder.none, + ), + ), + ), + + SizedBox( + height: size.height*0.325, + ), + + InkWell( + onTap: () async{ + bool isSubjectAdded = await addSubject(); + if(isSubjectAdded){ + Navigator.pop(context); + showSnackBarMessage("Subject Added Successfully", Colors.green); + } + }, + splashFactory: NoSplash.splashFactory, + child: Container( + alignment: Alignment.center, + height: 45, + width: size.width, + margin: EdgeInsets.symmetric(horizontal: 20), + decoration: BoxDecoration( + color: cardcolorblue, + borderRadius: BorderRadius.circular(5), + ), + child: Text("Send Mail",style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold),), + ), + ), + ], + ), + ); + } + + 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); + return false; + } + String subjectName = subjectController.text; + int totalLectures = + int.parse(totalLecturesController.text); + int attendedLectures = + int.parse(attendedLecturesController.text); + + 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); + return false; + } + else{ + Map updatedSubject = { + "subject_name": subjectName, + "total": totalLectures, + "present": attendedLectures + }; + 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,),); + } +} diff --git a/lib/new_ui/screens/attendance_screen/attendance_screen.dart b/lib/new_ui/screens/attendance_screen/attendance_screen.dart index dd131857..94ec4f30 100644 --- a/lib/new_ui/screens/attendance_screen/attendance_screen.dart +++ b/lib/new_ui/screens/attendance_screen/attendance_screen.dart @@ -11,6 +11,7 @@ import 'package:tsec_app/provider/auth_provider.dart'; import 'package:tsec_app/services/sharedprefsfordot.dart'; import '../../showcasekeys.dart'; +import 'add_attendance.dart'; class AttendanceScreen extends StatefulWidget { const AttendanceScreen({super.key}); @@ -183,11 +184,30 @@ class _AttendanceScreenState extends State { itemCount: attendanceList.length, itemBuilder: (context, index) { var attendanceInfo = attendanceList[index]; + print(attendanceInfo); return GestureDetector( onTap: () { // Show dialog with current values for modification - showDialog( + + Navigator.push(context, PageRouteBuilder( + pageBuilder: (context, animation, secondaryAnimation) => + AddAttendanceScreen(isUpdate: true,index: index,attendanceList: attendanceList,updatedSubject: attendanceInfo,), + transitionsBuilder: (context, animation, secondaryAnimation, child) { + const begin = Offset(0.0, 1.0); // Start from bottom + const end = Offset.zero; // Move to top (center) + const curve = Curves.easeInOut; + + var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); + var offsetAnimation = animation.drive(tween); + + return SlideTransition( + position: offsetAnimation, + child: child, + ); + }, + ),); + /* showDialog( context: context, builder: (BuildContext context) { TextEditingController subjectNameController = @@ -364,7 +384,8 @@ class _AttendanceScreenState extends State { } isEnabled = false; - /*DocumentSnapshot doc = await FirebaseFirestore.instance + */ + /*DocumentSnapshot doc = await FirebaseFirestore.instance .collection("Attendance") .doc(FirebaseAuth.instance.currentUser!.uid) .get(); @@ -390,6 +411,7 @@ class _AttendanceScreenState extends State { .update({'attendance': attendanceList}); } }*/ + /* }, child: Text('Update', style: TextStyle(color: Colors.blue)), @@ -399,7 +421,8 @@ class _AttendanceScreenState extends State { AttendanceService.deleteSubject( attendanceList, index); - /*DocumentSnapshot doc = await FirebaseFirestore.instance + */ + /*DocumentSnapshot doc = await FirebaseFirestore.instance .collection("Attendance") .doc(FirebaseAuth.instance.currentUser!.uid) .get(); @@ -417,6 +440,7 @@ class _AttendanceScreenState extends State { .update({'attendance': attendanceList}); } _fetchAndSetAttendance();*/ + /* Navigator.of(context).pop(); }, child: Text('Delete', @@ -432,7 +456,7 @@ class _AttendanceScreenState extends State { ], ); }, - ); + );*/ }, child: Card( child: Container( @@ -491,7 +515,7 @@ class _AttendanceScreenState extends State { height: 10, ), LinearProgressIndicator( - value: attendanceInfo['total'] + value: attendanceInfo['total'] != 0 ? attendanceInfo['present'] / attendanceInfo['total'] : 0, @@ -596,7 +620,7 @@ class _AttendanceScreenState extends State { descTextStyle: TextStyle(fontSize: 15), child: FloatingActionButton( onPressed: () { - showDialog( + /*showDialog( context: context, builder: (BuildContext context) { TextEditingController subjectNameController = @@ -740,7 +764,8 @@ class _AttendanceScreenState extends State { "present": attendedLectures }; AttendanceService.addSubject(updatedSubject); - /*FirebaseFirestore.instance + */ + /*FirebaseFirestore.instance .collection("Attendance") .doc(FirebaseAuth.instance.currentUser!.uid) .set({ @@ -751,6 +776,7 @@ class _AttendanceScreenState extends State { }]) }, SetOptions(merge: true)); _fetchAndSetAttendance();*/ + /* Navigator.of(context).pop(); } }, @@ -759,7 +785,25 @@ class _AttendanceScreenState extends State { ], ); }, - ); + );*/ + + Navigator.push(context, PageRouteBuilder( + pageBuilder: (context, animation, secondaryAnimation) => + AddAttendanceScreen(isUpdate: false,), + transitionsBuilder: (context, animation, secondaryAnimation, child) { + const begin = Offset(0.0, 1.0); // Start from bottom + const end = Offset.zero; // Move to top (center) + const curve = Curves.easeInOut; + + var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve)); + var offsetAnimation = animation.drive(tween); + + return SlideTransition( + position: offsetAnimation, + child: child, + ); + }, + ),); }, shape: CircleBorder( side: BorderSide( diff --git a/lib/new_ui/screens/attendance_screen/widgets/attendanceservice.dart b/lib/new_ui/screens/attendance_screen/widgets/attendanceservice.dart index 169861fd..2979a096 100644 --- a/lib/new_ui/screens/attendance_screen/widgets/attendanceservice.dart +++ b/lib/new_ui/screens/attendance_screen/widgets/attendanceservice.dart @@ -27,7 +27,7 @@ class AttendanceService{ await firestore.doc(auth.currentUser!.uid).set({"attendance":attendanceList}); } - static addSubject(Map updatedSubject)async{ + static Future addSubject(Map updatedSubject)async{ List attendanceList; final get = await firestore.doc(auth.currentUser!.uid).get(); if(get.exists){ diff --git a/lib/new_ui/screens/login_screen/ResetPasswordScreen.dart b/lib/new_ui/screens/login_screen/ResetPasswordScreen.dart new file mode 100644 index 00000000..3743ab8b --- /dev/null +++ b/lib/new_ui/screens/login_screen/ResetPasswordScreen.dart @@ -0,0 +1,121 @@ +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 '../../../provider/auth_provider.dart'; +import '../../../utils/custom_snackbar.dart'; + +class ResetPasswordScreen extends ConsumerStatefulWidget { + + @override + _ResetPasswordScreenState createState() => _ResetPasswordScreenState(); +} + +class _ResetPasswordScreenState extends ConsumerState { + String emailController = ""; + + @override + Widget build(BuildContext context) { + Size size = MediaQuery.of(context).size; + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.transparent, + foregroundColor: Colors.white, + centerTitle: true, + ), + 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),), + ), + 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),), + ), + + 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" + ), + ), + ), + + Spacer(), + + InkWell( + splashFactory: NoSplash.splashFactory, + 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), + decoration: BoxDecoration( + color: emailController.isNotEmpty ? cardcolorblue : Colors.grey.shade800, + borderRadius: BorderRadius.circular(5), + ), + child: Text("Send Mail",style: TextStyle(color: Colors.white,fontWeight: FontWeight.bold),), + ), + ), + SizedBox( + height: 20, + ), + ], + ), + ); + } + + Future forgotPassword(String email) async { + if (email.trim() != "") { + try { + await ref + .watch(authProvider.notifier) + .resetPassword(email.trim(), context); + + showSnackBar(context, + 'Check your inbox and click on the link in password reset email'); + } on FirebaseAuthException catch (e) { + if (e.code == 'user-not-found') { + showSnackBar(context, 'No user found corresponding to that email.'); + } else + showSnackBar(context, e.message.toString()); + return null; + } + } else { + showSnackBar( + context, 'Enter the email to reset password of that account'); + } + } +} diff --git a/lib/new_ui/screens/login_screen/login_screen.dart b/lib/new_ui/screens/login_screen/login_screen.dart index 70838f32..979a1434 100644 --- a/lib/new_ui/screens/login_screen/login_screen.dart +++ b/lib/new_ui/screens/login_screen/login_screen.dart @@ -6,6 +6,7 @@ import 'package:go_router/go_router.dart'; import 'package:tsec_app/models/notification_model/notification_model.dart'; import 'package:tsec_app/models/student_model/student_model.dart'; import 'package:tsec_app/models/user_model/user_model.dart'; +import 'package:tsec_app/new_ui/screens/login_screen/ResetPasswordScreen.dart'; import 'package:tsec_app/provider/auth_provider.dart'; import 'package:tsec_app/provider/firebase_provider.dart'; import 'package:tsec_app/provider/notification_provider.dart'; @@ -46,27 +47,7 @@ class _LoginScreenState extends ConsumerState { super.dispose(); } - Future forgotPassword() async { - if (_emailTextEditingController.text.trim() != "") { - try { - await ref - .watch(authProvider.notifier) - .resetPassword(_emailTextEditingController.text.trim(), context); - showSnackBar(context, - 'Check your inbox and click on the link in password reset email'); - } on FirebaseAuthException catch (e) { - if (e.code == 'user-not-found') { - showSnackBar(context, 'No user found corresponding to that email.'); - } else - showSnackBar(context, e.message.toString()); - return null; - } - } else { - showSnackBar( - context, 'Enter the email to reset password of that account'); - } - } Future login() async { if (_formKey.currentState!.validate()) { @@ -288,7 +269,8 @@ class _LoginScreenState extends ConsumerState { borderRadius: BorderRadius.circular( 30), // Set the desired border radius onTap: () async { - forgotPassword(); + //forgotPassword(); + Navigator.push(context, MaterialPageRoute(builder: (context)=> ResetPasswordScreen(),),); }, highlightShape: BoxShape.rectangle, // Custom shape diff --git a/lib/new_ui/screens/railway_screen/railwayform.dart b/lib/new_ui/screens/railway_screen/railwayform.dart index 2dc11ca8..4ca4217b 100644 --- a/lib/new_ui/screens/railway_screen/railwayform.dart +++ b/lib/new_ui/screens/railway_screen/railwayform.dart @@ -371,23 +371,23 @@ class _RailwayForm extends ConsumerState { statusMessage: "", ageMonths: int.parse(_ageMonths), ageYears: int.parse(_ageYears), - duration: duration ?? "Monthly", - branch: student.branch, - gender: gender ?? "Male", - firstName: firstNameController.text, - gradyear: student.gradyear, - middleName: middleNameController.text, - lastName: lastNameController.text, - idCardURL: idCardURL, - previousPassURL: previousPassURL, - from: homeStation, - to: toStation, + duration: duration?.toUpperCase() ?? "Monthly".toUpperCase(), + branch: student.branch.toUpperCase(), + gender: gender?.toUpperCase() ?? "Male".toUpperCase(), + firstName: firstNameController.text.toUpperCase(), + gradyear: student.gradyear.toUpperCase(), + middleName: middleNameController.text.toUpperCase(), + lastName: lastNameController.text.toUpperCase(), + idCardURL: idCardURL.toUpperCase(), + previousPassURL: previousPassURL.toUpperCase(), + from: homeStation.toUpperCase(), + to: toStation.toUpperCase(), lastPassIssued: null, - address: addressController.text, + address: addressController.text.toUpperCase(), dob: _selectedDate ?? DateTime.now(), phoneNum: int.parse(phoneNumController.text), - travelLane: travelLane ?? "Central", - type: travelClass ?? "I", + travelLane: travelLane?.toUpperCase() ?? "Central".toUpperCase(), + type: travelClass?.toUpperCase() ?? "I".toUpperCase(), ); if (_formKey.currentState!.validate() &&