diff --git a/lib/domain/models/contest_filter.dart b/lib/domain/models/contest_filter.dart index 36372fc..458345e 100644 --- a/lib/domain/models/contest_filter.dart +++ b/lib/domain/models/contest_filter.dart @@ -4,7 +4,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'contest_filter.freezed.dart'; part 'contest_filter.g.dart'; -@freezed +@Freezed(makeCollectionsUnmodifiable: false) class ContestFilter extends Equatable with _$ContestFilter { const factory ContestFilter({ int? duration, diff --git a/lib/presentation/update_profile/bloc/update_profile_bloc.dart b/lib/presentation/update_profile/bloc/update_profile_bloc.dart index 6cb514d..f63e6f2 100644 --- a/lib/presentation/update_profile/bloc/update_profile_bloc.dart +++ b/lib/presentation/update_profile/bloc/update_profile_bloc.dart @@ -161,13 +161,13 @@ class UpdateProfileBloc extends Bloc { for (final platform in platforms) { final handle = controllers[platform]!.text.trim(); - if (handle.isEmpty) continue; - if (!compareHandles(platform, handle)) { isChanged |= true; - final res = await UserRepository.verifyHandle(platform, handle); + if (handle.isNotEmpty) { + final res = await UserRepository.verifyHandle(platform, handle); - if (!res) errors[platform] = 'Invalid Handle'; + if (!res) errors[platform] = 'Invalid Handle'; + } } } @@ -209,19 +209,19 @@ class UpdateProfileBloc extends Bloc { bool compareHandles(String platform, String value) { switch (platform) { case 'codechef': - return value == state.user?.handle?.codechef; + return value.compareTo(state.user?.handle?.codechef ?? '') == 0; case 'codeforces': - return value == state.user?.handle?.codeforces; + return value.compareTo(state.user?.handle?.codeforces ?? '') == 0; case 'hackerrank': - return value == state.user?.handle?.hackerrank; + return value.compareTo(state.user?.handle?.hackerrank ?? '') == 0; case 'spoj': - return value == state.user?.handle?.spoj; + return value.compareTo(state.user?.handle?.spoj ?? '') == 0; case 'leetcode': - return value == state.user?.handle?.leetcode; + return value.compareTo(state.user?.handle?.leetcode ?? '') == 0; default: return false; diff --git a/lib/presentation/update_profile/update_profile.dart b/lib/presentation/update_profile/update_profile.dart index affdb94..62a2c8f 100644 --- a/lib/presentation/update_profile/update_profile.dart +++ b/lib/presentation/update_profile/update_profile.dart @@ -51,6 +51,7 @@ class UpdateProfile extends StatelessWidget { SizedBox(height: 30.r), PrimaryButton( label: 'Save Changes', + isLoading: state.isUpdating, onPressed: () { if (state.isUpdating) return; context diff --git a/pubspec.yaml b/pubspec.yaml index d617aef..cd79a03 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Codephile. publish_to: 'none' -version: 1.0.0+13 +version: 1.0.0+15 environment: sdk: ">=2.12.0 <3.0.0"