From 4cb280cb96d69eff653479a4665cf520e74b6c6b Mon Sep 17 00:00:00 2001 From: SayedZeeshanHyder Date: Sat, 6 Jul 2024 13:47:00 +0530 Subject: [PATCH 1/4] Commit Before Changing Schema --- .../railway_screen/railway_screen.dart | 3 +- .../railway_screen/widgets/stepperwidget.dart | 34 +++++++- lib/services/concession_service.dart | 3 +- pubspec.lock | 84 +++++++++---------- 4 files changed, 72 insertions(+), 52 deletions(-) diff --git a/lib/new_ui/screens/railway_screen/railway_screen.dart b/lib/new_ui/screens/railway_screen/railway_screen.dart index a3d328f6..fa531e99 100644 --- a/lib/new_ui/screens/railway_screen/railway_screen.dart +++ b/lib/new_ui/screens/railway_screen/railway_screen.dart @@ -468,6 +468,7 @@ class _RailwayConcessionScreenState return false; } } + print("Conession Request In Railway Screen ${concessionRequestData!.toJson()}"); return currState != "" ? Center( child: Column( @@ -501,7 +502,7 @@ class _RailwayConcessionScreenState crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox(height: 20), - StatusStepper(concessionStatus: concessionDetails?.status == null ? "" : concessionDetails!.status), + StatusStepper(concessionStatus: concessionDetails?.status == null ? "" : concessionDetails!.status, concessionRequestData: concessionRequestData,), // SizedBox(height: 10), if(concessionRequestData!=null && concessionRequestData.statusMessage!=null && concessionRequestData.status=="rejected" && concessionRequestData.statusMessage!="") Container( diff --git a/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart b/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart index e864fbb1..3042362b 100644 --- a/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart +++ b/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart @@ -1,11 +1,13 @@ import 'package:easy_stepper/easy_stepper.dart'; import 'package:flutter/material.dart'; +import 'package:tsec_app/models/concession_request_model/concession_request_model.dart'; import 'package:tsec_app/new_ui/colors.dart'; class StatusStepper extends StatelessWidget { final String concessionStatus; + final concessionRequestData; - StatusStepper({required this.concessionStatus}); + StatusStepper({required this.concessionStatus,required this.concessionRequestData}); @override Widget build(BuildContext context) { @@ -15,6 +17,7 @@ class StatusStepper extends StatelessWidget { color: Colors.transparent, width: size.width * 0.9, child: EasyStepper( + enableStepTapping: false, finishedStepBorderColor: Colors.white, activeStepBorderColor: Colors.white, activeStepBorderType: BorderType.normal, @@ -23,7 +26,7 @@ class StatusStepper extends StatelessWidget { activeStepBackgroundColor: Colors.white, lineStyle: LineStyle( - lineLength: size.width * 0.2, + lineLength: size.width * 0.1, finishedLineColor: Colors.white, lineType: LineType.normal, unreachedLineColor: Colors.grey.shade600, @@ -41,6 +44,8 @@ class StatusStepper extends StatelessWidget { getFirstStep(), getMiddleStep(), getFinalStep(), + if(concessionRequestData != null) + getCollectedStep(), ], ), ); @@ -100,6 +105,25 @@ class StatusStepper extends StatelessWidget { ); } + EasyStep getCollectedStep() { + if (concessionRequestData!.toJson().containsKey("passCollected")) { + print("HELLO"); + return EasyStep( + customStep: getStatusCircle(0), + title: "Rejected", + ); + } else if (concessionStatus == "serviced") { + return EasyStep( + customStep: getStatusCircle(0), + title: "Approved", + ); + } + return EasyStep( + customStep: getStatusCircle(-1), + title: "Approval", + ); + } + EasyStep getMiddleStep() { if (concessionStatus == "unserviced") { return EasyStep( @@ -133,7 +157,11 @@ class StatusStepper extends StatelessWidget { } int getActiveStep(){ - if(concessionStatus == "serviced" || concessionStatus == "rejected") {return 2;} + if(concessionRequestData != null && concessionRequestData!.toJson().containsKey("passCollected")){ + print("Returning 3"); + return 3; + } + else if(concessionStatus == "serviced" || concessionStatus == "rejected") {return 2;} else if(concessionStatus == "unserviced") {return 1;} else {return 0;} } diff --git a/lib/services/concession_service.dart b/lib/services/concession_service.dart index 8f1929cf..19cd1b08 100644 --- a/lib/services/concession_service.dart +++ b/lib/services/concession_service.dart @@ -80,8 +80,7 @@ class ConcessionService { print('concession requests are being fetched '); print(value.data()); if (value.exists) { - print("11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"); - print("if"); + print("Concession Request Present"); var detailsMap = value.data() as Map; ConcessionRequestModel concessionRequestData = ConcessionRequestModel.fromJson(detailsMap); diff --git a/pubspec.lock b/pubspec.lock index 6a5388f6..8063edd6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -93,10 +93,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.1" build_resolvers: dependency: transitive description: @@ -109,18 +109,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "644dc98a0f179b872f612d3eb627924b578897c629788e858157fa5e704ca0c7" + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" url: "https://pub.dev" source: hosted - version: "2.4.11" + version: "2.4.9" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: e3c79f69a64bdfcd8a776a3c28db4eb6e3fb5356d013ae5eb2e52007706d5dbe + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" url: "https://pub.dev" source: hosted - version: "7.3.1" + version: "7.3.0" built_collection: dependency: transitive description: @@ -546,10 +546,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: c6b0b4c05c458e1c01ad9bcc14041dd7b1f6783d487be4386f793f47a8a4d03e + sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f" url: "https://pub.dev" source: hosted - version: "2.0.20" + version: "2.0.19" flutter_riverpod: dependency: "direct main" description: @@ -652,10 +652,10 @@ packages: dependency: transitive description: name: image_picker_android - sha256: "4161e1f843d8480d2e9025ee22411778c3c9eb7e40076dcf2da23d8242b7b51c" + sha256: "0f57fee1e8bfadf8cc41818bbcd7f72e53bb768a54d9496355d5e8a5681a19f1" url: "https://pub.dev" source: hosted - version: "0.8.12+3" + version: "0.8.12+1" image_picker_for_web: dependency: transitive description: @@ -748,26 +748,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.4" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.0.1" linkify: dependency: transitive description: @@ -820,10 +820,10 @@ packages: dependency: transitive description: name: meta - sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.12.0" + version: "1.11.0" mime: dependency: transitive description: @@ -876,10 +876,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: bca87b0165ffd7cdb9cad8edd22d18d2201e886d9a9f19b4fb3452ea7df3a72a + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d url: "https://pub.dev" source: hosted - version: "2.2.6" + version: "2.2.4" path_provider_foundation: dependency: transitive description: @@ -1028,10 +1028,10 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: "93d0ec9dd902d85f326068e6a899487d1f65ffcd5798721a95330b26c8131577" + sha256: "1ee8bf911094a1b592de7ab29add6f826a7331fb854273d55918693d5364a1f2" url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.2.2" shared_preferences_foundation: dependency: transitive description: @@ -1084,10 +1084,10 @@ packages: dependency: transitive description: name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.4" sky_engine: dependency: transitive description: flutter @@ -1209,10 +1209,10 @@ packages: dependency: transitive description: name: test_api - sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.0" + version: "0.6.1" textfield_search: dependency: "direct main" description: @@ -1257,10 +1257,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: ceb2625f0c24ade6ef6778d1de0b2e44f2db71fded235eb52295247feba8c5cf + sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9" url: "https://pub.dev" source: hosted - version: "6.3.3" + version: "6.3.2" url_launcher_ios: dependency: transitive description: @@ -1329,10 +1329,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.1" + version: "13.0.0" watcher: dependency: transitive description: @@ -1349,22 +1349,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.5.1" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "24301d8c293ce6fe327ffe6f59d8fd8834735f0ec36e4fd383ec7ff8a64aa078" - url: "https://pub.dev" - source: hosted - version: "0.1.5" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: a2d56211ee4d35d9b344d9d4ce60f362e4f5d1aafb988302906bd732bc731276 + sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "2.4.5" webview_flutter: dependency: "direct main" description: @@ -1377,10 +1369,10 @@ packages: dependency: "direct main" description: name: webview_flutter_android - sha256: f42447ca49523f11d8f70abea55ea211b3cafe172dd7a0e7ac007bb35dd356dc + sha256: "0d21cfc3bfdd2e30ab2ebeced66512b91134b39e72e97b43db2d47dda1c4e53a" url: "https://pub.dev" source: hosted - version: "3.16.4" + version: "3.16.3" webview_flutter_platform_interface: dependency: transitive description: @@ -1401,10 +1393,10 @@ packages: dependency: transitive description: name: win32 - sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 + sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" url: "https://pub.dev" source: hosted - version: "5.5.1" + version: "5.5.0" xdg_directories: dependency: transitive description: @@ -1430,5 +1422,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" - flutter: ">=3.22.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" From 7dfaa74e517c3014cc0e24434c4aa3f019cc1074 Mon Sep 17 00:00:00 2001 From: SayedZeeshanHyder Date: Sat, 6 Jul 2024 14:22:33 +0530 Subject: [PATCH 2/4] Added Fourth Stepper --- .../concession_request_model.dart | 10 ++++-- .../concession_request_model.g.dart | 2 ++ .../railway_screen/railway_screen.dart | 1 - .../railway_screen/widgets/stepperwidget.dart | 31 ++++++++++--------- lib/services/concession_service.dart | 5 +-- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/lib/models/concession_request_model/concession_request_model.dart b/lib/models/concession_request_model/concession_request_model.dart index 7db9f67c..28039e1f 100644 --- a/lib/models/concession_request_model/concession_request_model.dart +++ b/lib/models/concession_request_model/concession_request_model.dart @@ -15,8 +15,11 @@ class ConcessionRequestModel { final DateTime time; @JsonKey(name: "uid") final String uid; + @JsonKey(name: "passCollected") + final Map? passCollected; - ConcessionRequestModel({ + ConcessionRequestModel( { + this.passCollected, this.passNum, required this.status, required this.statusMessage, @@ -24,8 +27,9 @@ class ConcessionRequestModel { required this.uid, }); - factory ConcessionRequestModel.fromJson(Map json) => - _$ConcessionRequestModelFromJson(json); + factory ConcessionRequestModel.fromJson(Map json) { + return _$ConcessionRequestModelFromJson(json); + } Map toJson() => _$ConcessionRequestModelToJson(this); } diff --git a/lib/models/concession_request_model/concession_request_model.g.dart b/lib/models/concession_request_model/concession_request_model.g.dart index cb898cf4..735fa61d 100644 --- a/lib/models/concession_request_model/concession_request_model.g.dart +++ b/lib/models/concession_request_model/concession_request_model.g.dart @@ -16,6 +16,7 @@ ConcessionRequestModel _$ConcessionRequestModelFromJson( time: const TimestampConverter() .fromJson(json['time'] as Timestamp), uid: json['uid'] as String, + passCollected: json['passCollected'] ); Map _$ConcessionRequestModelToJson( @@ -27,4 +28,5 @@ Map _$ConcessionRequestModelToJson( 'time': instance.time, 'uid': instance.uid, 'notificationTime': const TimestampConverter().toJson(instance.time), + 'passCollected':instance.passCollected, }; diff --git a/lib/new_ui/screens/railway_screen/railway_screen.dart b/lib/new_ui/screens/railway_screen/railway_screen.dart index fa531e99..69249b0c 100644 --- a/lib/new_ui/screens/railway_screen/railway_screen.dart +++ b/lib/new_ui/screens/railway_screen/railway_screen.dart @@ -468,7 +468,6 @@ class _RailwayConcessionScreenState return false; } } - print("Conession Request In Railway Screen ${concessionRequestData!.toJson()}"); return currState != "" ? Center( child: Column( diff --git a/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart b/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart index 3042362b..d0c5e1cb 100644 --- a/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart +++ b/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart @@ -5,12 +5,13 @@ import 'package:tsec_app/new_ui/colors.dart'; class StatusStepper extends StatelessWidget { final String concessionStatus; - final concessionRequestData; + final ConcessionRequestModel? concessionRequestData; StatusStepper({required this.concessionStatus,required this.concessionRequestData}); @override Widget build(BuildContext context) { + print("Inside Stepper ${concessionRequestData!.toJson()}"); Size size = MediaQuery.of(context).size; return Container( alignment: Alignment.center, @@ -106,21 +107,22 @@ class StatusStepper extends StatelessWidget { } EasyStep getCollectedStep() { - if (concessionRequestData!.toJson().containsKey("passCollected")) { - print("HELLO"); - return EasyStep( - customStep: getStatusCircle(0), - title: "Rejected", - ); - } else if (concessionStatus == "serviced") { - return EasyStep( - customStep: getStatusCircle(0), - title: "Approved", - ); + if (concessionRequestData!=null && concessionRequestData?.passCollected != null ) { + if(concessionRequestData!.passCollected!['collected'] == 1) { + return EasyStep( + customStep: getStatusCircle(0), + title: "Collected", + ); + }else{ + return EasyStep( + customStep: getStatusCircle(1), + title: "Not Collected", + ); + } } return EasyStep( customStep: getStatusCircle(-1), - title: "Approval", + title: "Collect", ); } @@ -157,7 +159,8 @@ class StatusStepper extends StatelessWidget { } int getActiveStep(){ - if(concessionRequestData != null && concessionRequestData!.toJson().containsKey("passCollected")){ + print(concessionRequestData!.toJson()); + if(concessionRequestData!=null && concessionRequestData?.passCollected != null && concessionRequestData!.passCollected!['collected'] == 1){ print("Returning 3"); return 3; } diff --git a/lib/services/concession_service.dart b/lib/services/concession_service.dart index 19cd1b08..384541a5 100644 --- a/lib/services/concession_service.dart +++ b/lib/services/concession_service.dart @@ -78,13 +78,14 @@ class ConcessionService { try { var value = await concessionRequestCollection.doc(user!.uid).get(); print('concession requests are being fetched '); - print(value.data()); + if (value.exists) { print("Concession Request Present"); var detailsMap = value.data() as Map; + print(detailsMap); ConcessionRequestModel concessionRequestData = ConcessionRequestModel.fromJson(detailsMap); - + print("Concession Request Data Got = ${concessionRequestData.toJson()}"); return concessionRequestData; } else { From 2ff9a8931a661dba8e5d2b602512fb61b11f0018 Mon Sep 17 00:00:00 2001 From: SayedZeeshanHyder Date: Sat, 6 Jul 2024 22:46:39 +0530 Subject: [PATCH 3/4] Finalized the Last Step of Stepper --- lib/new_ui/screens/railway_screen/railway_screen.dart | 1 + .../screens/railway_screen/widgets/stepperwidget.dart | 9 +++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/new_ui/screens/railway_screen/railway_screen.dart b/lib/new_ui/screens/railway_screen/railway_screen.dart index 69249b0c..fb29a228 100644 --- a/lib/new_ui/screens/railway_screen/railway_screen.dart +++ b/lib/new_ui/screens/railway_screen/railway_screen.dart @@ -468,6 +468,7 @@ class _RailwayConcessionScreenState return false; } } + print(concessionRequestData); return currState != "" ? Center( child: Column( diff --git a/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart b/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart index d0c5e1cb..2878eaee 100644 --- a/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart +++ b/lib/new_ui/screens/railway_screen/widgets/stepperwidget.dart @@ -11,7 +11,6 @@ class StatusStepper extends StatelessWidget { @override Widget build(BuildContext context) { - print("Inside Stepper ${concessionRequestData!.toJson()}"); Size size = MediaQuery.of(context).size; return Container( alignment: Alignment.center, @@ -45,8 +44,7 @@ class StatusStepper extends StatelessWidget { getFirstStep(), getMiddleStep(), getFinalStep(), - if(concessionRequestData != null) - getCollectedStep(), + getCollectedStep(), ], ), ); @@ -108,7 +106,7 @@ class StatusStepper extends StatelessWidget { EasyStep getCollectedStep() { if (concessionRequestData!=null && concessionRequestData?.passCollected != null ) { - if(concessionRequestData!.passCollected!['collected'] == 1) { + if(concessionRequestData!.passCollected!['collected'] == "1") { return EasyStep( customStep: getStatusCircle(0), title: "Collected", @@ -159,8 +157,7 @@ class StatusStepper extends StatelessWidget { } int getActiveStep(){ - print(concessionRequestData!.toJson()); - if(concessionRequestData!=null && concessionRequestData?.passCollected != null && concessionRequestData!.passCollected!['collected'] == 1){ + if(concessionRequestData!=null && concessionRequestData?.passCollected != null && concessionRequestData!.passCollected!['collected'] == "1"){ print("Returning 3"); return 3; } From f5b9f25cd490612a66c13b69610b4db3ef6ec8d6 Mon Sep 17 00:00:00 2001 From: SayedZeeshanHyder Date: Sat, 6 Jul 2024 23:40:01 +0530 Subject: [PATCH 4/4] Solved the Filter Section of Notes --- .../screens/notes_screen/notes_screen.dart | 1 + .../notes_screen/widgets/note_list.dart | 267 +++++++++--------- .../notes_screen/widgets/notes_filter.dart | 94 +----- 3 files changed, 137 insertions(+), 225 deletions(-) diff --git a/lib/new_ui/screens/notes_screen/notes_screen.dart b/lib/new_ui/screens/notes_screen/notes_screen.dart index 877f5f31..496540b7 100644 --- a/lib/new_ui/screens/notes_screen/notes_screen.dart +++ b/lib/new_ui/screens/notes_screen/notes_screen.dart @@ -100,6 +100,7 @@ class _NotesScreenState extends ConsumerState { void changeFilters(DateTime? startDate, DateTime? endDate, bool latest, List subjects) { + print("Filtered Subjects = ${subjects}"); setState(() { filterStartDate = startDate; filterEndDate = endDate; diff --git a/lib/new_ui/screens/notes_screen/widgets/note_list.dart b/lib/new_ui/screens/notes_screen/widgets/note_list.dart index e0e6e2d1..796fec4c 100644 --- a/lib/new_ui/screens/notes_screen/widgets/note_list.dart +++ b/lib/new_ui/screens/notes_screen/widgets/note_list.dart @@ -118,142 +118,145 @@ class _NoteListState extends ConsumerState { } return newString; }).toList(); - - return Column( - children: [ - SizedBox(height: 10), - i == 0 || allNotes[i].time != allNotes[i - 1].time - ? Row( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - formatDate(allNotes[i].time), - style: TextStyle( - color: Colors.grey, - ), - ) - ], - ) - : Container(), - SizedBox( - height: - i == 0 || allNotes[i].time != allNotes[i - 1].time - ? 15 - : 0), - Padding( - padding: EdgeInsets.all(8), - child: OpenContainer( - transitionDuration: Duration(milliseconds: 500), - closedColor: Color(0xff1B1B1B), - closedBuilder: (context, action) { - return Container( - // margin: EdgeInsets.all(8), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: Color(0xff383838), - ), - child: Padding( - padding: const EdgeInsets.all(20,), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - "${allNotes[i].subject}: ${allNotes[i].title}", - style: Theme.of(context) - .textTheme - .titleMedium! - .copyWith(color: Colors.white), - ), - const SizedBox( - height: 7, - ), - Text( - /* use can use the - _getFirst5Words method here if want to - _getFirst5Words(widget.noteContent) - method on line no. 40 - */ - allNotes[i].description, - // widget.noteContent, - style: Theme.of(context) - .textTheme - .titleSmall! - .copyWith(color: Colors.grey, fontSize: 14), + if(widget.subjects.contains(allNotes[i].subject)) + return Column( + children: [ + SizedBox(height: 10), + i == 0 || allNotes[i].time != allNotes[i - 1].time + ? Row( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + formatDate(allNotes[i].time), + style: TextStyle( + color: Colors.grey, ), - const SizedBox( - height: 10, - ), - Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Container( - width: - MediaQuery.of(context).size.width * - .8, - height: 40, - child: ListView.builder( - scrollDirection: Axis.horizontal, - itemCount: - min(2, attachments.length), - itemBuilder: (context, ind) { - return CustomPdfIcon( - pdfName: attachments[ind], - ); - }), - ), - attachments.length > 2 - ? Text( - "+${attachments.length - 2}", - style: TextStyle( - color: Theme.of(context).colorScheme.tertiary, - fontSize: 12, + ) + ], + ) + : Container(), + SizedBox( + height: + i == 0 || allNotes[i].time != allNotes[i - 1].time + ? 15 + : 0), + Padding( + padding: EdgeInsets.all(8), + child: OpenContainer( + transitionDuration: Duration(milliseconds: 500), + closedColor: Color(0xff1B1B1B), + closedBuilder: (context, action) { + return Container( + // margin: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Color(0xff383838), + ), + child: Padding( + padding: const EdgeInsets.all(20,), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${allNotes[i].subject}: ${allNotes[i].title}", + style: Theme.of(context) + .textTheme + .titleMedium! + .copyWith(color: Colors.white), + ), + const SizedBox( + height: 7, + ), + Text( + /* use can use the + _getFirst5Words method here if want to + _getFirst5Words(widget.noteContent) + method on line no. 40 + */ + allNotes[i].description, + // widget.noteContent, + style: Theme.of(context) + .textTheme + .titleSmall! + .copyWith(color: Colors.grey, fontSize: 14), + ), + const SizedBox( + height: 10, + ), + Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Container( + width: + MediaQuery.of(context).size.width * + .8, + height: 40, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: + min(2, attachments.length), + itemBuilder: (context, ind) { + return CustomPdfIcon( + pdfName: attachments[ind], + ); + }), + ), + attachments.length > 2 + ? Text( + "+${attachments.length - 2}", + style: TextStyle( + color: Theme.of(context).colorScheme.tertiary, + fontSize: 12, + ) ) - ) - : Container() - ], - ), - ], + : Container() + ], + ), + ], + ), ), - ), - ); - }, - openBuilder: (context, action) { - return NotesModal( - action: action, - note: allNotes[i], - formKey: widget.formKey, - uploadNoteCallback: (List selectedFiles, - List deletedFiles, - List originalFiles, - String? id, - String? title, - String? description, - String? subject, - String? branch, - String? division, - String? year) { - if (widget.formKey.currentState!.validate()) { - widget.uploadNoteCallback( - selectedFiles, - deletedFiles, - originalFiles, - id, - title, - description, - subject, - branch, - division, - year); - action.call(); - } - }, - ); - }, + ); + }, + openBuilder: (context, action) { + return NotesModal( + action: action, + note: allNotes[i], + formKey: widget.formKey, + uploadNoteCallback: (List selectedFiles, + List deletedFiles, + List originalFiles, + String? id, + String? title, + String? description, + String? subject, + String? branch, + String? division, + String? year) { + if (widget.formKey.currentState!.validate()) { + widget.uploadNoteCallback( + selectedFiles, + deletedFiles, + originalFiles, + id, + title, + description, + subject, + branch, + division, + year); + action.call(); + } + }, + ); + }, + ), ), - ), - ], - ); + ], + ); + else { + return SizedBox(); + } }, ), ) diff --git a/lib/new_ui/screens/notes_screen/widgets/notes_filter.dart b/lib/new_ui/screens/notes_screen/widgets/notes_filter.dart index 86ca1298..d577fac9 100644 --- a/lib/new_ui/screens/notes_screen/widgets/notes_filter.dart +++ b/lib/new_ui/screens/notes_screen/widgets/notes_filter.dart @@ -203,99 +203,6 @@ class _NotesFilterBarState extends ConsumerState padding: const EdgeInsets.all(8.0), child: Column( children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SizedBox( - width: MediaQuery.of(context).size.width * 0.40, - child: TextButton( - onPressed: () async { - DateTime? pickedDate = await showDatePicker( - context: context, - initialDate: widget.startDate, - firstDate: DateTime(2000), - lastDate: DateTime(2025), - ); - if (pickedDate != null) { - // setState(() {~ - // startDate = pickedDate; - // }); - widget.changeFilters(pickedDate, widget.endDate, - widget.latest, widget.subjects); - } else { - // print( - // "Date is not selected"); - } - }, - child: Text( - widget.startDate != null - ? DateFormat('d MMM y') - .format(widget.startDate!) - : "Start date", - style: Theme.of(context) - .textTheme - .labelMedium! - .copyWith( - color: Colors.black, - ), - ), - ), - ), - const SizedBox( - width: 20, - child: Icon( - Icons.arrow_right_alt_rounded, - color: Colors.black, - ), - ), - SizedBox( - width: MediaQuery.of(context).size.width * 0.40, - child: TextButton( - onPressed: () async { - DateTime? pickedDate = await showDatePicker( - context: context, - initialDate: widget.endDate, - firstDate: DateTime(2000), - lastDate: DateTime(2025), - ); - if (pickedDate != null) { - if (widget.startDate != null && - pickedDate.isBefore(widget.startDate!)) { - showSnackBar(context, - "Please select an appropriate date"); - return; - } - // setState(() { - // endDate = pickedDate; - // }); - - widget.changeFilters(widget.startDate, - pickedDate, widget.latest, widget.subjects); - } else { - // print( - // "Date is not selected"); - } - }, - child: Text( - widget.endDate != null - ? DateFormat('d MMM y') - .format(widget.endDate!) - : "End date", - style: Theme.of(context) - .textTheme - .labelMedium! - .copyWith( - color: Colors.black, - ), - ), - ), - ), - ], - ), - const Divider( - thickness: 1, - color: Colors.grey, - ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -368,6 +275,7 @@ class _NotesFilterBarState extends ConsumerState .toList(); } else { tempSubjects.add(allSubjects[index]); + widget.subjects = tempSubjects; } debugPrint( "after change: all subjects ${allSubjects.length}");