diff --git a/lib/presentation/hostel_change/hostel_change_screen.dart b/lib/presentation/hostel_change/hostel_change_screen.dart index 539a1c4c..77e9c0bc 100644 --- a/lib/presentation/hostel_change/hostel_change_screen.dart +++ b/lib/presentation/hostel_change/hostel_change_screen.dart @@ -121,9 +121,8 @@ class HostelChangeScreen extends StatelessWidget { TextField( controller: _searchController, onChanged: (value) { - BlocProvider.of(context) - .add(HostelSearchQueryChanged( - query: value)); + context.read().add( + HostelSearchQueryChanged(query: value)); }, decoration: InputDecoration( filled: true, @@ -167,9 +166,8 @@ class HostelChangeScreen extends StatelessWidget { onTap: () { _searchController.text = hostelMap.values.elementAt(index); - BlocProvider.of( - context) - .add(HostelSearchQueryChanged( + context.read().add( + HostelSearchQueryChanged( query: hostelMap.values .elementAt(index))); }, @@ -206,8 +204,8 @@ class HostelChangeScreen extends StatelessWidget { _searchController.text = hostelMap .values .elementAt(index); - BlocProvider.of( - context) + context + .read() .add(HostelSearchQueryChanged( query: hostelMap.values .elementAt(index))); diff --git a/lib/presentation/login/login_screen.dart b/lib/presentation/login/login_screen.dart index aa7747c0..5ec247ef 100644 --- a/lib/presentation/login/login_screen.dart +++ b/lib/presentation/login/login_screen.dart @@ -118,13 +118,13 @@ class LoginScreen extends StatelessWidget { ), suffixIcon: IconButton( onPressed: () { - BlocProvider.of(context).add( - ToggleObscureCreatePassword( - showPassword: !state.showPassword, - showConfirmPassword: - state.showConfirmPassword, - ), - ); + context.read().add( + ToggleObscureCreatePassword( + showPassword: !state.showPassword, + showConfirmPassword: + state.showConfirmPassword, + ), + ); }, icon: state.showPassword ? const Icon(Icons.visibility, @@ -155,13 +155,13 @@ class LoginScreen extends StatelessWidget { ), suffixIcon: IconButton( onPressed: () { - BlocProvider.of(context).add( - ToggleObscureCreatePassword( - showPassword: state.showPassword, - showConfirmPassword: - !state.showConfirmPassword, - ), - ); + context.read().add( + ToggleObscureCreatePassword( + showPassword: state.showPassword, + showConfirmPassword: + !state.showConfirmPassword, + ), + ); }, icon: state.showConfirmPassword ? const Icon(Icons.visibility, @@ -235,9 +235,9 @@ class LoginScreen extends StatelessWidget { suffixIcon: state is EnterPassword ? IconButton( onPressed: () { - BlocProvider.of(context).add( - ShowPasswordPressed(), - ); + context.read().add( + ShowPasswordPressed(), + ); }, icon: state.showPassword ? const Icon(Icons.visibility,