From 92c1bb1a9117de973aa3d02c8a7db99fb48b1755 Mon Sep 17 00:00:00 2001 From: Username1548 Date: Fri, 15 Nov 2024 19:58:10 +0700 Subject: [PATCH] added new analyzer exclude options and fixed naming in sorting filter types --- analysis_options.yaml | 10 +-- lib/core/widgets/base_button.dart | 10 --- .../widgets/diet_filter_bottom_sheet.dart | 32 +--------- .../widgets/sorting_drop_down_filter.dart | 54 ++++++++++++++++ lib/generated/intl/messages_all.dart | 2 +- lib/generated/intl/messages_en.dart | 62 ++++++++++-------- lib/generated/l10n.dart | 64 ++++++++++++++++++- lib/l10n/intl_en.arb | 8 ++- lib/theme/theme_helper.dart | 2 +- 9 files changed, 169 insertions(+), 75 deletions(-) delete mode 100644 lib/core/widgets/base_button.dart create mode 100644 lib/features/feed/presentation/widgets/sorting_drop_down_filter.dart diff --git a/analysis_options.yaml b/analysis_options.yaml index e8fba18e..fc61170b 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,11 +1,13 @@ - linter: rules: - require_trailing_commas analyzer: - exclude: - - '**/*.g.dart' + exclude: + - '**/*.g.dart' + - '**/l10n.dart' + - '**/messages_all.dart' + - '**/messages_en.dart' errors: invalid_annotation_target: ignore plugins: @@ -38,4 +40,4 @@ dart_code_metrics: # - no-boolean-literal-compare # - no-empty-block # - prefer-conditional-expressions -# - no-equal-then-else \ No newline at end of file +# - no-equal-then-else diff --git a/lib/core/widgets/base_button.dart b/lib/core/widgets/base_button.dart deleted file mode 100644 index c632ff4d..00000000 --- a/lib/core/widgets/base_button.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'package:flutter/material.dart'; - -class BaseButton extends StatelessWidget { - const BaseButton({super.key}); - - @override - Widget build(BuildContext context) { - return FilledButton(onPressed: () {}, child: Text('qweqwe')); - } -} diff --git a/lib/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart b/lib/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart index f9bd41f5..6ebb2a20 100644 --- a/lib/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart +++ b/lib/features/feed/presentation/widgets/diet_filter_bottom_sheet.dart @@ -1,5 +1,6 @@ import 'package:eatvio_app/core/widgets/bottom_sheet_handler_bar.dart'; import 'package:eatvio_app/core/widgets/custom_divider.dart'; +import 'package:eatvio_app/features/feed/presentation/widgets/sorting_drop_down_filter.dart'; import 'package:eatvio_app/features/feed/presentation/widgets/type_choice_filter_widget.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:eatvio_app/theme/custom_text_style.dart'; @@ -8,7 +9,7 @@ import 'package:flutter/material.dart'; class DietFilterBottomSheet extends StatelessWidget { const DietFilterBottomSheet({super.key}); - + @override Widget build(BuildContext context) { final s = S.of(context); @@ -28,34 +29,7 @@ class DietFilterBottomSheet extends StatelessWidget { style: TextStyles.textMSemibold.copyWith(color: appTheme.black), ), SizedBox(height: 12), - DropdownButtonFormField( - borderRadius: BorderRadius.circular(20), - dropdownColor: appTheme.qwe, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: const BorderRadius.all(Radius.circular(20)), - borderSide: BorderSide.none, - ), - fillColor: appTheme.qwe, - filled: true, - ), - value: 'qwe', - items: [ - DropdownMenuItem( - child: Text('qwe'), - value: 'qwe', - ), - DropdownMenuItem( - child: Text('qwe2'), - value: 'qwe2', - ), - DropdownMenuItem( - child: Text('qwe3'), - value: 'qwe3', - ), - ], - onChanged: (value) {}, - ), + SortingDropDownFilter(), SizedBox( height: 16, ), diff --git a/lib/features/feed/presentation/widgets/sorting_drop_down_filter.dart b/lib/features/feed/presentation/widgets/sorting_drop_down_filter.dart new file mode 100644 index 00000000..3c6fea42 --- /dev/null +++ b/lib/features/feed/presentation/widgets/sorting_drop_down_filter.dart @@ -0,0 +1,54 @@ +import 'package:eatvio_app/generated/l10n.dart'; +import 'package:eatvio_app/theme/theme_helper.dart'; +import 'package:flutter/material.dart'; +import 'package:collection/collection.dart'; + +class SortingDropDownFilter extends StatefulWidget { + const SortingDropDownFilter({super.key}); + + @override + State createState() => _SortingDropDownFilterState(); +} + +class _SortingDropDownFilterState extends State { + final List sortingTypes = []; + int selectedIndex = 0; + @override + void didChangeDependencies() { + super.didChangeDependencies(); + final s = S.of(context); + if (sortingTypes.isEmpty) { + sortingTypes.add(s.by_default); + sortingTypes.add(s.popular); + sortingTypes.add(s.most_new); + sortingTypes.add(s.most_old); + sortingTypes.add(s.most_liked); + } + } + + @override + Widget build(BuildContext context) { + return DropdownButtonFormField( + borderRadius: BorderRadius.circular(20), + dropdownColor: appTheme.lightGray0, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: const BorderRadius.all(Radius.circular(20)), + borderSide: BorderSide.none, + ), + fillColor: appTheme.lightGray0, + filled: true, + ), + value: sortingTypes[selectedIndex], + items: sortingTypes + .mapIndexed( + (index, value) => DropdownMenuItem( + child: Text(sortingTypes[index]), + value: sortingTypes[index], + ), + ) + .toList(), + onChanged: (value) {}, + ); + } +} diff --git a/lib/generated/intl/messages_all.dart b/lib/generated/intl/messages_all.dart index b6510a8a..203415cc 100644 --- a/lib/generated/intl/messages_all.dart +++ b/lib/generated/intl/messages_all.dart @@ -36,7 +36,7 @@ MessageLookupByLibrary? _findExact(String localeName) { Future initializeMessages(String localeName) { var availableLocale = Intl.verifiedLocale( localeName, (locale) => _deferredLibraries[locale] != null, - onFailure: (_) => null,); + onFailure: (_) => null); if (availableLocale == null) { return new SynchronousFuture(false); } diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 910355a7..ecffb344 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -32,7 +32,7 @@ class MessageLookup extends MessageLookupByLibrary { "admin": MessageLookupByLibrary.simpleMessage("Админ"), "alko_type": MessageLookupByLibrary.simpleMessage("Алкоголь"), "alko_type_desc": MessageLookupByLibrary.simpleMessage( - "С некоторыми видами диет можно употреблять алкоголь в умеренных количествах. Рекомендуется совмещать вместе с низкокалорийными закусками.",), + "С некоторыми видами диет можно употреблять алкоголь в умеренных количествах. Рекомендуется совмещать вместе с низкокалорийными закусками."), "all": MessageLookupByLibrary.simpleMessage("Все"), "allergies_presence": MessageLookupByLibrary.simpleMessage("Наличие аллергии"), @@ -43,8 +43,9 @@ class MessageLookup extends MessageLookupByLibrary { "archived": MessageLookupByLibrary.simpleMessage("В архиве"), "authentificate": MessageLookupByLibrary.simpleMessage("Войти"), "average_pressure": MessageLookupByLibrary.simpleMessage( - "Средние показатели давления:",), + "Средние показатели давления:"), "bodymass_chart": MessageLookupByLibrary.simpleMessage("График ИМТ"), + "by_default": MessageLookupByLibrary.simpleMessage("По умолчянию"), "calories": MessageLookupByLibrary.simpleMessage("Калории"), "carbohydrates": MessageLookupByLibrary.simpleMessage("Углеводы"), "chat": MessageLookupByLibrary.simpleMessage("Чат"), @@ -52,11 +53,11 @@ class MessageLookup extends MessageLookupByLibrary { "chest_circumference": MessageLookupByLibrary.simpleMessage("Обхват груди"), "choose_start_diet_date": MessageLookupByLibrary.simpleMessage( - "Выберите дату старты диеты. Она отобразиться у Вас в дневнике",), + "Выберите дату старты диеты. Она отобразиться у Вас в дневнике"), "circumference_empty": MessageLookupByLibrary.simpleMessage( - "Все замеры обязательны к заполнению",), + "Все замеры обязательны к заполнению"), "circumference_is_not_a_number": MessageLookupByLibrary.simpleMessage( - "Все замеры должны быть числами",), + "Все замеры должны быть числами"), "circumferences_chart": MessageLookupByLibrary.simpleMessage("График обхватов"), "city": MessageLookupByLibrary.simpleMessage("Город"), @@ -71,7 +72,7 @@ class MessageLookup extends MessageLookupByLibrary { "copy_link": MessageLookupByLibrary.simpleMessage("Скопировать ссылку"), "corb_type": MessageLookupByLibrary.simpleMessage("Мучное"), "corb_type_desc": MessageLookupByLibrary.simpleMessage( - "Если вы любите мучные продукты, но хотите придерживаться диеты, вам подходит диета с добавленим мучных блюд на основе цельнозерновых вариантов. В них больше сложных углеводов и клетчатки, что способствует длительному чувству сытости и поддерживает здоровье пищеварительной системы.",), + "Если вы любите мучные продукты, но хотите придерживаться диеты, вам подходит диета с добавленим мучных блюд на основе цельнозерновых вариантов. В них больше сложных углеводов и клетчатки, что способствует длительному чувству сытости и поддерживает здоровье пищеварительной системы."), "country": MessageLookupByLibrary.simpleMessage("Страна"), "date_of_birth": MessageLookupByLibrary.simpleMessage("Дата рождения"), "day": MessageLookupByLibrary.simpleMessage("День"), @@ -86,17 +87,17 @@ class MessageLookup extends MessageLookupByLibrary { "do_you_have_hypotension_tendency": MessageLookupByLibrary.simpleMessage("Есть ли у вас гипотония?"), "do_you_take_pills": MessageLookupByLibrary.simpleMessage( - "Принимаете ли вы лекарства или бады?",), + "Принимаете ли вы лекарства или бады?"), "down_pressure": MessageLookupByLibrary.simpleMessage("Нижние показатели давления:"), "draft": MessageLookupByLibrary.simpleMessage("Черновик"), "email": MessageLookupByLibrary.simpleMessage("Элетронная почта"), "email_empty": MessageLookupByLibrary.simpleMessage( - "Необходимо ввести адрес электронной почты",), + "Необходимо ввести адрес электронной почты"), "email_invalid": MessageLookupByLibrary.simpleMessage( - "Некорректный адрес электронной почты",), + "Некорректный адрес электронной почты"), "enter_additional_information": MessageLookupByLibrary.simpleMessage( - "Введите любую дополнительную информацию на своё усмотрение:",), + "Введите любую дополнительную информацию на своё усмотрение:"), "enter_information": MessageLookupByLibrary.simpleMessage("Введите информацию..."), "exit": MessageLookupByLibrary.simpleMessage("Выйти"), @@ -105,16 +106,16 @@ class MessageLookup extends MessageLookupByLibrary { "favorite_foods": MessageLookupByLibrary.simpleMessage("Любимые продукты"), "favorite_unfavorite_foods": MessageLookupByLibrary.simpleMessage( - "Ваши любимые/нелюбимые продукты питания?",), + "Ваши любимые/нелюбимые продукты питания?"), "female": MessageLookupByLibrary.simpleMessage("Женский"), "fill_in_information": MessageLookupByLibrary.simpleMessage("Заполните информацию:"), "finish": MessageLookupByLibrary.simpleMessage("Завершить"), "first_name": MessageLookupByLibrary.simpleMessage("Имя"), "first_name_empty": MessageLookupByLibrary.simpleMessage( - "Имя обязательно для заполнения",), + "Имя обязательно для заполнения"), "first_name_short": MessageLookupByLibrary.simpleMessage( - "В имени должен быть минимум 1 символ",), + "В имени должен быть минимум 1 символ"), "gr": MessageLookupByLibrary.simpleMessage("гр"), "grams": MessageLookupByLibrary.simpleMessage("гр"), "height_measurements": @@ -129,9 +130,9 @@ class MessageLookup extends MessageLookupByLibrary { "language": MessageLookupByLibrary.simpleMessage("Язык"), "last_name": MessageLookupByLibrary.simpleMessage("Фамилия"), "last_name_empty": MessageLookupByLibrary.simpleMessage( - "Фамилия обязательна для заполнения",), + "Фамилия обязательна для заполнения"), "last_name_short": MessageLookupByLibrary.simpleMessage( - "В фамилии должен быть минимум 6 символов",), + "В фамилии должен быть минимум 6 символов"), "lbl_english": MessageLookupByLibrary.simpleMessage("English"), "link_was_copied": MessageLookupByLibrary.simpleMessage("Ссылка успешно скопирована"), @@ -140,8 +141,14 @@ class MessageLookup extends MessageLookupByLibrary { "meal": MessageLookupByLibrary.simpleMessage("Приём пищи"), "meat_type": MessageLookupByLibrary.simpleMessage("С мясом"), "meat_type_desc": MessageLookupByLibrary.simpleMessage( - "Диета с мясом полезная и сбалансированная. Включает в себя нежирное мясо: курицу, индейку, кролика или говядину. В сочетании с овощами получаете все необходимые витамины и минералы. Не забывайте о порциях и старайтесь есть медленно, прислушиваясь к своему организму.",), + "Диета с мясом полезная и сбалансированная. Включает в себя нежирное мясо: курицу, индейку, кролика или говядину. В сочетании с овощами получаете все необходимые витамины и минералы. Не забывайте о порциях и старайтесь есть медленно, прислушиваясь к своему организму."), "milliliter": MessageLookupByLibrary.simpleMessage("мл"), + "most_copleted": + MessageLookupByLibrary.simpleMessage("Больше всего пройденных"), + "most_liked": + MessageLookupByLibrary.simpleMessage("Больше всего лайкнутых"), + "most_new": MessageLookupByLibrary.simpleMessage("Самые новые"), + "most_old": MessageLookupByLibrary.simpleMessage("Самые старые"), "msg_network_err": MessageLookupByLibrary.simpleMessage("Сетевая ошибка!"), "msg_something_went_wrong": @@ -149,9 +156,9 @@ class MessageLookup extends MessageLookupByLibrary { "my_blog": MessageLookupByLibrary.simpleMessage("Мой блог"), "my_settings": MessageLookupByLibrary.simpleMessage("Мои настройки"), "name_empty": MessageLookupByLibrary.simpleMessage( - "Имя пользователя обязательно для заполнения",), + "Имя пользователя обязательно для заполнения"), "name_short": MessageLookupByLibrary.simpleMessage( - "В имени пользователя должно быть минимум 6 символов",), + "В имени пользователя должно быть минимум 6 символов"), "no": MessageLookupByLibrary.simpleMessage("Нет"), "no_account": MessageLookupByLibrary.simpleMessage("У меня нет аккаунта"), @@ -162,20 +169,21 @@ class MessageLookup extends MessageLookupByLibrary { "password_confirmation_mismatch": MessageLookupByLibrary.simpleMessage("Пароли не совпадают"), "password_empty": MessageLookupByLibrary.simpleMessage( - "Пароль обязателен для заполнения",), + "Пароль обязателен для заполнения"), "password_short": MessageLookupByLibrary.simpleMessage( - "В пароле должно быть минимум 6 символов",), + "В пароле должно быть минимум 6 символов"), "pcs": MessageLookupByLibrary.simpleMessage("шт"), "place_of_living": MessageLookupByLibrary.simpleMessage("Место проживания"), "plans_complete": MessageLookupByLibrary.simpleMessage("Пройденные планы"), + "popular": MessageLookupByLibrary.simpleMessage("Популярные"), "preferred_language": MessageLookupByLibrary.simpleMessage("Предпочитаемый язык общения"), "pressure_empty": MessageLookupByLibrary.simpleMessage( - "Все показатели давления обязательны к заполнению",), + "Все показатели давления обязательны к заполнению"), "pressure_is_not_a_number": MessageLookupByLibrary.simpleMessage( - "Все показатели давления должны быть числами",), + "Все показатели давления должны быть числами"), "profile": MessageLookupByLibrary.simpleMessage("Профиль"), "proteins": MessageLookupByLibrary.simpleMessage("Белки"), "save": MessageLookupByLibrary.simpleMessage("Сохранить"), @@ -184,11 +192,11 @@ class MessageLookup extends MessageLookupByLibrary { "skip": MessageLookupByLibrary.simpleMessage("Пропустить"), "startDiet": MessageLookupByLibrary.simpleMessage("Начать диету"), "tell_your_schedule": MessageLookupByLibrary.simpleMessage( - "Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:",), + "Расскажите в свободной форме о том как просыпаетесь, когда едите, когда ложитесь спать:"), "unfavorite_foods": MessageLookupByLibrary.simpleMessage("Нелюбимые продукты"), "up_pressure": MessageLookupByLibrary.simpleMessage( - "Верхние показатели давления:",), + "Верхние показатели давления:"), "user_authorization": MessageLookupByLibrary.simpleMessage("Аутентификация"), "user_registration": @@ -196,7 +204,7 @@ class MessageLookup extends MessageLookupByLibrary { "username": MessageLookupByLibrary.simpleMessage("Имя пользователя"), "vegan_type": MessageLookupByLibrary.simpleMessage("Вегетарианская"), "vegan_type_desc": MessageLookupByLibrary.simpleMessage( - "Диета основана на потреблении растительной пищи и отказе от продуктов животного происхождения. Такой тип питания может быть разнообразным и вкусным, а также полезным для здоровья.",), + "Диета основана на потреблении растительной пищи и отказе от продуктов животного происхождения. Такой тип питания может быть разнообразным и вкусным, а также полезным для здоровья."), "waist": MessageLookupByLibrary.simpleMessage("Талия"), "waist_circumference": MessageLookupByLibrary.simpleMessage("Обхват талии"), @@ -207,7 +215,7 @@ class MessageLookup extends MessageLookupByLibrary { "what_is_your_name": MessageLookupByLibrary.simpleMessage("Как вас зовут?"), "wrong_credentials": MessageLookupByLibrary.simpleMessage( - "Неверные данные пользователя",), + "Неверные данные пользователя"), "your_blood_pressure": MessageLookupByLibrary.simpleMessage("Ваше артериальное давление?"), "your_favorite_sports": @@ -215,6 +223,6 @@ class MessageLookup extends MessageLookupByLibrary { "your_gender": MessageLookupByLibrary.simpleMessage("Ваш пол?"), "your_height": MessageLookupByLibrary.simpleMessage("Ваш рост:"), "your_schedule": MessageLookupByLibrary.simpleMessage("Ваш режим дня?"), - "your_weight": MessageLookupByLibrary.simpleMessage("Ваш вес:"), + "your_weight": MessageLookupByLibrary.simpleMessage("Ваш вес:") }; } diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index 9fd1162c..125ec2f1 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -19,7 +19,7 @@ class S { static S get current { assert(_current != null, - 'No instance of S was loaded. Try to initialize the S delegate before accessing S.current.',); + 'No instance of S was loaded. Try to initialize the S delegate before accessing S.current.'); return _current!; } @@ -42,7 +42,7 @@ class S { static S of(BuildContext context) { final instance = S.maybeOf(context); assert(instance != null, - 'No instance of S present in the widget tree. Did you add S.delegate in localizationsDelegates?',); + 'No instance of S present in the widget tree. Did you add S.delegate in localizationsDelegates?'); return instance!; } @@ -1409,6 +1409,66 @@ class S { args: [], ); } + + /// `Популярные` + String get popular { + return Intl.message( + 'Популярные', + name: 'popular', + desc: '', + args: [], + ); + } + + /// `Самые новые` + String get most_new { + return Intl.message( + 'Самые новые', + name: 'most_new', + desc: '', + args: [], + ); + } + + /// `Самые старые` + String get most_old { + return Intl.message( + 'Самые старые', + name: 'most_old', + desc: '', + args: [], + ); + } + + /// `Больше всего лайкнутых` + String get most_liked { + return Intl.message( + 'Больше всего лайкнутых', + name: 'most_liked', + desc: '', + args: [], + ); + } + + /// `Больше всего пройденных` + String get most_copleted { + return Intl.message( + 'Больше всего пройденных', + name: 'most_copleted', + desc: '', + args: [], + ); + } + + /// `По умолчянию` + String get by_default { + return Intl.message( + 'По умолчянию', + name: 'by_default', + desc: '', + args: [], + ); + } } class AppLocalizationDelegate extends LocalizationsDelegate { diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 0b130595..b29cc1c2 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -134,5 +134,11 @@ "order": "Порядок", "diet_time": "Время прохождения", "all": "Все", - "diet_type": "Тип диеты" + "diet_type": "Тип диеты", + "popular": "Популярные", + "most_new": "Самые новые", + "most_old": "Самые старые", + "most_liked": "Больше всего лайкнутых", + "most_copleted": "Больше всего пройденных", + "by_default": "По умолчянию" } diff --git a/lib/theme/theme_helper.dart b/lib/theme/theme_helper.dart index 39cede01..63675d02 100644 --- a/lib/theme/theme_helper.dart +++ b/lib/theme/theme_helper.dart @@ -177,7 +177,7 @@ class PrimaryColors { Color get transparentBlue => Color(0xFF2F80ED).withOpacity(0.1); - Color get qwe => Color(0xFFF6F6F6); + Color get lightGray0 => Color(0xFFF6F6F6); } PrimaryColors get appTheme => ThemeHelper().themeColor();