From 52d7134efbde3f43cac223d32fca4bef84211603 Mon Sep 17 00:00:00 2001 From: Shreya Bhatia Date: Sat, 29 Jun 2024 15:02:26 +0530 Subject: [PATCH 1/2] Added the loading part --- .../screens/railway_screen/railwayform.dart | 21 ++++++++++++++- lib/provider/concession_provider.dart | 27 ++++++------------- pubspec.lock | 24 ++++++++--------- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/lib/new_ui/screens/railway_screen/railwayform.dart b/lib/new_ui/screens/railway_screen/railwayform.dart index 25e52098..d9d9f081 100644 --- a/lib/new_ui/screens/railway_screen/railwayform.dart +++ b/lib/new_ui/screens/railway_screen/railwayform.dart @@ -416,6 +416,7 @@ class _RailwayForm extends ConsumerState { StudentModel student = ref.watch(userModelProvider)!.studentModel!; ConcessionDetailsModel? concessionDetails = ref.watch(concessionDetailsProvider); + String currState = ref.watch(concessionProvider); return Scaffold( appBar: AppBar( shadowColor: Colors.transparent, @@ -433,7 +434,25 @@ class _RailwayForm extends ConsumerState { Navigator.pop(context); },), ), - body: SingleChildScrollView( + body: currState != "" + ? Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const CircularProgressIndicator(), + const SizedBox(height: 40.0,), + SizedBox( + width: 300.0, + child: Text( + currState, + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.white), + ), + ), + ], + ), + ) + : SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/lib/provider/concession_provider.dart b/lib/provider/concession_provider.dart index 77824c24..8774fbfd 100644 --- a/lib/provider/concession_provider.dart +++ b/lib/provider/concession_provider.dart @@ -20,12 +20,12 @@ final concessionDetailsProvider = StateProvider((ref) { }); final concessionProvider = - StateNotifierProvider(((ref) { + StateNotifierProvider(((ref) { return ConcessionProvider( ref: ref, concessionService: ref.watch(concessionServiceProvider)); })); -class ConcessionProvider extends StateNotifier { +class ConcessionProvider extends StateNotifier { final ConcessionService _concessionService; final Ref _ref; @@ -33,7 +33,7 @@ class ConcessionProvider extends StateNotifier { ConcessionProvider({concessionService, ref}) : _concessionService = concessionService, _ref = ref, - super(false); + super(""); Future applyConcession(ConcessionDetailsModel concessionDetails, File idCardPhoto, File previousPassPhoto, BuildContext context) async { @@ -41,21 +41,13 @@ class ConcessionProvider extends StateNotifier { // concessionDetails.statusMessage = // await _concessionService.getWaitingMessage(); // _ref.read(concessionDetailsProvider.notifier).state = concessionDetails; + state="Applying for concession, please be patient"; - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('Applying for concession, please be patient'), - ), - ); ConcessionDetailsModel concessionDetailsData = await _concessionService.applyConcession(concessionDetails); - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text( - 'We are uploading your photos, this might take some time. We will notify you when the process completes.'), - ), - ); + state="We are uploading your photos, this might take some time. We will notify you when the process completes."; + _ref.read(concessionDetailsProvider.notifier).state = concessionDetailsData; concessionDetailsData.idCardURL = @@ -63,12 +55,9 @@ class ConcessionProvider extends StateNotifier { concessionDetailsData.previousPassURL = await _concessionService.uploadPhoto(previousPassPhoto, "prevpass"); await _concessionService.applyConcession(concessionDetailsData); + state=""; - ScaffoldMessenger.of(context).showSnackBar( - const SnackBar( - content: Text('All the attached photos have been uploaded'), - ), - ); + Navigator.of(context).pop(); } Future getConcessionData() async { diff --git a/pubspec.lock b/pubspec.lock index ad37f53e..a59af71d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -740,26 +740,26 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" url: "https://pub.dev" source: hosted - version: "10.0.0" + version: "10.0.4" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.3" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.1" linkify: dependency: transitive description: @@ -812,10 +812,10 @@ packages: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.12.0" mime: dependency: transitive description: @@ -1201,10 +1201,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.7.0" textfield_search: dependency: "direct main" description: @@ -1321,10 +1321,10 @@ packages: dependency: transitive description: name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "14.2.1" watcher: dependency: transitive description: From 55c2314f64c1dbcc09f7025bbf9b40d7402d0028 Mon Sep 17 00:00:00 2001 From: Shreya Bhatia Date: Sat, 29 Jun 2024 15:42:47 +0530 Subject: [PATCH 2/2] Changed the status message of the concession loading --- .../widgets/container_icon_with_label.dart | 2 +- .../screens/main_screen/main_screen.dart | 1 - lib/provider/concession_provider.dart | 5 +- pubspec.lock | 52 +++++++++++++++---- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/lib/new_ui/screens/home_screen/widgets/container_icon_with_label.dart b/lib/new_ui/screens/home_screen/widgets/container_icon_with_label.dart index 68cde3ab..ea0f36ba 100644 --- a/lib/new_ui/screens/home_screen/widgets/container_icon_with_label.dart +++ b/lib/new_ui/screens/home_screen/widgets/container_icon_with_label.dart @@ -24,7 +24,7 @@ class ContainerIconWithName extends StatelessWidget { //height: MediaQuery.of(context).size.height * 0.14, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( - color: _theme.colorScheme.onSecondary, + color: Colors.yellow.shade800, borderRadius: BorderRadius.circular(15.0), boxShadow: [ BoxShadow( diff --git a/lib/new_ui/screens/main_screen/main_screen.dart b/lib/new_ui/screens/main_screen/main_screen.dart index 06140de1..9895adfe 100644 --- a/lib/new_ui/screens/main_screen/main_screen.dart +++ b/lib/new_ui/screens/main_screen/main_screen.dart @@ -10,7 +10,6 @@ import 'package:tsec_app/new_ui/colors.dart'; import 'package:tsec_app/new_ui/screens/coming_soon_screen/coming_soon.dart'; import 'package:tsec_app/new_ui/screens/about_us_screen/about_us.dart'; import 'package:tsec_app/new_ui/screens/erp_screen/erp_screen.dart'; -import 'package:tsec_app/new_ui/screens/games/dino_screen/dino_screen.dart'; import 'package:tsec_app/new_ui/screens/home_screen/widgets/home_widget.dart'; import 'package:tsec_app/new_ui/screens/main_screen/widgets/main_bottom_nav_bar.dart'; import 'package:tsec_app/new_ui/screens/notes_screen/notes_screen.dart'; diff --git a/lib/provider/concession_provider.dart b/lib/provider/concession_provider.dart index ec62788b..eb31d9b3 100644 --- a/lib/provider/concession_provider.dart +++ b/lib/provider/concession_provider.dart @@ -41,12 +41,12 @@ class ConcessionProvider extends StateNotifier { // concessionDetails.statusMessage = // await _concessionService.getWaitingMessage(); // _ref.read(concessionDetailsProvider.notifier).state = concessionDetails; - state="Applying for concession, please be patient"; + state="Application processing..."; ConcessionDetailsModel concessionDetailsData = await _concessionService.applyConcession(concessionDetails); - state="We are uploading your photos, this might take some time. We will notify you when the process completes."; + state="Uploading files..."; _ref.read(concessionDetailsProvider.notifier).state = concessionDetailsData; @@ -57,7 +57,6 @@ class ConcessionProvider extends StateNotifier { await _concessionService.applyConcession(concessionDetailsData); state=""; - Navigator.of(context).pop(); } Future getConcessionData() async { diff --git a/pubspec.lock b/pubspec.lock index 9fad7397..0c74aa29 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -744,6 +744,30 @@ packages: url: "https://pub.dev" source: hosted version: "6.8.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a" + url: "https://pub.dev" + source: hosted + version: "10.0.4" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8" + url: "https://pub.dev" + source: hosted + version: "3.0.3" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" linkify: dependency: transitive description: @@ -780,26 +804,26 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136" url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.12.0" mime: dependency: transitive description: @@ -836,10 +860,10 @@ packages: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_provider: dependency: "direct main" description: @@ -1301,6 +1325,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec" + url: "https://pub.dev" + source: hosted + version: "14.2.1" watcher: dependency: transitive description: @@ -1390,5 +1422,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.3 <4.0.0" - flutter: ">=3.16.6" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.18.0-18.0.pre.54"