From 8456020b8015e94dd8b2ef5be34cbfec3e220584 Mon Sep 17 00:00:00 2001 From: Aman Date: Mon, 3 Oct 2022 01:52:59 +0530 Subject: [PATCH] rfac,chor: bump dependencies and minor refactors Signed-off-by: Aman --- android/app/build.gradle | 2 +- lib/data/services/local/image_service.dart | 8 +- lib/data/services/local/storage_service.dart | 4 +- .../services/remote/notification_service.dart | 11 +- lib/domain/models/grouped_feed.dart | 2 +- lib/domain/models/sign_up.dart | 1 - lib/domain/repositories/user_repository.dart | 6 +- .../components/widgets/primary_button.dart | 24 +- .../contests/bloc/contests_bloc.dart | 32 +-- .../contests/widgets/contest_card.dart | 8 +- .../contests/widgets/filter_sheet.dart | 10 +- lib/presentation/core/main_app.dart | 6 +- lib/presentation/login/bloc/login_bloc.dart | 2 +- .../login/widgets/text_fields.dart | 1 - .../profile/bloc/profile_bloc.dart | 44 ++-- .../profile/widgets/acceptance_graph.dart | 24 +- .../profile/widgets/following_view.dart | 8 +- .../profile/widgets/profile_header.dart | 14 +- lib/presentation/search/bloc/search_bloc.dart | 10 +- .../search/widgets/filter_search.dart | 10 +- .../signup/bloc/sign_up_bloc.dart | 2 +- .../bloc/update_profile_bloc.dart | 61 ++--- .../bloc/update_profile_event.dart | 9 - .../bloc/update_profile_state.dart | 1 - .../widgets/change_password.dart | 134 +++------- .../widgets/profile_details.dart | 2 +- .../update_profile/widgets/text_fields.dart | 137 ++++++++++ pubspec.lock | 238 ++++++++++-------- pubspec.yaml | 23 +- .../onboarding/onboarding_test.dart | 4 +- test/utils/pump_screen.dart | 4 +- 31 files changed, 479 insertions(+), 363 deletions(-) create mode 100644 lib/presentation/update_profile/widgets/text_fields.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index baaa5c6a..528defdd 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -33,7 +33,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 32 + compileSdkVersion 33 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 diff --git a/lib/data/services/local/image_service.dart b/lib/data/services/local/image_service.dart index 71c23e42..7702fb48 100644 --- a/lib/data/services/local/image_service.dart +++ b/lib/data/services/local/image_service.dart @@ -34,6 +34,12 @@ class ImageService { cropStyle: CropStyle.circle, compressFormat: ImageCompressFormat.png, ); - return croppedImage; + + File? file; + if (croppedImage != null) { + file = File(croppedImage.path); + } + + return file; } } diff --git a/lib/data/services/local/storage_service.dart b/lib/data/services/local/storage_service.dart index 45ea6973..86102fe5 100644 --- a/lib/data/services/local/storage_service.dart +++ b/lib/data/services/local/storage_service.dart @@ -103,6 +103,6 @@ class StorageService { } } - static set filter(ContestFilter? _filter) => - _set(AppStrings.filterKey, json.encode(_filter!.toJson())); + static set filter(ContestFilter? filter) => + _set(AppStrings.filterKey, json.encode(filter!.toJson())); } diff --git a/lib/data/services/remote/notification_service.dart b/lib/data/services/remote/notification_service.dart index 4305e16d..cb8d3aa5 100644 --- a/lib/data/services/remote/notification_service.dart +++ b/lib/data/services/remote/notification_service.dart @@ -1,3 +1,5 @@ +// ignore_for_file: depend_on_referenced_packages + import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_native_timezone/flutter_native_timezone.dart'; import 'package:timezone/data/latest.dart' as tz; @@ -13,20 +15,17 @@ class NotificationService { 'channelName', importance: Importance.max, ), - iOS: IOSNotificationDetails(), + iOS: DarwinNotificationDetails(), ); } static Future init() async { const settings = InitializationSettings( android: AndroidInitializationSettings('@mipmap/ic_launcher'), - iOS: IOSInitializationSettings(), + iOS: DarwinInitializationSettings(), ); - await _notification.initialize( - settings, - onSelectNotification: (payload) {}, - ); + await _notification.initialize(settings); tz.initializeTimeZones(); final locationName = await FlutterNativeTimezone.getLocalTimezone(); diff --git a/lib/domain/models/grouped_feed.dart b/lib/domain/models/grouped_feed.dart index 6b5a3fbc..eb3bc60f 100644 --- a/lib/domain/models/grouped_feed.dart +++ b/lib/domain/models/grouped_feed.dart @@ -3,7 +3,7 @@ import 'package:freezed_annotation/freezed_annotation.dart'; part 'grouped_feed.freezed.dart'; part 'grouped_feed.g.dart'; -@freezed +@Freezed(makeCollectionsUnmodifiable: false) class GroupedFeed with _$GroupedFeed { factory GroupedFeed({ required String username, diff --git a/lib/domain/models/sign_up.dart b/lib/domain/models/sign_up.dart index 148cd9f3..24332ffd 100644 --- a/lib/domain/models/sign_up.dart +++ b/lib/domain/models/sign_up.dart @@ -1,4 +1,3 @@ -import 'package:flutter/foundation.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'handle.dart'; diff --git a/lib/domain/repositories/user_repository.dart b/lib/domain/repositories/user_repository.dart index 6c439ab0..78d69f5b 100644 --- a/lib/domain/repositories/user_repository.dart +++ b/lib/domain/repositories/user_repository.dart @@ -221,14 +221,14 @@ class UserRepository { headers: headers, ); - final _users = []; + final users = []; if (response['status_code'] == 200) { for (final user in response['data'] ?? []) { - _users.add(User.fromJson(user)); + users.add(User.fromJson(user)); } } - return _users; + return users; } /// Get a list the names of recognized institutes. diff --git a/lib/presentation/components/widgets/primary_button.dart b/lib/presentation/components/widgets/primary_button.dart index 5e9137b6..1d9ad631 100644 --- a/lib/presentation/components/widgets/primary_button.dart +++ b/lib/presentation/components/widgets/primary_button.dart @@ -7,10 +7,12 @@ import '../../../data/constants/styles.dart'; class PrimaryButton extends StatelessWidget { const PrimaryButton({ required this.label, + this.isLoading = false, this.onPressed, Key? key, }) : super(key: key); final String label; + final bool isLoading; final VoidCallback? onPressed; @override @@ -28,13 +30,21 @@ class PrimaryButton extends StatelessWidget { alignment: Alignment.center, height: 48.r, padding: EdgeInsets.symmetric(horizontal: 40.r), - child: Text( - label, - style: AppStyles.h6.copyWith( - color: AppColors.white, - fontWeight: FontWeight.w700, - ), - ), + child: isLoading + ? SizedBox( + width: 20.r, + height: 20.r, + child: const CircularProgressIndicator( + color: AppColors.white, + ), + ) + : Text( + label, + style: AppStyles.h6.copyWith( + color: AppColors.white, + fontWeight: FontWeight.w700, + ), + ), ), ); } diff --git a/lib/presentation/contests/bloc/contests_bloc.dart b/lib/presentation/contests/bloc/contests_bloc.dart index e79b1a42..ebee97c6 100644 --- a/lib/presentation/contests/bloc/contests_bloc.dart +++ b/lib/presentation/contests/bloc/contests_bloc.dart @@ -159,33 +159,33 @@ extension on ContestFilter { if (!platfromCheck) return platfromCheck; - Duration _maxDuration; + Duration maxDuration; switch (duration) { case 0: - _maxDuration = const Duration(hours: 2); + maxDuration = const Duration(hours: 2); break; case 1: - _maxDuration = const Duration(hours: 3); + maxDuration = const Duration(hours: 3); break; case 2: - _maxDuration = const Duration(hours: 5); + maxDuration = const Duration(hours: 5); break; case 3: - _maxDuration = const Duration(days: 1); + maxDuration = const Duration(days: 1); break; case 4: - _maxDuration = const Duration(days: 10); + maxDuration = const Duration(days: 10); break; case 5: - _maxDuration = const Duration(days: 31); + maxDuration = const Duration(days: 31); break; default: - _maxDuration = Duration(days: 1e5.toInt()); + maxDuration = Duration(days: 1e5.toInt()); } final durationCheck = upcoming != null - ? upcoming.compareDuration(_maxDuration) - : ongoing!.compareDuration(_maxDuration); + ? upcoming.compareDuration(maxDuration) + : ongoing!.compareDuration(maxDuration); if (!durationCheck) return durationCheck; @@ -200,17 +200,17 @@ extension on ContestFilter { } extension on Upcoming { - bool compareDuration(Duration _duration) { - return _duration.compareTo(endTime.difference(startTime)) >= 0; + bool compareDuration(Duration duration) { + return duration.compareTo(endTime.difference(startTime)) >= 0; } - bool compareStart(DateTime _startDate) { - return startTime.isAfter(_startDate); + bool compareStart(DateTime startDate) { + return startTime.isAfter(startDate); } } extension on Ongoing { - bool compareDuration(Duration _duration) { - return _duration.compareTo(endTime.difference(DateTime.now())) >= 0; + bool compareDuration(Duration duration) { + return duration.compareTo(endTime.difference(DateTime.now())) >= 0; } } diff --git a/lib/presentation/contests/widgets/contest_card.dart b/lib/presentation/contests/widgets/contest_card.dart index 7a8912e7..ca1b686b 100644 --- a/lib/presentation/contests/widgets/contest_card.dart +++ b/lib/presentation/contests/widgets/contest_card.dart @@ -97,7 +97,7 @@ class ContestCard extends StatelessWidget { builder: (context, value, _) { return IconButton( onPressed: () { - final _bloc = context.read(); + final bloc = context.read(); showDialog( context: context, builder: (context) { @@ -208,7 +208,7 @@ class ContestCard extends StatelessWidget { TextButton( onPressed: () { _notifier.value = false; - _bloc.pendingNotification + bloc.pendingNotification .remove(upcoming!.name); NotificationService.cancelNotification( @@ -234,9 +234,9 @@ class ContestCard extends StatelessWidget { onPressed: () { if (upcoming != null) { _notifier.value = true; - if (!_bloc.pendingNotification + if (!bloc.pendingNotification .contains(upcoming!.name)) { - _bloc.pendingNotification + bloc.pendingNotification .add(upcoming!.name); } NotificationService.setNotification( diff --git a/lib/presentation/contests/widgets/filter_sheet.dart b/lib/presentation/contests/widgets/filter_sheet.dart index a4d0e889..f4a6df26 100644 --- a/lib/presentation/contests/widgets/filter_sheet.dart +++ b/lib/presentation/contests/widgets/filter_sheet.dart @@ -138,17 +138,17 @@ class FilterSheet extends StatelessWidget { divisions: 6, value: state.duration!.toDouble(), label: PlatformUtil.getLabel(state.duration), - onChanged: (_value) { + onChanged: (value) { context .read() - .add(UpdateFilter(duration: _value.toInt())); + .add(UpdateFilter(duration: value.toInt())); }, - onChangeEnd: (_value) { + onChangeEnd: (value) { context.read().add( UpdateFilter( - duration: _value.toInt(), + duration: value.toInt(), updatedFilter: state.filter!.copyWith( - duration: _value.toInt(), + duration: value.toInt(), ), ), ); diff --git a/lib/presentation/core/main_app.dart b/lib/presentation/core/main_app.dart index 35fde4fc..59c049c4 100644 --- a/lib/presentation/core/main_app.dart +++ b/lib/presentation/core/main_app.dart @@ -5,6 +5,7 @@ import 'package:get/get.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import '../../data/constants/routes.dart'; +import '../../data/constants/strings.dart'; import '../../data/constants/styles.dart'; import '../../data/services/local/image_service.dart'; import '../../data/services/local/storage_service.dart'; @@ -21,10 +22,9 @@ class Codephile extends StatelessWidget { Widget build(BuildContext context) { return ScreenUtilInit( designSize: const Size(360, 640), - builder: () { + builder: (context, _) { return GetMaterialApp( builder: (context, widget) { - ScreenUtil.setContext(context); return MediaQuery( data: MediaQuery.of(context).copyWith(textScaleFactor: 1), child: widget!, @@ -50,7 +50,7 @@ class Codephile extends StatelessWidget { StorageService.init(); NotificationService.init(); - if (StorageService.user != null) { + if (StorageService.exists(AppStrings.userKey)) { // Fetch User Details on Startup try { StorageService.user = await UserRepository.fetchUserDetails(); diff --git a/lib/presentation/login/bloc/login_bloc.dart b/lib/presentation/login/bloc/login_bloc.dart index 6f2ca76e..d8b8ce82 100644 --- a/lib/presentation/login/bloc/login_bloc.dart +++ b/lib/presentation/login/bloc/login_bloc.dart @@ -1,5 +1,5 @@ -import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:get/get.dart'; diff --git a/lib/presentation/login/widgets/text_fields.dart b/lib/presentation/login/widgets/text_fields.dart index e4e094b2..a701fdf5 100644 --- a/lib/presentation/login/widgets/text_fields.dart +++ b/lib/presentation/login/widgets/text_fields.dart @@ -22,7 +22,6 @@ class PasswordField extends StatelessWidget { horizontal: 8.r, vertical: 10.r, ), - // TODO(BURG3R5): Deal with Focus transfer. child: const ImageIcon( Svg(AppAssets.lock), ), diff --git a/lib/presentation/profile/bloc/profile_bloc.dart b/lib/presentation/profile/bloc/profile_bloc.dart index 5a2c3ded..ddde74b7 100644 --- a/lib/presentation/profile/bloc/profile_bloc.dart +++ b/lib/presentation/profile/bloc/profile_bloc.dart @@ -38,43 +38,43 @@ class ProfileBloc extends Bloc { _user = await UserRepository.fetchUserDetails(uid: event.userId); } - SubmissionStatus? _subStats; - List? _activityDetails; + SubmissionStatus? subStats; + List? activityDetails; // TODO(aman-singh7): Throw specific Error try { if (_user == null) throw Exception('User not found!!'); _followingList = await UserRepository.getFollowingList(); - _subStats = await UserRepository.getSubmissionStatusData(_user!.id!); + subStats = await UserRepository.getSubmissionStatusData(_user!.id!); - _activityDetails = await UserRepository.getActivityDetails(_user!.id!); + activityDetails = await UserRepository.getActivityDetails(_user!.id!); } on Exception catch (_) { emit(state.copyWith(status: const Status.error(AppStrings.genericError))); return; } - for (final activity in _activityDetails ?? []) { + for (final activity in activityDetails ?? []) { if (activity.createdAt == null) continue; _activity[activity.createdAt!] = activity.correct; } - bool? _isFollowing; + bool? isFollowing; for (final follower in _followingList ?? []) { if (follower.id == event.userId) { - _isFollowing = true; + isFollowing = true; break; } } - _isFollowing ??= false; + isFollowing ??= false; emit(state.copyWith( status: const Status(), user: _user, following: _followingList, - submissionStatus: _subStats, + submissionStatus: subStats, personalProfile: isSelfProfile, - isFollowing: _isFollowing, + isFollowing: isFollowing, currentYear: _currentYear, currentTriplet: _currentTriplet, showFollowing: false, @@ -126,14 +126,14 @@ class ProfileBloc extends Bloc { throw Exception(AppStrings.genericError); } - var _tempUser = StorageService.user; - _tempUser = _tempUser?.copyWith( - noOfFollowing: (_tempUser.noOfFollowing ?? 0) + 1, + var tempUser = StorageService.user; + tempUser = tempUser?.copyWith( + noOfFollowing: (tempUser.noOfFollowing ?? 0) + 1, ); - StorageService.user = _tempUser; - if (_user?.id != _tempUser?.id) return; + StorageService.user = tempUser; + if (_user?.id != tempUser?.id) return; - _user = _tempUser; + _user = tempUser; } Future unfollow(String userId) async { @@ -143,14 +143,14 @@ class ProfileBloc extends Bloc { throw Exception(AppStrings.genericError); } - var _tempUser = StorageService.user; - _tempUser = _tempUser?.copyWith( - noOfFollowing: (_tempUser.noOfFollowing ?? 0) - 1, + var tempUser = StorageService.user; + tempUser = tempUser?.copyWith( + noOfFollowing: (tempUser.noOfFollowing ?? 0) - 1, ); - StorageService.user = _tempUser; - if (_user?.id != _tempUser?.id) return; + StorageService.user = tempUser; + if (_user?.id != tempUser?.id) return; - _user = _tempUser; + _user = tempUser; } // Index -> Index%4 diff --git a/lib/presentation/profile/widgets/acceptance_graph.dart b/lib/presentation/profile/widgets/acceptance_graph.dart index 39c0b425..e1784c16 100644 --- a/lib/presentation/profile/widgets/acceptance_graph.dart +++ b/lib/presentation/profile/widgets/acceptance_graph.dart @@ -18,7 +18,7 @@ class AcceptanceGraph extends StatelessWidget { (previous.currentTriplet != current.currentTriplet); }, builder: (context, state) { - final _bloc = context.read(); + final bloc = context.read(); var day = 0; final firstWeekDay = util.DateUtils.fistDayofMonth( @@ -67,7 +67,7 @@ class AcceptanceGraph extends StatelessWidget { ), IconButton( onPressed: () { - _bloc.add(const UpdateYear(increment: true)); + bloc.add(const UpdateYear(increment: true)); }, icon: Icon( Icons.chevron_right, @@ -83,7 +83,7 @@ class AcceptanceGraph extends StatelessWidget { children: [ IconButton( onPressed: () { - _bloc.add(const UpdateMonth(increment: false)); + bloc.add(const UpdateMonth(increment: false)); }, icon: Icon( Icons.chevron_left, @@ -104,7 +104,7 @@ class AcceptanceGraph extends StatelessWidget { ).toList(), IconButton( onPressed: () { - _bloc.add(const UpdateMonth(increment: true)); + bloc.add(const UpdateMonth(increment: true)); }, icon: Icon( Icons.chevron_right, @@ -149,7 +149,7 @@ class AcceptanceGraph extends StatelessWidget { width: 20.r, height: 20.r, margin: EdgeInsets.all(2.r), - color: _bloc.getCellColor(util.DateUtils.getDateTime( + color: bloc.getCellColor(util.DateUtils.getDateTime( day, state.currentTriplet!, state.currentYear!)), ); }), @@ -165,9 +165,10 @@ class AcceptanceGraph extends StatelessWidget { width: 20.r, height: 20.r, margin: EdgeInsets.all(2.r), - color: _bloc.getCellColor( - util.DateUtils.getDateTime(day, - state.currentTriplet!, state.currentYear!)), + color: bloc.getCellColor(util.DateUtils.getDateTime( + day, + state.currentTriplet!, + state.currentYear!)), ); }), ); @@ -185,9 +186,10 @@ class AcceptanceGraph extends StatelessWidget { width: 20.r, height: 20.r, margin: EdgeInsets.all(2.r), - color: _bloc.getCellColor( - util.DateUtils.getDateTime(day, - state.currentTriplet!, state.currentYear!)), + color: bloc.getCellColor(util.DateUtils.getDateTime( + day, + state.currentTriplet!, + state.currentYear!)), ); }), ...List.generate(7 - lastWeekDays, (_) { diff --git a/lib/presentation/profile/widgets/following_view.dart b/lib/presentation/profile/widgets/following_view.dart index 54e8dcca..4050ebd0 100644 --- a/lib/presentation/profile/widgets/following_view.dart +++ b/lib/presentation/profile/widgets/following_view.dart @@ -63,7 +63,7 @@ class FollowingView extends StatelessWidget { itemCount: state.following?.length, itemBuilder: (context, index) { final user = state.following![index]; - final _followNotifier = ValueNotifier(true); + final followNotifier = ValueNotifier(true); return ListTile( leading: SizedBox( width: 35.r, @@ -89,14 +89,14 @@ class FollowingView extends StatelessWidget { /// will only build its trailing widget, eliminating the need /// to rebuild the whole list trailing: ValueListenableBuilder( - valueListenable: _followNotifier, + valueListenable: followNotifier, builder: (_, value, child) { if (value) { return FollowingButton( onTap: () async { try { await context.read().unfollow(user.id); - _followNotifier.value = false; + followNotifier.value = false; } on Exception catch (_) { showSnackBar(message: AppStrings.genericError); } @@ -108,7 +108,7 @@ class FollowingView extends StatelessWidget { onTap: () async { try { await context.read().follow(user.id); - _followNotifier.value = true; + followNotifier.value = true; } on Exception catch (_) { showSnackBar(message: AppStrings.genericError); } diff --git a/lib/presentation/profile/widgets/profile_header.dart b/lib/presentation/profile/widgets/profile_header.dart index 38f44c56..5a7a9740 100644 --- a/lib/presentation/profile/widgets/profile_header.dart +++ b/lib/presentation/profile/widgets/profile_header.dart @@ -10,6 +10,7 @@ import '../../../data/constants/colors.dart'; import '../../../data/constants/routes.dart'; import '../../../data/constants/strings.dart'; import '../../../data/constants/styles.dart'; +import '../../../data/services/local/storage_service.dart'; import '../../../domain/repositories/user_repository.dart'; import '../../../utils/snackbar.dart'; import '../bloc/profile_bloc.dart'; @@ -24,7 +25,7 @@ class ProfileHeader extends StatelessWidget { return BlocBuilder( builder: (context, state) { // Follow Notifier - final _followNotifier = ValueNotifier(state.isFollowing); + final followNotifier = ValueNotifier(state.isFollowing); return Container( color: AppColors.primary, child: Column( @@ -56,7 +57,7 @@ class ProfileHeader extends StatelessWidget { const Spacer(flex: 2), IconButton( onPressed: () async { - final _bloc = context.read(); + final bloc = context.read(); showMenu( context: context, position: RelativeRect.fromLTRB(100.r, 70.r, 0, 0), @@ -75,7 +76,7 @@ class ProfileHeader extends StatelessWidget { ?.then((value) { if (value == null) return; - _bloc.add(const FetchDetails()); + bloc.add(const FetchDetails()); }); }, ); @@ -97,6 +98,7 @@ class ProfileHeader extends StatelessWidget { onTap: () async { final res = await UserRepository.logout(); if (res) { + StorageService.delete(AppStrings.userKey); Get.offNamed(AppRoutes.login); return; } @@ -199,7 +201,7 @@ class ProfileHeader extends StatelessWidget { horizontal: 16.r, ), child: ValueListenableBuilder( - valueListenable: _followNotifier, + valueListenable: followNotifier, builder: (_, value, child) { if (value) { return FollowingButton( @@ -208,7 +210,7 @@ class ProfileHeader extends StatelessWidget { await context .read() .unfollow(state.user!.id!); - _followNotifier.value = false; + followNotifier.value = false; } on Exception catch (_) { showSnackBar( message: AppStrings.genericError); @@ -223,7 +225,7 @@ class ProfileHeader extends StatelessWidget { await context .read() .follow(state.user!.id!); - _followNotifier.value = true; + followNotifier.value = true; } on Exception catch (_) { showSnackBar( message: AppStrings.genericError); diff --git a/lib/presentation/search/bloc/search_bloc.dart b/lib/presentation/search/bloc/search_bloc.dart index 05404907..5deed6ea 100644 --- a/lib/presentation/search/bloc/search_bloc.dart +++ b/lib/presentation/search/bloc/search_bloc.dart @@ -89,17 +89,17 @@ class SearchBloc extends Bloc { } void _onRecentSearch(RecentSearch event, Emitter emit) { - final _recent = state.recentSearches; + final recent = state.recentSearches; if (event.toAdd) { - _recent.insert(0, event.user); + recent.insert(0, event.user); } else { - _recent.remove(event.user); + recent.remove(event.user); } - StorageService.recentSearches = _recent; + StorageService.recentSearches = recent; emit(state.copyWith( - recentSearches: [..._recent], + recentSearches: [...recent], count: state.count + 1, )); } diff --git a/lib/presentation/search/widgets/filter_search.dart b/lib/presentation/search/widgets/filter_search.dart index 06110ff3..5f1114a4 100644 --- a/lib/presentation/search/widgets/filter_search.dart +++ b/lib/presentation/search/widgets/filter_search.dart @@ -77,16 +77,18 @@ class FilterSearch extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(4)), ), child: DropdownSearch( - showSearchBox: true, selectedItem: state.selectedInstitute, + popupProps: const PopupProps.menu(showSearchBox: true), items: SearchBloc.institutes, onChanged: (institute) { if (institute == null) return; bloc.updatedFilter = institute; }, - dropdownSearchDecoration: const InputDecoration( - hintText: 'Select Institute', - contentPadding: EdgeInsets.all(8), + dropdownDecoratorProps: const DropDownDecoratorProps( + dropdownSearchDecoration: InputDecoration( + hintText: 'Select Institute', + contentPadding: EdgeInsets.all(8), + ), ), ), ), diff --git a/lib/presentation/signup/bloc/sign_up_bloc.dart b/lib/presentation/signup/bloc/sign_up_bloc.dart index b90db928..55332e74 100644 --- a/lib/presentation/signup/bloc/sign_up_bloc.dart +++ b/lib/presentation/signup/bloc/sign_up_bloc.dart @@ -1,9 +1,9 @@ import 'dart:async'; import 'dart:io'; -import 'package:bloc/bloc.dart'; import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:get/get.dart'; diff --git a/lib/presentation/update_profile/bloc/update_profile_bloc.dart b/lib/presentation/update_profile/bloc/update_profile_bloc.dart index c5362a93..6cb514d3 100644 --- a/lib/presentation/update_profile/bloc/update_profile_bloc.dart +++ b/lib/presentation/update_profile/bloc/update_profile_bloc.dart @@ -25,7 +25,6 @@ class UpdateProfileBloc extends Bloc { on(_onSelectImage); on(_onUpdateInstitute); on(_onSwitchView); - on(_onUpdateFocusField); on(_onToggleObscure); on(_onUpdatePassword); on(_onUpdateUserDetails); @@ -66,9 +65,9 @@ class UpdateProfileBloc extends Bloc { } void _onInitialize(Initialize event, Emitter emit) async { - final _instituteList = await UserRepository.getInstituteList(); - if (_instituteList.isNotEmpty) { - institutes = _instituteList; + final instituteList = await UserRepository.getInstituteList(); + if (instituteList.isNotEmpty) { + institutes = instituteList; } _initializeTextField(); @@ -97,15 +96,7 @@ class UpdateProfileBloc extends Bloc { controllers['old_pass']?.text = ''; controllers['new_pass']?.text = ''; controllers['re_enter']?.text = ''; - emit(state.copyWith( - showChangePasswordView: !currentState, - activePasswordTextField: -1, - )); - } - - void _onUpdateFocusField( - UpdateFocusField event, Emitter emit) { - emit(state.copyWith(activePasswordTextField: event.index)); + emit(state.copyWith(showChangePasswordView: !currentState)); } void _onToggleObscure(ToggleObscure event, Emitter emit) { @@ -140,23 +131,23 @@ class UpdateProfileBloc extends Bloc { isChanged = false; emit(state.copyWith(isUpdating: true)); - final _errors = {}; + final errors = {}; /// Name Field Validation isChanged |= controllers['name']!.text.trim() != state.user?.fullname; if (controllers['name']!.text.isEmpty) { - _errors['name'] = 'Required Field'; + errors['name'] = 'Required Field'; } /// Username Field Validation if (controllers['username']!.text.isEmpty) { - _errors['username'] = 'Required Field'; + errors['username'] = 'Required Field'; } else if (controllers['username']?.text.trim() != _currentUser.username) { isChanged = true; final res = await UserRepository.isUsernameAvailable( controllers['username']!.text.trim()); - if (!res) _errors['username'] = 'Already Taken'; + if (!res) errors['username'] = 'Already Taken'; } /// Handles Validation @@ -168,35 +159,35 @@ class UpdateProfileBloc extends Bloc { 'leetcode' ]; for (final platform in platforms) { - final _handle = controllers[platform]!.text.trim(); + final handle = controllers[platform]!.text.trim(); - if (_handle.isEmpty) continue; + if (handle.isEmpty) continue; - if (!compareHandles(platform, _handle)) { + if (!compareHandles(platform, handle)) { isChanged |= true; - final res = await UserRepository.verifyHandle(platform, _handle); + final res = await UserRepository.verifyHandle(platform, handle); - if (!res) _errors[platform] = 'Invalid Handle'; + if (!res) errors[platform] = 'Invalid Handle'; } } /// Returns if errors are not empty - if (_errors.keys.isNotEmpty || !isChanged) { - emit(state.copyWith(isUpdating: false, errors: _errors)); + if (errors.keys.isNotEmpty || !isChanged) { + emit(state.copyWith(isUpdating: false, errors: errors)); return; } - final _updatedData = {}; - _updatedData['fullname'] = controllers['name']?.text.trim(); - _updatedData['username'] = controllers['username']?.text.trim(); - _updatedData['institute'] = state.user!.institute; - _updatedData['handle.codechef'] = controllers['codechef']?.text.trim(); - _updatedData['handle.codeforces'] = controllers['codeforces']?.text.trim(); - _updatedData['handle.hackerrank'] = controllers['hackerrank']?.text.trim(); - _updatedData['handle.spoj'] = controllers['spoj']?.text.trim(); - _updatedData['handle.leetcode'] = controllers['leetcode']?.text.trim(); - - final statusCode = await UserRepository.updateUserDetails(_updatedData); + final updatedData = {}; + updatedData['fullname'] = controllers['name']?.text.trim(); + updatedData['username'] = controllers['username']?.text.trim(); + updatedData['institute'] = state.user!.institute; + updatedData['handle.codechef'] = controllers['codechef']?.text.trim(); + updatedData['handle.codeforces'] = controllers['codeforces']?.text.trim(); + updatedData['handle.hackerrank'] = controllers['hackerrank']?.text.trim(); + updatedData['handle.spoj'] = controllers['spoj']?.text.trim(); + updatedData['handle.leetcode'] = controllers['leetcode']?.text.trim(); + + final statusCode = await UserRepository.updateUserDetails(updatedData); if (state.image != null) { await UserRepository.uploadProfilePicture(state.image!); diff --git a/lib/presentation/update_profile/bloc/update_profile_event.dart b/lib/presentation/update_profile/bloc/update_profile_event.dart index 0f76ff7c..f547b569 100644 --- a/lib/presentation/update_profile/bloc/update_profile_event.dart +++ b/lib/presentation/update_profile/bloc/update_profile_event.dart @@ -28,15 +28,6 @@ class SwitchView extends UpdateProfileEvent { const SwitchView(); } -class UpdateFocusField extends UpdateProfileEvent { - const UpdateFocusField({required this.index}); - - final int index; - - @override - List get props => [index]; -} - class ToggleObscure extends UpdateProfileEvent { const ToggleObscure({required this.index}); diff --git a/lib/presentation/update_profile/bloc/update_profile_state.dart b/lib/presentation/update_profile/bloc/update_profile_state.dart index 4035394b..ee052c69 100644 --- a/lib/presentation/update_profile/bloc/update_profile_state.dart +++ b/lib/presentation/update_profile/bloc/update_profile_state.dart @@ -7,7 +7,6 @@ class UpdateProfileState with _$UpdateProfileState { @Default(false) bool showChangePasswordView, File? image, User? user, - @Default(-1) int activePasswordTextField, @Default([true, true, true]) List passwordFieldObscureState, @Default({}) Map errors, @Default(false) bool isUpdating, diff --git a/lib/presentation/update_profile/widgets/change_password.dart b/lib/presentation/update_profile/widgets/change_password.dart index 6f57a0a5..13f1365d 100644 --- a/lib/presentation/update_profile/widgets/change_password.dart +++ b/lib/presentation/update_profile/widgets/change_password.dart @@ -9,121 +9,57 @@ import '../../components/inputs/text_input.dart'; import '../../components/widgets/primary_button.dart'; import '../bloc/update_profile_bloc.dart'; +part 'text_fields.dart'; + class ChangePassword extends StatelessWidget { ChangePassword({Key? key}) : super(key: key); final GlobalKey _key = GlobalKey(); @override Widget build(BuildContext context) { - return BlocBuilder( - builder: (context, state) { - return Column( - children: [ - Expanded( - child: SingleChildScrollView( - child: Form( - key: _key, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox(height: 10.r), - Text( - 'Setup a new password for Codephile', - style: AppStyles.h4.copyWith( - fontSize: 16.sp, - ), - ), - SizedBox(height: 24.r), - _buildTextField( - context, - hint: 'Current Password', - index: 0, - activeIndex: state.activePasswordTextField, - obscure: state.passwordFieldObscureState[0], - controller: UpdateProfileBloc.controllers['old_pass'], - ), - SizedBox(height: 24.r), - _buildTextField( - context, - hint: 'New Password', - index: 1, - activeIndex: state.activePasswordTextField, - obscure: state.passwordFieldObscureState[1], - controller: UpdateProfileBloc.controllers['new_pass'], - ), - SizedBox(height: 24.r), - _buildTextField( - context, - hint: 'Re-enter Password', - index: 2, - activeIndex: state.activePasswordTextField, - obscure: state.passwordFieldObscureState[2], - controller: UpdateProfileBloc.controllers['re_enter'], - compareText: - UpdateProfileBloc.controllers['new_pass']?.text, - ), - ], + return Column( + children: [ + Expanded( + child: Form( + key: _key, + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 10.r), + Text( + 'Setup a new password for Codephile', + style: AppStyles.h4.copyWith( + fontSize: 16.sp, + ), ), - ), + SizedBox(height: 24.r), + const CurrentPasswordField(), + SizedBox(height: 24.r), + const NewPasswordField(), + SizedBox(height: 24.r), + const ReEnterPasswordField(), + ], ), ), - PrimaryButton( + ), + ), + BlocSelector( + selector: (state) => state.isUpdating, + builder: (context, isUpdating) { + return PrimaryButton( label: 'Update Password', + isLoading: isUpdating, onPressed: () { - if (state.isUpdating) return; + if (isUpdating) return; if (_key.currentState!.validate()) { context.read().add(const UpdatePassword()); } }, - ) - ], - ); - }, - ); - } - - Widget _buildTextField( - BuildContext context, { - required String hint, - required int index, - required int activeIndex, - required bool obscure, - TextEditingController? controller, - String? compareText, - }) { - return TextInput( - key: UniqueKey(), - hint: hint, - validator: (val) { - if (val?.isEmpty ?? true) { - return 'Required Field'; - } - // Re-enter field - if (index == 2 && val != compareText) { - return "It doesn't matches with new password"; - } - return null; - }, - onChanged: (val) {}, - controller: controller, - obscureText: obscure, - prefix: Padding( - padding: EdgeInsets.symmetric( - horizontal: 8.r, - vertical: 10.r, - ), - child: ImageIcon( - Svg(index == 0 ? AppAssets.lock : AppAssets.lockFilled), - ), - ), - suffix: IconButton( - onPressed: () { - context.read().add(ToggleObscure(index: index)); - }, - icon: ImageIcon( - Svg(obscure ? AppAssets.eyeOff : AppAssets.eyeOn), + ); + }, ), - ), + ], ); } } diff --git a/lib/presentation/update_profile/widgets/profile_details.dart b/lib/presentation/update_profile/widgets/profile_details.dart index 45606ac8..5138dcf9 100644 --- a/lib/presentation/update_profile/widgets/profile_details.dart +++ b/lib/presentation/update_profile/widgets/profile_details.dart @@ -46,9 +46,9 @@ class ProfileDetails extends StatelessWidget { previous.user?.institute != current.user?.institute, builder: (context, state) { return DropdownSearch( - showSearchBox: true, selectedItem: state.user?.institute, items: UpdateProfileBloc.institutes, + popupProps: const PopupProps.menu(showSearchBox: true), onChanged: (String? institute) { if (institute == null) return; diff --git a/lib/presentation/update_profile/widgets/text_fields.dart b/lib/presentation/update_profile/widgets/text_fields.dart new file mode 100644 index 00000000..4a42ae83 --- /dev/null +++ b/lib/presentation/update_profile/widgets/text_fields.dart @@ -0,0 +1,137 @@ +part of 'change_password.dart'; + +class CurrentPasswordField extends StatelessWidget { + const CurrentPasswordField({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BlocSelector( + selector: (state) => state.passwordFieldObscureState[0], + builder: (context, obscure) { + return TextInput( + hint: 'Current Password', + validator: (val) { + if (val?.isEmpty ?? true) { + return 'Required Field'; + } + + return null; + }, + onChanged: (val) {}, + controller: UpdateProfileBloc.controllers['old_pass'], + obscureText: obscure, + prefix: Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.r, + vertical: 10.r, + ), + child: const ImageIcon(Svg(AppAssets.lock)), + ), + suffix: IconButton( + onPressed: () { + context + .read() + .add(const ToggleObscure(index: 0)); + }, + icon: ImageIcon( + Svg(obscure ? AppAssets.eyeOff : AppAssets.eyeOn), + ), + ), + ); + }, + ); + } +} + +class NewPasswordField extends StatelessWidget { + const NewPasswordField({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BlocSelector( + selector: (state) => state.passwordFieldObscureState[1], + builder: (context, obscure) { + return TextInput( + hint: 'New Password', + validator: (val) { + if (val?.isEmpty ?? true) { + return 'Required Field'; + } + + return null; + }, + onChanged: (val) {}, + controller: UpdateProfileBloc.controllers['new_pass'], + obscureText: obscure, + prefix: Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.r, + vertical: 10.r, + ), + child: const ImageIcon( + Svg(AppAssets.lockFilled), + ), + ), + suffix: IconButton( + onPressed: () { + context + .read() + .add(const ToggleObscure(index: 1)); + }, + icon: ImageIcon( + Svg(obscure ? AppAssets.eyeOff : AppAssets.eyeOn), + ), + ), + ); + }, + ); + } +} + +class ReEnterPasswordField extends StatelessWidget { + const ReEnterPasswordField({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return BlocSelector( + selector: (state) => state.passwordFieldObscureState[2], + builder: (context, obscure) { + return TextInput( + hint: 'Re-enter Password', + action: TextInputAction.done, + validator: (val) { + if (val?.isEmpty ?? true) { + return 'Required Field'; + } + // Re-enter field + if (val != UpdateProfileBloc.controllers['new_pass']?.text) { + return "It doesn't matches with new password"; + } + return null; + }, + controller: UpdateProfileBloc.controllers['re_enter'], + obscureText: obscure, + prefix: Padding( + padding: EdgeInsets.symmetric( + horizontal: 8.r, + vertical: 10.r, + ), + child: const ImageIcon( + Svg(AppAssets.lockFilled), + ), + ), + suffix: IconButton( + onPressed: () { + context + .read() + .add(const ToggleObscure(index: 2)); + }, + icon: ImageIcon( + Svg(obscure ? AppAssets.eyeOff : AppAssets.eyeOn), + ), + ), + ); + }, + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 0a2b43cc..eb7533c0 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,28 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "38.0.0" + version: "47.0.0" + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "3.4.1" + version: "4.7.0" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.3.0" + version: "3.3.1" args: dependency: transitive description: @@ -35,7 +42,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" bloc: dependency: transitive description: @@ -63,7 +70,7 @@ packages: name: build url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.3.1" build_config: dependency: transitive description: @@ -98,7 +105,7 @@ packages: name: build_runner_core url: "https://pub.dartlang.org" source: hosted - version: "7.2.3" + version: "7.2.4" built_collection: dependency: transitive description: @@ -112,28 +119,28 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "8.4.0" + version: "8.4.1" cached_network_image: dependency: "direct main" description: name: cached_network_image url: "https://pub.dartlang.org" source: hosted - version: "3.2.1" + version: "3.2.2" cached_network_image_platform_interface: dependency: transitive description: name: cached_network_image_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "2.0.0" cached_network_image_web: dependency: transitive description: name: cached_network_image_web url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.0.2" card_swiper: dependency: "direct main" description: @@ -147,14 +154,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" charts_common: dependency: transitive description: @@ -176,20 +176,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.5" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "5.7.6" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.8.9" code_builder: dependency: transitive description: name: code_builder url: "https://pub.dartlang.org" source: hosted - version: "4.1.0" + version: "4.3.0" collection: dependency: transitive description: @@ -210,14 +231,14 @@ packages: name: coverage url: "https://pub.dartlang.org" source: hosted - version: "1.3.2" + version: "1.6.1" cross_file: dependency: transitive description: name: cross_file url: "https://pub.dartlang.org" source: hosted - version: "0.3.3+1" + version: "0.3.3+2" crypto: dependency: transitive description: @@ -225,6 +246,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.2" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.2" dart_style: dependency: transitive description: @@ -238,7 +266,7 @@ packages: name: dbus url: "https://pub.dartlang.org" source: hosted - version: "0.7.4" + version: "0.7.8" diff_match_patch: dependency: transitive description: @@ -259,112 +287,112 @@ packages: name: dropdown_search url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "5.0.3" equatable: dependency: "direct main" description: name: equatable url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.5" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.3.1" ffi: dependency: transitive description: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "2.0.1" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.2" + version: "6.1.4" firebase_core: dependency: "direct main" description: name: firebase_core url: "https://pub.dartlang.org" source: hosted - version: "1.19.2" + version: "1.24.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "4.4.3" + version: "4.5.1" firebase_core_web: dependency: transitive description: name: firebase_core_web url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.7.3" firebase_crashlytics: dependency: "direct main" description: name: firebase_crashlytics url: "https://pub.dartlang.org" source: hosted - version: "2.8.5" + version: "2.8.12" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "3.2.11" + version: "3.2.18" firebase_messaging: dependency: "direct main" description: name: firebase_messaging url: "https://pub.dartlang.org" source: hosted - version: "11.4.4" + version: "13.0.4" firebase_messaging_platform_interface: dependency: transitive description: name: firebase_messaging_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "3.5.4" + version: "4.1.6" firebase_messaging_web: dependency: transitive description: name: firebase_messaging_web url: "https://pub.dartlang.org" source: hosted - version: "2.4.4" + version: "3.1.6" firebase_remote_config: dependency: "direct main" description: name: firebase_remote_config url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.19" firebase_remote_config_platform_interface: dependency: transitive description: name: firebase_remote_config_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.1.11" + version: "1.1.18" firebase_remote_config_web: dependency: transitive description: name: firebase_remote_config_web url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.7" fixnum: dependency: transitive description: @@ -425,42 +453,42 @@ packages: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.9.3" + version: "0.10.0" flutter_lints: dependency: "direct dev" description: name: flutter_lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" flutter_local_notifications: dependency: "direct main" description: name: flutter_local_notifications url: "https://pub.dartlang.org" source: hosted - version: "9.7.0" + version: "11.0.1" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux url: "https://pub.dartlang.org" source: hosted - version: "0.5.0+1" + version: "1.0.0" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.0.0" flutter_native_splash: dependency: "direct main" description: name: flutter_native_splash url: "https://pub.dartlang.org" source: hosted - version: "2.2.4" + version: "2.2.10+1" flutter_native_timezone: dependency: "direct main" description: @@ -481,14 +509,14 @@ packages: name: flutter_screenutil url: "https://pub.dartlang.org" source: hosted - version: "5.0.4" + version: "5.5.4" flutter_svg: dependency: "direct main" description: name: flutter_svg url: "https://pub.dartlang.org" source: hosted - version: "1.1.1+1" + version: "1.1.5" flutter_svg_provider: dependency: "direct main" description: @@ -507,7 +535,7 @@ packages: name: flutter_typeahead url: "https://pub.dartlang.org" source: hosted - version: "3.2.7" + version: "4.1.1" flutter_web_browser: dependency: "direct main" description: @@ -526,14 +554,14 @@ packages: name: freezed url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "2.1.0+1" freezed_annotation: dependency: "direct main" description: name: freezed_annotation url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "2.1.0" frontend_server_client: dependency: transitive description: @@ -576,13 +604,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.15.0" http: dependency: transitive description: name: http url: "https://pub.dartlang.org" source: hosted - version: "0.13.4" + version: "0.13.5" http_multi_server: dependency: transitive description: @@ -617,7 +652,21 @@ packages: name: image_cropper url: "https://pub.dartlang.org" source: hosted - version: "1.5.1" + version: "3.0.0" + image_cropper_for_web: + dependency: transitive + description: + name: image_cropper_for_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + image_cropper_platform_interface: + dependency: transitive + description: + name: image_cropper_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" image_picker: dependency: "direct main" description: @@ -631,28 +680,28 @@ packages: name: image_picker_android url: "https://pub.dartlang.org" source: hosted - version: "0.8.5+1" + version: "0.8.5+3" image_picker_for_web: dependency: transitive description: name: image_picker_for_web url: "https://pub.dartlang.org" source: hosted - version: "2.1.8" + version: "2.1.10" image_picker_ios: dependency: transitive description: name: image_picker_ios url: "https://pub.dartlang.org" source: hosted - version: "0.8.5+6" + version: "0.8.6+1" image_picker_platform_interface: dependency: transitive description: name: image_picker_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.6.2" intl: dependency: "direct main" description: @@ -688,20 +737,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.3.1" - lint: - dependency: transitive - description: - name: lint - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.2" lints: dependency: transitive description: name: lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.0" logging: dependency: transitive description: @@ -715,21 +757,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" material_color_utilities: dependency: transitive description: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" mime: dependency: transitive description: @@ -778,7 +820,7 @@ packages: name: package_info_plus url: "https://pub.dartlang.org" source: hosted - version: "1.4.2" + version: "1.4.3+1" package_info_plus_linux: dependency: transitive description: @@ -813,30 +855,30 @@ packages: name: package_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" path_drawing: dependency: transitive description: name: path_drawing url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" path_parsing: dependency: transitive description: name: path_parsing url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.0.1" path_provider: - dependency: transitive + dependency: "direct main" description: name: path_provider url: "https://pub.dartlang.org" @@ -848,14 +890,14 @@ packages: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.16" + version: "2.0.20" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.10" + version: "2.0.11" path_provider_linux: dependency: transitive description: @@ -876,14 +918,14 @@ packages: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.1.3" pedantic: dependency: transitive description: @@ -911,7 +953,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.3" pool: dependency: transitive description: @@ -946,7 +988,7 @@ packages: name: pubspec_parse url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" rxdart: dependency: "direct main" description: @@ -960,21 +1002,21 @@ packages: name: sentry url: "https://pub.dartlang.org" source: hosted - version: "6.6.3" + version: "6.11.1" sentry_flutter: dependency: "direct main" description: name: sentry_flutter url: "https://pub.dartlang.org" source: hosted - version: "6.6.3" + version: "6.11.1" shelf: dependency: transitive description: name: shelf url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.4.0" shelf_packages_handler: dependency: transitive description: @@ -1035,21 +1077,21 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.9.0" sqflite: dependency: transitive description: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.1.0" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.dartlang.org" source: hosted - version: "2.2.1+1" + version: "2.3.0" stack_trace: dependency: transitive description: @@ -1077,49 +1119,49 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" synchronized: dependency: transitive description: name: synchronized url: "https://pub.dartlang.org" source: hosted - version: "3.0.0+2" + version: "3.0.0+3" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test: dependency: transitive description: name: test url: "https://pub.dartlang.org" source: hosted - version: "1.21.1" + version: "1.21.4" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.12" test_core: dependency: transitive description: name: test_core url: "https://pub.dartlang.org" source: hosted - version: "0.4.13" + version: "0.4.16" timezone: dependency: transitive description: name: timezone url: "https://pub.dartlang.org" source: hosted - version: "0.8.0" + version: "0.9.0" timing: dependency: transitive description: @@ -1161,7 +1203,7 @@ packages: name: vm_service url: "https://pub.dartlang.org" source: hosted - version: "8.3.0" + version: "9.4.0" watcher: dependency: transitive description: @@ -1182,21 +1224,21 @@ packages: name: webkit_inspection_protocol url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" win32: dependency: transitive description: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "3.0.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0+1" + version: "0.2.0+2" xml: dependency: transitive description: @@ -1212,5 +1254,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.17.0 <3.0.0" - flutter: ">=3.0.0" + dart: ">=2.18.0 <3.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 107ea49e..d617aef6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,42 +13,43 @@ dependencies: card_swiper: ^2.0.1 charts_flutter: ^0.12.0 dio: ^4.0.4 - dropdown_search: ^2.0.1 + dropdown_search: ^5.0.3 equatable: ^2.0.3 firebase_core: ^1.11.0 firebase_crashlytics: ^2.4.5 - firebase_messaging: ^11.2.5 - firebase_remote_config: ^1.0.4 + firebase_messaging: ^13.0.4 + firebase_remote_config: ^2.0.19 flutter: sdk: flutter flutter_bloc: ^8.0.1 - flutter_local_notifications: ^9.5.2 + flutter_local_notifications: ^11.0.1 flutter_native_splash: ^2.1.6 flutter_native_timezone: ^2.0.0 - flutter_screenutil: 5.0.4 + flutter_screenutil: ^5.5.4 flutter_svg: ^1.0.3 flutter_svg_provider: ^1.0.3 - flutter_typeahead: ^3.2.4 + flutter_typeahead: ^4.1.1 flutter_web_browser: ^0.17.0 - freezed_annotation: ^1.1.0 + freezed_annotation: ^2.1.0 get: ^4.6.1 hive_flutter: ^1.1.0 hydrated_bloc: ^8.0.0 - image_cropper: ^1.5.0 + image_cropper: ^3.0.0 image_picker: ^0.8.4+10 intl: ^0.17.0 json_annotation: ^4.4.0 + path_provider: ^2.0.11 rxdart: ^0.27.3 sentry_flutter: ^6.2.2 dev_dependencies: bloc_test: ^9.0.2 build_runner: ^2.1.7 - flutter_launcher_icons: ^0.9.2 - flutter_lints: ^1.0.0 + flutter_launcher_icons: ^0.10.0 + flutter_lints: ^2.0.1 flutter_test: sdk: flutter - freezed: ^1.1.0 + freezed: ^2.1.0+1 json_serializable: ^6.1.4 mocktail: diff --git a/test/presentation/onboarding/onboarding_test.dart b/test/presentation/onboarding/onboarding_test.dart index 497aeb46..6ee3d7df 100644 --- a/test/presentation/onboarding/onboarding_test.dart +++ b/test/presentation/onboarding/onboarding_test.dart @@ -11,13 +11,13 @@ import '../../utils/pump_screen.dart'; void widgetTests() { group('OnboardingScreen -', () { - Future _initHive() async { + Future initHive() async { await Hive.initFlutter(); await Hive.openBox(AppStrings.hiveBoxName); } setUpAll(() async { - await _initHive(); + await initHive(); StorageService.init(); }); diff --git a/test/utils/pump_screen.dart b/test/utils/pump_screen.dart index 2093d295..23216f4e 100644 --- a/test/utils/pump_screen.dart +++ b/test/utils/pump_screen.dart @@ -9,10 +9,10 @@ Future pumpScreen(WidgetTester tester, Widget Function() screen) async { await tester.pumpWidget( ScreenUtilInit( designSize: const Size(360, 640), - builder: () { + builder: (context, _) { return GetMaterialApp( builder: (context, widget) { - ScreenUtil.setContext(context); + // ScreenUtil.setContext(context); return MediaQuery( data: MediaQuery.of(context).copyWith(textScaleFactor: 1), child: widget!,