diff --git a/lib/core/credentials_storage.dart b/lib/core/credentials_storage.dart index 7bbd0bef..6e9870e5 100644 --- a/lib/core/credentials_storage.dart +++ b/lib/core/credentials_storage.dart @@ -20,12 +20,12 @@ abstract class CredentialsStorage { }; } - static saveCredentials(String email, String password) async { + static Future saveCredentials(String email, String password) async { await const FlutterSecureStorage().write(key: 'email', value: email); await const FlutterSecureStorage().write(key: 'password', value: password); } - static removeCredentials() async { + static Future removeCredentials() async { await const FlutterSecureStorage().delete(key: 'email'); await const FlutterSecureStorage().delete(key: 'password'); } diff --git a/lib/core/theme/custom_text_style.dart b/lib/core/theme/custom_text_style.dart index 88851233..62544e86 100644 --- a/lib/core/theme/custom_text_style.dart +++ b/lib/core/theme/custom_text_style.dart @@ -7,162 +7,162 @@ import 'package:flutter/material.dart'; class CustomTextStyles { // Headline style - static get headlineSmallMulish => theme.textTheme.headlineSmall!.mulish; + static TextStyle get headlineSmallMulish => theme.textTheme.headlineSmall!.mulish; // Title text style - static get titleMediumSegoeUI => theme.textTheme.titleMedium!.segoeUI.copyWith( + static TextStyle get titleMediumSegoeUI => theme.textTheme.titleMedium!.segoeUI.copyWith( fontWeight: FontWeight.w600, ); - static get bodyMediumBlack900 => theme.textTheme.bodyMedium!.copyWith( + static TextStyle get bodyMediumBlack900 => theme.textTheme.bodyMedium!.copyWith( color: appTheme.black900, ); - static get bodyMediumBlack90013 => theme.textTheme.bodyMedium!.copyWith( + static TextStyle get bodyMediumBlack90013 => theme.textTheme.bodyMedium!.copyWith( color: appTheme.black900, fontSize: 13, ); - static get bodyMediumBluegray800 => theme.textTheme.bodyMedium!.copyWith( + static TextStyle get bodyMediumBluegray800 => theme.textTheme.bodyMedium!.copyWith( color: appTheme.black, ); - static get bodyMediumBluegray800_1 => theme.textTheme.bodyMedium!.copyWith( + static TextStyle get bodyMediumBluegray800_1 => theme.textTheme.bodyMedium!.copyWith( color: appTheme.black, ); - static get bodyMediumBluegray800_2 => theme.textTheme.bodyMedium!.copyWith( + static TextStyle get bodyMediumBluegray800_2 => theme.textTheme.bodyMedium!.copyWith( color: appTheme.black, ); - static get bodyMediumWhiteA700 => theme.textTheme.bodyMedium!.copyWith( + static TextStyle get bodyMediumWhiteA700 => theme.textTheme.bodyMedium!.copyWith( color: appTheme.whiteA700, ); - static get bodySmallMulishBlack900 => theme.textTheme.bodySmall!.mulish.copyWith( + static TextStyle get bodySmallMulishBlack900 => theme.textTheme.bodySmall!.mulish.copyWith( color: appTheme.black900, fontSize: 12, ); - static get bodySmallMulishBluegray800 => theme.textTheme.bodySmall!.mulish.copyWith( + static TextStyle get bodySmallMulishBluegray800 => theme.textTheme.bodySmall!.mulish.copyWith( color: appTheme.black, fontSize: 12, ); - static get bodySmallMulishBluegray80012 => theme.textTheme.bodySmall!.mulish.copyWith( + static TextStyle get bodySmallMulishBluegray80012 => theme.textTheme.bodySmall!.mulish.copyWith( color: appTheme.black, fontSize: 12, ); - static get bodySmallMulishBluegray80012_1 => theme.textTheme.bodySmall!.mulish.copyWith( + static TextStyle get bodySmallMulishBluegray80012_1 => theme.textTheme.bodySmall!.mulish.copyWith( color: appTheme.black, fontSize: 12, ); - static get bodySmallMulishBluegray900 => theme.textTheme.bodySmall!.mulish.copyWith( + static TextStyle get bodySmallMulishBluegray900 => theme.textTheme.bodySmall!.mulish.copyWith( color: appTheme.blueGray900, fontSize: 12, ); - static get bodySmallMulishGray600 => theme.textTheme.bodySmall!.mulish.copyWith( + static TextStyle get bodySmallMulishGray600 => theme.textTheme.bodySmall!.mulish.copyWith( color: appTheme.gray600, ); - static get bodySmallMulishPrimary => theme.textTheme.bodySmall!.mulish.copyWith( + static TextStyle get bodySmallMulishPrimary => theme.textTheme.bodySmall!.mulish.copyWith( color: theme.colorScheme.primary, fontSize: 12, ); - static get bodySmallSegoeUIBlack900 => theme.textTheme.bodySmall!.segoeUI.copyWith( + static TextStyle get bodySmallSegoeUIBlack900 => theme.textTheme.bodySmall!.segoeUI.copyWith( color: appTheme.black900, fontSize: 12, ); // Label text style - static get labelLargeGray60003 => theme.textTheme.labelLarge!.copyWith( + static TextStyle get labelLargeGray60003 => theme.textTheme.labelLarge!.copyWith( color: appTheme.gray60003, ); - static get labelLargeWhiteA700 => theme.textTheme.labelLarge!.copyWith( + static TextStyle get labelLargeWhiteA700 => theme.textTheme.labelLarge!.copyWith( color: appTheme.whiteA700, ); // Title text style - static get titleMedium16 => theme.textTheme.titleMedium!.copyWith( + static TextStyle get titleMedium16 => theme.textTheme.titleMedium!.copyWith( fontSize: 16, ); - static get titleMediumBlack => theme.textTheme.titleMedium!.copyWith( + static TextStyle get titleMediumBlack => theme.textTheme.titleMedium!.copyWith( fontSize: 17, fontWeight: FontWeight.w900, ); - static get titleMediumBlack900 => theme.textTheme.titleMedium!.copyWith( + static TextStyle get titleMediumBlack900 => theme.textTheme.titleMedium!.copyWith( color: appTheme.black900, ); - static get titleMediumSemiBold => theme.textTheme.titleMedium!.copyWith( + static TextStyle get titleMediumSemiBold => theme.textTheme.titleMedium!.copyWith( fontWeight: FontWeight.w600, ); - static get titleMediumWhiteA700 => theme.textTheme.titleMedium!.copyWith( + static TextStyle get titleMediumWhiteA700 => theme.textTheme.titleMedium!.copyWith( color: appTheme.whiteA700, fontWeight: FontWeight.w600, ); - static get titleSmallBlue800 => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallBlue800 => theme.textTheme.titleSmall!.copyWith( color: appTheme.blue800, fontWeight: FontWeight.w800, ); - static get titleSmallBluegray800 => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallBluegray800 => theme.textTheme.titleSmall!.copyWith( color: appTheme.black, ); - static get titleSmallBluegray800Bold => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallBluegray800Bold => theme.textTheme.titleSmall!.copyWith( color: appTheme.black, fontWeight: FontWeight.w700, ); - static get titleSmallBluegray800ExtraBold => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallBluegray800ExtraBold => theme.textTheme.titleSmall!.copyWith( color: appTheme.black, fontWeight: FontWeight.w800, ); - static get titleSmallBold => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallBold => theme.textTheme.titleSmall!.copyWith( fontSize: 15, fontWeight: FontWeight.w700, ); - static get titleSmallGreenA70001 => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallGreenA70001 => theme.textTheme.titleSmall!.copyWith( color: appTheme.greenA70001, ); - static get titleSmallGreenA70001ExtraBold => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallGreenA70001ExtraBold => theme.textTheme.titleSmall!.copyWith( color: appTheme.greenA70001, fontWeight: FontWeight.w800, ); - static get titleSmallLightgreen300 => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallLightgreen300 => theme.textTheme.titleSmall!.copyWith( color: appTheme.lightGreen300, fontWeight: FontWeight.w800, ); - static get titleSmallRed200 => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallRed200 => theme.textTheme.titleSmall!.copyWith( color: appTheme.red200, fontWeight: FontWeight.w800, ); - static get titleSmallSecondaryContainer => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallSecondaryContainer => theme.textTheme.titleSmall!.copyWith( color: theme.colorScheme.secondaryContainer, fontWeight: FontWeight.w800, ); - static get titleSmallSecondaryContainer_1 => theme.textTheme.titleSmall!.copyWith( + static TextStyle get titleSmallSecondaryContainer_1 => theme.textTheme.titleSmall!.copyWith( color: theme.colorScheme.secondaryContainer, ); - static get titleSmallSegoeUIOnPrimary => theme.textTheme.titleSmall!.segoeUI.copyWith( + static TextStyle get titleSmallSegoeUIOnPrimary => theme.textTheme.titleSmall!.segoeUI.copyWith( color: theme.colorScheme.onPrimary, ); } diff --git a/lib/core/token_storage.dart b/lib/core/token_storage.dart index ec16d1ea..cbfb8abb 100644 --- a/lib/core/token_storage.dart +++ b/lib/core/token_storage.dart @@ -15,7 +15,7 @@ abstract class TokenStorage { static Future getTokenFromStorage() async => await const FlutterSecureStorage().read(key: 'token'); - static saveTokenInStorage(String token) async { + static Future saveTokenInStorage(String token) async { await const FlutterSecureStorage().write(key: 'token', value: token); } diff --git a/lib/core/widgets/custom_drop_down.dart b/lib/core/widgets/custom_drop_down.dart index bbd07a09..aca39b44 100644 --- a/lib/core/widgets/custom_drop_down.dart +++ b/lib/core/widgets/custom_drop_down.dart @@ -56,7 +56,7 @@ class CustomDropDown extends StatelessWidget { : _buildDropDownWidget(context); } - _buildDropDownWidget(BuildContext context) { + DropdownButtonFormField _buildDropDownWidget(BuildContext context) { return DropdownButtonFormField( focusNode: focusNode ?? FocusNode(), icon: const Icon(Icons.keyboard_arrow_down_rounded), @@ -84,7 +84,7 @@ class CustomDropDown extends StatelessWidget { ); } - void onDropDownChanged(value) { + void onDropDownChanged(dynamic value) { onChanged!(value!); } diff --git a/lib/core/widgets/custom_popup.dart b/lib/core/widgets/custom_popup.dart index 1ba0224e..b5934f4d 100644 --- a/lib/core/widgets/custom_popup.dart +++ b/lib/core/widgets/custom_popup.dart @@ -76,7 +76,7 @@ class CustomPopup extends StatelessWidget { ); } - List _buildMenuItems(s, context) { + List _buildMenuItems(S s,BuildContext context) { final entries = []; void addItem(String icon, String text, Function() onTap) { @@ -110,28 +110,28 @@ class CustomPopup extends StatelessWidget { addItem('assets/icons/red_trash.svg', 'Удалить', () async { if (complainedContentType == ComplainedContent.posts) { final result = await sl().deleteBlogPost(id!); - if (!result) { + if (!result && context.mounted) { showErrorDialog(context, title: S.current.could_not_delete_blog_post); return; } showSuccessToast('Пост удален, обновите ленту'); } else if (complainedContentType == ComplainedContent.recipe) { final result = await sl().deleteRecipe(slug!); - if (!result) { + if (!result && context.mounted) { showErrorDialog(context, title: 'Не удалось удалить рецепт'); return; } showSuccessToast('Рецепт удален, обновите ленту'); } else if (complainedContentType == ComplainedContent.diet) { final result = await sl().deleteDiet(id!); - if (!result) { + if (!result && context.mounted) { showErrorDialog(context, title: 'Не удалось удалить диету'); return; } showSuccessToast('Диета удалена, обновите ленту'); } else if (complainedContentType == ComplainedContent.plan) { final result = await sl().deletePlan(slug!); - if (!result) { + if (!result && context.mounted) { showErrorDialog(context, title: 'Не удалось удалить план'); return; } diff --git a/lib/features/auth/presentation/bloc/reset_password_cubit/reset_password_cubit.dart b/lib/features/auth/presentation/bloc/reset_password_cubit/reset_password_cubit.dart index 37fd0d5a..136ca9b8 100644 --- a/lib/features/auth/presentation/bloc/reset_password_cubit/reset_password_cubit.dart +++ b/lib/features/auth/presentation/bloc/reset_password_cubit/reset_password_cubit.dart @@ -7,7 +7,7 @@ class ResetPasswordCubit extends Cubit { ResetPasswordCubit({required this.resetPasswordRepository}) : super(const ResetPasswordState.empty()); - trySendEmailCode(String email) async { + Future trySendEmailCode(String email) async { emit(const ResetPasswordState.loadingSendEmailCode()); try { if (await resetPasswordRepository.sendEmailCodeForPasswordChange(email)) { @@ -20,7 +20,7 @@ class ResetPasswordCubit extends Cubit { } } - tryResetPassword(String email, String code, String password, String passwordConfirmation) async { + Future tryResetPassword(String email, String code, String password, String passwordConfirmation) async { emit(const ResetPasswordState.loadingResetPassword()); try { if (await resetPasswordRepository.confirmPasswordChange(code, password, passwordConfirmation, email)) { diff --git a/lib/features/blog_post/presentation/pages/blog_post_screen.dart b/lib/features/blog_post/presentation/pages/blog_post_screen.dart index 5541daa8..c254c479 100644 --- a/lib/features/blog_post/presentation/pages/blog_post_screen.dart +++ b/lib/features/blog_post/presentation/pages/blog_post_screen.dart @@ -319,7 +319,7 @@ class _BlogPostScreenState extends State { ); } - _iconButton({required IconData icon, String? text, Function()? onTap, Color? iconColor, Color? backgroundColor, Color? textColor}) { + InkWell _iconButton({required IconData icon, String? text, Function()? onTap, Color? iconColor, Color? backgroundColor, Color? textColor}) { return InkWell( onTap: onTap ?? () {}, borderRadius: BorderRadius.circular(16), diff --git a/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart b/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart index d1682338..6be43b3a 100644 --- a/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart +++ b/lib/features/blog_post_create/presentation/pages/blog_post_create_screen.dart @@ -80,7 +80,7 @@ class _BlogPostCreateScreenState extends State { ); } - _showImagePicker() { + void _showImagePicker() { showCupertinoModalPopup( context: context, builder: (context) { @@ -145,7 +145,7 @@ class _BlogPostCreateScreenState extends State { ); } - _buildBlogPostCreate(BuildContext context) { + Scaffold _buildBlogPostCreate(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: true, appBar: AppBar(), @@ -253,7 +253,7 @@ class _BlogPostCreateScreenState extends State { ); } - _buildAddPhoto() { + GestureDetector _buildAddPhoto() { return GestureDetector( onTap: () { _showImagePicker(); diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart index 6f31b94b..8aef9871 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/new_messages_cubit/new_messages_cubit.dart @@ -6,7 +6,7 @@ class NewMessagesCubit extends Cubit { NewMessagesCubit() : super(const NewMessagesState.empty()); - incrementCounter() { + void incrementCounter() { _messagesCount++; emit(NewMessagesState.loaded(messagesCount: _messagesCount)); } diff --git a/lib/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart b/lib/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart index 94ae4601..cc7939dd 100644 --- a/lib/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart +++ b/lib/features/bottom_navigation_bar/presentation/bloc/profile_avatar_cubit/profile_avatar_cubit.dart @@ -11,7 +11,7 @@ class ProfileAvatarCubit extends Cubit { required this.profileRepository, }) : super(const ProfileAvatarState.loading()); - getMyProfile() async { + Future getMyProfile() async { emit(const ProfileAvatarState.loading()); try { emit( diff --git a/lib/features/calendar/presentation/bloc/calendar_cubit.dart b/lib/features/calendar/presentation/bloc/calendar_cubit.dart index 01a16da9..84fa9f0e 100644 --- a/lib/features/calendar/presentation/bloc/calendar_cubit.dart +++ b/lib/features/calendar/presentation/bloc/calendar_cubit.dart @@ -7,7 +7,7 @@ class CalendarCubit extends Cubit { CalendarCubit({required this.calendarRepository}) : super(const CalendarState.loading()); - loadCalendarList() async { + Future loadCalendarList() async { emit(const CalendarState.loading()); try { final calendarList = await calendarRepository.getCalendar(); diff --git a/lib/features/calendar/presentation/pages/calendar_screen.dart b/lib/features/calendar/presentation/pages/calendar_screen.dart index a409a1b0..2ba9a0b7 100644 --- a/lib/features/calendar/presentation/pages/calendar_screen.dart +++ b/lib/features/calendar/presentation/pages/calendar_screen.dart @@ -89,7 +89,7 @@ class CalendarScreen extends StatelessWidget { ); } - _buildCalendarBody(BuildContext context, CalendarStateLoaded state) { + ListView _buildCalendarBody(BuildContext context, CalendarStateLoaded state) { return ListView.separated( padding: const EdgeInsets.all(8), shrinkWrap: true, diff --git a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart index f36cbbe5..63bf9e19 100644 --- a/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart +++ b/lib/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart @@ -47,7 +47,7 @@ class ChatRoomCubit extends Cubit { _timer?.cancel(); } - loadNextPage(String chatId) async { + Future loadNextPage(String chatId) async { if (currentPage < lastPage && !isLoading) { isLoading = true; @@ -89,7 +89,7 @@ class ChatRoomCubit extends Cubit { } } - initChat(String chatId, {bool sendInitialMessage = false}) async { + Future initChat(String chatId, {bool sendInitialMessage = false}) async { try { final chatRoom = await chatRepository.getChatRoom(chatId); ChosenPlanModel? chosenPlan; diff --git a/lib/features/chat/presentation/pages/chat_screen.dart b/lib/features/chat/presentation/pages/chat_screen.dart index ab1c80c5..55f74d70 100644 --- a/lib/features/chat/presentation/pages/chat_screen.dart +++ b/lib/features/chat/presentation/pages/chat_screen.dart @@ -69,7 +69,7 @@ class _ChatScreenState extends State { _listener = AppLifecycleListener(onHide: _onHide, onResume: _onResume); } - _onScroll() { + void _onScroll() { if (scrollController.offset >= scrollController.position.maxScrollExtent && !scrollController.position.outOfRange) { chatRoomCubit.loadNextPage(widget.chatId); } @@ -102,7 +102,7 @@ class _ChatScreenState extends State { ); } - _buildChat(BuildContext context, ChatRoomStateLoaded state) { + Scaffold _buildChat(BuildContext context, ChatRoomStateLoaded state) { final chosenPlan = state.chatRoom.chosenPlan; final amIConsultant = chosenPlan?.consultantId == state.chatRoom.users.sender.id; final showUserDetailsButton = [ @@ -560,7 +560,7 @@ class _ChatScreenState extends State { return 0; } - showImagePicker(String slug) { + void showImagePicker(String slug) { showCupertinoModalPopup( context: context, builder: (context) => CupertinoActionSheet( @@ -661,7 +661,7 @@ class _ChatScreenState extends State { ); } - _messageDate(DateTime date) { + Center _messageDate(DateTime date) { return Center( child: Padding( padding: const EdgeInsets.only(top: 32), diff --git a/lib/features/chat/presentation/pages/chats_screen.dart b/lib/features/chat/presentation/pages/chats_screen.dart index 6c4c2398..befaa00f 100644 --- a/lib/features/chat/presentation/pages/chats_screen.dart +++ b/lib/features/chat/presentation/pages/chats_screen.dart @@ -83,7 +83,7 @@ class _ChatsScreenState extends State { ); } - _buildChatList(BuildContext context, ChatsState state) { + NotificationListener _buildChatList(BuildContext context, ChatsState state) { return NotificationListener( onNotification: (notification) { loadNewContent(notification, context.read().loadMoreChatRooms); diff --git a/lib/features/chat/presentation/pages/empty_chat_screen.dart b/lib/features/chat/presentation/pages/empty_chat_screen.dart index 2f8e91b3..3195888c 100644 --- a/lib/features/chat/presentation/pages/empty_chat_screen.dart +++ b/lib/features/chat/presentation/pages/empty_chat_screen.dart @@ -167,7 +167,7 @@ class _EmptyChatScreenState extends State { ); } - showImagePicker(String slug) { + void showImagePicker(String slug) { showCupertinoModalPopup( context: context, builder: (context) => CupertinoActionSheet( diff --git a/lib/features/chat/presentation/widgets/chat_search_bar_widget.dart b/lib/features/chat/presentation/widgets/chat_search_bar_widget.dart index 80e0c42c..8691beb3 100644 --- a/lib/features/chat/presentation/widgets/chat_search_bar_widget.dart +++ b/lib/features/chat/presentation/widgets/chat_search_bar_widget.dart @@ -78,7 +78,7 @@ class ChatSearchBarWidget extends StatelessWidget { return searchViewWidget(context); } - searchViewWidget(BuildContext context) => SizedBox( + SizedBox searchViewWidget(BuildContext context) => SizedBox( width: width ?? MediaQuery.of(context).size.width, child: TextFormField( textCapitalization: TextCapitalization.sentences, diff --git a/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart b/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart index 05bfd52a..84961990 100644 --- a/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart +++ b/lib/features/consultant/become_consultant/presentation/bloc/register_consultant_cubit/register_consultant_cubit.dart @@ -37,7 +37,7 @@ class RegisterConsultantCubit extends Cubit { } } - getMyRequestStatus(String slug) async { + Future getMyRequestStatus(String slug) async { _update = true; final myRequestStatus = await consultantRepository.getMyRequestStatus(slug); @@ -81,11 +81,11 @@ class RegisterConsultantCubit extends Cubit { ); } - disableLoading() { + void disableLoading() { emit(state.copyWith(loading: false)); } - updateConsultantProfileModel(ConsultantProfileModel consultant, [bool acceptOffer = false]) { + void updateConsultantProfileModel(ConsultantProfileModel consultant, [bool acceptOffer = false]) { emit( state.copyWith( consultant: consultant, @@ -95,7 +95,7 @@ class RegisterConsultantCubit extends Cubit { ); } - registerConsultant() async { + Future registerConsultant() async { if (state.consultant.photos != null) { updateConsultantProfileModel( state.consultant.copyWith( diff --git a/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart index c559654c..ce13f905 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/additional_settings_screen.dart @@ -76,7 +76,7 @@ class _AdditionalSettingsScreenState extends State { ); } - _tile({ + ListTile _tile({ required String title, required Function() onTap, required bool value, @@ -102,7 +102,7 @@ class _AdditionalSettingsScreenState extends State { ); } - _divider(BuildContext context) { + Center _divider(BuildContext context) { return Center( child: Container( height: 0.4, diff --git a/lib/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart index bcffc6e4..ef9f5cec 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/become_consultant_screen.dart @@ -35,7 +35,7 @@ class _BecomeConsultantScreenState extends State { ); } - _startRegistrationButton() { + InkWell _startRegistrationButton() { return InkWell( onTap: () => GoRouter.of(context).pushReplacementNamed('stepperBecomeConsultantScreen'), borderRadius: BorderRadius.circular(20), diff --git a/lib/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_screen.dart index 3b877c4d..b2b26c0e 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/certificates_and_diplomas_screen.dart @@ -82,7 +82,7 @@ class _CertificatesAndDiplomasScreenState extends State().updateConsultantProfileModel( context.read().state.consultant.copyWith( certificates: diplomasList.map((e) => CertificatesModel(title: e.textEditingController.text, date: e.date.toString())).toList().sublist( diff --git a/lib/features/consultant/become_consultant/presentation/pages/last_step_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/last_step_screen.dart index 302aae96..b5afd001 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/last_step_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/last_step_screen.dart @@ -80,7 +80,7 @@ class _LastStepScreenState extends State { ); } - _divider(BuildContext context) { + Container _divider(BuildContext context) { return Container( height: 0.4, width: MediaQuery.of(context).size.width - 32, diff --git a/lib/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart index 672499b2..234e3d74 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/photo_or_scans_screen.dart @@ -148,7 +148,7 @@ class _PhotoOrScansScreenState extends State { ); } - _saveState() { + void _saveState() { context.read().updateConsultantProfileModel( context.read().state.consultant.copyWith( photos: imagesPaths, diff --git a/lib/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart index 5d69d36a..76b90a26 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/registration_as_screen.dart @@ -104,7 +104,7 @@ class _RegistrationAsScreenState extends State { ); } - _divider(BuildContext context) { + Container _divider(BuildContext context) { return Container( height: 0.4, width: MediaQuery.of(context).size.width - 32, diff --git a/lib/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart b/lib/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart index 5c0076c3..609e94a5 100644 --- a/lib/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart +++ b/lib/features/consultant/become_consultant/presentation/pages/social_networks_screen.dart @@ -158,7 +158,7 @@ class _SocialNetworksScreenState extends State { ); } - setLinksState({ + void setLinksState({ String? tgLink, String? vkLink, String? personalSiteLink, diff --git a/lib/features/consultations/presentation/widgets/consultation_card_widget.dart b/lib/features/consultations/presentation/widgets/consultation_card_widget.dart index 11322228..5173ab2d 100644 --- a/lib/features/consultations/presentation/widgets/consultation_card_widget.dart +++ b/lib/features/consultations/presentation/widgets/consultation_card_widget.dart @@ -354,7 +354,7 @@ class _ConsultationCardWidgetState extends State { ); } - _legendTitle(String text, Color color) { + Row _legendTitle(String text, Color color) { return Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/features/create_diet/presentation/diet_preview_screen.dart b/lib/features/create_diet/presentation/diet_preview_screen.dart index fa88e9d8..6c337142 100644 --- a/lib/features/create_diet/presentation/diet_preview_screen.dart +++ b/lib/features/create_diet/presentation/diet_preview_screen.dart @@ -348,7 +348,7 @@ class _DietPreviewScreenState extends State { ); } - _dayOfPlan(Map> day, int dayNumber, S s) { + Padding _dayOfPlan(Map> day, int dayNumber, S s) { choiceChipWidget(int index) { return ChoiceChip( selectedColor: appTheme.blueA400, @@ -435,7 +435,7 @@ class _DietPreviewScreenState extends State { ); } - _daily(DailySchedule? daily, S s) { + SingleChildRenderObjectWidget _daily(DailySchedule? daily, S s) { if (daily == null) return const SizedBox.shrink(); return Padding( padding: const EdgeInsets.only(bottom: 12), diff --git a/lib/features/create_diet/presentation/widgets/day_widget.dart b/lib/features/create_diet/presentation/widgets/day_widget.dart index 68b4424b..9e5fe5fb 100644 --- a/lib/features/create_diet/presentation/widgets/day_widget.dart +++ b/lib/features/create_diet/presentation/widgets/day_widget.dart @@ -289,7 +289,7 @@ class _DayWidgetState extends State { ); } - _product(int index, String product, int quantity, String portion, int dayIndex, int mealIndex) { + Material _product(int index, String product, int quantity, String portion, int dayIndex, int mealIndex) { return Material( child: ListTile( onTap: () { @@ -313,7 +313,7 @@ class _DayWidgetState extends State { ); } - _modalBottomSheet({ + Future _modalBottomSheet({ required CreateDietCubit createDietCubit, required int dayIndex, required int mealIndex, diff --git a/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart b/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart index f13d3d02..4ca081d4 100644 --- a/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart +++ b/lib/features/create_recipe/presentation/bloc/create_recipe_cubit/create_recipe_cubit.dart @@ -32,7 +32,7 @@ class CreateRecipeCubit extends Cubit { ), ); - addStep() { + void addStep() { emit( state.copyWith.entity( steps: [ @@ -43,13 +43,13 @@ class CreateRecipeCubit extends Cubit { ); } - removeStep(StepEntity step) { + void removeStep(StepEntity step) { List steps = [...state.entity.steps]; steps.remove(step); emit(state.copyWith.entity(steps: steps)); } - addIngredient(i.Ingredient entity) { + void addIngredient(i.Ingredient entity) { emit( state.copyWith.entity( ingredients: [ @@ -60,7 +60,7 @@ class CreateRecipeCubit extends Cubit { ); } - removeIngredient(int index) { + void removeIngredient(int index) { List ingredients = [...state.entity.ingredients]; ingredients.removeAt(index); @@ -73,26 +73,26 @@ class CreateRecipeCubit extends Cubit { emit(state.copyWith.entity(ingredients: ingredients)); } - replaceIngredientPosition(int oldIndex, int newIndex) { + void replaceIngredientPosition(int oldIndex, int newIndex) { List ingredients = [...state.entity.ingredients]; final item = ingredients.removeAt(oldIndex); ingredients.insert(newIndex, item); emit(state.copyWith.entity(ingredients: ingredients)); } - replaceTitle(String title) { + void replaceTitle(String title) { emit(state.copyWith.entity(title: title == '' ? null : title)); } - replaceDescription(String description) { + void replaceDescription(String description) { emit(state.copyWith.entity(description: description == '' ? null : description)); } - changeType(TypeOfRecipe typeOfRecipe) { + void changeType(TypeOfRecipe typeOfRecipe) { emit(state.copyWith.entity(typeOfRecipe: typeOfRecipe)); } - addTag(String tag) { + void addTag(String tag) { emit( state.copyWith.entity( tags: [ @@ -103,46 +103,46 @@ class CreateRecipeCubit extends Cubit { ); } - removeTag(String tag) { + void removeTag(String tag) { List tags = [...state.entity.tags]; tags.remove(tag); emit(state.copyWith.entity(tags: tags)); } - replacePortionsCount(int count) { + void replacePortionsCount(int count) { emit(state.copyWith.entity(countOfPortions: count)); } - replaceEnegryInPortion(double energy) { + void replaceEnegryInPortion(double energy) { emit(state.copyWith.entity(energyInOnePortion: energy)); } - setTotalCookingMinutes(int minutes) { + void setTotalCookingMinutes(int minutes) { emit(state.copyWith.entity(totalCookMinutes: minutes)); } - setTotalCookingHours(int hours) { + void setTotalCookingHours(int hours) { emit(state.copyWith.entity(totalCookHours: hours)); } - setActiveCookingMinutes(int minutes) { + void setActiveCookingMinutes(int minutes) { emit(state.copyWith.entity(activeCookMinutes: minutes)); } - setActiveCookingHours(int hours) { + void setActiveCookingHours(int hours) { emit(state.copyWith.entity(activeCookHours: hours)); } - replaceVideoUrl(String videoUrl) { + void replaceVideoUrl(String videoUrl) { emit(state.copyWith.entity(videoUrl: videoUrl)); } - replaceImage(File? image) { + void replaceImage(File? image) { emit(state.copyWith.entity(image: image)); } - replaceDescriptionInStep(String description, int index) { + void replaceDescriptionInStep(String description, int index) { List steps = [...state.entity.steps]; steps[index] = steps[index].copyWith(description: description); @@ -150,7 +150,7 @@ class CreateRecipeCubit extends Cubit { emit(state.copyWith.entity(steps: steps)); } - replaceImageInStep(File? image, int index) { + void replaceImageInStep(File? image, int index) { List steps = [...state.entity.steps]; steps[index] = steps[index].copyWith(image: image); @@ -182,7 +182,7 @@ class CreateRecipeCubit extends Cubit { } } - disableLoading() { + void disableLoading() { emit(state.copyWith(loading: false)); } diff --git a/lib/features/create_recipe/presentation/widgets/image_widget.dart b/lib/features/create_recipe/presentation/widgets/image_widget.dart index eb444b8e..bbb93c35 100644 --- a/lib/features/create_recipe/presentation/widgets/image_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/image_widget.dart @@ -69,7 +69,7 @@ class _ImageWidgetState extends State { ); } - _showImagePicker() { + void _showImagePicker() { showCupertinoModalPopup( context: context, builder: (context) { diff --git a/lib/features/create_recipe/presentation/widgets/ingredients_widget.dart b/lib/features/create_recipe/presentation/widgets/ingredients_widget.dart index 633bd2e7..06cc7c1f 100644 --- a/lib/features/create_recipe/presentation/widgets/ingredients_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/ingredients_widget.dart @@ -112,7 +112,7 @@ class _IngredientsWidgetState extends State { ); } - _modalBottomSheet({ + Future _modalBottomSheet({ required CreateRecipeCubit createRecipeCubit, int? portionIndex, String? productNameControllerText, diff --git a/lib/features/create_recipe/presentation/widgets/step_image_widget.dart b/lib/features/create_recipe/presentation/widgets/step_image_widget.dart index d00d08c7..8c18b185 100644 --- a/lib/features/create_recipe/presentation/widgets/step_image_widget.dart +++ b/lib/features/create_recipe/presentation/widgets/step_image_widget.dart @@ -82,7 +82,7 @@ class _StepImageWidgetState extends State { ); } - _showImagePicker() { + void _showImagePicker() { showCupertinoModalPopup( context: context, builder: (context) { diff --git a/lib/features/dev_tools/presentation/dev_tools_screen.dart b/lib/features/dev_tools/presentation/dev_tools_screen.dart index eab3c07e..62dc7ef3 100644 --- a/lib/features/dev_tools/presentation/dev_tools_screen.dart +++ b/lib/features/dev_tools/presentation/dev_tools_screen.dart @@ -168,7 +168,7 @@ class _DevToolsScreenContentState extends State { }); showErrorToast('${testCases[index].name} failed'); // Show AlertDialog with error description - if (mounted) { + if (context.mounted) { showDialog( context: context, builder: (context) => AlertDialog( @@ -190,12 +190,12 @@ class _DevToolsScreenContentState extends State { }); showErrorToast('${testCases[index].name} failed'); // Show AlertDialog with error description - if (mounted) { + if (context.mounted) { showDialog( context: context, builder: (context) => AlertDialog( title: const Text('Test Failed'), - content: SingleChildScrollView(child: Text(e.toString() + '\n' + stack.toString())), + content: SingleChildScrollView(child: Text('$e\n$stack')), actions: [ TextButton( onPressed: () => Navigator.of(context).pop(), diff --git a/lib/features/dev_tools/test_cases.dart b/lib/features/dev_tools/test_cases.dart index 59f92ce3..eb72a1e7 100644 --- a/lib/features/dev_tools/test_cases.dart +++ b/lib/features/dev_tools/test_cases.dart @@ -70,14 +70,14 @@ class CreateRecipeTask implements TestCases { steps: [Step(description: 'desc')], ), ); - } on DioError catch (e) { + } on DioException catch (e) { final res = e.response; if (res != null && (res.statusCode == null || res.statusCode! < 200 || res.statusCode! >= 300)) { return TestResult(false, 'DioError: statusCode=${res.statusCode}\n${res.data}'); } return TestResult(false, e.toString()); } catch (e, stack) { - return TestResult(false, e.toString() + '\n' + stack.toString()); + return TestResult(false, '$e\n$stack'); } return TestResult(true); } @@ -107,7 +107,7 @@ class Test850task implements TestCases { await dietsService.cancelDiet(id: lastChosenDiet?.dietId ?? 0); } catch (e, stack) { log('unexpected error7: $e'); - return TestResult(false, e.toString() + '\n' + stack.toString()); + return TestResult(false, '$e\n$stack'); } await Future.delayed(const Duration(seconds: 3)); } @@ -121,24 +121,24 @@ class Test850task implements TestCases { await dietsService.startDiet(id: diet.id, body: {'date': today.format('yyyy-MM-dd')}); } catch (e, stack) { log('unexpected error2: $e'); - return TestResult(false, e.toString() + '\n' + stack.toString()); + return TestResult(false, '$e\n$stack'); } try { await dietsService.cancelDiet(id: diet.id); } catch (e, stack) { log('unexpected error3: $e'); - return TestResult(false, e.toString() + '\n' + stack.toString()); + return TestResult(false, '$e\n$stack'); } await Future.delayed(const Duration(seconds: 3)); try { await dietsService.startDiet(id: diet.id, body: {'date': tomorrow.format('yyyy-MM-dd')}); } catch (e, stack) { log('unexpected error4: $e'); - return TestResult(false, e.toString() + '\n' + stack.toString()); + return TestResult(false, '$e\n$stack'); } try { await dietsService.cancelDiet(id: diet.id); - } catch (e, stack) { + } catch (e) { log('unexpected error5: $e'); } break; @@ -147,7 +147,7 @@ class Test850task implements TestCases { return TestResult(true); } catch (e, stack) { log('unexpected error6: $e'); - return TestResult(false, e.toString() + '\n' + stack.toString()); + return TestResult(false, '$e\n$stack'); } } } diff --git a/lib/features/diary/models/diary_day_model.dart b/lib/features/diary/models/diary_day_model.dart index 58a68bdd..6e08f6d0 100644 --- a/lib/features/diary/models/diary_day_model.dart +++ b/lib/features/diary/models/diary_day_model.dart @@ -64,7 +64,7 @@ abstract class DiaryFutureDietDayModel with _$DiaryFutureDietDayModel { factory DiaryFutureDietDayModel.fromJson(Map json) => _$DiaryFutureDietDayModelFromJson(json); } -DiaryDietModel? _parseDiet(json) { +DiaryDietModel? _parseDiet(dynamic json) { if (json == null) return null; return DiaryDietModel.fromJson(json['diet']); } @@ -80,7 +80,7 @@ abstract class DiaryDietModel with _$DiaryDietModel { factory DiaryDietModel.fromJson(Map json) => _$DiaryDietModelFromJson(json); } -TypeOfDiaryModel _parseDayTypeForFutureDay(json) { +TypeOfDiaryModel _parseDayTypeForFutureDay(dynamic json) { return TypeOfDiaryModel( hasChosenDiet: json['has_chosen_diet'] as bool, hasChosenPlan: json['has_chosen_plan'] as bool, diff --git a/lib/features/diary/presentation/bloc/diary_cubit.dart b/lib/features/diary/presentation/bloc/diary_cubit.dart index 7216ed1c..c973bcaa 100644 --- a/lib/features/diary/presentation/bloc/diary_cubit.dart +++ b/lib/features/diary/presentation/bloc/diary_cubit.dart @@ -55,7 +55,7 @@ class DiaryCubit extends Cubit { return null; } - setSelectedMeal(int meal) { + void setSelectedMeal(int meal) { selectedMeal = meal; final currentState = state; if (currentState is DiaryStateLoaded) { @@ -154,7 +154,7 @@ class DiaryCubit extends Cubit { return false; } - fetchDiary([bool needLoading = false, int? diaryId, int? currentDay]) async { + Future fetchDiary([bool needLoading = false, int? diaryId, int? currentDay]) async { this.diaryId ??= diaryId; if (needLoading) { @@ -215,7 +215,7 @@ class DiaryCubit extends Cubit { } } - finishDiaryDay({ + Future finishDiaryDay({ required int diaryId, required String wakeUp, required String retire, @@ -233,7 +233,7 @@ class DiaryCubit extends Cubit { return (await diaryRepository.getNutritionData(index)); } - addProductToMeal({ + Future addProductToMeal({ required int diaryId, required int mealId, required String productName, @@ -252,7 +252,7 @@ class DiaryCubit extends Cubit { await fetchDiary(); } - updateProductInMeal({ + Future updateProductInMeal({ required int diaryId, required int mealId, required int portionId, @@ -286,22 +286,22 @@ class DiaryCubit extends Cubit { await fetchDiary(); } - markEaten({required int diaryId, required int mealId, required int portionId}) async { + Future markEaten({required int diaryId, required int mealId, required int portionId}) async { await diaryRepository.markEaten(diaryId: diaryId, mealId: mealId, portionId: portionId); await fetchDiary(); } - unmarkEaten({required int diaryId, required int mealId, required int portionId}) async { + Future unmarkEaten({required int diaryId, required int mealId, required int portionId}) async { await diaryRepository.unmarkEaten(diaryId: diaryId, mealId: mealId, portionId: portionId); await fetchDiary(); } - restore({required int diaryId, required int mealId, required int portionId}) async { + Future restore({required int diaryId, required int mealId, required int portionId}) async { await diaryRepository.restore(diaryId: diaryId, mealId: mealId, portionId: portionId); await fetchDiary(); } - deleteProductFromMeal({required int diaryId, required int mealId, required int portionId}) async { + Future deleteProductFromMeal({required int diaryId, required int mealId, required int portionId}) async { await diaryRepository.deleteProductFromMeal(diaryId: diaryId, mealId: mealId, portionId: portionId); await fetchDiary(); } @@ -310,12 +310,12 @@ class DiaryCubit extends Cubit { return await glossaryRepository.getGlossaryListByQuery(query); } - uploadPhotos({required List files, required int diaryId}) async { + Future uploadPhotos({required List files, required int diaryId}) async { await diaryRepository.uploadPhotos(files: await ImageCompressUtility.compressFilesList(files), diaryId: diaryId, mealId: selectedMeal); await fetchDiary(); } - deletePhoto({required DiaryPhotoModel photo, required int diaryId}) async { + Future deletePhoto({required DiaryPhotoModel photo, required int diaryId}) async { await diaryRepository.deletePhoto(photo: photo, diaryId: diaryId, mealId: selectedMeal); await fetchDiary(); } @@ -335,32 +335,32 @@ class DiaryCubit extends Cubit { return null; } - fillTime({required int diaryId, required String time}) async { + Future fillTime({required int diaryId, required String time}) async { await diaryRepository.fillTime(diaryId: diaryId, mealId: selectedMeal, time: time); await fetchDiary(); } - fillWakeup({required int diaryId, required String time}) async { + Future fillWakeup({required int diaryId, required String time}) async { await diaryRepository.fillWakeup(diaryId: diaryId, time: time); await fetchDiary(); } - fillRetire({required int diaryId, required String time}) async { + Future fillRetire({required int diaryId, required String time}) async { await diaryRepository.fillRetire(diaryId: diaryId, time: time); await fetchDiary(); } - fillSatiety({required int diaryId, required int satiety}) async { + Future fillSatiety({required int diaryId, required int satiety}) async { await diaryRepository.fillSatiety(diaryId: diaryId, mealId: selectedMeal, satiety: satiety); await fetchDiary(); } - fillMood({required int diaryId, required int mood}) async { + Future fillMood({required int diaryId, required int mood}) async { await diaryRepository.fillMood(diaryId: diaryId, mealId: selectedMeal, mood: mood); await fetchDiary(); } - fillComment(String comment) { + void fillComment(String comment) { this.comment = comment; } } diff --git a/lib/features/diary/presentation/widgets/add_product_button_widget.dart b/lib/features/diary/presentation/widgets/add_product_button_widget.dart index 0c7534b1..b804989a 100644 --- a/lib/features/diary/presentation/widgets/add_product_button_widget.dart +++ b/lib/features/diary/presentation/widgets/add_product_button_widget.dart @@ -21,7 +21,7 @@ class _AddProductButtonWidgetState extends State { diaryCubit = context.read(); } - addProductInMeal(DiaryStateLoaded state, [int? portionId]) { + Future addProductInMeal(DiaryStateLoaded state, [int? portionId]) { return showModalBottomSheet( useRootNavigator: true, context: context, diff --git a/lib/features/diary/presentation/widgets/calendar_widget.dart b/lib/features/diary/presentation/widgets/calendar_widget.dart index 2d584eb2..b0e5c442 100644 --- a/lib/features/diary/presentation/widgets/calendar_widget.dart +++ b/lib/features/diary/presentation/widgets/calendar_widget.dart @@ -134,13 +134,13 @@ class _CalendarWidgetState extends State { ); } - _nextCalendarFormat() { + void _nextCalendarFormat() { setState(() { _calendarFormat = CalendarFormat.values[(_calendarFormat.index - 1) % CalendarFormat.values.length]; }); } - _arrowDown() { + GestureDetector _arrowDown() { return GestureDetector( behavior: HitTestBehavior.translucent, onVerticalDragStart: (_) { diff --git a/lib/features/diary/presentation/widgets/calories_chart_widget.dart b/lib/features/diary/presentation/widgets/calories_chart_widget.dart index 817508af..4aca0334 100644 --- a/lib/features/diary/presentation/widgets/calories_chart_widget.dart +++ b/lib/features/diary/presentation/widgets/calories_chart_widget.dart @@ -242,7 +242,7 @@ class CaloriesChartWidget extends StatelessWidget { ); } - _chartData(String title, String value) { + Row _chartData(String title, String value) { return Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ diff --git a/lib/features/diary/presentation/widgets/glossary_moderation_request_modal_widget.dart b/lib/features/diary/presentation/widgets/glossary_moderation_request_modal_widget.dart index f4991494..69b316a7 100644 --- a/lib/features/diary/presentation/widgets/glossary_moderation_request_modal_widget.dart +++ b/lib/features/diary/presentation/widgets/glossary_moderation_request_modal_widget.dart @@ -46,7 +46,7 @@ class _GlossaryModerationRequestModalWidgetState extends State { diaryCubit = context.read(); } - showImagePicker(DiaryDayModel diaryDay) { + void showImagePicker(DiaryDayModel diaryDay) { showCupertinoModalPopup( context: context, builder: (context) { diff --git a/lib/features/diary/presentation/widgets/product_widget.dart b/lib/features/diary/presentation/widgets/product_widget.dart index f5040d47..a221ffc6 100644 --- a/lib/features/diary/presentation/widgets/product_widget.dart +++ b/lib/features/diary/presentation/widgets/product_widget.dart @@ -44,7 +44,7 @@ class _ProductWidgetState extends State { isEaten = widget.portion.portionState == PortionState.eatenFromDiet ? true : false; } - updateProductInMeal(DiaryStateLoaded state, PortionModel portion) { + Future updateProductInMeal(DiaryStateLoaded state, PortionModel portion) { return showModalBottomSheet( useRootNavigator: true, context: context, diff --git a/lib/features/diary/presentation/widgets/time_of_meal_picker_widget.dart b/lib/features/diary/presentation/widgets/time_of_meal_picker_widget.dart index c9da23ed..a9086d88 100644 --- a/lib/features/diary/presentation/widgets/time_of_meal_picker_widget.dart +++ b/lib/features/diary/presentation/widgets/time_of_meal_picker_widget.dart @@ -23,7 +23,7 @@ class _TimeOfMealPickerWidgetState extends State { diaryCubit = context.read(); } - showTimePicker(int diaryId) { + void showTimePicker(int diaryId) { showModalBottomSheet( context: context, useRootNavigator: true, diff --git a/lib/features/diary/presentation/widgets/wakeup_and_retire_widget.dart b/lib/features/diary/presentation/widgets/wakeup_and_retire_widget.dart index 1dbe9925..6e74f5ec 100644 --- a/lib/features/diary/presentation/widgets/wakeup_and_retire_widget.dart +++ b/lib/features/diary/presentation/widgets/wakeup_and_retire_widget.dart @@ -26,7 +26,7 @@ class _WakeupAndRetireWidgetState extends State { diaryCubit = context.read(); } - showTimePicker(int diaryId, bool isWakeup) { + void showTimePicker(int diaryId, bool isWakeup) { showModalBottomSheet( context: context, useRootNavigator: true, diff --git a/lib/features/diets/presentation/pages/about_diet_screen.dart b/lib/features/diets/presentation/pages/about_diet_screen.dart index 28d5292a..b38d1afd 100644 --- a/lib/features/diets/presentation/pages/about_diet_screen.dart +++ b/lib/features/diets/presentation/pages/about_diet_screen.dart @@ -561,7 +561,7 @@ class _AboutDietScreenState extends State { ); } - _dayOfPlan(Map> day, int dayNumber, S s, List selectedIndexes, Diet diet) { + Padding _dayOfPlan(Map> day, int dayNumber, S s, List selectedIndexes, Diet diet) { choiceChipWidget(int index) { return ChoiceChip( selectedColor: appTheme.blueA400, @@ -646,7 +646,7 @@ class _AboutDietScreenState extends State { ); } - _daily(DailySchedule? daily, S s) { + SingleChildRenderObjectWidget _daily(DailySchedule? daily, S s) { if (daily == null) return const SizedBox(); return Padding( padding: const EdgeInsets.only(bottom: 12), diff --git a/lib/features/feed/models/plan_pagination_model.dart b/lib/features/feed/models/plan_pagination_model.dart index 21b53ed6..728ff0b7 100644 --- a/lib/features/feed/models/plan_pagination_model.dart +++ b/lib/features/feed/models/plan_pagination_model.dart @@ -46,7 +46,7 @@ abstract class PlanModel with _$PlanModel { factory PlanModel.fromJson(Map json) => _$PlanModelFromJson(json); } -PacketOptions? parseOption(json) { +PacketOptions? parseOption(dynamic json) { if (json is Map) { return PacketOptions.fromJson(json); } @@ -74,7 +74,7 @@ abstract class PacketOptions with _$PacketOptions { factory PacketOptions.empty() => PacketOptions(items: [], price: double.parse('1200'), short: '', description: ''); } -List _parseItems(json) { +List _parseItems(dynamic json) { if (json is Map) { return json.values.map((e) => e as String).toList(); } diff --git a/lib/features/feed/models/recipes_model.dart b/lib/features/feed/models/recipes_model.dart index dcb4d2ea..27aec217 100644 --- a/lib/features/feed/models/recipes_model.dart +++ b/lib/features/feed/models/recipes_model.dart @@ -53,7 +53,7 @@ abstract class Ingredient with _$Ingredient { factory Ingredient.fromJson(Map json) => _$IngredientFromJson(json); } -int _parseProductId(json) { +int _parseProductId(dynamic json) { if (json is String) { return int.parse(json); } diff --git a/lib/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart b/lib/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart index 106521e9..5bb62317 100644 --- a/lib/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart +++ b/lib/features/feed/presentation/bloc/comments_cubit/comments_cubit.dart @@ -10,11 +10,11 @@ class CommentsCubit extends Cubit { required this.feedRepository, }) : super(const CommentsState()); - setReplyId(int? replyId) { + void setReplyId(int? replyId) { emit((state as CommentsStateLoaded).copyWith(replyId: replyId)); } - getComments(String id, CommentSourceType commentSourceType, [bool isFirstFetch = false]) async { + Future getComments(String id, CommentSourceType commentSourceType, [bool isFirstFetch = false]) async { if (isFirstFetch) emit(const CommentsState.loading()); try { switch (commentSourceType) { @@ -36,7 +36,7 @@ class CommentsCubit extends Cubit { } } - sendComment({ + Future sendComment({ required String id, required String commentText, required CommentSourceType commentSourceType, diff --git a/lib/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart b/lib/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart index 660c7560..2c3473bd 100644 --- a/lib/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart +++ b/lib/features/feed/presentation/bloc/consultants_cubit/consultants_cubit.dart @@ -11,7 +11,7 @@ class ConsultantsCubit extends Cubit { required this.feedRepository, }) : super(const ConsultantsState()); - getConsultants() async { + Future getConsultants() async { emit(const ConsultantsState.loading()); try { emit( diff --git a/lib/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart b/lib/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart index 3f1ea0b0..e2f9b95b 100644 --- a/lib/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart +++ b/lib/features/feed/presentation/bloc/diets_cubit/diets_cubit.dart @@ -86,7 +86,7 @@ class DietsCubit extends Cubit { ); } - loadDiets({ + Future loadDiets({ String? query, }) async { try { diff --git a/lib/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart b/lib/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart index 670c4df9..d124a9f9 100644 --- a/lib/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart +++ b/lib/features/feed/presentation/bloc/feed_cubit/feed_cubit.dart @@ -16,7 +16,7 @@ class FeedCubit extends Cubit { required this.feedRepository, }) : super(const FeedState.loading()); - updateFeedBlogPostList(FeedBlogPostModel? feedBlogPostModel, bool wasLikedByMe) { + void updateFeedBlogPostList(FeedBlogPostModel? feedBlogPostModel, bool wasLikedByMe) { if (feedBlogPostModel == null) return; List feedBlogPostList = [...(state as FeedStateLoaded).feedBlogPostList]; final int index = feedBlogPostList.indexOf(feedBlogPostModel); @@ -32,7 +32,7 @@ class FeedCubit extends Cubit { ); } - loadFeedBlogPostList({ + Future loadFeedBlogPostList({ String? query, }) async { try { @@ -80,7 +80,7 @@ class FeedCubit extends Cubit { } } - likePost(int id) async { + Future likePost(int id) async { try { await feedRepository.likeBlogPost(id: id); } catch (e, st) { @@ -88,10 +88,10 @@ class FeedCubit extends Cubit { } } - unlikedPost(int id) async => await feedRepository.unlikedBlogPost(id: id); + Future unlikedPost(int id) async => await feedRepository.unlikedBlogPost(id: id); - viewPost(int id) async => await feedRepository.viewPost(id); - viewRecipe(String slug) async => await feedRepository.viewRecipe(slug); - viewDiet(int id) async => await feedRepository.viewDiet(id); - viewPlan(String slug) async => await feedRepository.viewPlan(slug); + Future viewPost(int id) async => await feedRepository.viewPost(id); + Future viewRecipe(String slug) async => await feedRepository.viewRecipe(slug); + Future viewDiet(int id) async => await feedRepository.viewDiet(id); + Future viewPlan(String slug) async => await feedRepository.viewPlan(slug); } diff --git a/lib/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart b/lib/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart index 356c832b..99432c22 100644 --- a/lib/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart +++ b/lib/features/feed/presentation/bloc/plans_cubit/plans_cubit.dart @@ -132,7 +132,7 @@ class PlansCubit extends Cubit { ); } - loadPlans({ + Future loadPlans({ String? query, }) async { try { diff --git a/lib/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart b/lib/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart index 866d4abb..001a7ec2 100644 --- a/lib/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart +++ b/lib/features/feed/presentation/bloc/recipes_cubit/recipes_cubit.dart @@ -40,7 +40,7 @@ class RecipesCubit extends Cubit { }); } - loadRecipesList({ + Future loadRecipesList({ String? query, }) async { try { @@ -99,7 +99,7 @@ class RecipesCubit extends Cubit { } } - updateTags(RecipeTag tag) { + void updateTags(RecipeTag tag) { _selectedTags.contains(tag.id) ? _selectedTags.remove(tag.id) : _selectedTags.add(tag.id); emit( state.copyWith( diff --git a/lib/features/feed/presentation/pages/feed_screen.dart b/lib/features/feed/presentation/pages/feed_screen.dart index a18cb9a7..b6869040 100644 --- a/lib/features/feed/presentation/pages/feed_screen.dart +++ b/lib/features/feed/presentation/pages/feed_screen.dart @@ -85,7 +85,7 @@ class _FeedScreenContentState extends State { - _onScrollConsultants() { + void _onScrollConsultants() { if (consultantsScrollController.offset >= consultantsScrollController.position.maxScrollExtent && !consultantsScrollController.position.outOfRange) {} } diff --git a/lib/features/feed/presentation/widgets/comments_widget.dart b/lib/features/feed/presentation/widgets/comments_widget.dart index 1e1a90d5..49f368cd 100644 --- a/lib/features/feed/presentation/widgets/comments_widget.dart +++ b/lib/features/feed/presentation/widgets/comments_widget.dart @@ -53,7 +53,7 @@ class _CommentsWidgetState extends State { ); } - _comment(S s, Comment comment, [double radius = 18, bool isChild = false]) { + Container _comment(S s, Comment comment, [double radius = 18, bool isChild = false]) { return Container( width: MediaQuery.of(context).size.width, decoration: BoxDecoration( diff --git a/lib/features/feed/presentation/widgets/consultant_widget.dart b/lib/features/feed/presentation/widgets/consultant_widget.dart index 6e8562f3..3b4a4b80 100644 --- a/lib/features/feed/presentation/widgets/consultant_widget.dart +++ b/lib/features/feed/presentation/widgets/consultant_widget.dart @@ -121,7 +121,7 @@ class ConsultantWidget extends StatelessWidget { ); } - _badges(List badges, BuildContext context) { + SingleChildScrollView _badges(List badges, BuildContext context) { return SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( diff --git a/lib/features/feed/presentation/widgets/recipes_widget.dart b/lib/features/feed/presentation/widgets/recipes_widget.dart index 2e0ed35b..ffe36b25 100644 --- a/lib/features/feed/presentation/widgets/recipes_widget.dart +++ b/lib/features/feed/presentation/widgets/recipes_widget.dart @@ -262,7 +262,7 @@ class _RecipesWidgetState extends State { ); } - _iconButton(String iconPath, [String? text]) { + Container _iconButton(String iconPath, [String? text]) { return Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( diff --git a/lib/features/feed/presentation/widgets/tags_modal_widget.dart b/lib/features/feed/presentation/widgets/tags_modal_widget.dart index b81b17a0..640f5ac0 100644 --- a/lib/features/feed/presentation/widgets/tags_modal_widget.dart +++ b/lib/features/feed/presentation/widgets/tags_modal_widget.dart @@ -42,7 +42,7 @@ class _TagsModalWidgetState extends State { ); } - _tagChip({ + ChoiceChip _tagChip({ required RecipeTag tag, required bool isSelected, }) { diff --git a/lib/features/finances_and_consultations_archive/models/consultant_finance_model.dart b/lib/features/finances_and_consultations_archive/models/consultant_finance_model.dart index 9e8cc751..ede4ccb2 100644 --- a/lib/features/finances_and_consultations_archive/models/consultant_finance_model.dart +++ b/lib/features/finances_and_consultations_archive/models/consultant_finance_model.dart @@ -19,7 +19,7 @@ abstract class ConsultantFinanceModel with _$ConsultantFinanceModel { factory ConsultantFinanceModel.fromJson(Map json) => _$ConsultantFinanceModelFromJson(json); } -String _parsePayment(json) { +String _parsePayment(dynamic json) { return ((json as int) / 100).toStringAsFixed(2); } diff --git a/lib/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart b/lib/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart index bd2a156d..3954e248 100644 --- a/lib/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart +++ b/lib/features/menu/presentation/blocked_user_cubit/blocked_users_cubit.dart @@ -9,7 +9,7 @@ class BlockedUsersCubit extends Cubit { required this.blockedUsersRepository, }) : super(const BlockedUsersState()); - getBlockedUsers() async { + Future getBlockedUsers() async { try { emit(BlockedUsersState.loaded(profilesList: await blockedUsersRepository.getBlockedUsers())); } catch (e, st) { @@ -17,12 +17,12 @@ class BlockedUsersCubit extends Cubit { } } - blockUser(String slug) async { + Future blockUser(String slug) async { await blockedUsersRepository.blockUserBySlug(slug); await getBlockedUsers(); } - unblockUser(String slug) async { + Future unblockUser(String slug) async { await blockedUsersRepository.unblockUserBySlug(slug); await getBlockedUsers(); } diff --git a/lib/features/menu/presentation/pages/menu_screen.dart b/lib/features/menu/presentation/pages/menu_screen.dart index 0449113b..f5b5f3d0 100644 --- a/lib/features/menu/presentation/pages/menu_screen.dart +++ b/lib/features/menu/presentation/pages/menu_screen.dart @@ -71,7 +71,7 @@ class MenuScreen extends StatelessWidget { ); } - _tile({required String title, required String leading, required Function() onTap}) { + ListTile _tile({required String title, required String leading, required Function() onTap}) { return ListTile( onTap: onTap, leading: SvgPicture.asset(leading, height: 24, width: 24, colorFilter: ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn)), @@ -80,7 +80,7 @@ class MenuScreen extends StatelessWidget { ); } - _divider(BuildContext context) { + Container _divider(BuildContext context) { return Container( height: 0.4, width: MediaQuery.of(context).size.width - 32, @@ -88,7 +88,7 @@ class MenuScreen extends StatelessWidget { ); } - _onTapLogout(BuildContext context) { + Future Function() _onTapLogout(BuildContext context) { return () async { showDialog( context: context, diff --git a/lib/features/menu/presentation/repositories/blocked_users_repository.dart b/lib/features/menu/presentation/repositories/blocked_users_repository.dart index 96c072c4..27dfafad 100644 --- a/lib/features/menu/presentation/repositories/blocked_users_repository.dart +++ b/lib/features/menu/presentation/repositories/blocked_users_repository.dart @@ -19,7 +19,7 @@ class BlockedUsersRepository { } } - blockUserBySlug(String slug) async { + Future blockUserBySlug(String slug) async { try { return await blockedUserService.blockUser( data: { @@ -32,7 +32,7 @@ class BlockedUsersRepository { } } - unblockUserBySlug(String slug) async { + Future unblockUserBySlug(String slug) async { try { return await blockedUserService.unblockUser( data: { diff --git a/lib/features/my_finance/models/card_model.dart b/lib/features/my_finance/models/card_model.dart index 0f9ca40d..0435ea56 100644 --- a/lib/features/my_finance/models/card_model.dart +++ b/lib/features/my_finance/models/card_model.dart @@ -14,7 +14,7 @@ abstract class CardModel with _$CardModel { factory CardModel.fromJson(Map json) => _$CardModelFromJson(json); } -bool parseBool(json) { +bool parseBool(dynamic json) { if (json == 1 || json == true || json == '1') { return true; } diff --git a/lib/features/plans/models/chosen_plan_model.dart b/lib/features/plans/models/chosen_plan_model.dart index 429cf78f..f70f1cd2 100644 --- a/lib/features/plans/models/chosen_plan_model.dart +++ b/lib/features/plans/models/chosen_plan_model.dart @@ -21,7 +21,7 @@ abstract class ChosenPlanModel with _$ChosenPlanModel { factory ChosenPlanModel.fromJson(Map json) => _$ChosenPlanModelFromJson(json); } -ChosenPlanModel? parseChosenPlan(json) { +ChosenPlanModel? parseChosenPlan(dynamic json) { if (json is Map) { return ChosenPlanModel.fromJson(json); } diff --git a/lib/features/plans/presentation/pages/about_plan_screen.dart b/lib/features/plans/presentation/pages/about_plan_screen.dart index 54f6ce35..d2984b68 100644 --- a/lib/features/plans/presentation/pages/about_plan_screen.dart +++ b/lib/features/plans/presentation/pages/about_plan_screen.dart @@ -72,7 +72,7 @@ class _AboutPlanScreenState extends State { @override Widget build(BuildContext context) { final s = S.of(context); - return PopScope( + return PopScope( child: MultiBlocProvider( providers: [ BlocProvider( @@ -102,14 +102,14 @@ class _AboutPlanScreenState extends State { return Scaffold( appBar: AppBar( leading: BackButton( - onPressed: () { - if (context.canPop()) { - GoRouter.of(context).pop(); - return; - } - GoRouter.of(context).go('/feed-screen'); - }, - ), + onPressed: () { + if (context.canPop()) { + GoRouter.of(context).pop(); + return; + } + GoRouter.of(context).go('/feed-screen'); + }, + ), centerTitle: true, title: Text( '', @@ -132,14 +132,14 @@ class _AboutPlanScreenState extends State { return Scaffold( appBar: AppBar( leading: BackButton( - onPressed: () { - if (context.canPop()) { - GoRouter.of(context).pop(); - return; - } - GoRouter.of(context).go('/feed-screen'); - }, - ), + onPressed: () { + if (context.canPop()) { + GoRouter.of(context).pop(); + return; + } + GoRouter.of(context).go('/feed-screen'); + }, + ), centerTitle: true, title: Text( state.planModel?.name ?? '', @@ -154,7 +154,7 @@ class _AboutPlanScreenState extends State { isAuthor: state.planModel?.author.authorIsMe ?? false, path: 'plan/${widget.slug}', complainedContentType: ComplainedContent.plan, - slug: widget.slug, + userSlug: state.planModel?.author.authorSlug ?? '', ), const SizedBox(width: 16), ], @@ -329,7 +329,7 @@ class _AboutPlanScreenState extends State { textEditingController.clear(); replyId = null; }); - + Future.delayed(const Duration(milliseconds: 500), () { if (context.mounted) { context.read().getPlan(widget.slug); @@ -382,7 +382,7 @@ class _AboutPlanScreenState extends State { isAuthor: state.planModel?.author.authorIsMe ?? false, path: 'plan/${widget.slug}', complainedContentType: ComplainedContent.plan, - slug: widget.slug, + userSlug: state.planModel?.author.authorSlug ?? '', ), const SizedBox(width: 16), ], @@ -436,7 +436,8 @@ class _AboutPlanScreenState extends State { 'assets/icons/heart.svg', width: 14, height: 12, - colorFilter: state.planModel?.wasLikedByMe == true ? ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn) : null, + colorFilter: + state.planModel?.wasLikedByMe == true ? ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn) : null, ), const SizedBox(width: 8), Text( diff --git a/lib/features/profile/models/chosen_diets_pagination_model.dart b/lib/features/profile/models/chosen_diets_pagination_model.dart index ce81c3d6..323ed660 100644 --- a/lib/features/profile/models/chosen_diets_pagination_model.dart +++ b/lib/features/profile/models/chosen_diets_pagination_model.dart @@ -26,7 +26,7 @@ abstract class ChosenDietModel with _$ChosenDietModel { factory ChosenDietModel.fromJson(Map json) => _$ChosenDietModelFromJson(json); } -int? _parseDietId(json) { +int? _parseDietId(dynamic json) { if (json == null) return null; return json['id'] as int?; } diff --git a/lib/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart b/lib/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart index 4b42c19b..4b5d86b6 100644 --- a/lib/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart +++ b/lib/features/profile/presentation/bloc/plans_cubit/plans_cubit.dart @@ -11,7 +11,7 @@ class PlansCubit extends Cubit { required this.plansRepository, }) : super(const PlansState()); - getPlans(String slug) async { + Future getPlans(String slug) async { emit(const PlansState.loading()); try { emit(PlansState.loaded(plansList: await plansRepository.getPlansBySlug(slug))); diff --git a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart index 1312dea8..b088a073 100644 --- a/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart +++ b/lib/features/profile/presentation/bloc/profile_cubit/profile_cubit.dart @@ -63,7 +63,7 @@ class ProfileCubit extends Cubit { } } - updateFeedBlogPostList(FeedBlogPostModel feedBlogPostModel, bool wasLikedByMe) { + void updateFeedBlogPostList(FeedBlogPostModel feedBlogPostModel, bool wasLikedByMe) { List feedBlogPostList = [...(state as ProfileStateLoaded).blogPosts]; final int index = feedBlogPostList.indexOf(feedBlogPostModel); feedBlogPostList[index] = feedBlogPostModel.copyWith( @@ -79,7 +79,7 @@ class ProfileCubit extends Cubit { ); } - addCircumference({ + Future addCircumference({ required int chestCircumference, required int waistCircumference, required int hipCircumference, @@ -96,7 +96,7 @@ class ProfileCubit extends Cubit { } } - addWeight({ + Future addWeight({ required double weight, }) async { try { @@ -107,7 +107,7 @@ class ProfileCubit extends Cubit { } } - getChatRoomIdBySlug({ + Future getChatRoomIdBySlug({ required Author author, }) async { try { @@ -126,19 +126,21 @@ class ProfileCubit extends Cubit { 'chatId': chatIdOrError, }, ); + return chatIdOrError; } } catch (e, st) { log(e.toString(), stackTrace: st); return ''; } + return null; } - uploadPhoto(File file) async { + Future uploadPhoto(File file) async { await profileRepository.uploadPhoto(await ImageCompressUtility.compressFile(file)); return await getMyProfile(); } - deletePhoto() async { + Future deletePhoto() async { await profileRepository.deletePhoto(); return await getMyProfile(); } diff --git a/lib/features/profile/presentation/bloc/sub_cubit/sub_cubit.dart b/lib/features/profile/presentation/bloc/sub_cubit/sub_cubit.dart index 60e2c486..b6d40645 100644 --- a/lib/features/profile/presentation/bloc/sub_cubit/sub_cubit.dart +++ b/lib/features/profile/presentation/bloc/sub_cubit/sub_cubit.dart @@ -9,7 +9,7 @@ class SubCubit extends Cubit { required this.profileRepository, }) : super(const SubState()); - getSubscriptions(String slug, [String? query]) async { + Future getSubscriptions(String slug, [String? query]) async { emit(const SubState.loading()); try { emit(SubState.loaded(subList: await profileRepository.getSubscriptionsBySlug(slug, query))); @@ -18,7 +18,7 @@ class SubCubit extends Cubit { } } - getSubscribers(String slug, [String? query]) async { + Future getSubscribers(String slug, [String? query]) async { emit(const SubState.loading()); try { emit(SubState.loaded(subList: await profileRepository.getSubscribersBySlug(slug, query))); @@ -27,11 +27,11 @@ class SubCubit extends Cubit { } } - subscribe(String slug) async { + Future subscribe(String slug) async { return await profileRepository.subscribe(slug); } - unsubscribe(String slug) async { + Future unsubscribe(String slug) async { return await profileRepository.unsubscribe(slug); } } diff --git a/lib/features/profile/presentation/pages/profile_screen.dart b/lib/features/profile/presentation/pages/profile_screen.dart index d475d34b..359bd21a 100644 --- a/lib/features/profile/presentation/pages/profile_screen.dart +++ b/lib/features/profile/presentation/pages/profile_screen.dart @@ -119,7 +119,7 @@ class _ProfileScreenState extends State { ); } - _profileScreen(ProfileStateLoaded state) { + Scaffold _profileScreen(ProfileStateLoaded state) { return Scaffold( backgroundColor: Colors.grey.shade200, appBar: AppBar(), @@ -213,7 +213,7 @@ class _ProfileScreenState extends State { ); } - _myProfileScreen(ProfileStateLoaded state) { + Scaffold _myProfileScreen(ProfileStateLoaded state) { return Scaffold( backgroundColor: Colors.grey.shade200, appBar: AppBar(toolbarHeight: 0), @@ -306,7 +306,7 @@ class _ProfileScreenState extends State { ); } - _activePlans(ProfileStateLoaded state) { + Widget _activePlans(ProfileStateLoaded state) { if (!state.profile.roles.contains('consultant')) { return const SizedBox.shrink(); } @@ -365,7 +365,7 @@ class _ProfileScreenState extends State { ); } - _bullets(int currentBullet, int bulletCount) { + Container _bullets(int currentBullet, int bulletCount) { return Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), decoration: BoxDecoration( @@ -384,7 +384,7 @@ class _ProfileScreenState extends State { ); } - _bullet(bool isActive) { + AnimatedContainer _bullet(bool isActive) { return AnimatedContainer( width: isActive ? 10 : 8, height: isActive ? 10 : 8, @@ -396,7 +396,7 @@ class _ProfileScreenState extends State { ); } - _newBlogPostButton() { + Material _newBlogPostButton() { return Material( color: Colors.white, borderRadius: BorderRadius.circular(12), @@ -437,7 +437,7 @@ class _ProfileScreenState extends State { ); } - _diplomasAndCertificates(ProfileStateLoaded state) { + SingleChildRenderObjectWidget _diplomasAndCertificates(ProfileStateLoaded state) { if (!state.profile.roles.contains('consultant') || state.consultantInfo!.photos.isEmpty) { return const SizedBox.shrink(); } @@ -510,7 +510,7 @@ class _ProfileScreenState extends State { ); } - _diplomaImage(String url) { + GestureDetector _diplomaImage(String url) { return GestureDetector( onTap: () { context.pushTransparentRoute( @@ -536,7 +536,7 @@ class _ProfileScreenState extends State { ); } - _education(ProfileStateLoaded state) { + SingleChildRenderObjectWidget _education(ProfileStateLoaded state) { if (!state.profile.roles.contains('consultant') || state.consultantInfo!.educationModel.completedCourses == null || (state.consultantInfo!.educationModel.completedCourses?.isEmpty ?? false)) { @@ -603,7 +603,7 @@ class _ProfileScreenState extends State { ); } - _educationBlock(String title, String date) { + SizedBox _educationBlock(String title, String date) { final parsedDate = DateTime.tryParse(date); final formattedDate = parsedDate != null ? DateFormat('d MMMM y', 'ru_RU').format(parsedDate) : date; @@ -643,7 +643,7 @@ class _ProfileScreenState extends State { ); } - _socialLinks(ProfileStateLoaded state) { + SingleChildRenderObjectWidget _socialLinks(ProfileStateLoaded state) { if (!state.profile.roles.contains('consultant')) { return const SizedBox.shrink(); } @@ -701,7 +701,7 @@ class _ProfileScreenState extends State { ); } - _socialLinkButton(Function() onTap, String icon, bool disabled) { + InkWell _socialLinkButton(Function() onTap, String icon, bool disabled) { return InkWell( onTap: disabled ? null : onTap, borderRadius: BorderRadius.circular(20), @@ -723,7 +723,7 @@ class _ProfileScreenState extends State { ); } - _badges(ProfileStateLoaded state) { + Padding _badges(ProfileStateLoaded state) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 4), child: InkWell( @@ -815,7 +815,7 @@ class _ProfileScreenState extends State { ); } - _subscriptionsAndSubscribers(ProfileStateLoaded state) { + Padding _subscriptionsAndSubscribers(ProfileStateLoaded state) { return Padding( padding: const EdgeInsets.all(4), child: Row( @@ -924,7 +924,7 @@ class _ProfileScreenState extends State { ); } - _miniAvatars(List urls) { + Row _miniAvatars(List urls) { int maxLength = urls.length > 2 ? 3 : urls.length; return Row( mainAxisAlignment: MainAxisAlignment.center, @@ -944,7 +944,7 @@ class _ProfileScreenState extends State { ); } - _blogPosts(ProfileStateLoaded state) { + ListView _blogPosts(ProfileStateLoaded state) { return ListView.separated( padding: const EdgeInsets.symmetric(vertical: 16), shrinkWrap: true, @@ -958,7 +958,7 @@ class _ProfileScreenState extends State { ); } - _additionalInfo(ProfileStateLoaded state) { + Container _additionalInfo(ProfileStateLoaded state) { String text = state.profileDetails.additionalInfo; if (state.profileDetails.additionalInfo.length > 250) { text = state.profileDetails.additionalInfo.substring(0, 250); @@ -976,7 +976,7 @@ class _ProfileScreenState extends State { ); } - _header(ProfileStateLoaded state) { + Padding _header(ProfileStateLoaded state) { return Padding( padding: const EdgeInsets.all(16), child: Row( @@ -1212,7 +1212,7 @@ class _ProfileScreenState extends State { ); } - _additional(String title, String value) { + Row _additional(String title, String value) { return Row( children: [ Text( @@ -1235,7 +1235,7 @@ class _ProfileScreenState extends State { ); } - _messageAndSubscribe(ProfileStateLoaded state) { + Row _messageAndSubscribe(ProfileStateLoaded state) { return Row( children: [ const SizedBox(width: 16), @@ -1286,7 +1286,7 @@ class _ProfileScreenState extends State { ); } - _charts() { + Material _charts() { return Material( color: Colors.white, borderRadius: BorderRadius.circular(16), @@ -1350,7 +1350,7 @@ class _ProfileScreenState extends State { ); } - _choiceIntervalChipWidget(int index) { + ChoiceChip _choiceIntervalChipWidget(int index) { return ChoiceChip( selectedColor: Colors.grey.withValues(alpha: 0.1), pressElevation: 0, @@ -1376,7 +1376,7 @@ class _ProfileScreenState extends State { ); } - _choiceChipWidget(int index) { + ChoiceChip _choiceChipWidget(int index) { return ChoiceChip( selectedColor: appTheme.blueA400, pressElevation: 0, diff --git a/lib/features/profile/presentation/pages/subs_screen.dart b/lib/features/profile/presentation/pages/subs_screen.dart index 1893b189..d5d782f2 100644 --- a/lib/features/profile/presentation/pages/subs_screen.dart +++ b/lib/features/profile/presentation/pages/subs_screen.dart @@ -79,7 +79,7 @@ class _SubsScreenState extends State { ); } - _buildStates(SubState state) { + StatelessWidget? _buildStates(SubState state) { if (state is SubStateLoading) { return const Loader(); } @@ -94,5 +94,6 @@ class _SubsScreenState extends State { itemCount: state.subList.length, ); } + return null; } } diff --git a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart index a4fc00cb..11ce16d1 100644 --- a/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart +++ b/lib/features/profile/presentation/widgets/profile_blog_post_widget.dart @@ -191,7 +191,7 @@ class _ProfileBlogPostWidgetState extends State { isLiked ? await context.read().likePost(state.blogPosts[widget.index].id) : await context.read().unlikedPost(state.blogPosts[widget.index].id); - await widget.profileCubit.updateFeedBlogPostList( + widget.profileCubit.updateFeedBlogPostList( state.blogPosts[widget.index], isLiked ? false : true, ); diff --git a/lib/features/recipe/presentation/cubit/my_recipes_cubit/my_recieps_cubit.dart b/lib/features/recipe/presentation/cubit/my_recipes_cubit/my_recieps_cubit.dart index df454594..44481c3a 100644 --- a/lib/features/recipe/presentation/cubit/my_recipes_cubit/my_recieps_cubit.dart +++ b/lib/features/recipe/presentation/cubit/my_recipes_cubit/my_recieps_cubit.dart @@ -17,7 +17,7 @@ class MyRecipesCubit extends Cubit { required this.aboutRecipeRepository, }) : super(const MyRecipesState.loading()); - getMyRecipes() async { + Future getMyRecipes() async { emit(const MyRecipesState.loading()); try { final myRecipes = await myRecipesRepository.getMyRecipes(); @@ -28,7 +28,7 @@ class MyRecipesCubit extends Cubit { } } - setActiveState() async { + Future setActiveState() async { emit(const MyRecipesState.loading()); try { final myRecipes = await myRecipesRepository.getMyRecipes(); @@ -39,7 +39,7 @@ class MyRecipesCubit extends Cubit { } } - setArchivedState() async { + Future setArchivedState() async { emit(const MyRecipesState.loading()); try { final myRecipes = await myRecipesRepository.getMyRecipes(); diff --git a/lib/features/recipe/presentation/widgets/my_recipe_widget.dart b/lib/features/recipe/presentation/widgets/my_recipe_widget.dart index fecf6ab2..060285dd 100644 --- a/lib/features/recipe/presentation/widgets/my_recipe_widget.dart +++ b/lib/features/recipe/presentation/widgets/my_recipe_widget.dart @@ -187,7 +187,7 @@ class _MyRecipeWidgetState extends State { ); } - _iconButton(String iconPath, [String? text]) { + Container _iconButton(String iconPath, [String? text]) { return Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), decoration: BoxDecoration( diff --git a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart index 1ccbde80..9581779d 100644 --- a/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart +++ b/lib/features/registration/presentation/bloc/registration_cubit/registration_cubit.dart @@ -48,7 +48,7 @@ class RegistrationCubit extends Cubit { ), ); - updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState(sheet: sheet)); + void updateSheet(UserRegistrationSheet sheet) => emit(RegistrationState(sheet: sheet)); Future tryRegistration() async { if (await registrationRepository.emailIsReachable(state.sheet.email)) { diff --git a/lib/features/registration/presentation/bloc/verify_email_cubit/verify_email_cubit.dart b/lib/features/registration/presentation/bloc/verify_email_cubit/verify_email_cubit.dart index 864951ae..649c1fb8 100644 --- a/lib/features/registration/presentation/bloc/verify_email_cubit/verify_email_cubit.dart +++ b/lib/features/registration/presentation/bloc/verify_email_cubit/verify_email_cubit.dart @@ -9,7 +9,7 @@ class VerifyEmailCubit extends Cubit { required this.profileRepository, }) : super(const VerifyEmailState.loading()); - sendEmailCode() async { + Future sendEmailCode() async { try { final profile = await profileRepository.getMyProfile(); await profileRepository.sendEmailCode(); @@ -19,7 +19,7 @@ class VerifyEmailCubit extends Cubit { } } - tryVerify(String code) async { + Future tryVerify(String code) async { try { emit(const VerifyEmailState.verifyLoading()); final result = await profileRepository.tryVerifyEmailByCode(code); diff --git a/lib/features/registration/presentation/pages/date_of_birth_screen.dart b/lib/features/registration/presentation/pages/date_of_birth_screen.dart index 089cb180..f97167fd 100644 --- a/lib/features/registration/presentation/pages/date_of_birth_screen.dart +++ b/lib/features/registration/presentation/pages/date_of_birth_screen.dart @@ -61,7 +61,7 @@ class _DateOfBirthScreenState extends State { ); } - onTapCalendar(BuildContext context) { + Null Function() onTapCalendar(BuildContext context) { return () { _showDialog( CupertinoDatePicker( diff --git a/lib/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart b/lib/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart index 1bc68637..d3995d6a 100644 --- a/lib/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart +++ b/lib/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart @@ -40,7 +40,7 @@ class SettingsCubit extends Cubit { } } - updateProfileDetails({ + Future updateProfileDetails({ required ProfileDetailsModel profileDetailsModel, }) async { try { @@ -54,7 +54,7 @@ class SettingsCubit extends Cubit { } } - updateProfileSettings({ + Future updateProfileSettings({ required ProfileSettingsModel profileSettingsModel, }) async { try { diff --git a/lib/features/settings/presentation/pages/general_info_screen.dart b/lib/features/settings/presentation/pages/general_info_screen.dart index 9e12ee19..0e7600ce 100644 --- a/lib/features/settings/presentation/pages/general_info_screen.dart +++ b/lib/features/settings/presentation/pages/general_info_screen.dart @@ -151,7 +151,7 @@ class _GeneralInfoScreenState extends State { ); } - onTapCalendar(BuildContext context) { + Null Function() onTapCalendar(BuildContext context) { return () { _showDialog( CupertinoDatePicker( @@ -187,7 +187,7 @@ class _GeneralInfoScreenState extends State { ); } - _saveButton() { + InkWell _saveButton() { return InkWell( onTap: () { widget.settingsEntity.settingsCubit.updateProfileDetails( diff --git a/lib/features/settings/presentation/pages/other_info_screen.dart b/lib/features/settings/presentation/pages/other_info_screen.dart index 555eb97e..840d8bbe 100644 --- a/lib/features/settings/presentation/pages/other_info_screen.dart +++ b/lib/features/settings/presentation/pages/other_info_screen.dart @@ -129,7 +129,7 @@ class _OtherInfoScreenState extends State { ); } - _saveButton() { + InkWell _saveButton() { return InkWell( onTap: () { widget.settingsEntity.settingsCubit.updateProfileDetails( diff --git a/lib/features/settings/presentation/pages/physical_activity_screen.dart b/lib/features/settings/presentation/pages/physical_activity_screen.dart index c3ef542f..3c6b000c 100644 --- a/lib/features/settings/presentation/pages/physical_activity_screen.dart +++ b/lib/features/settings/presentation/pages/physical_activity_screen.dart @@ -116,7 +116,7 @@ class _PhysicalActivityScreenState extends State { ); } - _saveButton() { + InkWell _saveButton() { return InkWell( onTap: () { late final double activityCoefficient; diff --git a/lib/features/settings/presentation/pages/physical_form_screen.dart b/lib/features/settings/presentation/pages/physical_form_screen.dart index 8574d222..0c22cf85 100644 --- a/lib/features/settings/presentation/pages/physical_form_screen.dart +++ b/lib/features/settings/presentation/pages/physical_form_screen.dart @@ -100,7 +100,7 @@ class _PhysicalFormScreenState extends State { ); } - _saveButton() { + InkWell _saveButton() { return InkWell( onTap: () { widget.settingsEntity.settingsCubit.updateProfileDetails( diff --git a/lib/features/settings/presentation/pages/pressure_screen.dart b/lib/features/settings/presentation/pages/pressure_screen.dart index 1a155dcb..287744a9 100644 --- a/lib/features/settings/presentation/pages/pressure_screen.dart +++ b/lib/features/settings/presentation/pages/pressure_screen.dart @@ -106,7 +106,7 @@ class _PressureScreenState extends State { ); } - _saveButton() { + InkWell _saveButton() { return InkWell( onTap: () { widget.settingsEntity.settingsCubit.updateProfileDetails( diff --git a/lib/features/settings/presentation/pages/settings_screen.dart b/lib/features/settings/presentation/pages/settings_screen.dart index 8afe8cd7..c5c9dc99 100644 --- a/lib/features/settings/presentation/pages/settings_screen.dart +++ b/lib/features/settings/presentation/pages/settings_screen.dart @@ -86,7 +86,7 @@ class _SettingsScreenState extends State { ); } - _additionalInfo(SettingsStateLoaded state) { + Column _additionalInfo(SettingsStateLoaded state) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -189,7 +189,7 @@ class _SettingsScreenState extends State { ); } - _notifications(SettingsStateLoaded state) { + Column _notifications(SettingsStateLoaded state) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -323,7 +323,7 @@ class _SettingsScreenState extends State { ); } - _aboutEatvio(SettingsStateLoaded state) { + Column _aboutEatvio(SettingsStateLoaded state) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -351,7 +351,7 @@ class _SettingsScreenState extends State { ); } - _becomeConsultantButton(SettingsStateLoaded state) { + SingleChildRenderObjectWidget _becomeConsultantButton(SettingsStateLoaded state) { if (state.consultationRequestModel == null) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16) + const EdgeInsets.only(bottom: 8), @@ -432,7 +432,7 @@ class _SettingsScreenState extends State { return const SizedBox.shrink(); } - _deleteAccountButton(SettingsStateLoaded state) { + Padding _deleteAccountButton(SettingsStateLoaded state) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 16), child: InkWell( @@ -460,7 +460,7 @@ class _SettingsScreenState extends State { ); } - _tile({ + ListTile _tile({ required String title, required Function() onTap, Widget? trailing, @@ -486,7 +486,7 @@ class _SettingsScreenState extends State { ); } - _divider(BuildContext context) { + Center _divider(BuildContext context) { return Center( child: Container( height: 0.4, diff --git a/lib/features/user_details/presentation/user_details_screen.dart b/lib/features/user_details/presentation/user_details_screen.dart index e13b3c7a..f79b990e 100644 --- a/lib/features/user_details/presentation/user_details_screen.dart +++ b/lib/features/user_details/presentation/user_details_screen.dart @@ -421,7 +421,7 @@ class _UserDetailsContentState extends State { ); } - _charts() { + Material _charts() { return Material( color: Colors.white, borderRadius: BorderRadius.circular(16), @@ -483,7 +483,7 @@ class _UserDetailsContentState extends State { ); } - _choiceIntervalChipWidget(int index) { + ChoiceChip _choiceIntervalChipWidget(int index) { return ChoiceChip( selectedColor: Colors.grey.withValues(alpha: 0.1), pressElevation: 0, @@ -509,7 +509,7 @@ class _UserDetailsContentState extends State { ); } - _choiceChipWidget(int index) { + ChoiceChip _choiceChipWidget(int index) { return ChoiceChip( selectedColor: appTheme.blueA400, pressElevation: 0,