diff --git a/lib/features/User Profile/widgets/confirm_delete_dialog.dart b/lib/features/User Profile/widgets/confirm_delete_dialog.dart index a4137b4..763c02a 100644 --- a/lib/features/User Profile/widgets/confirm_delete_dialog.dart +++ b/lib/features/User Profile/widgets/confirm_delete_dialog.dart @@ -1,3 +1,5 @@ +import 'dart:ui'; + import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:mess_mgmt/Global/models/coupon_data_model.dart'; @@ -17,60 +19,72 @@ showConfirmDeleteDialog( context: context, barrierDismissible: false, builder: (BuildContext context) { - return AlertDialog( - title: const Text('Are you sure to delete'), - content: Observer(builder: (context) { - final isLoadingLocally = userProfileStore.isLoadingLocally; - if (isLoadingLocally) { - return const AppLoader(); - } - return const SizedBox(); - }), - actions: [ - Observer(builder: (context) { - final isLoadingLocally = userProfileStore.isLoadingLocally; - return Row( - children: [ - if (!isLoadingLocally) - TextButton( - onPressed: () { - Navigator.pop(context); - }, - child: const Text( - 'Cancel', - ), - ), - ReactionBuilder( - builder: (context) { - return autorun((_) { - final canDialogPop = appState.canDialogPop; - if (canDialogPop) { + return BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: AlertDialog( + title: const Text('Are you sure to delete?'), + // content: Observer(builder: (context) { + // final isLoadingLocally = userProfileStore.isLoadingLocally; + // if (isLoadingLocally) { + // return const AppLoader(); + // } + // return const SizedBox(); + // }), + actions: [ + Observer(builder: (context) { + final isLoadingLocally = userProfileStore.isLoadingLocally; + if (isLoadingLocally) { + return const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + AppLoader(), + ], + ); + } + return Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + if (!isLoadingLocally) + TextButton( + onPressed: () { Navigator.pop(context); - } - }); - }, - child: ElevatedButton( - onPressed: () async { - if (!isLoadingLocally) { - await userProfileStore.deleteCoupon(coupon: coupon); - } + }, + child: const Text( + 'Cancel', + ), + ), + ReactionBuilder( + builder: (context) { + return autorun((_) { + final canDialogPop = appState.canDialogPop; + if (canDialogPop) { + Navigator.pop(context); + } + }); }, - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - 20, + child: ElevatedButton( + onPressed: () async { + if (!isLoadingLocally) { + await userProfileStore.deleteCoupon(coupon: coupon); + } + }, + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + 20, + ), ), ), - ), - child: const Text( - 'Confirm', + child: const Text( + 'Confirm', + ), ), ), - ), - ], - ); - }), - ], + ], + ); + }), + ], + ), ); }, ); diff --git a/lib/features/auth/repository/auth_repo.dart b/lib/features/auth/repository/auth_repo.dart index aa1a8e0..9b530d0 100644 --- a/lib/features/auth/repository/auth_repo.dart +++ b/lib/features/auth/repository/auth_repo.dart @@ -33,4 +33,10 @@ class AuthRepository { await http.post(uri, body: data).timeout(const Duration(seconds: 7)); return res; } + + static bool validateEmail({required String email}) { + const String emailPattern = r'^[bB]\d{6}@iiit-bh\.ac\.in$'; + RegExp expression = RegExp(emailPattern); + return expression.hasMatch(email.trim().toLowerCase()); + } } diff --git a/lib/features/auth/screens/login_screen.dart b/lib/features/auth/screens/login_screen.dart index f6688b2..ff2e179 100644 --- a/lib/features/auth/screens/login_screen.dart +++ b/lib/features/auth/screens/login_screen.dart @@ -7,6 +7,7 @@ import 'package:mess_mgmt/Global/widgets/custom_pwd_tile.dart'; import 'package:mess_mgmt/Global/widgets/custom_text_field.dart'; import 'package:mess_mgmt/Global/widgets/loader.dart'; import 'package:mess_mgmt/features/auth/enums/auth_enum.dart'; +import 'package:mess_mgmt/features/auth/repository/auth_repo.dart'; import 'package:mess_mgmt/features/auth/stores/auth_store.dart'; import '../../../Global/widgets/scaffold_messenger.dart'; @@ -28,7 +29,11 @@ class _LoginScreenState extends State void login() async { if (!isValidate(_emailController.text)) { - showMessage(message: "Enter Valid Email", context: context); + showMessage(message: "Please Enter The Email", context: context); + return; + } + if (!AuthRepository.validateEmail(email: _emailController.text)) { + showMessage(message: "Enter Your Valid College Email-Id", context: context); return; } if (!isValidate(_pwdController.text)) { diff --git a/lib/features/auth/screens/signup_screen_1.dart b/lib/features/auth/screens/signup_screen_1.dart index 585c7eb..7ca20a9 100644 --- a/lib/features/auth/screens/signup_screen_1.dart +++ b/lib/features/auth/screens/signup_screen_1.dart @@ -7,6 +7,7 @@ import 'package:mess_mgmt/Global/widgets/custom_text_field.dart'; import 'package:mess_mgmt/Global/widgets/loader.dart'; import 'package:mess_mgmt/Global/widgets/scaffold_messenger.dart'; import 'package:mess_mgmt/features/auth/enums/auth_enum.dart'; +import 'package:mess_mgmt/features/auth/repository/auth_repo.dart'; import 'package:mess_mgmt/features/auth/stores/auth_store.dart'; import '../../../features/Networking/widgets/wobble_appbar.dart'; @@ -48,7 +49,12 @@ class _SignupScreenOneState extends State return; } if (!isValidate(email)) { - showMessage(message: 'Enter Valid Email', context: context); + showMessage(message: 'Please Enter The Email', context: context); + return; + } + if (!AuthRepository.validateEmail(email: _emailController.text)) { + showMessage( + message: "Enter Your Valid College Email-Id", context: context); return; } // navigateAndPopToNextScreen(