From e3bc40fdf31b8425e5c742a0fabac83cae4b54ad Mon Sep 17 00:00:00 2001 From: Edouard Marquez Date: Mon, 23 Jun 2025 18:14:17 +0200 Subject: [PATCH] chore: Migration to Dart 3.8 (#6668) * Migration to Dart 3.8 * New GA * Fix dartdoc --- .github/workflows/postsubmit.yml | 3 +- .github/workflows/presubmit.yml | 3 +- .../lib/src/apple_app_store.dart | 6 +- .../app_store/apple_app_store/pubspec.yaml | 2 +- packages/app_store/google_play/pubspec.yaml | 2 +- packages/app_store/shared/pubspec.yaml | 2 +- .../uri_store/lib/src/uri_app_store.dart | 5 +- packages/app_store/uri_store/pubspec.yaml | 2 +- .../lib/src/mobile_scanner_controller.dart | 11 +- .../ml_kit/lib/src/scanner_ml_kit.dart | 110 +- packages/scanner/ml_kit/pubspec.yaml | 2 +- packages/scanner/shared/lib/src/scanner.dart | 10 +- .../shared/lib/src/scanner_mocked.dart | 13 +- .../scanner/shared/lib/src/scanner_visor.dart | 14 +- .../shared/lib/src/screen_visibility.dart | 5 +- packages/scanner/shared/pubspec.yaml | 2 +- .../scanner/zxing/lib/src/scanner_zxing.dart | 194 +-- packages/scanner/zxing/pubspec.yaml | 2 +- packages/smooth_app/dartdoc_options.yaml | 2 + .../smooth_app/integration_test/app_test.dart | 47 +- .../lib/background/background_task.dart | 65 +- .../background_task_add_other_price.dart | 49 +- .../background/background_task_add_price.dart | 89 +- .../lib/background/background_task_badge.dart | 5 +- .../background/background_task_barcode.dart | 17 +- .../lib/background/background_task_crop.dart | 77 +- .../background/background_task_details.dart | 46 +- .../background_task_download_products.dart | 70 +- .../background_task_full_refresh.dart | 57 +- .../background_task_hunger_games.dart | 43 +- .../lib/background/background_task_image.dart | 125 +- .../background_task_language_refresh.dart | 79 +- .../background/background_task_manager.dart | 45 +- .../background/background_task_offline.dart | 29 +- .../lib/background/background_task_paged.dart | 4 +- .../lib/background/background_task_price.dart | 86 +- .../background_task_progressing.dart | 19 +- .../background_task_refresh_later.dart | 30 +- .../background_task_top_barcodes.dart | 64 +- .../background/background_task_unselect.dart | 62 +- .../background/background_task_upload.dart | 47 +- .../lib/background/operation_type.dart | 75 +- .../smooth_app/lib/background/work_type.dart | 24 +- .../cards/category_cards/abstract_cache.dart | 13 +- .../category_cards/asset_cache_helper.dart | 14 +- .../lib/cards/category_cards/null_cache.dart | 5 +- .../category_cards/raster_async_asset.dart | 34 +- .../cards/category_cards/raster_cache.dart | 46 +- .../cards/category_cards/svg_async_asset.dart | 60 +- .../lib/cards/category_cards/svg_cache.dart | 16 +- .../category_cards/svg_safe_network.dart | 106 +- .../product_image_carousel_item.dart | 28 +- .../lib/cards/data_cards/score_card.dart | 54 +- .../product_cards/product_title_card.dart | 47 +- .../smooth_product_base_card.dart | 80 +- .../smooth_product_card_error.dart | 8 +- .../smooth_product_card_found.dart | 100 +- .../smooth_product_card_loading.dart | 19 +- .../smooth_product_card_not_found.dart | 17 +- .../smooth_product_card_template.dart | 19 +- .../product_cards/smooth_product_image.dart | 234 ++-- .../data_models/abstract_onboarding_data.dart | 3 +- .../data_models/continuous_scan_model.dart | 45 +- .../lib/data_models/downloadable_string.dart | 5 +- .../lib/data_models/fetched_product.dart | 25 +- .../github_contributors_model.dart | 6 +- .../location_list_nominatim_supplier.dart | 6 +- .../location_list_photon_supplier.dart | 8 +- .../lib/data_models/location_query_model.dart | 4 +- .../lib/data_models/login_result.dart | 20 +- .../data_models/news_feed/newsfeed_json.dart | 313 +++-- .../data_models/news_feed/newsfeed_model.dart | 31 +- .../news_feed/newsfeed_provider.dart | 33 +- .../data_models/onboarding_data_product.dart | 13 +- .../lib/data_models/onboarding_loader.dart | 5 +- .../personalized_ranking_model.dart | 9 +- .../migration/user_preferences_migration.dart | 13 +- .../preferences/user_preferences.dart | 88 +- .../lib/data_models/product_image_data.dart | 6 +- .../lib/data_models/product_list.dart | 112 +- .../data_models/product_list_supplier.dart | 12 +- .../lib/data_models/product_preferences.dart | 89 +- .../query_product_list_supplier.dart | 5 +- .../lib/data_models/up_to_date_changes.dart | 23 +- .../up_to_date_product_list_mixin.dart | 4 +- .../up_to_date_product_list_provider.dart | 5 +- .../up_to_date_product_provider.dart | 14 +- .../data_models/user_management_provider.dart | 26 +- .../smooth_app/lib/database/bulk_manager.dart | 3 +- .../lib/database/dao_osm_location.dart | 89 +- .../smooth_app/lib/database/dao_product.dart | 155 +-- .../lib/database/dao_product_last_access.dart | 17 +- .../lib/database/dao_product_list.dart | 27 +- .../lib/database/dao_work_barcode.dart | 73 +- .../lib/database/transient_file.dart | 16 +- .../animations/smooth_reveal_animation.dart | 34 +- .../bottom_sheets/smooth_bottom_sheet.dart | 163 +-- .../smooth_draggable_bottom_sheet.dart | 12 +- .../smooth_draggable_bottom_sheet_route.dart | 13 +- .../buttons/smooth_boolean_button.dart | 55 +- .../buttons/smooth_button_with_arrow.dart | 8 +- .../smooth_large_button_with_icon.dart | 4 +- .../buttons/smooth_simple_button.dart | 17 +- .../lib/generic_lib/design_constants.dart | 5 +- .../dialogs/smooth_alert_dialog.dart | 166 +-- .../generic_lib/html/smooth_html_factory.dart | 8 +- .../html/smooth_html_fake_button.dart | 14 +- .../html/smooth_html_marker_chip.dart | 19 +- .../html/smooth_html_marker_decimal.dart | 19 +- .../generic_lib/html/smooth_html_widget.dart | 15 +- .../lib/generic_lib/loading_dialog.dart | 107 +- .../lib/generic_lib/loading_sliver.dart | 12 +- .../lib/generic_lib/svg_icon_chip.dart | 11 +- .../widgets/images/smooth_image.dart | 115 +- .../widgets/languages_selector.dart | 137 +- .../widgets/picture_not_found.dart | 48 +- .../generic_lib/widgets/smooth_app_logo.dart | 11 +- .../widgets/smooth_back_button.dart | 14 +- .../lib/generic_lib/widgets/smooth_card.dart | 89 +- .../widgets/smooth_error_card.dart | 45 +- .../widgets/smooth_list_tile_card.dart | 26 +- .../widgets/smooth_responsive.dart | 7 +- .../widgets/smooth_sliver_card.dart | 37 +- .../generic_lib/widgets/smooth_snackbar.dart | 146 +- .../widgets/smooth_text_form_field.dart | 38 +- .../lib/generic_lib/widgets/svg_icon.dart | 22 +- .../lib/helpers/analytics_helper.dart | 148 +- .../lib/helpers/attributes_card_helper.dart | 24 +- .../lib/helpers/collections_helper.dart | 5 +- .../lib/helpers/color_extension.dart | 10 +- .../lib/helpers/database_helper.dart | 5 +- .../lib/helpers/entry_points_helper.dart | 14 +- .../lib/helpers/extension_on_text_helper.dart | 30 +- .../lib/helpers/haptic_feedback_helper.dart | 5 +- .../lib/helpers/image_compute_container.dart | 20 +- .../lib/helpers/image_field_extension.dart | 108 +- .../lib/helpers/launch_url_helper.dart | 24 +- .../lib/helpers/network_config.dart | 11 +- .../smooth_app/lib/helpers/paint_helper.dart | 10 +- .../lib/helpers/permission_helper.dart | 24 +- packages/smooth_app/lib/helpers/physics.dart | 56 +- .../lib/helpers/product_cards_helper.dart | 166 +-- .../helpers/product_compatibility_helper.dart | 8 +- .../lib/helpers/provider_helper.dart | 77 +- .../lib/helpers/robotoff_insight_helper.dart | 15 +- .../lib/helpers/score_card_helper.dart | 3 +- .../lib/helpers/strings_helper.dart | 37 +- .../temp_product_list_share_helper.dart | 7 +- .../helpers/text_input_formatters_helper.dart | 19 +- .../smooth_app/lib/helpers/ui_helpers.dart | 7 +- .../knowledge_panel_action_card.dart | 18 +- .../knowledge_panel_card.dart | 47 +- .../knowledge_panel_expanded_card.dart | 27 +- .../knowledge_panel_group_card.dart | 10 +- .../knowledge_panel_image_card.dart | 4 +- .../knowledge_panel_page.dart | 63 +- .../knowledge_panel_product_cards.dart | 71 +- .../knowledge_panel_table_card.dart | 116 +- .../knowledge_panel_text_card.dart | 34 +- .../knowledge_panel_title_card.dart | 22 +- .../knowledge_panel_world_map_card.dart | 10 +- .../knowledge_panels_builder.dart | 58 +- .../lib/l10n/app_localizations.dart | 327 +++-- .../lib/l10n/app_localizations_aa.dart | 50 +- .../lib/l10n/app_localizations_af.dart | 50 +- .../lib/l10n/app_localizations_ak.dart | 50 +- .../lib/l10n/app_localizations_am.dart | 50 +- .../lib/l10n/app_localizations_ar.dart | 50 +- .../lib/l10n/app_localizations_as.dart | 50 +- .../lib/l10n/app_localizations_az.dart | 50 +- .../lib/l10n/app_localizations_be.dart | 50 +- .../lib/l10n/app_localizations_bg.dart | 50 +- .../lib/l10n/app_localizations_bm.dart | 50 +- .../lib/l10n/app_localizations_bn.dart | 50 +- .../lib/l10n/app_localizations_bo.dart | 50 +- .../lib/l10n/app_localizations_br.dart | 50 +- .../lib/l10n/app_localizations_bs.dart | 50 +- .../lib/l10n/app_localizations_ca.dart | 50 +- .../lib/l10n/app_localizations_ce.dart | 50 +- .../lib/l10n/app_localizations_co.dart | 50 +- .../lib/l10n/app_localizations_cs.dart | 50 +- .../lib/l10n/app_localizations_cv.dart | 50 +- .../lib/l10n/app_localizations_cy.dart | 50 +- .../lib/l10n/app_localizations_da.dart | 50 +- .../lib/l10n/app_localizations_de.dart | 50 +- .../lib/l10n/app_localizations_el.dart | 50 +- .../lib/l10n/app_localizations_en.dart | 50 +- .../lib/l10n/app_localizations_eo.dart | 50 +- .../lib/l10n/app_localizations_es.dart | 50 +- .../lib/l10n/app_localizations_et.dart | 50 +- .../lib/l10n/app_localizations_eu.dart | 50 +- .../lib/l10n/app_localizations_fa.dart | 50 +- .../lib/l10n/app_localizations_fi.dart | 50 +- .../lib/l10n/app_localizations_fo.dart | 50 +- .../lib/l10n/app_localizations_fr.dart | 50 +- .../lib/l10n/app_localizations_ga.dart | 50 +- .../lib/l10n/app_localizations_gd.dart | 50 +- .../lib/l10n/app_localizations_gl.dart | 50 +- .../lib/l10n/app_localizations_gu.dart | 50 +- .../lib/l10n/app_localizations_ha.dart | 50 +- .../lib/l10n/app_localizations_he.dart | 50 +- .../lib/l10n/app_localizations_hi.dart | 50 +- .../lib/l10n/app_localizations_hr.dart | 50 +- .../lib/l10n/app_localizations_ht.dart | 50 +- .../lib/l10n/app_localizations_hu.dart | 50 +- .../lib/l10n/app_localizations_hy.dart | 50 +- .../lib/l10n/app_localizations_id.dart | 50 +- .../lib/l10n/app_localizations_ii.dart | 50 +- .../lib/l10n/app_localizations_is.dart | 50 +- .../lib/l10n/app_localizations_it.dart | 50 +- .../lib/l10n/app_localizations_iu.dart | 50 +- .../lib/l10n/app_localizations_ja.dart | 50 +- .../lib/l10n/app_localizations_jv.dart | 50 +- .../lib/l10n/app_localizations_ka.dart | 50 +- .../lib/l10n/app_localizations_kk.dart | 50 +- .../lib/l10n/app_localizations_km.dart | 50 +- .../lib/l10n/app_localizations_kn.dart | 50 +- .../lib/l10n/app_localizations_ko.dart | 50 +- .../lib/l10n/app_localizations_ku.dart | 50 +- .../lib/l10n/app_localizations_kw.dart | 50 +- .../lib/l10n/app_localizations_ky.dart | 50 +- .../lib/l10n/app_localizations_la.dart | 50 +- .../lib/l10n/app_localizations_lb.dart | 50 +- .../lib/l10n/app_localizations_lo.dart | 50 +- .../lib/l10n/app_localizations_lt.dart | 50 +- .../lib/l10n/app_localizations_lv.dart | 50 +- .../lib/l10n/app_localizations_mg.dart | 50 +- .../lib/l10n/app_localizations_mi.dart | 50 +- .../lib/l10n/app_localizations_ml.dart | 50 +- .../lib/l10n/app_localizations_mn.dart | 50 +- .../lib/l10n/app_localizations_mr.dart | 50 +- .../lib/l10n/app_localizations_ms.dart | 50 +- .../lib/l10n/app_localizations_mt.dart | 50 +- .../lib/l10n/app_localizations_my.dart | 50 +- .../lib/l10n/app_localizations_nb.dart | 50 +- .../lib/l10n/app_localizations_ne.dart | 50 +- .../lib/l10n/app_localizations_nl.dart | 50 +- .../lib/l10n/app_localizations_nn.dart | 50 +- .../lib/l10n/app_localizations_no.dart | 50 +- .../lib/l10n/app_localizations_nr.dart | 50 +- .../lib/l10n/app_localizations_oc.dart | 50 +- .../lib/l10n/app_localizations_or.dart | 50 +- .../lib/l10n/app_localizations_pa.dart | 50 +- .../lib/l10n/app_localizations_pl.dart | 50 +- .../lib/l10n/app_localizations_pt.dart | 100 +- .../lib/l10n/app_localizations_qu.dart | 50 +- .../lib/l10n/app_localizations_rm.dart | 50 +- .../lib/l10n/app_localizations_ro.dart | 50 +- .../lib/l10n/app_localizations_ru.dart | 50 +- .../lib/l10n/app_localizations_sa.dart | 50 +- .../lib/l10n/app_localizations_sc.dart | 50 +- .../lib/l10n/app_localizations_sd.dart | 50 +- .../lib/l10n/app_localizations_sg.dart | 50 +- .../lib/l10n/app_localizations_si.dart | 50 +- .../lib/l10n/app_localizations_sk.dart | 50 +- .../lib/l10n/app_localizations_sl.dart | 50 +- .../lib/l10n/app_localizations_sn.dart | 50 +- .../lib/l10n/app_localizations_so.dart | 50 +- .../lib/l10n/app_localizations_sq.dart | 50 +- .../lib/l10n/app_localizations_sr.dart | 50 +- .../lib/l10n/app_localizations_ss.dart | 50 +- .../lib/l10n/app_localizations_st.dart | 50 +- .../lib/l10n/app_localizations_sv.dart | 50 +- .../lib/l10n/app_localizations_sw.dart | 50 +- .../lib/l10n/app_localizations_ta.dart | 50 +- .../lib/l10n/app_localizations_te.dart | 50 +- .../lib/l10n/app_localizations_tg.dart | 50 +- .../lib/l10n/app_localizations_th.dart | 50 +- .../lib/l10n/app_localizations_ti.dart | 50 +- .../lib/l10n/app_localizations_tl.dart | 50 +- .../lib/l10n/app_localizations_tn.dart | 50 +- .../lib/l10n/app_localizations_tr.dart | 50 +- .../lib/l10n/app_localizations_ts.dart | 50 +- .../lib/l10n/app_localizations_tt.dart | 50 +- .../lib/l10n/app_localizations_tw.dart | 50 +- .../lib/l10n/app_localizations_ty.dart | 50 +- .../lib/l10n/app_localizations_ug.dart | 50 +- .../lib/l10n/app_localizations_uk.dart | 50 +- .../lib/l10n/app_localizations_ur.dart | 50 +- .../lib/l10n/app_localizations_uz.dart | 50 +- .../lib/l10n/app_localizations_ve.dart | 50 +- .../lib/l10n/app_localizations_vi.dart | 50 +- .../lib/l10n/app_localizations_wa.dart | 50 +- .../lib/l10n/app_localizations_wo.dart | 50 +- .../lib/l10n/app_localizations_xh.dart | 50 +- .../lib/l10n/app_localizations_yi.dart | 50 +- .../lib/l10n/app_localizations_yo.dart | 50 +- .../lib/l10n/app_localizations_zh.dart | 50 +- .../lib/l10n/app_localizations_zu.dart | 50 +- packages/smooth_app/lib/main.dart | 39 +- .../lib/pages/all_product_list_modal.dart | 92 +- packages/smooth_app/lib/pages/app_review.dart | 12 +- .../smooth_app/lib/pages/crop_helper.dart | 8 +- packages/smooth_app/lib/pages/crop_page.dart | 127 +- .../smooth_app/lib/pages/crop_parameters.dart | 8 +- .../lib/pages/folksonomy/folksonomy_card.dart | 120 +- .../folksonomy_create_edit_modal.dart | 59 +- .../lib/pages/folksonomy/folksonomy_page.dart | 101 +- .../pages/folksonomy/folksonomy_provider.dart | 28 +- .../smooth_app/lib/pages/folksonomy/tag.dart | 4 +- .../guides/guide/guide_nutriscore_v2.dart | 17 +- .../pages/guides/helpers/guides_content.dart | 150 +- .../pages/guides/helpers/guides_footer.dart | 46 +- .../pages/guides/helpers/guides_header.dart | 101 +- packages/smooth_app/lib/pages/html_page.dart | 11 +- .../lib/pages/hunger_games/congrats.dart | 41 +- .../question_answers_options.dart | 10 +- .../lib/pages/hunger_games/question_card.dart | 53 +- .../question_image_full_page.dart | 42 +- .../question_image_thumbnail.dart | 46 +- .../lib/pages/hunger_games/question_page.dart | 166 ++- .../product_image_gallery_other_view.dart | 108 +- .../pages/image/product_image_other_page.dart | 290 ++-- .../lib/pages/image/product_image_widget.dart | 23 +- .../pages/image/uploaded_image_gallery.dart | 33 +- .../smooth_app/lib/pages/image_crop_page.dart | 129 +- .../debounced_text_editing_controller.dart | 5 +- .../input/smooth_autocomplete_text_field.dart | 180 +-- .../input/unfocus_field_when_tap_outside.dart | 16 +- .../locations/favorite_location_helper.dart | 5 +- .../pages/locations/location_map_page.dart | 25 +- .../pages/locations/location_query_page.dart | 128 +- .../lib/pages/locations/osm_location.dart | 24 +- .../locations/search_location_helper.dart | 6 +- .../search_location_preloaded_item.dart | 15 +- .../lib/pages/navigator/app_navigator.dart | 50 +- .../lib/pages/navigator/error_page.dart | 12 +- .../lib/pages/navigator/external_page.dart | 24 +- .../navigator/external_page_webview.dart | 16 +- .../pages/navigator/slide_up_transition.dart | 34 +- .../lib/pages/offline_data_page.dart | 57 +- .../lib/pages/offline_tasks_page.dart | 53 +- .../common/tooltip_shape_border.dart | 5 +- .../pages/onboarding/currency_selector.dart | 13 +- .../onboarding/currency_selector_helper.dart | 136 +- .../knowledge_panel_page_template.dart | 165 ++- .../lib/pages/onboarding/next_button.dart | 21 +- .../onboarding/onboarding_bottom_bar.dart | 64 +- .../onboarding/onboarding_flow_navigator.dart | 23 +- .../pages/onboarding/permissions_page.dart | 79 +- .../pages/onboarding/preferences_page.dart | 38 +- .../pages/onboarding/reinvention_page.dart | 85 +- .../onboarding/sample_eco_card_page.dart | 16 +- .../onboarding/sample_health_card_page.dart | 22 +- .../v2/onboarding_bottom_hills.dart | 14 +- .../lib/pages/onboarding/welcome_page.dart | 11 +- .../smooth_app/lib/pages/page_manager.dart | 26 +- .../lib/pages/personalized_ranking_page.dart | 111 +- .../abstract_user_preferences.dart | 59 +- .../preferences/account_deletion_webview.dart | 27 +- .../attribute_group_list_tile.dart | 31 +- .../preferences/country_selector/country.dart | 7 +- .../country_selector/country_selector.dart | 288 ++-- .../country_selector_provider.dart | 29 +- .../language_selector/language_selector.dart | 254 ++-- .../language_selector_provider.dart | 38 +- .../lib/pages/preferences/lazy_counter.dart | 17 +- .../preferences/user_preferences_account.dart | 130 +- .../user_preferences_attribute_group.dart | 36 +- .../user_preferences_choose_accent_color.dart | 33 +- ...references_choose_text_color_contrast.dart | 10 +- .../preferences/user_preferences_connect.dart | 341 ++--- .../user_preferences_contribute.dart | 323 ++--- .../user_preferences_currency_selector.dart | 4 +- .../user_preferences_dev_debug_info.dart | 69 +- .../user_preferences_dev_mode.dart | 905 ++++++------ .../user_preferences_donation.dart | 11 +- .../preferences/user_preferences_faq.dart | 276 ++-- .../preferences/user_preferences_food.dart | 55 +- .../user_preferences_language_selector.dart | 8 +- .../user_preferences_languages_list.dart | 368 ++--- .../user_preferences_list_tile.dart | 14 +- .../preferences/user_preferences_page.dart | 73 +- .../preferences/user_preferences_prices.dart | 68 +- .../user_preferences_search_page.dart | 14 +- .../user_preferences_settings.dart | 83 +- .../user_preferences_share_with_friends.dart | 62 +- .../preferences/user_preferences_widgets.dart | 324 ++--- .../lib/pages/prices/currency_extension.dart | 2 +- .../lib/pages/prices/eraser_model.dart | 74 +- .../lib/pages/prices/eraser_painter.dart | 8 +- .../lib/pages/prices/get_prices_model.dart | 34 +- .../pages/prices/infinite_scroll_list.dart | 27 +- .../pages/prices/infinite_scroll_manager.dart | 15 +- .../lib/pages/prices/price_add_helper.dart | 55 +- .../pages/prices/price_add_product_card.dart | 99 +- .../lib/pages/prices/price_amount_card.dart | 18 +- .../lib/pages/prices/price_amount_field.dart | 9 +- .../lib/pages/prices/price_amount_model.dart | 4 +- .../pages/prices/price_bulk_proof_card.dart | 12 +- .../lib/pages/prices/price_button.dart | 5 +- .../prices/price_category_input_page.dart | 97 +- .../lib/pages/prices/price_count_widget.dart | 53 +- .../lib/pages/prices/price_data_widget.dart | 27 +- .../lib/pages/prices/price_date_card.dart | 9 +- .../prices/price_existing_amount_card.dart | 36 +- .../prices/price_existing_amount_field.dart | 5 +- .../lib/pages/prices/price_location_card.dart | 46 +- .../pages/prices/price_location_widget.dart | 42 +- .../lib/pages/prices/price_meta_product.dart | 67 +- .../lib/pages/prices/price_model.dart | 26 +- .../lib/pages/prices/price_per_extension.dart | 6 +- .../pages/prices/price_product_list_tile.dart | 10 +- .../pages/prices/price_product_widget.dart | 23 +- .../lib/pages/prices/price_proof_card.dart | 80 +- .../lib/pages/prices/price_proof_page.dart | 52 +- .../lib/pages/prices/price_scan_page.dart | 17 +- .../lib/pages/prices/price_user_button.dart | 53 +- .../lib/pages/prices/prices_card.dart | 5 +- .../pages/prices/prices_locations_page.dart | 51 +- .../lib/pages/prices/prices_page.dart | 57 +- .../pages/prices/prices_products_page.dart | 37 +- .../lib/pages/prices/prices_proofs_page.dart | 74 +- .../lib/pages/prices/prices_stats_page.dart | 57 +- .../lib/pages/prices/prices_users_page.dart | 19 +- .../pages/prices/product_price_add_page.dart | 76 +- .../lib/pages/prices/product_prices_list.dart | 25 +- .../lib/pages/prices/proof_bulk_add_page.dart | 31 +- .../pages/prices/proof_type_extensions.dart | 14 +- .../add_basic_details_name.dart | 415 +++--- .../add_basic_details_page.dart | 33 +- .../add_new_product/add_new_product_page.dart | 217 ++- .../product_type_radio_list_tile.dart | 30 +- .../pages/product/add_new_product_helper.dart | 58 +- .../pages/product/add_nutrition_button.dart | 14 +- .../lib/pages/product/add_ocr_button.dart | 11 +- .../pages/product/add_other_details_page.dart | 22 +- .../pages/product/add_packaging_button.dart | 18 +- .../product/add_simple_input_button.dart | 17 +- .../pages/product/attribute_extensions.dart | 250 ++-- .../product/attribute_first_row_helper.dart | 84 +- .../product/attribute_first_row_widget.dart | 44 +- .../lib/pages/product/attribute_icons.dart | 584 ++++---- .../lib/pages/product/autocomplete.dart | 8 +- .../pages/product/common/loading_status.dart | 6 +- .../product/common/product_dialog_helper.dart | 82 +- .../product/common/product_list_helper.dart | 43 +- .../common/product_list_item_popup_items.dart | 24 +- .../common/product_list_item_simple.dart | 73 +- .../product/common/product_list_page.dart | 202 ++- .../common/product_list_popup_items.dart | 38 +- .../common/product_picture_banner.dart | 202 ++- .../product/common/product_query_page.dart | 72 +- .../common/product_query_page_helper.dart | 9 +- .../product/common/product_refresher.dart | 129 +- .../product/common/search_app_bar_title.dart | 5 +- .../product/common/search_empty_screen.dart | 5 +- .../pages/product/common/search_helper.dart | 29 +- .../product/common/search_loading_screen.dart | 8 +- .../pages/product/compare_products3_page.dart | 66 +- .../lib/pages/product/edit_image_button.dart | 4 +- .../pages/product/edit_language_tabbar.dart | 228 ++- .../pages/product/edit_new_packagings.dart | 48 +- .../edit_new_packagings_component.dart | 149 +- .../product/edit_new_packagings_helper.dart | 49 +- .../product/edit_ocr/edit_ocr_image.dart | 167 +-- .../pages/product/edit_ocr/edit_ocr_page.dart | 44 +- .../product/edit_ocr/edit_ocr_tabbar.dart | 14 +- .../product/edit_ocr/edit_ocr_textfield.dart | 129 +- .../pages/product/edit_ocr/ocr_helper.dart | 15 +- .../edit_ocr/ocr_ingredients_helper.dart | 25 +- .../edit_ocr/ocr_packaging_helper.dart | 12 +- .../edit_product/edit_product_footer.dart | 138 +- .../edit_product/edit_product_page.dart | 155 +-- .../product/edit_product_image_viewer.dart | 26 +- .../lib/pages/product/explanation_widget.dart | 23 +- .../product_image_gallery_photo_row.dart | 135 +- .../product_image_gallery_tabs.dart | 32 +- .../product_image_gallery_view.dart | 98 +- .../helpers/pinch_to_zoom_indicator.dart | 6 +- .../lib/pages/product/hideable_container.dart | 10 +- .../pages/product/may_exit_page_helper.dart | 9 +- .../pages/product/multilingual_helper.dart | 5 +- .../nutrition_page/nutrition_page.dart | 267 ++-- .../nutrition_page/nutrition_page_loader.dart | 5 +- .../nutrition_add_nutrient_button.dart | 65 +- .../nutrition_availability_container.dart | 62 +- .../widgets/nutrition_container_helper.dart | 38 +- .../widgets/nutrition_facts_editor.dart | 196 +-- .../widgets/nutrition_serving_size.dart | 15 +- .../widgets/nutrition_serving_switch.dart | 56 +- .../product/ordered_nutrients_cache.dart | 9 +- .../lib/pages/product/owner_field_info.dart | 16 +- .../lib/pages/product/portion_calculator.dart | 76 +- .../lib/pages/product/portion_helper.dart | 21 +- .../pages/product/product_field_editor.dart | 27 +- .../pages/product/product_image_button.dart | 65 +- .../product/product_image_crop_button.dart | 67 +- .../product/product_image_server_button.dart | 37 +- .../product/product_image_swipeable_view.dart | 66 +- .../product_image_unselect_button.dart | 4 +- .../pages/product/product_image_viewer.dart | 109 +- .../product/product_incomplete_card.dart | 22 +- .../pages/product/product_list_helper.dart | 215 ++- .../pages/product/product_loader_page.dart | 55 +- .../footer/new_product_footer.dart | 123 +- ...product_footer_add_product_properties.dart | 11 +- .../new_product_footer_add_to_lists.dart | 10 +- .../footer/new_product_footer_barcode.dart | 7 +- .../footer/new_product_footer_compare.dart | 4 +- ...product_footer_data_contributor_guide.dart | 6 +- .../new_product_footer_data_quality.dart | 4 +- .../new_product_footer_open_website.dart | 8 +- .../footer/new_product_footer_settings.dart | 293 ++-- .../footer/new_product_footer_share.dart | 13 +- .../header/product_page_tabs.dart | 30 +- .../product_page/new_product_header.dart | 153 +- .../product_page/new_product_page.dart | 38 +- .../new_product_page_loading_indicator.dart | 17 +- .../product/product_questions_widget.dart | 85 +- .../product/product_type_extensions.dart | 41 +- .../reorderable_knowledge_panel_page.dart | 38 +- .../reordered_knowledge_panel_cards.dart | 3 +- .../simple_input/list/simple_input_list.dart | 56 +- .../list/simple_input_list_item.dart | 29 +- .../list/suggestions/list_suggestions.dart | 54 +- .../robotoff_suggestion_item_button.dart | 18 +- .../robotoff_suggestion_item_picture.dart | 9 +- .../robotoff/robotoff_suggestions_item.dart | 127 +- .../robotoff/robotoff_suggestions_list.dart | 30 +- .../simple_input/simple_input_page.dart | 40 +- .../simple_input_page_helpers.dart | 530 ++++--- .../simple_input/simple_input_text_field.dart | 3 +- .../simple_input/simple_input_widget.dart | 72 +- .../product/simple_input_number_field.dart | 85 +- .../product/summary_attribute_group.dart | 22 +- .../lib/pages/product/summary_card.dart | 74 +- .../lib/pages/product/website_card.dart | 16 +- .../lib/pages/product/world_map_page.dart | 15 +- .../lib/pages/product_crop_helper.dart | 23 +- .../product_list_user_dialog_helper.dart | 76 +- .../lib/pages/proof_crop_helper.dart | 4 +- .../lib/pages/scan/camera_scan_page.dart | 8 +- .../bottom_cards/news/scan_news_card.dart | 38 +- .../bottom_cards/news/scan_news_provider.dart | 21 +- .../bottom_cards/scan_app_review_card.dart | 43 +- .../bottom_cards/scan_bottom_card.dart | 83 +- .../carousel/main_card/scan_main_card.dart | 24 +- .../main_card/top_card/scan_search_card.dart | 26 +- .../pages/scan/carousel/scan_carousel.dart | 58 +- .../scan/carousel/scan_carousel_manager.dart | 19 +- .../lib/pages/scan/scan_header.dart | 39 +- .../smooth_app/lib/pages/scan/scan_page.dart | 61 +- .../lib/pages/scan/scan_product_card.dart | 25 +- .../pages/scan/scan_product_card_loader.dart | 28 +- .../scan/smooth_barcode_scanner_mockup.dart | 4 +- .../lib/pages/search/search_field.dart | 53 +- .../lib/pages/search/search_history_view.dart | 26 +- .../lib/pages/search/search_page.dart | 32 +- .../pages/search/search_product_helper.dart | 19 +- .../lib/pages/text_field_helper.dart | 4 +- .../user_management/forgot_password_page.dart | 8 +- .../lib/pages/user_management/login_page.dart | 80 +- .../pages/user_management/sign_up_page.dart | 115 +- .../lib/query/barcode_product_query.dart | 10 +- .../lib/query/category_product_query.dart | 25 +- .../lib/query/keywords_product_query.dart | 23 +- .../lib/query/paged_product_query.dart | 5 +- .../lib/query/paged_search_product_query.dart | 5 +- .../paged_to_be_completed_product_query.dart | 29 +- .../lib/query/paged_user_product_query.dart | 51 +- .../smooth_app/lib/query/product_query.dart | 166 +-- .../lib/query/product_questions_query.dart | 8 +- .../lib/query/search_products_manager.dart | 25 +- .../lib/resources/app_animations.dart | 186 +-- .../smooth_app/lib/resources/app_icons.dart | 207 ++- .../lib/resources/app_icons_font.dart | 1232 ++++++++++++----- .../services/app_store/app_store_service.dart | 6 +- .../logs/fimber/trees/base_fimber_tree.dart | 10 +- .../logs/fimber/trees/debug_fimber_tree.dart | 12 +- .../logs/fimber/trees/file_fimber_tree.dart | 10 +- .../logs/fimber/trees/sentry_fimber_tree.dart | 4 +- .../lib/services/logs/logs_fimber_impl.dart | 40 +- .../lib/services/logs/smooth_log_levels.dart | 10 +- .../services/logs/smooth_logs_service.dart | 75 +- .../smooth_app/lib/themes/smooth_theme.dart | 72 +- .../lib/themes/smooth_theme_colors.dart | 162 +-- .../smooth_app/lib/themes/theme_provider.dart | 5 +- .../lib/widgets/attribute_button.dart | 48 +- .../lib/widgets/auto_scale_widget.dart | 11 +- .../ranking_floating_action_button.dart | 53 +- .../smooth_screen_list_choice.dart | 217 +-- .../smooth_screen_selector_provider.dart | 14 +- packages/smooth_app/lib/widgets/slivers.dart | 11 +- .../lib/widgets/smooth_app_bar.dart | 145 +- .../smooth_app/lib/widgets/smooth_banner.dart | 46 +- .../lib/widgets/smooth_barcode_widget.dart | 4 +- .../smooth_app/lib/widgets/smooth_circle.dart | 10 +- .../lib/widgets/smooth_close_button.dart | 19 +- .../lib/widgets/smooth_dropdown.dart | 60 +- ...oth_expandable_floating_action_button.dart | 4 +- .../widgets/smooth_explanation_banner.dart | 199 ++- .../lib/widgets/smooth_floating_message.dart | 56 +- .../smooth_app/lib/widgets/smooth_hero.dart | 49 +- .../lib/widgets/smooth_indicator_icon.dart | 13 +- .../widgets/smooth_interactive_viewer.dart | 13 +- .../lib/widgets/smooth_list_diff.dart | 78 +- .../lib/widgets/smooth_menu_button.dart | 12 +- .../lib/widgets/smooth_navigation_bar.dart | 99 +- .../lib/widgets/smooth_scaffold.dart | 45 +- .../smooth_app/lib/widgets/smooth_switch.dart | 45 +- .../smooth_app/lib/widgets/smooth_tabbar.dart | 57 +- .../smooth_app/lib/widgets/smooth_text.dart | 247 ++-- .../smooth_app/lib/widgets/tab_navigator.dart | 5 +- .../lib/widgets/v2/smooth_buttons_bar.dart | 62 +- .../lib/widgets/v2/smooth_leading_button.dart | 40 +- .../lib/widgets/v2/smooth_scaffold2.dart | 17 +- .../lib/widgets/v2/smooth_topbar2.dart | 50 +- .../xcshareddata/xcschemes/satdev.xcscheme | 78 ++ packages/smooth_app/pubspec.lock | 2 +- packages/smooth_app/pubspec.yaml | 2 +- packages/smooth_app/test/basic_test.dart | 4 +- .../dialogs/generic_lib/dialogs_test.dart | 130 +- .../widgets/smooth_error_card_test.dart | 4 +- .../pages/user_preferences_page_test.dart | 16 +- .../test/plural_translation_test.dart | 78 +- .../smooth_reveal_animation_test.dart | 64 +- .../test/smooth_ui_library/basic_test.dart | 3 +- .../dialogs/smooth_category_picker_test.dart | 68 +- .../smooth_app/test/tests_utils/goldens.dart | 16 +- .../smooth_app/test/tests_utils/mocks.dart | 201 +-- .../forgot_password_page_layout_test.dart | 16 +- .../test/users/login_page_layout_test.dart | 16 +- .../test/users/signup_page_layout_test.dart | 16 +- .../test/utils/smooth_text_test.dart | 10 +- .../test/utils/string_extensions_test.dart | 87 +- .../utils/text_input_formatters_tests.dart | 178 +-- .../test_driver/screenshot_driver.dart | 10 +- 628 files changed, 18834 insertions(+), 17076 deletions(-) create mode 100644 packages/smooth_app/dartdoc_options.yaml create mode 100644 packages/smooth_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/satdev.xcscheme diff --git a/.github/workflows/postsubmit.yml b/.github/workflows/postsubmit.yml index 7e31fcdb9a..7624548008 100644 --- a/.github/workflows/postsubmit.yml +++ b/.github/workflows/postsubmit.yml @@ -41,8 +41,7 @@ jobs: # Check for formatting issues - name: Check for formatting issues (run "dart format . ") - #run: dart format --set-exit-if-changed . - run: dart format . + run: dart format --set-exit-if-changed . # analyze Dart for errors - name: Analyze code diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml index e691250582..1d9e7f6704 100644 --- a/.github/workflows/presubmit.yml +++ b/.github/workflows/presubmit.yml @@ -40,8 +40,7 @@ jobs: # Check for formatting issues - name: 🧹 Check for formatting issues (run "dart format . ") - #run: dart format --set-exit-if-changed . - run: dart format . + run: dart format --set-exit-if-changed . # Analyze Dart for errors - name: Analyze code diff --git a/packages/app_store/apple_app_store/lib/src/apple_app_store.dart b/packages/app_store/apple_app_store/lib/src/apple_app_store.dart index 9c6be56acf..3ab9df3c0d 100644 --- a/packages/app_store/apple_app_store/lib/src/apple_app_store.dart +++ b/packages/app_store/apple_app_store/lib/src/apple_app_store.dart @@ -7,9 +7,9 @@ import 'package:in_app_review/in_app_review.dart'; /// Apple App Store implementation class AppleAppStore extends AppStore { AppleAppStore(this.appId) - : assert(appId.isNotEmpty), - assert(!appId.startsWith('id')), - assert(Platform.isIOS || Platform.isMacOS); + : assert(appId.isNotEmpty), + assert(!appId.startsWith('id')), + assert(Platform.isIOS || Platform.isMacOS); final String appId; final InAppReview _inAppReview = InAppReview.instance; diff --git a/packages/app_store/apple_app_store/pubspec.yaml b/packages/app_store/apple_app_store/pubspec.yaml index 7d76362ecc..5b608a69b2 100644 --- a/packages/app_store/apple_app_store/pubspec.yaml +++ b/packages/app_store/apple_app_store/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.0.1 publish_to: "none" environment: - sdk: ^3.6.0 + sdk: ^3.8.1 dependencies: flutter: diff --git a/packages/app_store/google_play/pubspec.yaml b/packages/app_store/google_play/pubspec.yaml index b2235438d8..1b7424e4f0 100644 --- a/packages/app_store/google_play/pubspec.yaml +++ b/packages/app_store/google_play/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.0.1 publish_to: "none" environment: - sdk: ^3.6.0 + sdk: ^3.8.1 dependencies: flutter: diff --git a/packages/app_store/shared/pubspec.yaml b/packages/app_store/shared/pubspec.yaml index bee92f190f..417f5c7390 100644 --- a/packages/app_store/shared/pubspec.yaml +++ b/packages/app_store/shared/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: "none" environment: - sdk: ^3.6.0 + sdk: ^3.8.1 dependencies: flutter: diff --git a/packages/app_store/uri_store/lib/src/uri_app_store.dart b/packages/app_store/uri_store/lib/src/uri_app_store.dart index ad079e1741..b0a8d9c70d 100644 --- a/packages/app_store/uri_store/lib/src/uri_app_store.dart +++ b/packages/app_store/uri_store/lib/src/uri_app_store.dart @@ -4,10 +4,7 @@ import 'package:app_store_shared/app_store_shared.dart'; import 'package:url_launcher/url_launcher.dart'; class URIAppStore extends AppStore { - const URIAppStore( - this.appUri, { - this.appReviewUri, - }); + const URIAppStore(this.appUri, {this.appReviewUri}); final Uri appUri; final Uri? appReviewUri; diff --git a/packages/app_store/uri_store/pubspec.yaml b/packages/app_store/uri_store/pubspec.yaml index d3c5275361..34a1508b48 100644 --- a/packages/app_store/uri_store/pubspec.yaml +++ b/packages/app_store/uri_store/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.0.1 publish_to: "none" environment: - sdk: ^3.6.0 + sdk: ^3.8.1 dependencies: flutter: diff --git a/packages/scanner/ml_kit/lib/src/mobile_scanner_controller.dart b/packages/scanner/ml_kit/lib/src/mobile_scanner_controller.dart index d8f68d6524..9e27560540 100644 --- a/packages/scanner/ml_kit/lib/src/mobile_scanner_controller.dart +++ b/packages/scanner/ml_kit/lib/src/mobile_scanner_controller.dart @@ -3,12 +3,11 @@ import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:torch_light/torch_light.dart'; class CustomScannerController { - CustomScannerController({ - required MobileScannerController controller, - }) : _controller = controller, - _torchState = TorchState(), - _availableCamerasState = AvailableCamerasState(), - _cameraFacingState = CameraFacingState() { + CustomScannerController({required MobileScannerController controller}) + : _controller = controller, + _torchState = TorchState(), + _availableCamerasState = AvailableCamerasState(), + _cameraFacingState = CameraFacingState() { _detectTorch(); } diff --git a/packages/scanner/ml_kit/lib/src/scanner_ml_kit.dart b/packages/scanner/ml_kit/lib/src/scanner_ml_kit.dart index 1fd83277dd..5ff64df900 100644 --- a/packages/scanner/ml_kit/lib/src/scanner_ml_kit.dart +++ b/packages/scanner/ml_kit/lib/src/scanner_ml_kit.dart @@ -19,9 +19,13 @@ class ScannerMLKit extends Scanner { required Future Function(String) onScan, required Future Function() hapticFeedback, required Function(BuildContext)? onCameraFlashError, - required Function(String msg, String category, - {int? eventValue, String? barcode}) - trackCustomEvent, + required Function( + String msg, + String category, { + int? eventValue, + String? barcode, + }) + trackCustomEvent, required bool hasMoreThanOneCamera, String? toggleCameraModeTooltip, String? toggleFlashModeTooltip, @@ -56,8 +60,13 @@ class _SmoothBarcodeScannerMLKit extends StatefulWidget { final Future Function(String) onScan; final Future Function() hapticFeedback; - final Function(String msg, String category, - {int? eventValue, String? barcode}) trackCustomEvent; + final Function( + String msg, + String category, { + int? eventValue, + String? barcode, + }) + trackCustomEvent; final Function(BuildContext)? onCameraFlashError; final bool hasMoreThanOneCamera; @@ -83,8 +92,9 @@ class _SmoothBarcodeScannerMLKitState extends State<_SmoothBarcodeScannerMLKit> BarcodeFormat.upcE, ]; - static const ValueKey _visibilityKey = - ValueKey('VisibilityDetector'); + static const ValueKey _visibilityKey = ValueKey( + 'VisibilityDetector', + ); late CustomScannerController _cameraController; late final AppLifecycleListener _lifecycleListener; @@ -135,12 +145,12 @@ class _SmoothBarcodeScannerMLKitState extends State<_SmoothBarcodeScannerMLKit> MobileScanner( controller: _cameraController.controller, fit: BoxFit.cover, - errorBuilder: ( - BuildContext context, - MobileScannerException error, - Widget? child, - ) => - EMPTY_WIDGET, + errorBuilder: + ( + BuildContext context, + MobileScannerException error, + Widget? child, + ) => EMPTY_WIDGET, onDetect: (final BarcodeCapture capture) async { for (final Barcode barcode in capture.barcodes) { final String? string = barcode.displayValue; @@ -225,12 +235,13 @@ class _TorchIconState extends State<_TorchIcon> { return EMPTY_WIDGET; } - final CustomScannerController controller = - context.watch(); + final CustomScannerController controller = context + .watch(); final bool isTorchOn = controller.isTorchOn; return VisorButton( - tooltip: widget.toggleFlashModeTooltip ?? + tooltip: + widget.toggleFlashModeTooltip ?? 'Turn ON or OFF the flash of the camera', onTap: () async { widget.hapticFeedback.call(); @@ -244,14 +255,8 @@ class _TorchIconState extends State<_TorchIcon> { } }, child: switch (isTorchOn) { - true => const Icon( - Icons.flash_off, - color: Colors.white, - ), - false => const Icon( - Icons.flash_on, - color: Colors.white, - ), + true => const Icon(Icons.flash_off, color: Colors.white), + false => const Icon(Icons.flash_on, color: Colors.white), }, ); }, @@ -270,39 +275,36 @@ class _ToggleCameraIcon extends StatelessWidget { @override Widget build(BuildContext context) { - final CustomScannerController controller = - context.watch(); + final CustomScannerController controller = context + .watch(); return ValueListenableBuilder( - valueListenable: controller.availableCameras, - builder: (BuildContext context, int cameras, _) { - if (cameras <= 1) { - return EMPTY_WIDGET; - } + valueListenable: controller.availableCameras, + builder: (BuildContext context, int cameras, _) { + if (cameras <= 1) { + return EMPTY_WIDGET; + } - return VisorButton( - onTap: () async { - hapticFeedback.call(); - controller.toggleCamera(); + return VisorButton( + onTap: () async { + hapticFeedback.call(); + controller.toggleCamera(); + }, + tooltip: + toggleCameraModeTooltip ?? 'Switch between back and front camera', + child: ValueListenableBuilder( + valueListenable: controller.cameraFacing, + builder: (BuildContext context, CameraFacing state, Widget? child) { + switch (state) { + case CameraFacing.front: + return const Icon(Icons.camera_front); + case CameraFacing.back: + return const Icon(Icons.camera_rear); + } }, - tooltip: toggleCameraModeTooltip ?? - 'Switch between back and front camera', - child: ValueListenableBuilder( - valueListenable: controller.cameraFacing, - builder: ( - BuildContext context, - CameraFacing state, - Widget? child, - ) { - switch (state) { - case CameraFacing.front: - return const Icon(Icons.camera_front); - case CameraFacing.back: - return const Icon(Icons.camera_rear); - } - }, - ), - ); - }); + ), + ); + }, + ); } } diff --git a/packages/scanner/ml_kit/pubspec.yaml b/packages/scanner/ml_kit/pubspec.yaml index 972e23acdf..2251b342d9 100644 --- a/packages/scanner/ml_kit/pubspec.yaml +++ b/packages/scanner/ml_kit/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: "none" environment: - sdk: ^3.6.0 + sdk: ^3.8.1 dependencies: flutter: diff --git a/packages/scanner/shared/lib/src/scanner.dart b/packages/scanner/shared/lib/src/scanner.dart index d249c8b699..0dfbf6e2d1 100644 --- a/packages/scanner/shared/lib/src/scanner.dart +++ b/packages/scanner/shared/lib/src/scanner.dart @@ -14,9 +14,13 @@ abstract class Scanner { required Future Function(String) onScan, required Future Function() hapticFeedback, required Function(BuildContext)? onCameraFlashError, - required Function(String msg, String category, - {int? eventValue, String? barcode}) - trackCustomEvent, + required Function( + String msg, + String category, { + int? eventValue, + String? barcode, + }) + trackCustomEvent, required bool hasMoreThanOneCamera, String? toggleCameraModeTooltip, String? toggleFlashModeTooltip, diff --git a/packages/scanner/shared/lib/src/scanner_mocked.dart b/packages/scanner/shared/lib/src/scanner_mocked.dart index 262e37a938..a468bf904a 100644 --- a/packages/scanner/shared/lib/src/scanner_mocked.dart +++ b/packages/scanner/shared/lib/src/scanner_mocked.dart @@ -13,13 +13,16 @@ class MockedScanner extends Scanner { required Future Function(String) onScan, required Future Function() hapticFeedback, required Function(BuildContext)? onCameraFlashError, - required Function(String msg, String category, - {int? eventValue, String? barcode}) - trackCustomEvent, + required Function( + String msg, + String category, { + int? eventValue, + String? barcode, + }) + trackCustomEvent, required bool hasMoreThanOneCamera, String? toggleCameraModeTooltip, String? toggleFlashModeTooltip, EdgeInsetsGeometry? contentPadding, - }) => - Container(); + }) => Container(); } diff --git a/packages/scanner/shared/lib/src/scanner_visor.dart b/packages/scanner/shared/lib/src/scanner_visor.dart index 6c3d21d8e7..f078806e0a 100644 --- a/packages/scanner/shared/lib/src/scanner_visor.dart +++ b/packages/scanner/shared/lib/src/scanner_visor.dart @@ -2,10 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; class SmoothBarcodeScannerVisor extends StatelessWidget { - const SmoothBarcodeScannerVisor({ - this.contentPadding, - super.key, - }); + const SmoothBarcodeScannerVisor({this.contentPadding, super.key}); static const double CORNER_PADDING = 26.0; static const double STROKE_WIDTH = 3.0; @@ -105,10 +102,7 @@ class _ScanVisorPainter extends CustomPainter { path ..lineTo(rect.right - _halfCornerSize, rect.top) - ..arcToPoint( - Offset(rect.right, _halfCornerSize), - radius: _borderRadius, - ) + ..arcToPoint(Offset(rect.right, _halfCornerSize), radius: _borderRadius) ..lineTo(rect.right, rect.top + _fullCornerSize); // Bottom right @@ -170,9 +164,7 @@ class VisorButton extends StatelessWidget { child: InkWell( onTap: onTap, borderRadius: const BorderRadius.all( - Radius.circular( - SmoothBarcodeScannerVisor.CORNER_PADDING, - ), + Radius.circular(SmoothBarcodeScannerVisor.CORNER_PADDING), ), child: Tooltip( message: tooltip, diff --git a/packages/scanner/shared/lib/src/screen_visibility.dart b/packages/scanner/shared/lib/src/screen_visibility.dart index 31f04c7605..809a52e3da 100644 --- a/packages/scanner/shared/lib/src/screen_visibility.dart +++ b/packages/scanner/shared/lib/src/screen_visibility.dart @@ -3,10 +3,7 @@ import 'package:provider/provider.dart'; import 'package:visibility_detector/visibility_detector.dart'; class ScreenVisibilityDetector extends StatefulWidget { - const ScreenVisibilityDetector({ - required this.child, - super.key, - }); + const ScreenVisibilityDetector({required this.child, super.key}); final Widget child; diff --git a/packages/scanner/shared/pubspec.yaml b/packages/scanner/shared/pubspec.yaml index 4483a79cb2..6aceaaf7ac 100644 --- a/packages/scanner/shared/pubspec.yaml +++ b/packages/scanner/shared/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: "none" environment: - sdk: ^3.6.0 + sdk: ^3.8.1 dependencies: flutter: diff --git a/packages/scanner/zxing/lib/src/scanner_zxing.dart b/packages/scanner/zxing/lib/src/scanner_zxing.dart index bafeca62d3..f05c12ed95 100644 --- a/packages/scanner/zxing/lib/src/scanner_zxing.dart +++ b/packages/scanner/zxing/lib/src/scanner_zxing.dart @@ -19,9 +19,13 @@ class ScannerZXing extends Scanner { required Future Function(String) onScan, required Future Function() hapticFeedback, required Function(BuildContext)? onCameraFlashError, - required Function(String msg, String category, - {int? eventValue, String? barcode}) - trackCustomEvent, + required Function( + String msg, + String category, { + int? eventValue, + String? barcode, + }) + trackCustomEvent, required bool hasMoreThanOneCamera, String? toggleCameraModeTooltip, String? toggleFlashModeTooltip, @@ -104,103 +108,101 @@ class _SmoothBarcodeScannerZXingState @override Widget build(BuildContext context) => VisibilityDetector( - key: const ValueKey('VisibilityDetector'), - onVisibilityChanged: (final VisibilityInfo info) { - if (info.visibleBounds.height > 0.0) { - if (_visible) { - return; - } - _visible = true; - _controller?.resumeCamera(); - return; - } - if (!_visible) { - return; - } - _visible = false; - _controller?.pauseCamera(); - }, - child: Stack( - children: [ - QRView( - key: _qrKey, - onQRViewCreated: _onQRViewCreated, - formatsAllowed: _barcodeFormats, - ), - Center( - child: SmoothBarcodeScannerVisor( - contentPadding: widget.contentPadding, - ), - ), - Align( - alignment: Alignment.bottomCenter, - child: Padding( - padding: const EdgeInsets.all( - SmoothBarcodeScannerVisor.CORNER_PADDING, - ), - child: Row( - mainAxisAlignment: _showFlipCameraButton - ? MainAxisAlignment.spaceBetween - : MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - if (_showFlipCameraButton) - VisorButton( - tooltip: widget.toggleCameraModeTooltip ?? - 'Switch between back and front camera', - onTap: () async { - widget.hapticFeedback.call(); - await _controller?.flipCamera(); - setState(() {}); - }, - child: Icon(getCameraFlip()), - ), - FutureBuilder( - future: _controller?.getFlashStatus(), - builder: (_, final AsyncSnapshot snapshot) { - final bool? flashOn = snapshot.data; - if (flashOn == null) { - return EMPTY_WIDGET; - } - return VisorButton( - tooltip: widget.toggleFlashModeTooltip ?? - 'Turn ON or OFF the flash of the camera', - onTap: () async { - widget.hapticFeedback.call(); - - try { - await _controller?.toggleFlash(); - setState(() {}); - } catch (err) { - if (context.mounted) { - widget.onCameraFlashError?.call(context); - } - } - }, - child: Icon( - flashOn ? Icons.flash_on : Icons.flash_off, - ), - ); - }, - ), - ], - ), - ), - ), - ], + key: const ValueKey('VisibilityDetector'), + onVisibilityChanged: (final VisibilityInfo info) { + if (info.visibleBounds.height > 0.0) { + if (_visible) { + return; + } + _visible = true; + _controller?.resumeCamera(); + return; + } + if (!_visible) { + return; + } + _visible = false; + _controller?.pauseCamera(); + }, + child: Stack( + children: [ + QRView( + key: _qrKey, + onQRViewCreated: _onQRViewCreated, + formatsAllowed: _barcodeFormats, ), - ); + Center( + child: SmoothBarcodeScannerVisor( + contentPadding: widget.contentPadding, + ), + ), + Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: const EdgeInsets.all( + SmoothBarcodeScannerVisor.CORNER_PADDING, + ), + child: Row( + mainAxisAlignment: _showFlipCameraButton + ? MainAxisAlignment.spaceBetween + : MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + if (_showFlipCameraButton) + VisorButton( + tooltip: + widget.toggleCameraModeTooltip ?? + 'Switch between back and front camera', + onTap: () async { + widget.hapticFeedback.call(); + await _controller?.flipCamera(); + setState(() {}); + }, + child: Icon(getCameraFlip()), + ), + FutureBuilder( + future: _controller?.getFlashStatus(), + builder: (_, final AsyncSnapshot snapshot) { + final bool? flashOn = snapshot.data; + if (flashOn == null) { + return EMPTY_WIDGET; + } + return VisorButton( + tooltip: + widget.toggleFlashModeTooltip ?? + 'Turn ON or OFF the flash of the camera', + onTap: () async { + widget.hapticFeedback.call(); + + try { + await _controller?.toggleFlash(); + setState(() {}); + } catch (err) { + if (context.mounted) { + widget.onCameraFlashError?.call(context); + } + } + }, + child: Icon(flashOn ? Icons.flash_on : Icons.flash_off), + ); + }, + ), + ], + ), + ), + ), + ], + ), + ); void _onQRViewCreated(final QRViewController controller) { setState(() => _controller = controller); - controller.scannedDataStream.listen( - (final Barcode scanData) { - final String? barcode = scanData.code; - if (barcode != null) { - widget.onScan(barcode); - } - }, - ); + controller.scannedDataStream.listen((final Barcode scanData) { + final String? barcode = scanData.code; + if (barcode != null) { + widget.onScan(barcode); + } + }); } @override diff --git a/packages/scanner/zxing/pubspec.yaml b/packages/scanner/zxing/pubspec.yaml index ff07f5f930..8b56c38328 100644 --- a/packages/scanner/zxing/pubspec.yaml +++ b/packages/scanner/zxing/pubspec.yaml @@ -4,7 +4,7 @@ version: 1.0.0 publish_to: "none" environment: - sdk: ^3.6.0 + sdk: ^3.8.1 dependencies: flutter: diff --git a/packages/smooth_app/dartdoc_options.yaml b/packages/smooth_app/dartdoc_options.yaml new file mode 100644 index 0000000000..60fc617b0c --- /dev/null +++ b/packages/smooth_app/dartdoc_options.yaml @@ -0,0 +1,2 @@ +dartdoc: + nodoc: ['lib/l10n/app_localizations_*.dart'] \ No newline at end of file diff --git a/packages/smooth_app/integration_test/app_test.dart b/packages/smooth_app/integration_test/app_test.dart index 6c376be62e..4f3856f6b9 100644 --- a/packages/smooth_app/integration_test/app_test.dart +++ b/packages/smooth_app/integration_test/app_test.dart @@ -25,8 +25,9 @@ Future _takeScreenshot( if ((!kIsWeb) && Platform.isAndroid) { await tester.pumpAndSettle(); } - await binding - .takeScreenshot('$platform/$device/$country/$language/$screenshotName'); + await binding.takeScreenshot( + '$platform/$device/$country/$language/$screenshotName', + ); } const String language = String.fromEnvironment('LANGUAGE'); // e.g. fr @@ -45,13 +46,11 @@ void main() { group('end-to-end test', () { testWidgets('just a single screenshot', (WidgetTester tester) async { - SharedPreferences.setMockInitialValues( - const { - 'IMPORTANCE_AS_STRINGnutriscore': 'important', - 'IMPORTANCE_AS_STRINGnova': 'important', - 'IMPORTANCE_AS_STRINGecoscore': 'important', - }, - ); + SharedPreferences.setMockInitialValues(const { + 'IMPORTANCE_AS_STRINGnutriscore': 'important', + 'IMPORTANCE_AS_STRINGnova': 'important', + 'IMPORTANCE_AS_STRINGecoscore': 'important', + }); await tester.runAsync(() async { await _initScreenshot(binding); @@ -68,28 +67,40 @@ void main() { sleep(const Duration(seconds: 30)); await _takeScreenshot( - tester, binding, 'test-screenshot-onboarding-reinvention'); + tester, + binding, + 'test-screenshot-onboarding-reinvention', + ); sleep(const Duration(seconds: 10)); await tester.tap(find.byKey(const Key('nextAfterReinvention'))); await tester.pumpAndSettle(); await _takeScreenshot( - tester, binding, 'test-screenshot-onboarding-home'); + tester, + binding, + 'test-screenshot-onboarding-home', + ); sleep(const Duration(seconds: 10)); await tester.tap(find.byKey(const Key('nextAfterWelcome'))); await tester.pumpAndSettle(); await _takeScreenshot( - tester, binding, 'test-screenshot-onboarding-scan'); + tester, + binding, + 'test-screenshot-onboarding-scan', + ); sleep(const Duration(seconds: 10)); await tester.tap(find.byKey(const Key('nextAfterScanExample'))); await tester.pumpAndSettle(); await _takeScreenshot( - tester, binding, 'test-screenshot-onboarding-health'); + tester, + binding, + 'test-screenshot-onboarding-health', + ); sleep(const Duration(seconds: 10)); await tester.tap(find.byKey(const Key('toolTipPopUp'))); @@ -99,14 +110,20 @@ void main() { await tester.pumpAndSettle(); await _takeScreenshot( - tester, binding, 'test-screenshot-onboarding-eco'); + tester, + binding, + 'test-screenshot-onboarding-eco', + ); sleep(const Duration(seconds: 10)); await tester.tap(find.byKey(const Key('nextAfterEco'))); await tester.pumpAndSettle(); await _takeScreenshot( - tester, binding, 'test-screenshot-onboarding-prefs'); + tester, + binding, + 'test-screenshot-onboarding-prefs', + ); sleep(const Duration(seconds: 10)); }); }); diff --git a/packages/smooth_app/lib/background/background_task.dart b/packages/smooth_app/lib/background/background_task.dart index 010ca2abe6..4883f18683 100644 --- a/packages/smooth_app/lib/background/background_task.dart +++ b/packages/smooth_app/lib/background/background_task.dart @@ -18,11 +18,11 @@ abstract class BackgroundTask { required this.uniqueId, required this.stamp, final OpenFoodFactsLanguage? language, - }) // TODO(monsieurtanuki): don't store the password in a clear format... -// TODO(monsieurtanuki): store the uriProductHelper as well - : user = jsonEncode(ProductQuery.getWriteUser().toJson()), - country = ProductQuery.getCountry().offTag, - languageCode = (language ?? ProductQuery.getLanguage()).offTag; + }) // TODO(monsieurtanuki): don't store the password in a clear format... + // TODO(monsieurtanuki): store the uriProductHelper as well + : user = jsonEncode(ProductQuery.getWriteUser().toJson()), + country = ProductQuery.getCountry().offTag, + languageCode = (language ?? ProductQuery.getLanguage()).offTag; BackgroundTask._({ required this.processName, @@ -34,14 +34,14 @@ abstract class BackgroundTask { }); BackgroundTask.fromJson(Map json) - : this._( - processName: json[_jsonTagProcessName] as String, - uniqueId: json[_jsonTagUniqueId] as String, - languageCode: json[_jsonTagLanguageCode] as String, - user: json[_jsonTagUser] as String, - country: json[_jsonTagCountry] as String, - stamp: json[_jsonTagStamp] as String, - ); + : this._( + processName: json[_jsonTagProcessName] as String, + uniqueId: json[_jsonTagUniqueId] as String, + languageCode: json[_jsonTagLanguageCode] as String, + user: json[_jsonTagUser] as String, + country: json[_jsonTagCountry] as String, + stamp: json[_jsonTagStamp] as String, + ); static const String _jsonTagProcessName = 'processName'; static const String _jsonTagUniqueId = 'uniqueId'; @@ -70,13 +70,13 @@ abstract class BackgroundTask { @mustCallSuper Map toJson() => { - _jsonTagProcessName: processName, - _jsonTagUniqueId: uniqueId, - _jsonTagLanguageCode: languageCode, - _jsonTagUser: user, - _jsonTagCountry: country, - _jsonTagStamp: stamp, - }; + _jsonTagProcessName: processName, + _jsonTagUniqueId: uniqueId, + _jsonTagLanguageCode: languageCode, + _jsonTagUser: user, + _jsonTagCountry: country, + _jsonTagStamp: stamp, + }; /// Executes the background task: upload, download, update locally. Future execute(final LocalDatabase localDatabase); @@ -101,8 +101,7 @@ abstract class BackgroundTask { Future postExecute( final LocalDatabase localDatabase, final bool success, - ) async => - localDatabase.upToDate.terminate(uniqueId); + ) async => localDatabase.upToDate.terminate(uniqueId); /// Returns true if the task may run now. /// @@ -141,16 +140,13 @@ abstract class BackgroundTask { if (!context.mounted) { return; } - if (getFloatingMessage(AppLocalizations.of(context)) - case ( - final String message, - final AlignmentGeometry alignment, - )) { - SmoothFloatingMessage.loading(message: message).show( - context, - duration: SnackBarDuration.medium, - alignment: alignment, - ); + if (getFloatingMessage(AppLocalizations.of(context)) case ( + final String message, + final AlignmentGeometry alignment, + )) { + SmoothFloatingMessage.loading( + message: message, + ).show(context, duration: SnackBarDuration.medium, alignment: alignment); } } @@ -163,8 +159,9 @@ abstract class BackgroundTask { @protected User getUser() { - final User storedUser = - User.fromJson(jsonDecode(user) as Map); + final User storedUser = User.fromJson( + jsonDecode(user) as Map, + ); final User currentUser = ProductQuery.getWriteUser(); if (storedUser.userId == currentUser.userId) { // with a latest password. diff --git a/packages/smooth_app/lib/background/background_task_add_other_price.dart b/packages/smooth_app/lib/background/background_task_add_other_price.dart index 9c0d1318bc..f9431e34ab 100644 --- a/packages/smooth_app/lib/background/background_task_add_other_price.dart +++ b/packages/smooth_app/lib/background/background_task_add_other_price.dart @@ -33,8 +33,8 @@ class BackgroundTaskAddOtherPrice extends BackgroundTaskPrice { }); BackgroundTaskAddOtherPrice.fromJson(super.json) - : proofId = json[_jsonTagProofId] as int, - super.fromJson(); + : proofId = json[_jsonTagProofId] as int, + super.fromJson(); static const String _jsonTagProofId = 'proofId'; @@ -110,29 +110,28 @@ class BackgroundTaskAddOtherPrice extends BackgroundTaskPrice { required final List pricesAreDiscounted, required final List prices, required final List pricesWithoutDiscount, - }) => - BackgroundTaskAddOtherPrice._( - uniqueId: uniqueId, - processName: _operationType.processName, - proofId: proofId, - date: date, - currency: currency, - locationOSMId: locationOSMId, - locationOSMType: locationOSMType, - barcodes: barcodes, - categories: categories, - origins: origins, - labels: labels, - pricePers: pricePers, - pricesAreDiscounted: pricesAreDiscounted, - prices: prices, - pricesWithoutDiscount: pricesWithoutDiscount, - stamp: BackgroundTaskPrice.getStamp( - date: date, - locationOSMId: locationOSMId, - locationOSMType: locationOSMType, - ), - ); + }) => BackgroundTaskAddOtherPrice._( + uniqueId: uniqueId, + processName: _operationType.processName, + proofId: proofId, + date: date, + currency: currency, + locationOSMId: locationOSMId, + locationOSMType: locationOSMType, + barcodes: barcodes, + categories: categories, + origins: origins, + labels: labels, + pricePers: pricePers, + pricesAreDiscounted: pricesAreDiscounted, + prices: prices, + pricesWithoutDiscount: pricesWithoutDiscount, + stamp: BackgroundTaskPrice.getStamp( + date: date, + locationOSMId: locationOSMId, + locationOSMType: locationOSMType, + ), + ); @override Future execute(final LocalDatabase localDatabase) async { diff --git a/packages/smooth_app/lib/background/background_task_add_price.dart b/packages/smooth_app/lib/background/background_task_add_price.dart index 62a3e910a8..0b560481db 100644 --- a/packages/smooth_app/lib/background/background_task_add_price.dart +++ b/packages/smooth_app/lib/background/background_task_add_price.dart @@ -47,16 +47,17 @@ class BackgroundTaskAddPrice extends BackgroundTaskPrice { }); BackgroundTaskAddPrice.fromJson(super.json) - : fullPath = json[_jsonTagImagePath] as String, - rotationDegrees = json[_jsonTagRotation] as int? ?? 0, - cropX1 = json[_jsonTagX1] as int? ?? 0, - cropY1 = json[_jsonTagY1] as int? ?? 0, - cropX2 = json[_jsonTagX2] as int? ?? 0, - cropY2 = json[_jsonTagY2] as int? ?? 0, - proofType = ProofType.fromOffTag(json[_jsonTagProofType] as String)!, - eraserCoordinates = BackgroundTaskPrice.fromJsonListDouble( - json[_jsonTagEraserCoordinates]), - super.fromJson(); + : fullPath = json[_jsonTagImagePath] as String, + rotationDegrees = json[_jsonTagRotation] as int? ?? 0, + cropX1 = json[_jsonTagX1] as int? ?? 0, + cropY1 = json[_jsonTagY1] as int? ?? 0, + cropX2 = json[_jsonTagX2] as int? ?? 0, + cropY2 = json[_jsonTagY2] as int? ?? 0, + proofType = ProofType.fromOffTag(json[_jsonTagProofType] as String)!, + eraserCoordinates = BackgroundTaskPrice.fromJsonListDouble( + json[_jsonTagEraserCoordinates], + ), + super.fromJson(); static const String _jsonTagImagePath = 'imagePath'; static const String _jsonTagRotation = 'rotation'; @@ -156,36 +157,35 @@ class BackgroundTaskAddPrice extends BackgroundTaskPrice { required final List pricesAreDiscounted, required final List prices, required final List pricesWithoutDiscount, - }) => - BackgroundTaskAddPrice._( - uniqueId: uniqueId, - processName: _operationType.processName, - fullPath: cropObject.fullFile!.path, - rotationDegrees: cropObject.rotation, - cropX1: cropObject.x1, - cropY1: cropObject.y1, - cropX2: cropObject.x2, - cropY2: cropObject.y2, - proofType: proofType, - date: date, - currency: currency, - locationOSMId: locationOSMId, - locationOSMType: locationOSMType, - eraserCoordinates: cropObject.eraserCoordinates, - barcodes: barcodes, - categories: categories, - origins: origins, - labels: labels, - pricePers: pricePers, - pricesAreDiscounted: pricesAreDiscounted, - prices: prices, - pricesWithoutDiscount: pricesWithoutDiscount, - stamp: BackgroundTaskPrice.getStamp( - date: date, - locationOSMId: locationOSMId, - locationOSMType: locationOSMType, - ), - ); + }) => BackgroundTaskAddPrice._( + uniqueId: uniqueId, + processName: _operationType.processName, + fullPath: cropObject.fullFile!.path, + rotationDegrees: cropObject.rotation, + cropX1: cropObject.x1, + cropY1: cropObject.y1, + cropX2: cropObject.x2, + cropY2: cropObject.y2, + proofType: proofType, + date: date, + currency: currency, + locationOSMId: locationOSMId, + locationOSMType: locationOSMType, + eraserCoordinates: cropObject.eraserCoordinates, + barcodes: barcodes, + categories: categories, + origins: origins, + labels: labels, + pricePers: pricePers, + pricesAreDiscounted: pricesAreDiscounted, + prices: prices, + pricesWithoutDiscount: pricesWithoutDiscount, + stamp: BackgroundTaskPrice.getStamp( + date: date, + locationOSMId: locationOSMId, + locationOSMType: locationOSMType, + ), + ); @override Future postExecute( @@ -200,8 +200,8 @@ class BackgroundTaskAddPrice extends BackgroundTaskPrice { } try { (await BackgroundTaskUpload.getFile( - BackgroundTaskImage.getCroppedPath(fullPath))) - .deleteSync(); + BackgroundTaskImage.getCroppedPath(fullPath), + )).deleteSync(); } catch (e) { // possible, but let's not spoil the task for that either. } @@ -229,8 +229,9 @@ class BackgroundTaskAddPrice extends BackgroundTaskPrice { // proof upload final Uri initialImageUri = Uri.parse(path); - final MediaType initialMediaType = - HttpHelper().imagineMediaType(initialImageUri.path)!; + final MediaType initialMediaType = HttpHelper().imagineMediaType( + initialImageUri.path, + )!; final MaybeError uploadProof = await OpenPricesAPIClient.uploadProof( createProofParameters: CreateProofParameters(proofType) ..date = date diff --git a/packages/smooth_app/lib/background/background_task_badge.dart b/packages/smooth_app/lib/background/background_task_badge.dart index 644f9aac6b..458ffd0a2d 100644 --- a/packages/smooth_app/lib/background/background_task_badge.dart +++ b/packages/smooth_app/lib/background/background_task_badge.dart @@ -21,10 +21,7 @@ class BackgroundTaskBadge extends StatelessWidget { } return Badge( backgroundColor: Colors.blue.shade900, - label: Text( - '$count', - style: const TextStyle(color: Colors.white), - ), + label: Text('$count', style: const TextStyle(color: Colors.white)), child: child, ); } diff --git a/packages/smooth_app/lib/background/background_task_barcode.dart b/packages/smooth_app/lib/background/background_task_barcode.dart index 203e5f4393..0af2a83597 100644 --- a/packages/smooth_app/lib/background/background_task_barcode.dart +++ b/packages/smooth_app/lib/background/background_task_barcode.dart @@ -17,12 +17,12 @@ abstract class BackgroundTaskBarcode extends BackgroundTask { }); BackgroundTaskBarcode.fromJson(super.json) - : barcode = json[_jsonTagBarcode] as String, - productType = - ProductType.fromOffTag(json[_jsonTagProductType] as String?) ?? - // for legacy reason (not refreshed products = no product type) - ProductType.food, - super.fromJson(); + : barcode = json[_jsonTagBarcode] as String, + productType = + ProductType.fromOffTag(json[_jsonTagProductType] as String?) ?? + // for legacy reason (not refreshed products = no product type) + ProductType.food, + super.fromJson(); final String barcode; final ProductType productType; @@ -57,7 +57,6 @@ abstract class BackgroundTaskBarcode extends BackgroundTask { ); @protected - UriProductHelper get uriProductHelper => ProductQuery.getUriProductHelper( - productType: productType, - ); + UriProductHelper get uriProductHelper => + ProductQuery.getUriProductHelper(productType: productType); } diff --git a/packages/smooth_app/lib/background/background_task_crop.dart b/packages/smooth_app/lib/background/background_task_crop.dart index 947780479e..7e42d7ae79 100644 --- a/packages/smooth_app/lib/background/background_task_crop.dart +++ b/packages/smooth_app/lib/background/background_task_crop.dart @@ -31,8 +31,8 @@ class BackgroundTaskCrop extends BackgroundTaskUpload { }); BackgroundTaskCrop.fromJson(super.json) - : imageId = json[_jsonTagImageId] as int, - super.fromJson(); + : imageId = json[_jsonTagImageId] as int, + super.fromJson(); static const String _jsonTagImageId = 'imageId'; @@ -93,11 +93,11 @@ class BackgroundTaskCrop extends BackgroundTaskUpload { @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - ( - appLocalizations.product_task_background_schedule, - AlignmentDirectional.topCenter, - ); + final AppLocalizations appLocalizations, + ) => ( + appLocalizations.product_task_background_schedule, + AlignmentDirectional.topCenter, + ); /// Returns a new background task about cropping an existing image. static BackgroundTaskCrop _getNewTask( @@ -113,44 +113,43 @@ class BackgroundTaskCrop extends BackgroundTaskUpload { final int cropY1, final int cropX2, final int cropY2, - ) => - BackgroundTaskCrop._( - uniqueId: uniqueId, - barcode: barcode, - productType: productType, - processName: _operationType.processName, - imageId: imageId, - imageField: imageField.offTag, - croppedPath: croppedFile.path, - rotationDegrees: rotationDegrees, - cropX1: cropX1, - cropY1: cropY1, - cropX2: cropX2, - cropY2: cropY2, - language: language, - stamp: BackgroundTaskUpload.getStamp( - barcode, - imageField.offTag, - language.code, - ), - ); + ) => BackgroundTaskCrop._( + uniqueId: uniqueId, + barcode: barcode, + productType: productType, + processName: _operationType.processName, + imageId: imageId, + imageField: imageField.offTag, + croppedPath: croppedFile.path, + rotationDegrees: rotationDegrees, + cropX1: cropX1, + cropY1: cropY1, + cropX2: cropX2, + cropY2: cropY2, + language: language, + stamp: BackgroundTaskUpload.getStamp( + barcode, + imageField.offTag, + language.code, + ), + ); /// Returns the actual crop parameters. /// /// cf. [UpToDateChanges._overwrite] regarding `images` field. @override ProductImage getProductImageChange() => ProductImage( - field: ImageField.fromOffTag(imageField)!, - language: getLanguage(), - size: ImageSize.ORIGINAL, - angle: ImageAngleExtension.fromInt(rotationDegrees), - imgid: '$imageId', - x1: cropX1, - y1: cropY1, - x2: cropX2, - y2: cropY2, - coordinatesImageSize: ImageSize.ORIGINAL.number, - ); + field: ImageField.fromOffTag(imageField)!, + language: getLanguage(), + size: ImageSize.ORIGINAL, + angle: ImageAngleExtension.fromInt(rotationDegrees), + imgid: '$imageId', + x1: cropX1, + y1: cropY1, + x2: cropX2, + y2: cropY2, + coordinatesImageSize: ImageSize.ORIGINAL.number, + ); @override Future postExecute( diff --git a/packages/smooth_app/lib/background/background_task_details.dart b/packages/smooth_app/lib/background/background_task_details.dart index ad26d47c11..098c974b3e 100644 --- a/packages/smooth_app/lib/background/background_task_details.dart +++ b/packages/smooth_app/lib/background/background_task_details.dart @@ -47,8 +47,8 @@ class BackgroundTaskDetails extends BackgroundTaskBarcode }); BackgroundTaskDetails.fromJson(super.json) - : inputMap = json[_jsonTagInputMap] as String, - super.fromJson(); + : inputMap = json[_jsonTagInputMap] as String, + super.fromJson(); static const String _jsonTagInputMap = 'inputMap'; @@ -100,8 +100,8 @@ class BackgroundTaskDetails extends BackgroundTaskBarcode @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - null; + final AppLocalizations appLocalizations, + ) => null; /// Returns a new background task about changing a product. static BackgroundTaskDetails _getNewTask( @@ -109,23 +109,23 @@ class BackgroundTaskDetails extends BackgroundTaskBarcode final String uniqueId, final BackgroundTaskDetailsStamp stamp, final ProductType productType, - ) => - BackgroundTaskDetails._( - uniqueId: uniqueId, - processName: _operationType.processName, - barcode: minimalistProduct.barcode!, - productType: productType, - inputMap: jsonEncode(minimalistProduct.toJson()), - stamp: getStamp(minimalistProduct.barcode!, stamp.tag), - ); + ) => BackgroundTaskDetails._( + uniqueId: uniqueId, + processName: _operationType.processName, + barcode: minimalistProduct.barcode!, + productType: productType, + inputMap: jsonEncode(minimalistProduct.toJson()), + stamp: getStamp(minimalistProduct.barcode!, stamp.tag), + ); static String getStamp(final String barcode, final String stamp) => '$barcode;detail;$stamp'; @override Product getProductChange() { - final Product result = - Product.fromJson(json.decode(inputMap) as Map); + final Product result = Product.fromJson( + json.decode(inputMap) as Map, + ); return result; } @@ -140,14 +140,14 @@ class BackgroundTaskDetails extends BackgroundTaskBarcode // and V3 can only save those fields. final ProductResultV3 result = await OpenFoodAPIClient.temporarySaveProductV3( - getUser(), - product.barcode!, - packagings: product.packagings, - packagingsComplete: product.packagingsComplete, - language: getLanguage(), - country: getCountry(), - uriHelper: uriProductHelper, - ); + getUser(), + product.barcode!, + packagings: product.packagings, + packagingsComplete: product.packagingsComplete, + language: getLanguage(), + country: getCountry(), + uriHelper: uriProductHelper, + ); if (result.status != ProductResultV3.statusSuccess && result.status != ProductResultV3.statusWarning) { bool isInvalidUser = false; diff --git a/packages/smooth_app/lib/background/background_task_download_products.dart b/packages/smooth_app/lib/background/background_task_download_products.dart index 3c54097dae..734873dd58 100644 --- a/packages/smooth_app/lib/background/background_task_download_products.dart +++ b/packages/smooth_app/lib/background/background_task_download_products.dart @@ -25,8 +25,8 @@ class BackgroundTaskDownloadProducts extends BackgroundTaskProgressing { }); BackgroundTaskDownloadProducts.fromJson(super.json) - : downloadFlag = json[_jsonTagDownloadFlag] as int, - super.fromJson(); + : downloadFlag = json[_jsonTagDownloadFlag] as int, + super.fromJson(); /// Download flag. Normal case: 0, meaning all fields are downloaded. final int downloadFlag; @@ -69,16 +69,13 @@ class BackgroundTaskDownloadProducts extends BackgroundTaskProgressing { downloadFlag, productType, ); - await task.addToManager( - localDatabase, - queue: BackgroundTaskQueue.longHaul, - ); + await task.addToManager(localDatabase, queue: BackgroundTaskQueue.longHaul); } @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - null; + final AppLocalizations appLocalizations, + ) => null; static BackgroundTask _getNewTask( final String uniqueId, @@ -87,17 +84,16 @@ class BackgroundTaskDownloadProducts extends BackgroundTaskProgressing { final int totalSize, final int downloadFlag, final ProductType productType, - ) => - BackgroundTaskDownloadProducts._( - processName: _operationType.processName, - uniqueId: uniqueId, - stamp: ';offlineProducts;$work', - work: work, - pageSize: pageSize, - totalSize: totalSize, - downloadFlag: downloadFlag, - productType: productType, - ); + ) => BackgroundTaskDownloadProducts._( + processName: _operationType.processName, + uniqueId: uniqueId, + stamp: ';offlineProducts;$work', + work: work, + pageSize: pageSize, + totalSize: totalSize, + downloadFlag: downloadFlag, + productType: productType, + ); @override Future preExecute(final LocalDatabase localDatabase) async {} @@ -126,21 +122,21 @@ class BackgroundTaskDownloadProducts extends BackgroundTaskProgressing { final OpenFoodFactsLanguage language = ProductQuery.getLanguage(); final SearchResult searchResult = await SearchProductsManager.searchProducts( - ProductQuery.getReadUser(), - ProductSearchQueryConfiguration( - fields: fields, - parametersList: [ - PageSize(size: pageSize), - const PageNumber(page: 1), - BarcodeParameter.list(barcodes), - ], - language: language, - country: ProductQuery.getCountry(), - version: ProductQuery.productQueryVersion, - ), - uriHelper: uriProductHelper, - type: SearchProductsType.background, - ); + ProductQuery.getReadUser(), + ProductSearchQueryConfiguration( + fields: fields, + parametersList: [ + PageSize(size: pageSize), + const PageNumber(page: 1), + BarcodeParameter.list(barcodes), + ], + language: language, + country: ProductQuery.getCountry(), + version: ProductQuery.productQueryVersion, + ), + uriHelper: uriProductHelper, + type: SearchProductsType.background, + ); final List? downloadedProducts = searchResult.products; if (downloadedProducts == null) { throw Exception('Something bad happened downloading products'); @@ -148,11 +144,7 @@ class BackgroundTaskDownloadProducts extends BackgroundTaskProgressing { final DaoProduct daoProduct = DaoProduct(localDatabase); for (final Product product in downloadedProducts) { if (await _shouldBeUpdated(daoProduct, product.barcode!)) { - await daoProduct.put( - product, - language, - productType: productType, - ); + await daoProduct.put(product, language, productType: productType); } } final int deleted = await daoWorkBarcode.deleteBarcodes(work, barcodes); diff --git a/packages/smooth_app/lib/background/background_task_full_refresh.dart b/packages/smooth_app/lib/background/background_task_full_refresh.dart index f1cd8bcf86..c1be61615a 100644 --- a/packages/smooth_app/lib/background/background_task_full_refresh.dart +++ b/packages/smooth_app/lib/background/background_task_full_refresh.dart @@ -30,13 +30,8 @@ class BackgroundTaskFullRefresh extends BackgroundTaskPaged { required final int pageSize, }) async { final LocalDatabase localDatabase = context.read(); - final String uniqueId = await _operationType.getNewKey( - localDatabase, - ); - final BackgroundTask task = _getNewTask( - uniqueId, - pageSize, - ); + final String uniqueId = await _operationType.getNewKey(localDatabase); + final BackgroundTask task = _getNewTask(uniqueId, pageSize); if (!context.mounted) { return; } @@ -49,22 +44,21 @@ class BackgroundTaskFullRefresh extends BackgroundTaskPaged { @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - ( - appLocalizations.background_task_title_full_refresh, - AlignmentDirectional.bottomCenter, - ); + final AppLocalizations appLocalizations, + ) => ( + appLocalizations.background_task_title_full_refresh, + AlignmentDirectional.bottomCenter, + ); static BackgroundTaskFullRefresh _getNewTask( final String uniqueId, final int pageSize, - ) => - BackgroundTaskFullRefresh._( - processName: _operationType.processName, - uniqueId: uniqueId, - stamp: ';fullRefresh', - pageSize: pageSize, - ); + ) => BackgroundTaskFullRefresh._( + processName: _operationType.processName, + uniqueId: uniqueId, + stamp: ';fullRefresh', + pageSize: pageSize, + ); @override Future execute(final LocalDatabase localDatabase) async { @@ -72,9 +66,7 @@ class BackgroundTaskFullRefresh extends BackgroundTaskPaged { final DaoWorkBarcode daoWorkBarcode = DaoWorkBarcode(localDatabase); for (final ProductType productType in ProductType.values) { - await daoWorkBarcode.deleteWork( - WorkType.freshKP.getWorkTag(productType), - ); + await daoWorkBarcode.deleteWork(WorkType.freshKP.getWorkTag(productType)); await daoWorkBarcode.deleteWork( WorkType.freshNoKP.getWorkTag(productType), ); @@ -82,14 +74,14 @@ class BackgroundTaskFullRefresh extends BackgroundTaskPaged { // We separate the products into lists, products with or without // knowledge panels, and split by product types. - final Map> split = await daoProduct.splitAllProducts( - (Product product) { - final bool noKP = product.knowledgePanels == null; - final WorkType workType = noKP ? WorkType.freshNoKP : WorkType.freshKP; - final ProductType productType = product.productType ?? ProductType.food; - return workType.getWorkTag(productType); - }, - ); + final Map> split = await daoProduct.splitAllProducts(( + Product product, + ) { + final bool noKP = product.knowledgePanels == null; + final WorkType workType = noKP ? WorkType.freshNoKP : WorkType.freshKP; + final ProductType productType = product.productType ?? ProductType.food; + return workType.getWorkTag(productType); + }); for (int i = 0; i <= 1; i++) { final bool noKP = i == 0; final WorkType workType = noKP ? WorkType.freshNoKP : WorkType.freshKP; @@ -103,8 +95,9 @@ class BackgroundTaskFullRefresh extends BackgroundTaskPaged { barcodes: barcodes, work: tag, localDatabase: localDatabase, - downloadFlag: - noKP ? BackgroundTaskDownloadProducts.flagMaskExcludeKP : 0, + downloadFlag: noKP + ? BackgroundTaskDownloadProducts.flagMaskExcludeKP + : 0, productType: productType, ); } diff --git a/packages/smooth_app/lib/background/background_task_hunger_games.dart b/packages/smooth_app/lib/background/background_task_hunger_games.dart index 156ef8b9c2..20f21623df 100644 --- a/packages/smooth_app/lib/background/background_task_hunger_games.dart +++ b/packages/smooth_app/lib/background/background_task_hunger_games.dart @@ -21,9 +21,9 @@ class BackgroundTaskHungerGames extends BackgroundTaskBarcode { }); BackgroundTaskHungerGames.fromJson(super.json) - : insightId = json[_jsonTagInsightId] as String, - insightAnnotation = json[_jsonTagInsightAnnotation] as int, - super.fromJson(); + : insightId = json[_jsonTagInsightId] as String, + insightAnnotation = json[_jsonTagInsightAnnotation] as int, + super.fromJson(); static const String _jsonTagInsightId = 'insightId'; static const String _jsonTagInsightAnnotation = 'insightAnnotation'; @@ -72,8 +72,7 @@ class BackgroundTaskHungerGames extends BackgroundTaskBarcode { @override (String, AlignmentGeometry)? getFloatingMessage( final AppLocalizations appLocalizations, - ) => - null; + ) => null; /// Returns a new background task about hunger games. static BackgroundTaskHungerGames _getNewTask( @@ -81,17 +80,16 @@ class BackgroundTaskHungerGames extends BackgroundTaskBarcode { final String insightId, final int insightAnnotation, final String uniqueId, - ) => - BackgroundTaskHungerGames._( - processName: _operationType.processName, - uniqueId: uniqueId, - barcode: barcode, - // not really relevant for Robotoff - productType: ProductType.food, - stamp: _getStamp(barcode, insightId), - insightId: insightId, - insightAnnotation: insightAnnotation, - ); + ) => BackgroundTaskHungerGames._( + processName: _operationType.processName, + uniqueId: uniqueId, + barcode: barcode, + // not really relevant for Robotoff + productType: ProductType.food, + stamp: _getStamp(barcode, insightId), + insightId: insightId, + insightAnnotation: insightAnnotation, + ); static String _getStamp(final String barcode, final String insightId) => '$barcode;hungerGames;$insightId'; @@ -105,19 +103,18 @@ class BackgroundTaskHungerGames extends BackgroundTaskBarcode { final bool success, ) async { await super.postExecute(localDatabase, success); - final RobotoffInsightHelper robotoffInsightHelper = - RobotoffInsightHelper(localDatabase); - await robotoffInsightHelper.cacheInsightAnnotationVoted( - barcode, - insightId, + final RobotoffInsightHelper robotoffInsightHelper = RobotoffInsightHelper( + localDatabase, ); + await robotoffInsightHelper.cacheInsightAnnotationVoted(barcode, insightId); } /// Unselects the product image. @override Future upload() async { - final InsightAnnotation? annotation = - InsightAnnotation.fromInt(insightAnnotation); + final InsightAnnotation? annotation = InsightAnnotation.fromInt( + insightAnnotation, + ); if (annotation == null) { // very unlikely return; diff --git a/packages/smooth_app/lib/background/background_task_image.dart b/packages/smooth_app/lib/background/background_task_image.dart index 8ade2f375b..d0911491f5 100644 --- a/packages/smooth_app/lib/background/background_task_image.dart +++ b/packages/smooth_app/lib/background/background_task_image.dart @@ -42,10 +42,11 @@ class BackgroundTaskImage extends BackgroundTaskUpload { }); BackgroundTaskImage.fromJson(super.json) - : fullPath = json[_jsonTagImagePath] as String, - eraserCoordinates = BackgroundTaskPrice.fromJsonListDouble( - json[_jsonTagEraserCoordinates]), - super.fromJson(); + : fullPath = json[_jsonTagImagePath] as String, + eraserCoordinates = BackgroundTaskPrice.fromJsonListDouble( + json[_jsonTagEraserCoordinates], + ), + super.fromJson(); static const String _jsonTagImagePath = 'imagePath'; static const String _jsonTagEraserCoordinates = 'eraserCoordinates'; @@ -115,8 +116,8 @@ class BackgroundTaskImage extends BackgroundTaskUpload { @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - null; + final AppLocalizations appLocalizations, + ) => null; /// Returns a new background task about changing a product. static BackgroundTaskImage _getNewTask( @@ -133,28 +134,27 @@ class BackgroundTaskImage extends BackgroundTaskUpload { final int cropX2, final int cropY2, final List? eraserCoordinates, - ) => - BackgroundTaskImage._( - uniqueId: uniqueId, - barcode: barcode, - productType: productType, - processName: _operationType.processName, - imageField: imageField.offTag, - fullPath: fullFile.path, - croppedPath: croppedFile.path, - rotationDegrees: rotationDegrees, - cropX1: cropX1, - cropY1: cropY1, - cropX2: cropX2, - cropY2: cropY2, - eraserCoordinates: eraserCoordinates, - language: language, - stamp: BackgroundTaskUpload.getStamp( - barcode, - imageField.offTag, - language.code, - ), - ); + ) => BackgroundTaskImage._( + uniqueId: uniqueId, + barcode: barcode, + productType: productType, + processName: _operationType.processName, + imageField: imageField.offTag, + fullPath: fullFile.path, + croppedPath: croppedFile.path, + rotationDegrees: rotationDegrees, + cropX1: cropX1, + cropY1: cropY1, + cropX2: cropX2, + cropY2: cropY2, + eraserCoordinates: eraserCoordinates, + language: language, + stamp: BackgroundTaskUpload.getStamp( + barcode, + imageField.offTag, + language.code, + ), + ); /// Returns a fake value that means: "remove the previous value when merging". /// @@ -164,10 +164,10 @@ class BackgroundTaskImage extends BackgroundTaskUpload { /// cf. [UpToDateChanges._overwrite] regarding `images` field. @override ProductImage getProductImageChange() => ProductImage( - field: ImageField.fromOffTag(imageField)!, - language: getLanguage(), - size: ImageSize.ORIGINAL, - ); + field: ImageField.fromOffTag(imageField)!, + language: getLanguage(), + size: ImageSize.ORIGINAL, + ); // TODO(monsieurtanuki): we may also need to remove old files that were not removed from some reason @override @@ -187,8 +187,9 @@ class BackgroundTaskImage extends BackgroundTaskUpload { // not likely, but let's not spoil the task for that either. } try { - (await BackgroundTaskUpload.getFile(getCroppedPath(fullPath))) - .deleteSync(); + (await BackgroundTaskUpload.getFile( + getCroppedPath(fullPath), + )).deleteSync(); } catch (e) { // possible, but let's not spoil the task for that either. } @@ -210,10 +211,7 @@ class BackgroundTaskImage extends BackgroundTaskUpload { } /// Returns [source] with all corners multiplied by a [factor]. - static Rect getResizedRect( - final Rect source, - final num factor, - ) => + static Rect getResizedRect(final Rect source, final num factor) => Rect.fromLTRB( source.left * factor, source.top * factor, @@ -229,16 +227,15 @@ class BackgroundTaskImage extends BackgroundTaskUpload { final int cropY1, final int cropX2, final int cropY2, - ) => - getResizedRect( - Rect.fromLTRB( - cropX1.toDouble(), - cropY1.toDouble(), - cropX2.toDouble(), - cropY2.toDouble(), - ), - 1 / _cropConversionFactor, - ); + ) => getResizedRect( + Rect.fromLTRB( + cropX1.toDouble(), + cropY1.toDouble(), + cropX2.toDouble(), + cropY2.toDouble(), + ), + 1 / _cropConversionFactor, + ); /// Conversion factor to `int` from / to UI / background task. static const int _cropConversionFactor = 1000000; @@ -262,21 +259,22 @@ class BackgroundTaskImage extends BackgroundTaskUpload { final String croppedPath = getCroppedPath(fullPath); final CustomPainter? overlayPainter = eraserCoordinates == null || eraserCoordinates.isEmpty - ? null - : EraserPainter( - eraserModel: EraserModel( - rotation: CropRotationExtension.fromDegrees(rotationDegrees)!, - offsets: CropHelper.getOffsets(eraserCoordinates), - ), - cropRect: BackgroundTaskImage.getDownsizedRect( - cropX1, - cropY1, - cropX2, - cropY2, - ), - ); + ? null + : EraserPainter( + eraserModel: EraserModel( + rotation: CropRotationExtension.fromDegrees(rotationDegrees)!, + offsets: CropHelper.getOffsets(eraserCoordinates), + ), + cropRect: BackgroundTaskImage.getDownsizedRect( + cropX1, + cropY1, + cropX2, + cropY2, + ), + ); final ui.Image full = await loadUiImage( - await (await BackgroundTaskUpload.getFile(fullPath)).readAsBytes()); + await (await BackgroundTaskUpload.getFile(fullPath)).readAsBytes(), + ); if (!forceCompression) { if (cropX1 == 0 && cropY1 == 0 && @@ -390,6 +388,7 @@ class BackgroundTaskImage extends BackgroundTaskUpload { return; } throw Exception( - 'Could not upload picture: ${status.status} / ${status.error}'); + 'Could not upload picture: ${status.status} / ${status.error}', + ); } } diff --git a/packages/smooth_app/lib/background/background_task_language_refresh.dart b/packages/smooth_app/lib/background/background_task_language_refresh.dart index 97c4b5a82f..f1d34e1ad7 100644 --- a/packages/smooth_app/lib/background/background_task_language_refresh.dart +++ b/packages/smooth_app/lib/background/background_task_language_refresh.dart @@ -20,15 +20,17 @@ class BackgroundTaskLanguageRefresh extends BackgroundTask { }); BackgroundTaskLanguageRefresh.fromJson(super.json) - : excludeBarcodes = _getStringList(json, _jsonTagExcludeBarcodes), - productType = - ProductType.fromOffTag(json[_jsonTagProductType] as String?) ?? -// for legacy reason (not refreshed products = no product type) - ProductType.food, - super.fromJson(); + : excludeBarcodes = _getStringList(json, _jsonTagExcludeBarcodes), + productType = + ProductType.fromOffTag(json[_jsonTagProductType] as String?) ?? + // for legacy reason (not refreshed products = no product type) + ProductType.food, + super.fromJson(); static List _getStringList( - final Map json, final String tag) { + final Map json, + final String tag, + ) { final List dynamicList = json[_jsonTagExcludeBarcodes] as List; final List result = []; @@ -54,13 +56,10 @@ class BackgroundTaskLanguageRefresh extends BackgroundTask { static const OperationType _operationType = OperationType.languageRefresh; - UriProductHelper get _uriProductHelper => ProductQuery.getUriProductHelper( - productType: productType, - ); + UriProductHelper get _uriProductHelper => + ProductQuery.getUriProductHelper(productType: productType); - static Future addTask( - final LocalDatabase localDatabase, - ) async { + static Future addTask(final LocalDatabase localDatabase) async { for (final ProductType productType in ProductType.values) { await _addTask( localDatabase, @@ -84,29 +83,25 @@ class BackgroundTaskLanguageRefresh extends BackgroundTask { excludeBarcodes, productType, ); - await task.addToManager( - localDatabase, - queue: BackgroundTaskQueue.longHaul, - ); + await task.addToManager(localDatabase, queue: BackgroundTaskQueue.longHaul); } @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - null; + final AppLocalizations appLocalizations, + ) => null; static BackgroundTask _getNewTask( final String uniqueId, final List excludeBarcodes, final ProductType productType, - ) => - BackgroundTaskLanguageRefresh._( - processName: _operationType.processName, - uniqueId: uniqueId, - stamp: ';languageRefresh;${productType.offTag}', - excludeBarcodes: excludeBarcodes, - productType: productType, - ); + ) => BackgroundTaskLanguageRefresh._( + processName: _operationType.processName, + uniqueId: uniqueId, + stamp: ';languageRefresh;${productType.offTag}', + excludeBarcodes: excludeBarcodes, + productType: productType, + ); @override Future preExecute(final LocalDatabase localDatabase) async {} @@ -132,21 +127,21 @@ class BackgroundTaskLanguageRefresh extends BackgroundTask { } final SearchResult searchResult = await SearchProductsManager.searchProducts( - getUser(), - ProductSearchQueryConfiguration( - fields: ProductQuery.fields, - parametersList: [ - const PageSize(size: _pageSize), - const PageNumber(page: 1), - BarcodeParameter.list(barcodes), - ], - language: language, - country: ProductQuery.getCountry(), - version: ProductQuery.productQueryVersion, - ), - uriHelper: _uriProductHelper, - type: SearchProductsType.background, - ); + getUser(), + ProductSearchQueryConfiguration( + fields: ProductQuery.fields, + parametersList: [ + const PageSize(size: _pageSize), + const PageNumber(page: 1), + BarcodeParameter.list(barcodes), + ], + language: language, + country: ProductQuery.getCountry(), + version: ProductQuery.productQueryVersion, + ), + uriHelper: _uriProductHelper, + type: SearchProductsType.background, + ); if (searchResult.products == null || searchResult.count == null) { throw Exception('Cannot refresh language'); } diff --git a/packages/smooth_app/lib/background/background_task_manager.dart b/packages/smooth_app/lib/background/background_task_manager.dart index 14ffc80eba..a7b3fa31ab 100644 --- a/packages/smooth_app/lib/background/background_task_manager.dart +++ b/packages/smooth_app/lib/background/background_task_manager.dart @@ -53,19 +53,16 @@ class BackgroundTaskManager { getInstance( localDatabase, queue: queue, - )._run( - forceNowIfPossible: forceNowIfPossible, - ); + )._run(forceNowIfPossible: forceNowIfPossible); } } /// Adds a task to the pending task list. Future add(final BackgroundTask task) async { final String taskId = task.uniqueId; - await DaoInstantString(localDatabase).put( - _taskIdToDaoInstantStringKey(taskId), - jsonEncode(task.toJson()), - ); + await DaoInstantString( + localDatabase, + ).put(_taskIdToDaoInstantStringKey(taskId), jsonEncode(task.toJson())); await DaoStringList(localDatabase).add(queue.tagTaskQueue, taskId); await task.preExecute(localDatabase); _run(forceNowIfPossible: true); @@ -87,18 +84,21 @@ class BackgroundTaskManager { await task.postExecute(localDatabase, success); } await DaoStringList(localDatabase).remove(queue.tagTaskQueue, taskId); - await DaoInstantString(localDatabase) - .put(_taskIdToDaoInstantStringKey(taskId), null); - await DaoInstantString(localDatabase) - .put(taskIdToErrorDaoInstantStringKey(taskId), null); + await DaoInstantString( + localDatabase, + ).put(_taskIdToDaoInstantStringKey(taskId), null); + await DaoInstantString( + localDatabase, + ).put(taskIdToErrorDaoInstantStringKey(taskId), null); localDatabase.notifyListeners(); } /// Returns the related task, or null but that is unexpected. BackgroundTask? _get(final String taskId) { try { - final String? json = DaoInstantString(localDatabase) - .get(_taskIdToDaoInstantStringKey(taskId)); + final String? json = DaoInstantString( + localDatabase, + ).get(_taskIdToDaoInstantStringKey(taskId)); if (json == null) { // unexpected return null; @@ -124,10 +124,12 @@ class BackgroundTaskManager { /// of running now or at least just after the current running block. int? _canStartNow(final bool forceNowIfPossible) { final int now = LocalDatabase.nowInMillis(); - final int? latestRunStart = - localDatabase.daoIntGet(queue.tagLastStartTimestamp); - final int? latestRunStop = - localDatabase.daoIntGet(queue.tagLastStopTimestamp); + final int? latestRunStart = localDatabase.daoIntGet( + queue.tagLastStartTimestamp, + ); + final int? latestRunStop = localDatabase.daoIntGet( + queue.tagLastStopTimestamp, + ); if (_running) { // if pretending to be running but started a very very long time ago if (latestRunStart != null && @@ -258,8 +260,9 @@ class BackgroundTaskManager { /// Returns true if managed to remove the task immediately. /// Returns false if the task will be removed next time it's possible. Future removeTaskAsap(final String taskId) async { - final String? status = DaoInstantString(localDatabase) - .get(taskIdToErrorDaoInstantStringKey(taskId)); + final String? status = DaoInstantString( + localDatabase, + ).get(taskIdToErrorDaoInstantStringKey(taskId)); if (status == taskStatusStarted) { // that value will be detected later await _setTaskErrorStatus(taskId, taskStatusStopAsap); @@ -291,9 +294,7 @@ class BackgroundTaskManager { Future> _getAllTasks() async { _debugPrint('get all tasks/0'); final List result = []; - final List list = localDatabase.getAllTaskIds( - queue.tagTaskQueue, - ); + final List list = localDatabase.getAllTaskIds(queue.tagTaskQueue); final List removeTaskIds = []; if (list.isEmpty) { return result; diff --git a/packages/smooth_app/lib/background/background_task_offline.dart b/packages/smooth_app/lib/background/background_task_offline.dart index c42da3cbb8..18a597d0ff 100644 --- a/packages/smooth_app/lib/background/background_task_offline.dart +++ b/packages/smooth_app/lib/background/background_task_offline.dart @@ -58,11 +58,11 @@ class BackgroundTaskOffline extends BackgroundTaskProgressing { @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - ( - appLocalizations.background_task_title_top_n, - AlignmentDirectional.bottomCenter, - ); + final AppLocalizations appLocalizations, + ) => ( + appLocalizations.background_task_title_top_n, + AlignmentDirectional.bottomCenter, + ); static BackgroundTaskOffline _getNewTask( final String uniqueId, @@ -70,16 +70,15 @@ class BackgroundTaskOffline extends BackgroundTaskProgressing { final int pageSize, final int totalSize, final ProductType productType, - ) => - BackgroundTaskOffline._( - processName: _operationType.processName, - uniqueId: uniqueId, - stamp: ';offline', - work: work, - pageSize: pageSize, - totalSize: totalSize, - productType: productType, - ); + ) => BackgroundTaskOffline._( + processName: _operationType.processName, + uniqueId: uniqueId, + stamp: ';offline', + work: work, + pageSize: pageSize, + totalSize: totalSize, + productType: productType, + ); @override Future preExecute(final LocalDatabase localDatabase) async {} diff --git a/packages/smooth_app/lib/background/background_task_paged.dart b/packages/smooth_app/lib/background/background_task_paged.dart index a4844202cc..689a03773e 100644 --- a/packages/smooth_app/lib/background/background_task_paged.dart +++ b/packages/smooth_app/lib/background/background_task_paged.dart @@ -10,8 +10,8 @@ abstract class BackgroundTaskPaged extends BackgroundTask { }); BackgroundTaskPaged.fromJson(super.json) - : pageSize = json[_jsonTagPageSize] as int, - super.fromJson(); + : pageSize = json[_jsonTagPageSize] as int, + super.fromJson(); final int pageSize; diff --git a/packages/smooth_app/lib/background/background_task_price.dart b/packages/smooth_app/lib/background/background_task_price.dart index 86909b23bf..3e08e870ed 100644 --- a/packages/smooth_app/lib/background/background_task_price.dart +++ b/packages/smooth_app/lib/background/background_task_price.dart @@ -31,31 +31,31 @@ abstract class BackgroundTaskPrice extends BackgroundTask { }); BackgroundTaskPrice.fromJson(super.json) - : date = JsonHelper.stringTimestampToDate(json[_jsonTagDate] as String), - currency = Currency.fromName(json[_jsonTagCurrency] as String)!, - locationOSMId = json[_jsonTagOSMId] as int, - locationOSMType = - LocationOSMType.fromOffTag(json[_jsonTagOSMType] as String)!, - barcodes = json.containsKey(_jsonTagBarcode) - ? [json[_jsonTagBarcode] as String] - : _fromJsonListString(json[_jsonTagBarcodes])!, - categories = - _fromJsonListString(json[_jsonTagCategories]) ?? [], - origins = - _fromJsonListListString(json[_jsonTagOrigins]) ?? >[], - labels = - _fromJsonListListString(json[_jsonTagLabels]) ?? >[], - pricePers = _fromJsonListString(json[_jsonTagPricePers]) ?? [], - pricesAreDiscounted = json.containsKey(_jsonTagIsDiscounted) - ? [json[_jsonTagIsDiscounted] as bool] - : _fromJsonListBool(json[_jsonTagAreDiscounted])!, - prices = json.containsKey(_jsonTagPrice) - ? [json[_jsonTagPrice] as double] - : fromJsonListDouble(json[_jsonTagPrices])!, - pricesWithoutDiscount = json.containsKey(_jsonTagPriceWithoutDiscount) - ? [json[_jsonTagPriceWithoutDiscount] as double?] - : _fromJsonListNullableDouble(json[_jsonTagPricesWithoutDiscount])!, - super.fromJson(); + : date = JsonHelper.stringTimestampToDate(json[_jsonTagDate] as String), + currency = Currency.fromName(json[_jsonTagCurrency] as String)!, + locationOSMId = json[_jsonTagOSMId] as int, + locationOSMType = LocationOSMType.fromOffTag( + json[_jsonTagOSMType] as String, + )!, + barcodes = json.containsKey(_jsonTagBarcode) + ? [json[_jsonTagBarcode] as String] + : _fromJsonListString(json[_jsonTagBarcodes])!, + categories = _fromJsonListString(json[_jsonTagCategories]) ?? [], + origins = + _fromJsonListListString(json[_jsonTagOrigins]) ?? >[], + labels = + _fromJsonListListString(json[_jsonTagLabels]) ?? >[], + pricePers = _fromJsonListString(json[_jsonTagPricePers]) ?? [], + pricesAreDiscounted = json.containsKey(_jsonTagIsDiscounted) + ? [json[_jsonTagIsDiscounted] as bool] + : _fromJsonListBool(json[_jsonTagAreDiscounted])!, + prices = json.containsKey(_jsonTagPrice) + ? [json[_jsonTagPrice] as double] + : fromJsonListDouble(json[_jsonTagPrices])!, + pricesWithoutDiscount = json.containsKey(_jsonTagPriceWithoutDiscount) + ? [json[_jsonTagPriceWithoutDiscount] as double?] + : _fromJsonListNullableDouble(json[_jsonTagPricesWithoutDiscount])!, + super.fromJson(); static const String _jsonTagDate = 'date'; static const String _jsonTagCurrency = 'currency'; @@ -176,19 +176,15 @@ abstract class BackgroundTaskPrice extends BackgroundTask { @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - ( - appLocalizations.add_price_queued, - AlignmentDirectional.bottomCenter, - ); + final AppLocalizations appLocalizations, + ) => (appLocalizations.add_price_queued, AlignmentDirectional.bottomCenter); @protected static String getStamp({ required final DateTime date, required final int locationOSMId, required final LocationOSMType locationOSMType, - }) => - 'no_barcode;price;$date;$locationOSMId;$locationOSMType'; + }) => 'no_barcode;price;$date;$locationOSMId;$locationOSMType'; @override Future preExecute(final LocalDatabase localDatabase) async {} @@ -198,10 +194,10 @@ abstract class BackgroundTaskPrice extends BackgroundTask { final User user = getUser(); final MaybeError token = await OpenPricesAPIClient.getAuthenticationToken( - username: user.userId, - password: user.password, - uriHelper: ProductQuery.uriPricesHelper, - ); + username: user.userId, + password: user.password, + uriHelper: ProductQuery.uriPricesHelper, + ); if (token.isError) { throw Exception('Could not get token: ${token.error}'); } @@ -239,10 +235,10 @@ abstract class BackgroundTaskPrice extends BackgroundTask { // create price final MaybeError addedPrice = await OpenPricesAPIClient.createPrice( - price: newPrice, - bearerToken: bearerToken, - uriHelper: ProductQuery.uriPricesHelper, - ); + price: newPrice, + bearerToken: bearerToken, + uriHelper: ProductQuery.uriPricesHelper, + ); if (addedPrice.isError) { throw Exception('Could not add price: ${addedPrice.error}'); } @@ -254,14 +250,12 @@ abstract class BackgroundTaskPrice extends BackgroundTask { } @protected - Future closeSession({ - required final String bearerToken, - }) async { + Future closeSession({required final String bearerToken}) async { final MaybeError closedSession = await OpenPricesAPIClient.deleteUserSession( - uriHelper: ProductQuery.uriPricesHelper, - bearerToken: bearerToken, - ); + uriHelper: ProductQuery.uriPricesHelper, + bearerToken: bearerToken, + ); if (closedSession.isError) { // TODO(monsieurtanuki): do we really care? // throw Exception('Could not close session: ${closedSession.error}'); diff --git a/packages/smooth_app/lib/background/background_task_progressing.dart b/packages/smooth_app/lib/background/background_task_progressing.dart index c7e92dabf4..fefeec292b 100644 --- a/packages/smooth_app/lib/background/background_task_progressing.dart +++ b/packages/smooth_app/lib/background/background_task_progressing.dart @@ -16,13 +16,13 @@ abstract class BackgroundTaskProgressing extends BackgroundTaskPaged { }); BackgroundTaskProgressing.fromJson(super.json) - : work = json[_jsonTagWork] as String, - totalSize = json[_jsonTagTotalSize] as int, - productType = - ProductType.fromOffTag(json[_jsonTagProductType] as String?) ?? -// for legacy reason (not refreshed products = no product type) - ProductType.food, - super.fromJson(); + : work = json[_jsonTagWork] as String, + totalSize = json[_jsonTagTotalSize] as int, + productType = + ProductType.fromOffTag(json[_jsonTagProductType] as String?) ?? + // for legacy reason (not refreshed products = no product type) + ProductType.food, + super.fromJson(); final String work; final int totalSize; @@ -42,9 +42,8 @@ abstract class BackgroundTaskProgressing extends BackgroundTaskPaged { } @protected - UriProductHelper get uriProductHelper => ProductQuery.getUriProductHelper( - productType: productType, - ); + UriProductHelper get uriProductHelper => + ProductQuery.getUriProductHelper(productType: productType); static const String noBarcode = 'NO_BARCODE'; } diff --git a/packages/smooth_app/lib/background/background_task_refresh_later.dart b/packages/smooth_app/lib/background/background_task_refresh_later.dart index 094a62d8e0..453f505078 100644 --- a/packages/smooth_app/lib/background/background_task_refresh_later.dart +++ b/packages/smooth_app/lib/background/background_task_refresh_later.dart @@ -22,8 +22,8 @@ class BackgroundTaskRefreshLater extends BackgroundTaskBarcode { }); BackgroundTaskRefreshLater.fromJson(super.json) - : timestamp = json[_jsonTagTimestamp] as int, - super.fromJson(); + : timestamp = json[_jsonTagTimestamp] as int, + super.fromJson(); static const String _jsonTagTimestamp = 'timestamp'; @@ -63,31 +63,27 @@ class BackgroundTaskRefreshLater extends BackgroundTaskBarcode { uniqueId, productType, ); - await task.addToManager( - localDatabase, - queue: BackgroundTaskQueue.fast, - ); + await task.addToManager(localDatabase, queue: BackgroundTaskQueue.fast); } @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - null; + final AppLocalizations appLocalizations, + ) => null; /// Returns a new background task about refreshing a product later. static BackgroundTaskRefreshLater _getNewTask( final String barcode, final String uniqueId, final ProductType productType, - ) => - BackgroundTaskRefreshLater._( - uniqueId: uniqueId, - processName: _operationType.processName, - barcode: barcode, - productType: productType, - timestamp: LocalDatabase.nowInMillis(), - stamp: _getStamp(barcode), - ); + ) => BackgroundTaskRefreshLater._( + uniqueId: uniqueId, + processName: _operationType.processName, + barcode: barcode, + productType: productType, + timestamp: LocalDatabase.nowInMillis(), + stamp: _getStamp(barcode), + ); static String _getStamp(final String barcode) => '$barcode;refresh'; diff --git a/packages/smooth_app/lib/background/background_task_top_barcodes.dart b/packages/smooth_app/lib/background/background_task_top_barcodes.dart index 937278b6d9..1ae04550e7 100644 --- a/packages/smooth_app/lib/background/background_task_top_barcodes.dart +++ b/packages/smooth_app/lib/background/background_task_top_barcodes.dart @@ -25,8 +25,8 @@ class BackgroundTaskTopBarcodes extends BackgroundTaskProgressing { }); BackgroundTaskTopBarcodes.fromJson(super.json) - : pageNumber = json[_jsonTagPageNumber] as int? ?? 1, - super.fromJson(); + : pageNumber = json[_jsonTagPageNumber] as int? ?? 1, + super.fromJson(); final int pageNumber; @@ -64,16 +64,13 @@ class BackgroundTaskTopBarcodes extends BackgroundTaskProgressing { pageNumber, productType, ); - await task.addToManager( - localDatabase, - queue: BackgroundTaskQueue.longHaul, - ); + await task.addToManager(localDatabase, queue: BackgroundTaskQueue.longHaul); } @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - null; + final AppLocalizations appLocalizations, + ) => null; static BackgroundTask _getNewTask( final String uniqueId, @@ -82,17 +79,16 @@ class BackgroundTaskTopBarcodes extends BackgroundTaskProgressing { final int totalSize, final int pageNumber, final ProductType productType, - ) => - BackgroundTaskTopBarcodes._( - processName: _operationType.processName, - uniqueId: uniqueId, - stamp: ';offlineBarcodes;$work', - work: work, - pageSize: pageSize, - totalSize: totalSize, - pageNumber: pageNumber, - productType: productType, - ); + ) => BackgroundTaskTopBarcodes._( + processName: _operationType.processName, + uniqueId: uniqueId, + stamp: ';offlineBarcodes;$work', + work: work, + pageSize: pageSize, + totalSize: totalSize, + pageNumber: pageNumber, + productType: productType, + ); @override Future preExecute(final LocalDatabase localDatabase) async {} @@ -104,21 +100,21 @@ class BackgroundTaskTopBarcodes extends BackgroundTaskProgressing { Future execute(final LocalDatabase localDatabase) async { final SearchResult searchResult = await SearchProductsManager.searchProducts( - ProductQuery.getReadUser(), - ProductSearchQueryConfiguration( - fields: [ProductField.BARCODE], - parametersList: [ - PageSize(size: pageSize), - PageNumber(page: pageNumber), - const SortBy(option: SortOption.POPULARITY), - ], - language: ProductQuery.getLanguage(), - country: ProductQuery.getCountry(), - version: ProductQuery.productQueryVersion, - ), - uriHelper: uriProductHelper, - type: SearchProductsType.background, - ); + ProductQuery.getReadUser(), + ProductSearchQueryConfiguration( + fields: [ProductField.BARCODE], + parametersList: [ + PageSize(size: pageSize), + PageNumber(page: pageNumber), + const SortBy(option: SortOption.POPULARITY), + ], + language: ProductQuery.getLanguage(), + country: ProductQuery.getCountry(), + version: ProductQuery.productQueryVersion, + ), + uriHelper: uriProductHelper, + type: SearchProductsType.background, + ); if (searchResult.products == null || searchResult.count == null) { throw Exception('Cannot download top barcodes'); } diff --git a/packages/smooth_app/lib/background/background_task_unselect.dart b/packages/smooth_app/lib/background/background_task_unselect.dart index 5a453efdbf..b20fb21ad5 100644 --- a/packages/smooth_app/lib/background/background_task_unselect.dart +++ b/packages/smooth_app/lib/background/background_task_unselect.dart @@ -26,8 +26,8 @@ class BackgroundTaskUnselect extends BackgroundTaskBarcode }); BackgroundTaskUnselect.fromJson(super.json) - : imageField = json[_jsonTagImageField] as String, - super.fromJson(); + : imageField = json[_jsonTagImageField] as String, + super.fromJson(); static const String _jsonTagImageField = 'imageField'; @@ -74,11 +74,11 @@ class BackgroundTaskUnselect extends BackgroundTaskBarcode @override (String, AlignmentGeometry)? getFloatingMessage( - final AppLocalizations appLocalizations) => - ( - appLocalizations.product_task_background_schedule, - AlignmentDirectional.bottomCenter, - ); + final AppLocalizations appLocalizations, + ) => ( + appLocalizations.product_task_background_schedule, + AlignmentDirectional.bottomCenter, + ); /// Returns a new background task about unselecting a product image. static BackgroundTaskUnselect _getNewTask( @@ -87,21 +87,20 @@ class BackgroundTaskUnselect extends BackgroundTaskBarcode final ImageField imageField, final String uniqueId, final OpenFoodFactsLanguage language, - ) => - BackgroundTaskUnselect._( - uniqueId: uniqueId, - barcode: barcode, - productType: productType, - language: language, - processName: _operationType.processName, - imageField: imageField.offTag, - // same stamp as image upload - stamp: BackgroundTaskUpload.getStamp( - barcode, - imageField.offTag, - language.code, - ), - ); + ) => BackgroundTaskUnselect._( + uniqueId: uniqueId, + barcode: barcode, + productType: productType, + language: language, + processName: _operationType.processName, + imageField: imageField.offTag, + // same stamp as image upload + stamp: BackgroundTaskUpload.getStamp( + barcode, + imageField.offTag, + language.code, + ), + ); @override Future preExecute(final LocalDatabase localDatabase) async { @@ -109,11 +108,8 @@ class BackgroundTaskUnselect extends BackgroundTaskBarcode _getTransientFile().removeImage(localDatabase); } - TransientFile _getTransientFile() => TransientFile( - ImageField.fromOffTag(imageField)!, - barcode, - getLanguage(), - ); + TransientFile _getTransientFile() => + TransientFile(ImageField.fromOffTag(imageField)!, barcode, getLanguage()); @override Future postExecute( @@ -134,12 +130,12 @@ class BackgroundTaskUnselect extends BackgroundTaskBarcode /// Unselects the product image. @override Future upload() async => OpenFoodAPIClient.unselectProductImage( - barcode: barcode, - imageField: ImageField.fromOffTag(imageField)!, - language: getLanguage(), - user: getUser(), - uriHelper: uriProductHelper, - ); + barcode: barcode, + imageField: ImageField.fromOffTag(imageField)!, + language: getLanguage(), + user: getUser(), + uriHelper: uriProductHelper, + ); /// Returns a product with "unselected" image. /// diff --git a/packages/smooth_app/lib/background/background_task_upload.dart b/packages/smooth_app/lib/background/background_task_upload.dart index 603fb948fe..d522be9165 100644 --- a/packages/smooth_app/lib/background/background_task_upload.dart +++ b/packages/smooth_app/lib/background/background_task_upload.dart @@ -29,14 +29,14 @@ abstract class BackgroundTaskUpload extends BackgroundTaskBarcode }); BackgroundTaskUpload.fromJson(super.json) - : imageField = json[_jsonTagImageField] as String, - croppedPath = json[_jsonTagCroppedPath] as String, - rotationDegrees = json[_jsonTagRotation] as int? ?? 0, - cropX1 = json[_jsonTagX1] as int? ?? 0, - cropY1 = json[_jsonTagY1] as int? ?? 0, - cropX2 = json[_jsonTagX2] as int? ?? 0, - cropY2 = json[_jsonTagY2] as int? ?? 0, - super.fromJson(); + : imageField = json[_jsonTagImageField] as String, + croppedPath = json[_jsonTagCroppedPath] as String, + rotationDegrees = json[_jsonTagRotation] as int? ?? 0, + cropX1 = json[_jsonTagX1] as int? ?? 0, + cropY1 = json[_jsonTagY1] as int? ?? 0, + cropX2 = json[_jsonTagX2] as int? ?? 0, + cropY2 = json[_jsonTagY2] as int? ?? 0, + super.fromJson(); final String imageField; final String croppedPath; @@ -67,18 +67,12 @@ abstract class BackgroundTaskUpload extends BackgroundTaskBarcode return result; } - TransientFile _getTransientFile() => TransientFile( - ImageField.fromOffTag(imageField)!, - barcode, - getLanguage(), - ); + TransientFile _getTransientFile() => + TransientFile(ImageField.fromOffTag(imageField)!, barcode, getLanguage()); @protected Future putTransientImage(final LocalDatabase localDatabase) async => - _getTransientFile().putImage( - localDatabase, - await getFile(croppedPath), - ); + _getTransientFile().putImage(localDatabase, await getFile(croppedPath)); @protected void removeTransientImage(final LocalDatabase localDatabase) => @@ -98,8 +92,7 @@ abstract class BackgroundTaskUpload extends BackgroundTaskBarcode final String barcode, final String imageField, final String language, - ) => - '$barcode;image;$imageField;$language'; + ) => '$barcode;image;$imageField;$language'; static Future getDirectory() async => getApplicationSupportDirectory(); @@ -113,8 +106,9 @@ abstract class BackgroundTaskUpload extends BackgroundTaskBarcode static Future getFile(String path) async { if (Platform.isIOS) { final int lastSeparator = path.lastIndexOf('/'); - final String filename = - lastSeparator == -1 ? path : path.substring(lastSeparator + 1); + final String filename = lastSeparator == -1 + ? path + : path.substring(lastSeparator + 1); final Directory directory = await getDirectory(); path = '${directory.path}/$filename'; } @@ -123,18 +117,15 @@ abstract class BackgroundTaskUpload extends BackgroundTaskBarcode @override Future preExecute(final LocalDatabase localDatabase) async { - await localDatabase.upToDate.addChange( - uniqueId, - getProductChange(), - ); + await localDatabase.upToDate.addChange(uniqueId, getProductChange()); await putTransientImage(localDatabase); } @override Product getProductChange() => Product( - barcode: barcode, - images: [getProductImageChange()], - ); + barcode: barcode, + images: [getProductImageChange()], + ); /// Changed [ProductImage] for this product change. /// diff --git a/packages/smooth_app/lib/background/operation_type.dart b/packages/smooth_app/lib/background/operation_type.dart index 0e0c57d246..7829ea8e24 100644 --- a/packages/smooth_app/lib/background/operation_type.dart +++ b/packages/smooth_app/lib/background/operation_type.dart @@ -61,8 +61,10 @@ enum OperationType { final String? work, final ProductType? productType, }) async { - final int sequentialId = - await getNextSequenceNumber(DaoInt(localDatabase), _uniqueSequenceKey); + final int sequentialId = await getNextSequenceNumber( + DaoInt(localDatabase), + _uniqueSequenceKey, + ); return '$header' '$_transientHeaderSeparator$sequentialId' '$_transientHeaderSeparator$barcode' @@ -73,46 +75,46 @@ enum OperationType { } BackgroundTask fromJson(Map map) => switch (this) { - crop => BackgroundTaskCrop.fromJson(map), - addPrice => BackgroundTaskAddPrice.fromJson(map), - addOtherPrice => BackgroundTaskAddOtherPrice.fromJson(map), - details => BackgroundTaskDetails.fromJson(map), - hungerGames => BackgroundTaskHungerGames.fromJson(map), - image => BackgroundTaskImage.fromJson(map), - refreshLater => BackgroundTaskRefreshLater.fromJson(map), - unselect => BackgroundTaskUnselect.fromJson(map), - offline => BackgroundTaskOffline.fromJson(map), - offlineBarcodes => BackgroundTaskTopBarcodes.fromJson(map), - offlineProducts => BackgroundTaskDownloadProducts.fromJson(map), - fullRefresh => BackgroundTaskFullRefresh.fromJson(map), - languageRefresh => BackgroundTaskLanguageRefresh.fromJson(map), - }; + crop => BackgroundTaskCrop.fromJson(map), + addPrice => BackgroundTaskAddPrice.fromJson(map), + addOtherPrice => BackgroundTaskAddOtherPrice.fromJson(map), + details => BackgroundTaskDetails.fromJson(map), + hungerGames => BackgroundTaskHungerGames.fromJson(map), + image => BackgroundTaskImage.fromJson(map), + refreshLater => BackgroundTaskRefreshLater.fromJson(map), + unselect => BackgroundTaskUnselect.fromJson(map), + offline => BackgroundTaskOffline.fromJson(map), + offlineBarcodes => BackgroundTaskTopBarcodes.fromJson(map), + offlineProducts => BackgroundTaskDownloadProducts.fromJson(map), + fullRefresh => BackgroundTaskFullRefresh.fromJson(map), + languageRefresh => BackgroundTaskLanguageRefresh.fromJson(map), + }; bool matches(final TransientOperation action) => action.key.startsWith('$header$_transientHeaderSeparator'); String getLabel(final AppLocalizations appLocalizations) => switch (this) { - OperationType.details => - appLocalizations.background_task_operation_details, - OperationType.addPrice => 'Add price', - OperationType.addOtherPrice => 'Add price to existing proof', - OperationType.image => appLocalizations.background_task_operation_image, - OperationType.unselect => 'Unselect a product image', - OperationType.hungerGames => 'Answering to a Hunger Games question', - OperationType.crop => 'Crop an existing image', - OperationType.refreshLater => - 'Waiting 10 min before refreshing product to get all automatic edits', - OperationType.offline => 'Downloading top n products for offline usage', - OperationType.offlineBarcodes => 'Downloading top n barcodes', - OperationType.offlineProducts => 'Downloading products', - OperationType.fullRefresh => 'Refreshing the full local database', - OperationType.languageRefresh => - 'Refreshing the local database to a new language', - }; + OperationType.details => appLocalizations.background_task_operation_details, + OperationType.addPrice => 'Add price', + OperationType.addOtherPrice => 'Add price to existing proof', + OperationType.image => appLocalizations.background_task_operation_image, + OperationType.unselect => 'Unselect a product image', + OperationType.hungerGames => 'Answering to a Hunger Games question', + OperationType.crop => 'Crop an existing image', + OperationType.refreshLater => + 'Waiting 10 min before refreshing product to get all automatic edits', + OperationType.offline => 'Downloading top n products for offline usage', + OperationType.offlineBarcodes => 'Downloading top n barcodes', + OperationType.offlineProducts => 'Downloading products', + OperationType.fullRefresh => 'Refreshing the full local database', + OperationType.languageRefresh => + 'Refreshing the local database to a new language', + }; static int getSequentialId(final TransientOperation operation) { - final List keyItems = - operation.key.split(_transientHeaderSeparator); + final List keyItems = operation.key.split( + _transientHeaderSeparator, + ); return int.parse(keyItems[1]); } @@ -156,6 +158,5 @@ enum OperationType { static int sort( final TransientOperation operationA, final TransientOperation operationB, - ) => - getSequentialId(operationA).compareTo(getSequentialId(operationB)); + ) => getSequentialId(operationA).compareTo(getSequentialId(operationB)); } diff --git a/packages/smooth_app/lib/background/work_type.dart b/packages/smooth_app/lib/background/work_type.dart index 257a6e8af1..29794b611b 100644 --- a/packages/smooth_app/lib/background/work_type.dart +++ b/packages/smooth_app/lib/background/work_type.dart @@ -3,27 +3,15 @@ import 'package:openfoodfacts/openfoodfacts.dart'; /// Type of long download work for some background tasks. enum WorkType { /// Top products. - offline( - tag: 'O', - englishLabel: 'Top products', - ), + offline(tag: 'O', englishLabel: 'Top products'), /// Fresh products with Knowledge Panels. - freshKP( - tag: 'K', - englishLabel: 'Refresh products with KP', - ), + freshKP(tag: 'K', englishLabel: 'Refresh products with KP'), /// Fresh products without Knowledge Panels. - freshNoKP( - tag: 'w', - englishLabel: 'Refresh products without KP', - ); + freshNoKP(tag: 'w', englishLabel: 'Refresh products without KP'); - const WorkType({ - required this.tag, - required this.englishLabel, - }); + const WorkType({required this.tag, required this.englishLabel}); final String tag; final String englishLabel; @@ -49,9 +37,7 @@ enum WorkType { return (workType, productType); } - static WorkType? fromTag( - final String tag, - ) { + static WorkType? fromTag(final String tag) { for (final WorkType workType in values) { if (workType.tag == tag) { return workType; diff --git a/packages/smooth_app/lib/cards/category_cards/abstract_cache.dart b/packages/smooth_app/lib/cards/category_cards/abstract_cache.dart index 38cb4bd469..e6734aa101 100644 --- a/packages/smooth_app/lib/cards/category_cards/abstract_cache.dart +++ b/packages/smooth_app/lib/cards/category_cards/abstract_cache.dart @@ -7,11 +7,7 @@ import 'package:smooth_app/cards/category_cards/svg_cache.dart'; /// Widget that displays an image from network (and cache while waiting). abstract class AbstractCache extends StatelessWidget { @protected - const AbstractCache( - this.iconUrl, { - this.width, - this.height, - }); + const AbstractCache(this.iconUrl, {this.width, this.height}); /// Returns the best cache possibility: none, svg or png/jpeg factory AbstractCache.best({ @@ -68,9 +64,6 @@ abstract class AbstractCache extends StatelessWidget { } @protected - Widget getDefaultUnknown() => Icon( - CupertinoIcons.question, - size: width ?? height, - color: Colors.red, - ); + Widget getDefaultUnknown() => + Icon(CupertinoIcons.question, size: width ?? height, color: Colors.red); } diff --git a/packages/smooth_app/lib/cards/category_cards/asset_cache_helper.dart b/packages/smooth_app/lib/cards/category_cards/asset_cache_helper.dart index 718569230a..52d85c94b8 100644 --- a/packages/smooth_app/lib/cards/category_cards/asset_cache_helper.dart +++ b/packages/smooth_app/lib/cards/category_cards/asset_cache_helper.dart @@ -25,16 +25,14 @@ class AssetCacheHelper { final String? semanticsLabel; Widget getEmptySpace() => Semantics( - label: semanticsLabel, - image: true, - child: SizedBox( - width: width ?? height, - height: height ?? width, - ), - ); + label: semanticsLabel, + image: true, + child: SizedBox(width: width ?? height, height: height ?? width), + ); void notFound() => Logs.d( - 'please download $url and put it in asset somewhere like $cachedFilenames'); + 'please download $url and put it in asset somewhere like $cachedFilenames', + ); Exception loadException() => Exception('could not load any cached file ($cachedFilenames)'); diff --git a/packages/smooth_app/lib/cards/category_cards/null_cache.dart b/packages/smooth_app/lib/cards/category_cards/null_cache.dart index 59bf77b8c9..c5168703e1 100644 --- a/packages/smooth_app/lib/cards/category_cards/null_cache.dart +++ b/packages/smooth_app/lib/cards/category_cards/null_cache.dart @@ -3,10 +3,7 @@ import 'package:smooth_app/cards/category_cards/abstract_cache.dart'; /// Empty image cache: the url was null, there is not much we can display. class NullCache extends AbstractCache { - const NullCache({ - super.width, - super.height, - }) : super(null); + const NullCache({super.width, super.height}) : super(null); @override Widget build(BuildContext context) => getDefaultUnknown(); diff --git a/packages/smooth_app/lib/cards/category_cards/raster_async_asset.dart b/packages/smooth_app/lib/cards/category_cards/raster_async_asset.dart index e4af285f69..f8899e7c17 100644 --- a/packages/smooth_app/lib/cards/category_cards/raster_async_asset.dart +++ b/packages/smooth_app/lib/cards/category_cards/raster_async_asset.dart @@ -30,21 +30,21 @@ class _RasterAsyncAssetState extends State { @override Widget build(BuildContext context) => FutureBuilder( - future: _loading, - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.data != null) { - return Image.memory( - snapshot.data!.buffer.asUint8List(), - width: widget.assetCacheHelper.width, - height: widget.assetCacheHelper.height, - fit: BoxFit.contain, - ); - } else { - widget.assetCacheHelper.notFound(); - } - } - return widget.assetCacheHelper.getEmptySpace(); - }, - ); + future: _loading, + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.data != null) { + return Image.memory( + snapshot.data!.buffer.asUint8List(), + width: widget.assetCacheHelper.width, + height: widget.assetCacheHelper.height, + fit: BoxFit.contain, + ); + } else { + widget.assetCacheHelper.notFound(); + } + } + return widget.assetCacheHelper.getEmptySpace(); + }, + ); } diff --git a/packages/smooth_app/lib/cards/category_cards/raster_cache.dart b/packages/smooth_app/lib/cards/category_cards/raster_cache.dart index dd86ec4c51..c6d0890fc8 100644 --- a/packages/smooth_app/lib/cards/category_cards/raster_cache.dart +++ b/packages/smooth_app/lib/cards/category_cards/raster_cache.dart @@ -5,11 +5,7 @@ import 'package:smooth_app/cards/category_cards/raster_async_asset.dart'; /// Widget that displays a png/jpeg from network (and cache while waiting). class RasterCache extends AbstractCache { - const RasterCache( - super.iconUrl, { - super.width, - super.height, - }); + const RasterCache(super.iconUrl, {super.width, super.height}); @override Widget build(BuildContext context) { @@ -23,33 +19,29 @@ class RasterCache extends AbstractCache { width: width, height: height, fit: BoxFit.contain, - loadingBuilder: ( - final BuildContext context, - final Widget child, - final ImageChunkEvent? loadingProgress, - ) { - if (loadingProgress == null) { - return child; - } - return _localAssetWidget(fullFilenames); - }, - errorBuilder: ( - final BuildContext context, - final Object error, - final StackTrace? stackTrace, - ) => - _localAssetWidget(fullFilenames), + loadingBuilder: + ( + final BuildContext context, + final Widget child, + final ImageChunkEvent? loadingProgress, + ) { + if (loadingProgress == null) { + return child; + } + return _localAssetWidget(fullFilenames); + }, + errorBuilder: + ( + final BuildContext context, + final Object error, + final StackTrace? stackTrace, + ) => _localAssetWidget(fullFilenames), ); } RasterAsyncAsset _localAssetWidget(List fullFilenames) { return RasterAsyncAsset( - AssetCacheHelper( - fullFilenames, - iconUrl!, - width: width, - height: height, - ), + AssetCacheHelper(fullFilenames, iconUrl!, width: width, height: height), ); } } diff --git a/packages/smooth_app/lib/cards/category_cards/svg_async_asset.dart b/packages/smooth_app/lib/cards/category_cards/svg_async_asset.dart index 5a961f43eb..1009d7ec91 100644 --- a/packages/smooth_app/lib/cards/category_cards/svg_async_asset.dart +++ b/packages/smooth_app/lib/cards/category_cards/svg_async_asset.dart @@ -52,36 +52,36 @@ class _SvgAsyncAssetState extends State { @override Widget build(BuildContext context) => FutureBuilder( - future: _loading, - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.data != null) { - return SvgPicture.string( - snapshot.data!, - width: widget.assetCacheHelper.width, - height: widget.assetCacheHelper.height, - colorFilter: widget.assetCacheHelper.color == null - ? null - : ui.ColorFilter.mode( - widget.assetCacheHelper.color!, - ui.BlendMode.srcIn, - ), - fit: BoxFit.contain, - placeholderBuilder: (BuildContext context) => - widget.assetCacheHelper.getEmptySpace(), - ); - } else { - widget.assetCacheHelper.notFound(); - if (widget.errorBuilder != null) { - return widget.errorBuilder!(context, Exception('Not found')); - } - } + future: _loading, + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.data != null) { + return SvgPicture.string( + snapshot.data!, + width: widget.assetCacheHelper.width, + height: widget.assetCacheHelper.height, + colorFilter: widget.assetCacheHelper.color == null + ? null + : ui.ColorFilter.mode( + widget.assetCacheHelper.color!, + ui.BlendMode.srcIn, + ), + fit: BoxFit.contain, + placeholderBuilder: (BuildContext context) => + widget.assetCacheHelper.getEmptySpace(), + ); + } else { + widget.assetCacheHelper.notFound(); + if (widget.errorBuilder != null) { + return widget.errorBuilder!(context, Exception('Not found')); } + } + } - if (widget.loadingBuilder != null) { - return widget.loadingBuilder!(context); - } - return widget.assetCacheHelper.getEmptySpace(); - }, - ); + if (widget.loadingBuilder != null) { + return widget.loadingBuilder!(context); + } + return widget.assetCacheHelper.getEmptySpace(); + }, + ); } diff --git a/packages/smooth_app/lib/cards/category_cards/svg_cache.dart b/packages/smooth_app/lib/cards/category_cards/svg_cache.dart index 5a330732b8..cea6a40dee 100644 --- a/packages/smooth_app/lib/cards/category_cards/svg_cache.dart +++ b/packages/smooth_app/lib/cards/category_cards/svg_cache.dart @@ -92,8 +92,10 @@ class SvgCache extends AbstractCache { 'nova-group-3.svg' => localizations.nova_group_3, 'nova-group-4.svg' => localizations.nova_group_4, 'nova-group-unknown.svg' => localizations.nova_group_unknown, - String _ when fileName.startsWith('nutriscore-') => - _extractNutriScore(localizations, fileName), + String _ when fileName.startsWith('nutriscore-') => _extractNutriScore( + localizations, + fileName, + ), _ => null, }; } @@ -178,12 +180,4 @@ class SvgCache extends AbstractCache { } } -enum NutriScoreValue { - a, - b, - c, - d, - e, - unknown, - notApplicable, -} +enum NutriScoreValue { a, b, c, d, e, unknown, notApplicable } diff --git a/packages/smooth_app/lib/cards/category_cards/svg_safe_network.dart b/packages/smooth_app/lib/cards/category_cards/svg_safe_network.dart index 930ff720b4..01723881cb 100644 --- a/packages/smooth_app/lib/cards/category_cards/svg_safe_network.dart +++ b/packages/smooth_app/lib/cards/category_cards/svg_safe_network.dart @@ -38,7 +38,7 @@ class _SvgSafeNetworkState extends State { String get _url => widget.helper.url; -// TODO(monsieurtanuki): Change /dist/ url to be the first try when the majority of products have been updated + // TODO(monsieurtanuki): Change /dist/ url to be the first try when the majority of products have been updated /// Loads the SVG file from url or from alternate url. /// /// In Autumn 2023, the web image folders were moved to a /dist/ subfolder. @@ -110,67 +110,59 @@ class _SvgSafeNetworkState extends State { @override Widget build(BuildContext context) => FutureBuilder( - future: _loading, - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done) { - if (snapshot.data != null) { - return SvgPicture.string( - snapshot.data!, - width: widget.helper.width, - height: widget.helper.height, - colorFilter: widget.helper.color == null - ? null - : ui.ColorFilter.mode( - widget.helper.color!, - ui.BlendMode.srcIn, - ), - fit: BoxFit.contain, - semanticsLabel: widget.helper.semanticsLabel ?? - SvgCache.getSemanticsLabel(context, _url), - placeholderBuilder: (BuildContext context) => SvgAsyncAsset( - widget.helper, - loadingBuilder: widget.loadingBuilder, - errorBuilder: widget.errorBuilder, - ), - ); + future: _loading, + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done) { + if (snapshot.data != null) { + return SvgPicture.string( + snapshot.data!, + width: widget.helper.width, + height: widget.helper.height, + colorFilter: widget.helper.color == null + ? null + : ui.ColorFilter.mode(widget.helper.color!, ui.BlendMode.srcIn), + fit: BoxFit.contain, + semanticsLabel: + widget.helper.semanticsLabel ?? + SvgCache.getSemanticsLabel(context, _url), + placeholderBuilder: (BuildContext context) => SvgAsyncAsset( + widget.helper, + loadingBuilder: widget.loadingBuilder, + errorBuilder: widget.errorBuilder, + ), + ); + } + } + if (snapshot.error != null) { + String? findWarningLabel() { + const List warningLabels = [ + 'Failed host lookup', + 'Connection timed out', + 'Connection reset by peer', + ]; + final String error = snapshot.error.toString(); + for (final String warningLabel in warningLabels) { + if (error.contains(warningLabel)) { + return warningLabel; } } - if (snapshot.error != null) { - String? findWarningLabel() { - const List warningLabels = [ - 'Failed host lookup', - 'Connection timed out', - 'Connection reset by peer', - ]; - final String error = snapshot.error.toString(); - for (final String warningLabel in warningLabels) { - if (error.contains(warningLabel)) { - return warningLabel; - } - } - return null; - } + return null; + } - final String? warningLabel = findWarningLabel(); - if (warningLabel != null) { - Logs.w( - '$warningLabel for "$_url"', - ex: snapshot.error, - ); - } else { - Logs.e( - 'Could really not download "$_url"', - ex: snapshot.error, - ); - } - } - return SvgAsyncAsset(widget.helper); - }, - ); + final String? warningLabel = findWarningLabel(); + if (warningLabel != null) { + Logs.w('$warningLabel for "$_url"', ex: snapshot.error); + } else { + Logs.e('Could really not download "$_url"', ex: snapshot.error); + } + } + return SvgAsyncAsset(widget.helper); + }, + ); } /// Network cache, with url as key and SVG data as value. Map _networkCache = {}; -typedef WidgetErrorBuilder = Widget Function( - BuildContext context, dynamic exception); +typedef WidgetErrorBuilder = + Widget Function(BuildContext context, dynamic exception); diff --git a/packages/smooth_app/lib/cards/data_cards/product_image_carousel_item.dart b/packages/smooth_app/lib/cards/data_cards/product_image_carousel_item.dart index 2f4078385b..48e477b6d9 100644 --- a/packages/smooth_app/lib/cards/data_cards/product_image_carousel_item.dart +++ b/packages/smooth_app/lib/cards/data_cards/product_image_carousel_item.dart @@ -64,28 +64,24 @@ class _ProductImageCarouselItemState extends State { image: imageProvider, fit: BoxFit.cover, height: 1000, - errorBuilder: ( - BuildContext context, - Object exception, - StackTrace? stackTrace, - ) => - Column( - children: [ - Icon( - Icons.cloud_off_sharp, - size: screenSize.width / 4, + errorBuilder: + ( + BuildContext context, + Object exception, + StackTrace? stackTrace, + ) => Column( + children: [ + Icon(Icons.cloud_off_sharp, size: screenSize.width / 4), + Text(appLocalizations.no_internet_connection), + ], ), - Text(appLocalizations.no_internet_connection), - ], - ), ), ), onTap: () async => Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => ProductImageGalleryView( - product: widget.product, - ), + builder: (BuildContext context) => + ProductImageGalleryView(product: widget.product), ), ), ); diff --git a/packages/smooth_app/lib/cards/data_cards/score_card.dart b/packages/smooth_app/lib/cards/data_cards/score_card.dart index fa45004f26..5aa289405a 100644 --- a/packages/smooth_app/lib/cards/data_cards/score_card.dart +++ b/packages/smooth_app/lib/cards/data_cards/score_card.dart @@ -9,18 +9,9 @@ import 'package:smooth_app/themes/constant_icons.dart'; import 'package:smooth_app/themes/smooth_theme.dart'; enum CardEvaluation { - UNKNOWN( - backgroundColor: GREY_COLOR, - textColor: PRIMARY_GREY_COLOR, - ), - VERY_BAD( - backgroundColor: RED_BACKGROUND_COLOR, - textColor: RED_COLOR, - ), - BAD( - backgroundColor: ORANGE_BACKGROUND_COLOR, - textColor: LIGHT_ORANGE_COLOR, - ), + UNKNOWN(backgroundColor: GREY_COLOR, textColor: PRIMARY_GREY_COLOR), + VERY_BAD(backgroundColor: RED_BACKGROUND_COLOR, textColor: RED_COLOR), + BAD(backgroundColor: ORANGE_BACKGROUND_COLOR, textColor: LIGHT_ORANGE_COLOR), NEUTRAL( backgroundColor: YELLOW_BACKGROUND_COLOR, textColor: DARK_YELLOW_COLOR, @@ -48,20 +39,21 @@ class ScoreCard extends StatelessWidget { required Attribute attribute, required this.isClickable, this.margin, - }) : type = ScoreCardType.attribute, - iconUrl = attribute.iconUrl, - description = attribute.descriptionShort ?? attribute.description ?? '', - cardEvaluation = getCardEvaluationFromAttribute(attribute); + }) : type = ScoreCardType.attribute, + iconUrl = attribute.iconUrl, + description = attribute.descriptionShort ?? attribute.description ?? '', + cardEvaluation = getCardEvaluationFromAttribute(attribute); ScoreCard.titleElement({ required TitleElement titleElement, required this.isClickable, this.margin, - }) : type = ScoreCardType.title, - iconUrl = titleElement.iconUrl, - description = titleElement.title, - cardEvaluation = - getCardEvaluationFromKnowledgePanelTitleElement(titleElement); + }) : type = ScoreCardType.title, + iconUrl = titleElement.iconUrl, + description = titleElement.title, + cardEvaluation = getCardEvaluationFromKnowledgePanelTitleElement( + titleElement, + ); final String? iconUrl; final String description; @@ -77,13 +69,15 @@ class ScoreCard extends StatelessWidget { final double opacity = themeData.brightness == Brightness.light ? 1 : SmoothTheme.ADDITIONAL_OPACITY_FOR_DARK; - final Color backgroundColor = - cardEvaluation.backgroundColor.withValues(alpha: opacity); + final Color backgroundColor = cardEvaluation.backgroundColor.withValues( + alpha: opacity, + ); final Color textColor = themeData.brightness == Brightness.dark ? Colors.white : cardEvaluation.textColor.withValues(alpha: opacity); - final SvgIconChip? iconChip = - iconUrl == null ? null : SvgIconChip(iconUrl!, height: iconHeight); + final SvgIconChip? iconChip = iconUrl == null + ? null + : SvgIconChip(iconUrl!, height: iconHeight); return Semantics( value: _generateSemanticsValue(context), @@ -114,8 +108,9 @@ class ScoreCard extends StatelessWidget { child: Center( child: Text( description, - style: themeData.textTheme.headlineMedium! - .apply(color: textColor), + style: themeData.textTheme.headlineMedium!.apply( + color: textColor, + ), textAlign: TextAlign.center, ), ), @@ -143,7 +138,4 @@ class ScoreCard extends StatelessWidget { } } -enum ScoreCardType { - title, - attribute, -} +enum ScoreCardType { title, attribute } diff --git a/packages/smooth_app/lib/cards/product_cards/product_title_card.dart b/packages/smooth_app/lib/cards/product_cards/product_title_card.dart index e1d123717e..42fcbd2402 100644 --- a/packages/smooth_app/lib/cards/product_cards/product_title_card.dart +++ b/packages/smooth_app/lib/cards/product_cards/product_title_card.dart @@ -28,12 +28,11 @@ class ProductTitleCard extends StatelessWidget { @override Widget build(BuildContext context) { - final Widget trailing = _ProductTitleCardTrailing( - selectable: isSelectable, - ); + final Widget trailing = _ProductTitleCardTrailing(selectable: isSelectable); - final Size imageSize = - Size.square(MediaQuery.sizeOf(context).width * (dense ? 0.22 : 0.25)); + final Size imageSize = Size.square( + MediaQuery.sizeOf(context).width * (dense ? 0.22 : 0.25), + ); Widget child = Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -43,16 +42,10 @@ class ProductTitleCard extends StatelessWidget { constraints: BoxConstraints( minHeight: DefaultTextStyle.of(context).style.fontSize! * 2.0, ), - child: _ProductTitleCardName( - selectable: isSelectable, - dense: dense, - ), + child: _ProductTitleCardName(selectable: isSelectable, dense: dense), ), const SizedBox(height: SMALL_SPACE), - _ProductTitleCardBrand( - selectable: isSelectable, - dense: dense, - ), + _ProductTitleCardBrand(selectable: isSelectable, dense: dense), const SizedBox(height: 2.0), trailing, ], @@ -88,14 +81,12 @@ class ProductTitleCard extends StatelessWidget { noImageBuilder: (_) => const PictureNotFound(), onTap: !dense ? () async => Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - ProductImageGalleryView( - product: product, - ), - ), - ) + context, + MaterialPageRoute( + builder: (BuildContext context) => + ProductImageGalleryView(product: product), + ), + ) : null, ), ), @@ -129,10 +120,7 @@ class ProductTitleCard extends StatelessWidget { } class _ProductTitleCardName extends StatelessWidget { - const _ProductTitleCardName({ - required this.selectable, - this.dense = false, - }); + const _ProductTitleCardName({required this.selectable, this.dense = false}); final bool dense; final bool selectable; @@ -155,10 +143,7 @@ class _ProductTitleCardName extends StatelessWidget { } class _ProductTitleCardBrand extends StatelessWidget { - const _ProductTitleCardBrand({ - required this.selectable, - this.dense = false, - }); + const _ProductTitleCardBrand({required this.selectable, this.dense = false}); final bool selectable; final bool dense; @@ -181,9 +166,7 @@ class _ProductTitleCardBrand extends StatelessWidget { } class _ProductTitleCardTrailing extends StatelessWidget { - const _ProductTitleCardTrailing({ - required this.selectable, - }); + const _ProductTitleCardTrailing({required this.selectable}); final bool selectable; diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_base_card.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_base_card.dart index 4ad88b5a3d..7832a9083c 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_base_card.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_base_card.dart @@ -68,9 +68,9 @@ class ScanProductBaseCard extends StatelessWidget { borderRadius: ROUNDED_BORDER_RADIUS, boxShadow: [ BoxShadow( - color: Theme.of(context) - .shadowColor - .withValues(alpha: context.lightTheme() ? 0.08 : 0.3), + color: Theme.of(context).shadowColor.withValues( + alpha: context.lightTheme() ? 0.08 : 0.3, + ), offset: const Offset(0.0, 2.0), blurRadius: 5.0, spreadRadius: 1.0, @@ -87,12 +87,11 @@ class ScanProductBaseCard extends StatelessWidget { backgroundColor: headerBackgroundColor, label: headerLabel, indicatorColor: headerIndicatorColor, - onClose: - onRemove != null ? () => onRemove?.call(context) : null, - ), - Expanded( - child: child, + onClose: onRemove != null + ? () => onRemove?.call(context) + : null, ), + Expanded(child: child), ], ), ), @@ -105,7 +104,8 @@ class ScanProductBaseCard extends StatelessWidget { Widget _buildChild() { return LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { - final EdgeInsetsGeometry padding = childPadding ?? + final EdgeInsetsGeometry padding = + childPadding ?? const EdgeInsetsDirectional.only( start: VERY_LARGE_SPACE, end: VERY_LARGE_SPACE, @@ -146,10 +146,12 @@ class _SmoothProductCardHeader extends StatelessWidget { @override Widget build(BuildContext context) { - final Color bgColor = backgroundColor ?? + final Color bgColor = + backgroundColor ?? context.extension().primarySemiDark; - final String closeTooltip = - AppLocalizations.of(context).carousel_close_tooltip; + final String closeTooltip = AppLocalizations.of( + context, + ).carousel_close_tooltip; final bool dense = context.read() == ScanCardDensity.DENSE; return ConstrainedBox( @@ -227,14 +229,15 @@ class ScanProductBaseCardTitle extends StatelessWidget { return SizedBox( width: double.infinity, child: Padding( - padding: EdgeInsetsDirectional.only( - bottom: dense ? SMALL_SPACE : MEDIUM_SPACE, - ).copyWith( - top: padding?.top, - bottom: padding?.bottom, - start: padding?.start, - end: padding?.end, - ), + padding: + EdgeInsetsDirectional.only( + bottom: dense ? SMALL_SPACE : MEDIUM_SPACE, + ).copyWith( + top: padding?.top, + bottom: padding?.bottom, + start: padding?.start, + end: padding?.end, + ), child: TextWithUnderlinedParts( text: title, textStyle: const TextStyle( @@ -248,10 +251,7 @@ class ScanProductBaseCardTitle extends StatelessWidget { } class ScanProductBaseCardText extends StatelessWidget { - const ScanProductBaseCardText({ - required this.text, - super.key, - }); + const ScanProductBaseCardText({required this.text, super.key}); final Widget text; @@ -278,21 +278,22 @@ class ScanProductBaseCardBarcode extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); final bool lightTheme = context.lightTheme(); final bool dense = context.read() == ScanCardDensity.DENSE; return Padding( - padding: EdgeInsetsDirectional.only( - top: dense ? SMALL_SPACE : MEDIUM_SPACE, - bottom: dense ? BALANCED_SPACE : LARGE_SPACE * 2, - ).copyWith( - top: padding?.top, - bottom: padding?.bottom, - start: padding?.start, - end: padding?.end, - ), + padding: + EdgeInsetsDirectional.only( + top: dense ? SMALL_SPACE : MEDIUM_SPACE, + bottom: dense ? BALANCED_SPACE : LARGE_SPACE * 2, + ).copyWith( + top: padding?.top, + bottom: padding?.bottom, + start: padding?.start, + end: padding?.end, + ), child: DecoratedBox( decoration: BoxDecoration( borderRadius: ANGULAR_BORDER_RADIUS, @@ -300,9 +301,7 @@ class ScanProductBaseCardBarcode extends StatelessWidget { ), child: Center( child: ConstrainedBox( - constraints: BoxConstraints( - minHeight: dense ? 75.0 : 100.0, - ), + constraints: BoxConstraints(minHeight: dense ? 75.0 : 100.0), child: SmoothBarcodeWidget( height: height ?? 100.0, padding: EdgeInsetsDirectional.symmetric( @@ -332,9 +331,6 @@ class ScanProductBaseCardButton extends StatelessWidget { @override Widget build(BuildContext context) { - return SmoothButtonWithArrow( - text: text, - onTap: onTap, - ); + return SmoothButtonWithArrow(text: text, onTap: onTap); } } diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_error.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_error.dart index 89af0e6937..4197c81030 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_error.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_error.dart @@ -25,8 +25,8 @@ class ScanProductCardError extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); final bool dense = context.read() == ScanCardDensity.DENSE; return ScanProductBaseCard( @@ -65,8 +65,8 @@ class ScanProductCardError extends StatelessWidget { ScanProductBaseCardButton( text: appLocalizations.carousel_error_button, onTap: () async { - final ContinuousScanModel model = - context.read(); + final ContinuousScanModel model = context + .read(); model.retryBarcodeFetch(barcode); }, diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart index 5b0c5af4c4..107afa512a 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_found.dart @@ -62,7 +62,7 @@ class SmoothProductCardItemFound extends StatelessWidget { constraints: BoxConstraints( minHeight: themeData.textTheme.headlineMedium!.fontSize! * - 2.0, + 2.0, ), child: Align( alignment: AlignmentDirectional.centerStart, @@ -86,7 +86,7 @@ class SmoothProductCardItemFound extends StatelessWidget { style: themeData.textTheme.bodyMedium, ), const Spacer(), - const _SmoothProductItemScores() + const _SmoothProductItemScores(), ], ), ), @@ -112,20 +112,16 @@ class SmoothProductCardItemFound extends StatelessWidget { return MultiProvider( providers: [ - Provider( - create: (_) => product, - ), + Provider(create: (_) => product), Provider.value(value: heroTag), ], child: InkWell( - onTap: onTap ?? + onTap: + onTap ?? () => AppNavigator.of(context).push( - AppRoutes.PRODUCT( - product.barcode!, - heroTag: heroTag, - ), - extra: product, - ), + AppRoutes.PRODUCT(product.barcode!, heroTag: heroTag), + extra: product, + ), onLongPress: () => onLongPress?.call(), child: child, ), @@ -145,8 +141,8 @@ class _SmoothProductItemPicture extends StatelessWidget { final Widget? scoreWidget; if (hasScore) { - final ProductPreferences productPreferences = - context.watch(); + final ProductPreferences productPreferences = context + .watch(); final MatchedProductV2 matchedProduct = MatchedProductV2( product, @@ -196,13 +192,8 @@ class _SmoothProductItemPicture extends StatelessWidget { return Ink( decoration: BoxDecoration( - borderRadius: const BorderRadius.all( - Radius.circular(09.0), - ), - border: Border.all( - color: borderColor, - width: 1.0, - ), + borderRadius: const BorderRadius.all(Radius.circular(09.0)), + border: Border.all(color: borderColor, width: 1.0), ), child: Column( children: [ @@ -248,8 +239,8 @@ class _SmoothProductItemScores extends StatelessWidget { final UserPreferences userPreferences = context.watch(); - final List excludedAttributeIds = - userPreferences.getExcludedAttributeIds(); + final List excludedAttributeIds = userPreferences + .getExcludedAttributeIds(); final List attributes = getPopulatedAttributes( product, @@ -257,41 +248,39 @@ class _SmoothProductItemScores extends StatelessWidget { excludedAttributeIds, ); - final List scores = List.generate( - attributes.length, - (int index) { - final bool nutriScoreLogo = attributes[index] - .iconUrl - ?.contains(RegExp(r'.*/nutriscore-[a-z]-.*\.svg')) == - true; + final List scores = List.generate(attributes.length, ( + int index, + ) { + final bool nutriScoreLogo = + attributes[index].iconUrl?.contains( + RegExp(r'.*/nutriscore-[a-z]-.*\.svg'), + ) == + true; - Widget child = SvgIconChip( - attributes[index].iconUrl!, - height: 39.0 - (nutriScoreLogo ? 1.0 : 0.0), - ); + Widget child = SvgIconChip( + attributes[index].iconUrl!, + height: 39.0 - (nutriScoreLogo ? 1.0 : 0.0), + ); - if (nutriScoreLogo) { - child = DecoratedBox( - decoration: BoxDecoration( - border: Border.all( - color: context.lightTheme() ? Colors.black26 : Colors.white54, - width: 1.0, - strokeAlign: BorderSide.strokeAlignOutside, - ), - borderRadius: const BorderRadius.all( - Radius.circular(6.5), - ), + if (nutriScoreLogo) { + child = DecoratedBox( + decoration: BoxDecoration( + border: Border.all( + color: context.lightTheme() ? Colors.black26 : Colors.white54, + width: 1.0, + strokeAlign: BorderSide.strokeAlignOutside, ), - child: child, - ); - } - - return Padding( - padding: const EdgeInsetsDirectional.only(end: 1.0), + borderRadius: const BorderRadius.all(Radius.circular(6.5)), + ), child: child, ); - }, - ); + } + + return Padding( + padding: const EdgeInsetsDirectional.only(end: 1.0), + child: child, + ); + }); return scores; } } @@ -307,9 +296,6 @@ class _SmoothProductItemTypeIndicator extends StatelessWidget { return EMPTY_WIDGET; } - return SvgPicture.asset( - productType.getIllustration(), - width: 50.0, - ); + return SvgPicture.asset(productType.getIllustration(), width: 50.0); } } diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_loading.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_loading.dart index 3d2fef5a8c..a9a6256d19 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_loading.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_loading.dart @@ -7,10 +7,8 @@ import 'package:smooth_app/themes/smooth_theme_colors.dart'; import 'package:smooth_app/widgets/smooth_text.dart'; class ScanProductCardLoading extends StatelessWidget { - ScanProductCardLoading({ - required this.barcode, - this.onRemoveProduct, - }) : assert(barcode.isNotEmpty); + ScanProductCardLoading({required this.barcode, this.onRemoveProduct}) + : assert(barcode.isNotEmpty); final String barcode; final OnRemoveCallback? onRemoveProduct; @@ -18,8 +16,8 @@ class ScanProductCardLoading extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); return ScanProductBaseCard( headerLabel: appLocalizations.carousel_loading_header, @@ -32,16 +30,11 @@ class ScanProductCardLoading extends StatelessWidget { ScanProductBaseCardTitle( title: appLocalizations.carousel_loading_title, ), - ScanProductBaseCardBarcode( - barcode: barcode, - height: 75.0, - ), + ScanProductBaseCardBarcode(barcode: barcode, height: 75.0), ScanProductBaseCardText( text: TextWithBoldParts( text: appLocalizations.carousel_loading_text, - textStyle: const TextStyle( - fontSize: 14.5, - ), + textStyle: const TextStyle(fontSize: 14.5), ), ), const Spacer(flex: 10), diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_not_found.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_not_found.dart index bea3a9ea62..47dbc64cd6 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_not_found.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_not_found.dart @@ -24,8 +24,8 @@ class ScanProductCardNotFound extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); final bool dense = context.read() == ScanCardDensity.DENSE; return ScanProductBaseCard( @@ -63,9 +63,7 @@ class ScanProductCardNotFound extends StatelessWidget { text: TextWithBubbleParts( text: appLocalizations.carousel_unknown_product_text, backgroundColor: theme.primarySemiDark, - textStyle: const TextStyle( - fontSize: 14.5, - ), + textStyle: const TextStyle(fontSize: 14.5), bubbleTextStyle: const TextStyle( color: Colors.white, fontWeight: FontWeight.w600, @@ -94,10 +92,7 @@ class ScanProductCardNotFound extends StatelessWidget { if (dense) { return SingleChildScrollView( - child: InkWell( - onTap: () => _onTap(context), - child: child, - ), + child: InkWell(onTap: () => _onTap(context), child: child), ); } else { return child; @@ -108,9 +103,7 @@ class ScanProductCardNotFound extends StatelessWidget { } Future _onTap(BuildContext context) async { - await AppNavigator.of(context).push( - AppRoutes.PRODUCT_CREATOR(barcode), - ); + await AppNavigator.of(context).push(AppRoutes.PRODUCT_CREATOR(barcode)); await onAddProduct?.call(); } } diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_template.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_template.dart index 8385729c85..657855a6a7 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_card_template.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_card_template.dart @@ -24,8 +24,8 @@ class SmoothProductCardTemplate extends StatelessWidget { Widget build(BuildContext context) { final Size screenSize = MediaQuery.sizeOf(context); final ThemeData themeData = Theme.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool isDarkMode = themeData.colorScheme.brightness == Brightness.dark; final Color itemColor = isDarkMode ? PRIMARY_GREY_COLOR : LIGHT_GREY_COLOR; @@ -48,10 +48,7 @@ class SmoothProductCardTemplate extends StatelessWidget { child: PictureNotFound.decoration( backgroundDecoration: BoxDecoration( borderRadius: const BorderRadius.all(Radius.circular(8.0)), - border: Border.all( - color: extension.greyNormal, - width: 1.0, - ), + border: Border.all(color: extension.greyNormal, width: 1.0), ), ), ), @@ -86,10 +83,7 @@ class SmoothProductCardTemplate extends StatelessWidget { if (message == null) textWidget else - Text( - message!, - maxLines: 3, - ), + Text(message!, maxLines: 3), const Spacer(), if (actionButton == null) Shimmer.fromColors( @@ -126,10 +120,7 @@ class SmoothProductCardTemplate extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(5.0)), color: itemColor, ), - child: const SizedBox( - height: 39.0, - width: 240 * 39.0 / 130, - ), + child: const SizedBox(height: 39.0, width: 240 * 39.0 / 130), ); } } diff --git a/packages/smooth_app/lib/cards/product_cards/smooth_product_image.dart b/packages/smooth_app/lib/cards/product_cards/smooth_product_image.dart index 4c1abaf0a4..f75d94f8a6 100644 --- a/packages/smooth_app/lib/cards/product_cards/smooth_product_image.dart +++ b/packages/smooth_app/lib/cards/product_cards/smooth_product_image.dart @@ -31,33 +31,31 @@ class ProductPicture extends StatefulWidget { String? heroTag, bool showObsoleteIcon = false, bool showOwnerIcon = false, - BorderRadius? borderRadius = const BorderRadius.all( - Radius.circular(14.0), - ), + BorderRadius? borderRadius = const BorderRadius.all(Radius.circular(14.0)), double imageFoundBorder = 0.0, double imageNotFoundBorder = 0.0, TextStyle? errorTextStyle, WidgetBuilder? noImageBuilder, bool blurFilter = true, }) : this._( - transientFile: null, - product: product, - imageField: imageField, - language: language ?? ProductQuery.getLanguage(), - allowAlternativeLanguage: allowAlternativeLanguage, - size: size, - fallbackUrl: fallbackUrl, - heroTag: heroTag, - onTap: onTap, - borderRadius: borderRadius, - imageFoundBorder: imageFoundBorder, - imageNotFoundBorder: imageNotFoundBorder, - errorTextStyle: errorTextStyle, - showObsoleteIcon: showObsoleteIcon, - showOwnerIcon: showOwnerIcon, - noImageBuilder: noImageBuilder, - blurFilter: blurFilter, - ); + transientFile: null, + product: product, + imageField: imageField, + language: language ?? ProductQuery.getLanguage(), + allowAlternativeLanguage: allowAlternativeLanguage, + size: size, + fallbackUrl: fallbackUrl, + heroTag: heroTag, + onTap: onTap, + borderRadius: borderRadius, + imageFoundBorder: imageFoundBorder, + imageNotFoundBorder: imageNotFoundBorder, + errorTextStyle: errorTextStyle, + showObsoleteIcon: showObsoleteIcon, + showOwnerIcon: showOwnerIcon, + noImageBuilder: noImageBuilder, + blurFilter: blurFilter, + ); ProductPicture.fromTransientFile({ required TransientFile transientFile, @@ -78,24 +76,24 @@ class ProductPicture extends StatefulWidget { WidgetBuilder? noImageBuilder, bool blurFilter = true, }) : this._( - transientFile: transientFile, - product: product, - imageField: imageField, - language: language, - allowAlternativeLanguage: allowAlternativeLanguage, - size: size, - fallbackUrl: fallbackUrl, - heroTag: heroTag, - onTap: onTap, - borderRadius: borderRadius, - imageFoundBorder: imageFoundBorder, - imageNotFoundBorder: imageNotFoundBorder, - errorTextStyle: errorTextStyle, - showObsoleteIcon: showObsoleteIcon, - showOwnerIcon: showOwnerIcon, - noImageBuilder: noImageBuilder, - blurFilter: blurFilter, - ); + transientFile: transientFile, + product: product, + imageField: imageField, + language: language, + allowAlternativeLanguage: allowAlternativeLanguage, + size: size, + fallbackUrl: fallbackUrl, + heroTag: heroTag, + onTap: onTap, + borderRadius: borderRadius, + imageFoundBorder: imageFoundBorder, + imageNotFoundBorder: imageNotFoundBorder, + errorTextStyle: errorTextStyle, + showObsoleteIcon: showObsoleteIcon, + showOwnerIcon: showOwnerIcon, + noImageBuilder: noImageBuilder, + blurFilter: blurFilter, + ); ProductPicture._({ required this.product, @@ -116,10 +114,10 @@ class ProductPicture extends StatefulWidget { this.showOwnerIcon = false, this.noImageBuilder, super.key, - }) : assert(imageFoundBorder >= 0.0), - assert(imageNotFoundBorder >= 0.0), - assert(heroTag == null || heroTag.isNotEmpty), - assert(size.width >= 0.0 && size.height >= 0.0); + }) : assert(imageFoundBorder >= 0.0), + assert(imageNotFoundBorder >= 0.0), + assert(heroTag == null || heroTag.isNotEmpty), + assert(size.width >= 0.0 && size.height >= 0.0); final Product? product; final ImageField? imageField; @@ -174,10 +172,7 @@ class _ProductPictureState extends State { ); final Widget? inkWell = widget.onTap != null - ? InkWell( - onTap: widget.onTap, - splashColor: _getSplashColor(context), - ) + ? InkWell(onTap: widget.onTap, splashColor: _getSplashColor(context)) : null; Widget child; @@ -186,11 +181,13 @@ class _ProductPictureState extends State { child = _ProductPictureAssetsSvg( asset: 'assets/product/product_error.svg', - semanticsLabel: - appLocalizations.product_image_error_accessibility_label( - widget.imageField?.getPictureAccessibilityLabel(appLocalizations) ?? - appLocalizations.product_image_front_accessibility_label, - ), + semanticsLabel: appLocalizations + .product_image_error_accessibility_label( + widget.imageField?.getPictureAccessibilityLabel( + appLocalizations, + ) ?? + appLocalizations.product_image_front_accessibility_label, + ), text: appLocalizations.product_image_error, textStyle: TextStyle( color: context.extension().error, @@ -205,7 +202,8 @@ class _ProductPictureState extends State { imageProvider: imageProvider!.$1!, imageField: widget.imageField, outdated: imageProvider.$2, - locked: widget.imageField != null && + locked: + widget.imageField != null && widget.product?.isImageLocked( widget.imageField!, widget.language ?? ProductQuery.getLanguage(), @@ -247,10 +245,7 @@ class _ProductPictureState extends State { } if (widget.borderRadius != null) { - return ClipRRect( - borderRadius: widget.borderRadius!, - child: child, - ); + return ClipRRect(borderRadius: widget.borderRadius!, child: child); } else { return child; } @@ -259,10 +254,9 @@ class _ProductPictureState extends State { /// The splash tries to use the product compatibility as the accent color Color? _getSplashColor(BuildContext context) { try { - return context - .read() - .color - ?.withValues(alpha: 0.5); + return context.read().color?.withValues( + alpha: 0.5, + ); } catch (_) { return null; } @@ -285,8 +279,8 @@ class _ProductPictureState extends State { widget.imageField!, widget.language ?? ProductQuery.getLanguage(), ); - final ImageProvider? imageProvider = - productTransientFile.getImageProvider(); + final ImageProvider? imageProvider = productTransientFile + .getImageProvider(); if (imageProvider != null) { return (imageProvider, productTransientFile.expired); @@ -371,7 +365,8 @@ class _ProductPictureWithImageProvider extends StatelessWidget { final bool lightTheme = context.lightTheme(); final Widget image = Semantics( - label: imageField?.getPictureAccessibilityLabel(appLocalizations) ?? + label: + imageField?.getPictureAccessibilityLabel(appLocalizations) ?? appLocalizations.product_image_front_accessibility_label, image: true, excludeSemantics: true, @@ -390,18 +385,13 @@ class _ProductPictureWithImageProvider extends StatelessWidget { child: ImageFiltered( imageFilter: ImageFilter.blur(sigmaX: 8.0, sigmaY: 8.0), enabled: blurFilter, - child: Image( - image: imageProvider, - fit: BoxFit.cover, - ), + child: Image(image: imageProvider, fit: BoxFit.cover), ), ), ), ), ), - Positioned.fill( - child: _buildImage(), - ), + Positioned.fill(child: _buildImage()), if (child != null) Positioned.fill( child: Material( @@ -466,9 +456,7 @@ class _ProductPictureWithImageProvider extends StatelessWidget { end: 2.0, textDirection: Directionality.of(context), child: IconTheme( - data: const IconThemeData( - color: Color(0xFF616161), - ), + data: const IconThemeData(color: Color(0xFF616161)), child: icons, ), ), @@ -485,27 +473,23 @@ class _ProductPictureWithImageProvider extends StatelessWidget { height: size.height, fit: BoxFit.contain, image: imageProvider, - loadingBuilder: ( - BuildContext context, - Widget child, - ImageChunkEvent? loadingProgress, - ) { - if (loadingProgress == null) { - return child; - } + loadingBuilder: + ( + BuildContext context, + Widget child, + ImageChunkEvent? loadingProgress, + ) { + if (loadingProgress == null) { + return child; + } - return _loadingPlaceholder(context); - }, + return _loadingPlaceholder(context); + }, errorBuilder: (_, __, ___) { onError.call(); return EMPTY_WIDGET; }, - frameBuilder: ( - BuildContext context, - Widget child, - int? frame, - _, - ) { + frameBuilder: (BuildContext context, Widget child, int? frame, _) { /// Force a loader, as the [loadingBuilder] has a [loadingProgress] of null, /// which is not expected. if (frame == null) { @@ -517,29 +501,21 @@ class _ProductPictureWithImageProvider extends StatelessWidget { ); if (heroTag != null) { - return Hero( - tag: heroTag!, - child: image, - ); + return Hero(tag: heroTag!, child: image); } else { return image; } } Widget _loadingPlaceholder(BuildContext context) => DecoratedBox( - decoration: BoxDecoration( - borderRadius: borderRadius, - border: border > 0.0 - ? Border.all( - color: Theme.of(context).dividerColor, - width: 1.0, - ) - : null, - ), - child: const Center( - child: CircularProgressIndicator(), - ), - ); + decoration: BoxDecoration( + borderRadius: borderRadius, + border: border > 0.0 + ? Border.all(color: Theme.of(context).dividerColor, width: 1.0) + : null, + ), + child: const Center(child: CircularProgressIndicator()), + ); } class _OutdatedProductPictureIcon extends StatelessWidget { @@ -556,11 +532,11 @@ class _OutdatedProductPictureIcon extends StatelessWidget { @override Widget build(BuildContext context) { return _ProductPictureIcon( - semanticsLabel: - appLocalizations.product_image_outdated_message_accessibility_label( - imageField?.getPictureAccessibilityLabel(appLocalizations) ?? - appLocalizations.product_image_front_accessibility_label, - ), + semanticsLabel: appLocalizations + .product_image_outdated_message_accessibility_label( + imageField?.getPictureAccessibilityLabel(appLocalizations) ?? + appLocalizations.product_image_front_accessibility_label, + ), icon: const icons.Outdated(size: 15.0), padding: const EdgeInsetsDirectional.only( top: 4.5, @@ -587,11 +563,11 @@ class _LockedProductPictureIcon extends StatelessWidget { @override Widget build(BuildContext context) { return _ProductPictureIcon( - semanticsLabel: - appLocalizations.product_image_locked_message_accessibility_label( - imageField?.getPictureAccessibilityLabel(appLocalizations) ?? - appLocalizations.product_image_front_accessibility_label, - ), + semanticsLabel: appLocalizations + .product_image_locked_message_accessibility_label( + imageField?.getPictureAccessibilityLabel(appLocalizations) ?? + appLocalizations.product_image_front_accessibility_label, + ), icon: IconTheme.merge( data: const IconThemeData(size: 16.0), child: const OwnerFieldIcon(), @@ -633,10 +609,7 @@ class _ProductPictureIcon extends StatelessWidget { color: Colors.white54, borderRadius: borderRadius, ), - child: Padding( - padding: padding, - child: icon, - ), + child: Padding(padding: padding, child: icon), ), ), ); @@ -654,8 +627,8 @@ class _ProductPictureAssetsSvg extends StatelessWidget { this.imageOverride, this.borderRadius, this.border = 0.0, - }) : assert(asset.isNotEmpty), - assert(size.width > 0.0 && size.height > 0.0); + }) : assert(asset.isNotEmpty), + assert(size.width > 0.0 && size.height > 0.0); final String asset; final String semanticsLabel; @@ -678,7 +651,8 @@ class _ProductPictureAssetsSvg extends StatelessWidget { child: Stack( children: [ Positioned.fill( - child: imageOverride?.call(context) ?? + child: + imageOverride?.call(context) ?? SvgPicture.asset( asset, width: size.width, @@ -706,17 +680,15 @@ class _ProductPictureAssetsSvg extends StatelessWidget { borderRadius: borderRadius, border: border > 0.0 ? Border.all( - color: (textStyle?.color ?? - Theme.of(context).dividerColor) - .withValues(alpha: 0.2), + color: + (textStyle?.color ?? + Theme.of(context).dividerColor) + .withValues(alpha: 0.2), width: 1.0, ) : null, ), - child: Material( - type: MaterialType.transparency, - child: child, - ), + child: Material(type: MaterialType.transparency, child: child), ), ), ], diff --git a/packages/smooth_app/lib/data_models/abstract_onboarding_data.dart b/packages/smooth_app/lib/data_models/abstract_onboarding_data.dart index b46000dcec..61e0ff5d62 100644 --- a/packages/smooth_app/lib/data_models/abstract_onboarding_data.dart +++ b/packages/smooth_app/lib/data_models/abstract_onboarding_data.dart @@ -67,7 +67,8 @@ abstract class AbstractOnboardingData { String getAssetPath(); /// Database key used to store the string. - String _getDatabaseKey() => '${getAssetPath()}' + String _getDatabaseKey() => + '${getAssetPath()}' '/${ProductQuery.getLanguage()}' '/${ProductQuery.getCountry()}'; } diff --git a/packages/smooth_app/lib/data_models/continuous_scan_model.dart b/packages/smooth_app/lib/data_models/continuous_scan_model.dart index be7664d2b1..77792641da 100644 --- a/packages/smooth_app/lib/data_models/continuous_scan_model.dart +++ b/packages/smooth_app/lib/data_models/continuous_scan_model.dart @@ -48,9 +48,11 @@ class ContinuousScanModel with ChangeNotifier { /// List only barcodes where the product exists Iterable getAvailableBarcodes() => _states - .where((MapEntry entry) => - entry.value == ScannedProductState.FOUND || - entry.value == ScannedProductState.CACHED) + .where( + (MapEntry entry) => + entry.value == ScannedProductState.FOUND || + entry.value == ScannedProductState.CACHED, + ) .keys; String? get latestConsultedBarcode => _latestConsultedBarcode; @@ -100,10 +102,7 @@ class ContinuousScanModel with ChangeNotifier { Future refreshProductList() async => _daoProductList.get(_productList); - void _setBarcodeState( - final String barcode, - final ScannedProductState state, - ) { + void _setBarcodeState(final String barcode, final ScannedProductState state) { _states[barcode] = state; notifyListeners(); } @@ -128,10 +127,7 @@ class ContinuousScanModel with ChangeNotifier { return false; } - AnalyticsHelper.trackEvent( - AnalyticsEvent.scanAction, - barcode: code, - ); + AnalyticsHelper.trackEvent(AnalyticsEvent.scanAction, barcode: code); _latestScannedBarcode = code; return _addBarcode(code); @@ -189,8 +185,9 @@ class ContinuousScanModel with ChangeNotifier { if (product != null) { try { // We try to load the fresh copy of product from the server - final FetchedProduct fetchedProduct = - await _queryBarcode(barcode).timeout(SnackBarDuration.long); + final FetchedProduct fetchedProduct = await _queryBarcode( + barcode, + ).timeout(SnackBarDuration.long); if (fetchedProduct.product != null) { if (fetchedProduct.isValid) { _addProduct(barcode, ScannedProductState.CACHED); @@ -216,18 +213,14 @@ class ContinuousScanModel with ChangeNotifier { return false; } - Future _queryBarcode( - final String barcode, - ) async => + Future _queryBarcode(final String barcode) async => BarcodeProductQuery( barcode: barcode, daoProduct: _daoProduct, isScanned: true, ).getFetchedProduct(); - Future _loadBarcode( - final String barcode, - ) async { + Future _loadBarcode(final String barcode) async { final FetchedProduct fetchedProduct = await _queryBarcode(barcode); switch (fetchedProduct.status) { case FetchedProductStatus.ok: @@ -252,9 +245,7 @@ class ContinuousScanModel with ChangeNotifier { } } - Future _updateBarcode( - final String barcode, - ) async { + Future _updateBarcode(final String barcode) async { final FetchedProduct fetchedProduct = await _queryBarcode(barcode); switch (fetchedProduct.status) { case FetchedProductStatus.ok: @@ -298,14 +289,8 @@ class ContinuousScanModel with ChangeNotifier { await refresh(); } - Future removeBarcode( - final String barcode, - ) async { - await _daoProductList.set( - productList, - barcode, - false, - ); + Future removeBarcode(final String barcode) async { + await _daoProductList.set(productList, barcode, false); _barcodes.remove(barcode); _states.remove(barcode); diff --git a/packages/smooth_app/lib/data_models/downloadable_string.dart b/packages/smooth_app/lib/data_models/downloadable_string.dart index da9c3cc470..72ddc99ebe 100644 --- a/packages/smooth_app/lib/data_models/downloadable_string.dart +++ b/packages/smooth_app/lib/data_models/downloadable_string.dart @@ -3,10 +3,7 @@ import 'package:smooth_app/database/dao_string.dart'; /// Downloadable String that may be stored (and compared to the previous value). class DownloadableString { - DownloadableString( - this.uri, { - this.dao, - }); + DownloadableString(this.uri, {this.dao}); final Uri uri; final DaoString? dao; diff --git a/packages/smooth_app/lib/data_models/fetched_product.dart b/packages/smooth_app/lib/data_models/fetched_product.dart index 2ca5605534..a3168d9e75 100644 --- a/packages/smooth_app/lib/data_models/fetched_product.dart +++ b/packages/smooth_app/lib/data_models/fetched_product.dart @@ -23,19 +23,16 @@ class FetchedProduct { // The reason behind the "ignore": I want to force "product" to be not null const FetchedProduct.found(final Product product) - // ignore: prefer_initializing_formals - : this._( - status: FetchedProductStatus.ok, - product: product, - ); + // ignore: prefer_initializing_formals + : this._(status: FetchedProductStatus.ok, product: product); /// The internet Product search said it couldn't find the product. const FetchedProduct.internetNotFound() - : this._(status: FetchedProductStatus.internetNotFound); + : this._(status: FetchedProductStatus.internetNotFound); /// The user cancelled the operation. const FetchedProduct.userCancelled() - : this._(status: FetchedProductStatus.userCancelled); + : this._(status: FetchedProductStatus.userCancelled); /// When the "fetch product" operation had an internet error. const FetchedProduct.error({ @@ -43,11 +40,11 @@ class FetchedProduct { required final bool isConnected, final String? failedPingedHost, }) : this._( - status: FetchedProductStatus.internetError, - isConnected: isConnected, - exceptionString: exceptionString, - failedPingedHost: failedPingedHost, - ); + status: FetchedProductStatus.internetError, + isConnected: isConnected, + exceptionString: exceptionString, + failedPingedHost: failedPingedHost, + ); final Product? product; final FetchedProductStatus status; @@ -61,9 +58,7 @@ class FetchedProduct { /// When relevant, host of the query that we couldn't even ping. final String? failedPingedHost; - String getErrorTitle( - final AppLocalizations appLocalizations, - ) { + String getErrorTitle(final AppLocalizations appLocalizations) { switch (status) { case FetchedProductStatus.ok: return 'Not supposed to happen...'; diff --git a/packages/smooth_app/lib/data_models/github_contributors_model.dart b/packages/smooth_app/lib/data_models/github_contributors_model.dart index 3a12371b68..3a71c3e472 100644 --- a/packages/smooth_app/lib/data_models/github_contributors_model.dart +++ b/packages/smooth_app/lib/data_models/github_contributors_model.dart @@ -6,9 +6,9 @@ class ContributorsModel { }); ContributorsModel.fromJson(Map json) - : profilePath = json['html_url'].toString(), - login = json['login'].toString(), - avatarUrl = json['avatar_url'].toString(); + : profilePath = json['html_url'].toString(), + login = json['login'].toString(), + avatarUrl = json['avatar_url'].toString(); final String avatarUrl; final String profilePath; diff --git a/packages/smooth_app/lib/data_models/location_list_nominatim_supplier.dart b/packages/smooth_app/lib/data_models/location_list_nominatim_supplier.dart index fad2dea9fd..7e9bbfbec2 100644 --- a/packages/smooth_app/lib/data_models/location_list_nominatim_supplier.dart +++ b/packages/smooth_app/lib/data_models/location_list_nominatim_supplier.dart @@ -24,7 +24,8 @@ class LocationListNominatimSupplier extends LocationListSupplier { scheme: 'https', host: 'nominatim.openstreetmap.org', path: 'lookup', - query: 'osm_ids=${queries.join(',')}' + query: + 'osm_ids=${queries.join(',')}' '&format=json' '&accept-language=${ProductQuery.getLanguage().offTag}', ), @@ -35,7 +36,8 @@ class LocationListNominatimSupplier extends LocationListSupplier { final List list = json.decode(response.body); for (final Map item in list) { final LocationOSMType? osmType = LocationOSMType.fromOffTag( - (item['osm_type'] as String).toUpperCase()); + (item['osm_type'] as String).toUpperCase(), + ); if (osmType == null) { continue; } diff --git a/packages/smooth_app/lib/data_models/location_list_photon_supplier.dart b/packages/smooth_app/lib/data_models/location_list_photon_supplier.dart index 10329f6f85..955ac52ca6 100644 --- a/packages/smooth_app/lib/data_models/location_list_photon_supplier.dart +++ b/packages/smooth_app/lib/data_models/location_list_photon_supplier.dart @@ -13,10 +13,7 @@ import 'package:smooth_app/query/product_query.dart'; /// * the first one optimized on shops, as it's what we want. /// * an optional one with no restrictions, in case OSM data is a bit clumsy. class LocationListPhotonSupplier extends LocationListSupplier { - LocationListPhotonSupplier( - this.query, - this.optimizedSearch, - ); + LocationListPhotonSupplier(this.query, this.optimizedSearch); /// Query text. final String query; @@ -52,7 +49,8 @@ class LocationListPhotonSupplier extends LocationListSupplier { scheme: 'https', host: 'photon.komoot.io', path: 'api', - query: 'q=${Uri.encodeComponent(query)}' + query: + 'q=${Uri.encodeComponent(query)}' '&lang=${getQueryLanguage().offTag}' '${_getAdditionalParameters()}', ), diff --git a/packages/smooth_app/lib/data_models/location_query_model.dart b/packages/smooth_app/lib/data_models/location_query_model.dart index d038b890f6..f82e2563c8 100644 --- a/packages/smooth_app/lib/data_models/location_query_model.dart +++ b/packages/smooth_app/lib/data_models/location_query_model.dart @@ -42,9 +42,7 @@ class LocationQueryModel with ChangeNotifier { final Set _locationKeys = {}; - Future _process( - final List locations, - ) async { + Future _process(final List locations) async { for (final OsmLocation location in locations) { final String primaryKey = location.primaryKey; if (_locationKeys.contains(primaryKey)) { diff --git a/packages/smooth_app/lib/data_models/login_result.dart b/packages/smooth_app/lib/data_models/login_result.dart index c8e9a84c52..d2cb0fb970 100644 --- a/packages/smooth_app/lib/data_models/login_result.dart +++ b/packages/smooth_app/lib/data_models/login_result.dart @@ -5,12 +5,7 @@ import 'package:smooth_app/pages/preferences/user_preferences_dev_mode.dart'; import 'package:smooth_app/query/product_query.dart'; /// How did the login attempt work? -enum LoginResultType { - successful, - unsuccessful, - serverIssue, - exception, -} +enum LoginResultType { successful, unsuccessful, serverIssue, exception } /// Result of a log in attempt, more subtle than a `bool`. class LoginResult { @@ -26,9 +21,10 @@ class LoginResult { LoginResultType.unsuccessful => appLocalizations.incorrect_credentials, LoginResultType.serverIssue => appLocalizations.login_result_type_server_issue, - LoginResultType.exception => isNoNetworkException(text!) - ? appLocalizations.login_result_type_server_unreachable - : text!, + LoginResultType.exception => + isNoNetworkException(text!) + ? appLocalizations.login_result_type_server_unreachable + : text!, }; static bool isNoNetworkException(final String text) => @@ -41,8 +37,10 @@ class LoginResult { final UserPreferences userPreferences, ) async { try { - final bool prodUrl = userPreferences - .getFlag(UserPreferencesDevMode.userPreferencesFlagProd) ?? + final bool prodUrl = + userPreferences.getFlag( + UserPreferencesDevMode.userPreferencesFlagProd, + ) ?? true; final LoginStatus? loginStatus = await OpenFoodAPIClient.login2( diff --git a/packages/smooth_app/lib/data_models/news_feed/newsfeed_json.dart b/packages/smooth_app/lib/data_models/news_feed/newsfeed_json.dart index 09b05d16e4..20a44a8663 100644 --- a/packages/smooth_app/lib/data_models/news_feed/newsfeed_json.dart +++ b/packages/smooth_app/lib/data_models/news_feed/newsfeed_json.dart @@ -4,13 +4,13 @@ part of 'newsfeed_provider.dart'; class _TagLineJSON { _TagLineJSON.fromJson(Map json) - : news = (json['news'] as Map).map( - (dynamic id, dynamic value) => MapEntry( - id, - _TagLineItemNewsItem.fromJson(id, value), - ), + : news = (json['news'] as Map).map( + (dynamic id, dynamic value) => MapEntry( + id, + _TagLineItemNewsItem.fromJson(id, value), ), - taglineFeed = _TaglineJSONFeed.fromJson(json['tagline_feed']); + ), + taglineFeed = _TaglineJSONFeed.fromJson(json['tagline_feed']); final _TagLineJSONNewsList news; final _TaglineJSONFeed taglineFeed; @@ -27,14 +27,14 @@ class _TagLineJSON { ); final _TagLineJSONFeedLocale localizedFeed = taglineFeed.loadNews(locale); - final Iterable feed = - _getAppNewsFeedItems(localizedFeed, locale); + final Iterable feed = _getAppNewsFeedItems( + localizedFeed, + locale, + ); return AppNews( news: AppNewsList(tagLineNews), - feed: AppNewsFeed( - feed.toList(growable: false), - ), + feed: AppNewsFeed(feed.toList(growable: false)), ); } @@ -44,13 +44,12 @@ class _TagLineJSON { int appLaunches, ) { final Map tagLineNews = news.map( - (String key, _TagLineItemNewsItem value) => MapEntry( - key, - value.toTagLineItem(locale), - ), + (String key, _TagLineItemNewsItem value) => + MapEntry(key, value.toTagLineItem(locale)), + ); + final Iterable values = List.of( + tagLineNews.values, ); - final Iterable values = - List.of(tagLineNews.values); final int? appVersionNumber = _extractVersionNumber(appVersion); @@ -85,7 +84,9 @@ class _TagLineJSON { } Iterable _getAppNewsFeedItems( - _TagLineJSONFeedLocale localizedFeed, String locale) { + _TagLineJSONFeedLocale localizedFeed, + String locale, + ) { final Iterable feed = localizedFeed.news .map((_TagLineJSONFeedLocaleItem item) { if (news[item.id] == null) { @@ -94,11 +95,13 @@ class _TagLineJSON { } return item.overrideNewsItem(news[item.id]!, locale); }) - .where((AppNewsFeedItem? item) => - item != null && - (item.startDate == null || - item.startDate!.isBefore(DateTime.now())) && - (item.endDate == null || item.endDate!.isAfter(DateTime.now()))) + .where( + (AppNewsFeedItem? item) => + item != null && + (item.startDate == null || + item.startDate!.isBefore(DateTime.now())) && + (item.endDate == null || item.endDate!.isAfter(DateTime.now())), + ) .nonNulls; return feed; } @@ -127,30 +130,35 @@ class _TagLineItemNewsItem { }) : _translations = translations; _TagLineItemNewsItem.fromJson(this.id, Map json) - : assert((json['url'] as String).isNotEmpty), - url = json['url'], - assert((json['translations'] as Map) - .containsKey('default')), - _translations = (json['translations'] as Map) - .map((dynamic key, dynamic value) { - if (key == 'default') { - return MapEntry( - key, _TagLineItemNewsTranslationDefault.fromJson(value)); - } else { - return MapEntry( - key, - _TagLineItemNewsTranslation.fromJson(value), - ); - } - }), - minLaunches = json['min_launches'] is int ? json['min_launches'] : null, - startDate = DateTime.tryParse(json['start_date']), - endDate = DateTime.tryParse(json['end_date']), - minVersion = json['min_version'], - maxVersion = json['max_version'], - style = json['style'] == null - ? null - : _TagLineNewsStyle.fromJson(json['style']); + : assert((json['url'] as String).isNotEmpty), + url = json['url'], + assert( + (json['translations'] as Map).containsKey('default'), + ), + _translations = (json['translations'] as Map).map(( + dynamic key, + dynamic value, + ) { + if (key == 'default') { + return MapEntry( + key, + _TagLineItemNewsTranslationDefault.fromJson(value), + ); + } else { + return MapEntry( + key, + _TagLineItemNewsTranslation.fromJson(value), + ); + } + }), + minLaunches = json['min_launches'] is int ? json['min_launches'] : null, + startDate = DateTime.tryParse(json['start_date']), + endDate = DateTime.tryParse(json['end_date']), + minVersion = json['min_version'], + maxVersion = json['max_version'], + style = json['style'] == null + ? null + : _TagLineNewsStyle.fromJson(json['style']); final String id; final String url; @@ -243,22 +251,23 @@ class _TagLineItemNewsTranslation { }); _TagLineItemNewsTranslation.fromJson(Map json) - : assert(json['title'] == null || (json['title'] as String).isNotEmpty), - assert( - json['message'] == null || (json['message'] as String).isNotEmpty), - assert(json['url'] == null || (json['url'] as String).isNotEmpty), - assert(json['button_label'] == null || - (json['button_label'] as String).isNotEmpty), - title = json['title'], - message = json['message'], - url = json['url'], - buttonLabel = json['button_label'], - image = json['image'] == null - ? null - : _TagLineNewsImage.fromJson(json['image']), - darkImage = json['image_dark'] == null - ? null - : _TagLineNewsImage.fromJson(json['image_dark']); + : assert(json['title'] == null || (json['title'] as String).isNotEmpty), + assert(json['message'] == null || (json['message'] as String).isNotEmpty), + assert(json['url'] == null || (json['url'] as String).isNotEmpty), + assert( + json['button_label'] == null || + (json['button_label'] as String).isNotEmpty, + ), + title = json['title'], + message = json['message'], + url = json['url'], + buttonLabel = json['button_label'], + image = json['image'] == null + ? null + : _TagLineNewsImage.fromJson(json['image']), + darkImage = json['image_dark'] == null + ? null + : _TagLineNewsImage.fromJson(json['image_dark']); final String? title; final String? message; final String? url; @@ -302,36 +311,38 @@ class _TagLineItemNewsTranslation { class _TagLineItemNewsTranslationDefault extends _TagLineItemNewsTranslation { _TagLineItemNewsTranslationDefault.fromJson(super.json) - : assert((json['title'] as String).isNotEmpty), - assert((json['message'] as String).isNotEmpty), - assert(json['image'] == null || + : assert((json['title'] as String).isNotEmpty), + assert((json['message'] as String).isNotEmpty), + assert( + json['image'] == null || ((json['image'] as Map)['url'] as String) - .isNotEmpty), - assert(json['image_dark'] == null || + .isNotEmpty, + ), + assert( + json['image_dark'] == null || ((json['image_dark'] as Map)['url'] as String) - .isNotEmpty), - super.fromJson(); + .isNotEmpty, + ), + super.fromJson(); } class _TagLineNewsImage { _TagLineNewsImage.fromJson(Map json) - : assert(json['width'] == null || - ((json['width'] as num) >= 0.0 && (json['width'] as num) <= 1.0)), - assert(json['alt'] == null || (json['alt'] as String).isNotEmpty), - url = json['url'], - width = json['width'], - alt = json['alt']; + : assert( + json['width'] == null || + ((json['width'] as num) >= 0.0 && (json['width'] as num) <= 1.0), + ), + assert(json['alt'] == null || (json['alt'] as String).isNotEmpty), + url = json['url'], + width = json['width'], + alt = json['alt']; final String? url; final double? width; final String? alt; AppNewsImage toTagLineImage() { - return AppNewsImage( - src: url, - width: width, - alt: alt, - ); + return AppNewsImage(src: url, width: width, alt: alt); } bool get overridesContent => url != null || width != null || alt != null; @@ -350,30 +361,46 @@ class _TagLineNewsStyle { }); _TagLineNewsStyle.fromJson(Map json) - : assert(json['title_background'] == null || - (json['title_background'] as String).startsWith('#')), - assert(json['title_text_color'] == null || - (json['title_text_color'] as String).startsWith('#')), - assert(json['title_indicator_color'] == null || - (json['title_indicator_color'] as String).startsWith('#')), - assert(json['message_background'] == null || - (json['message_background'] as String).startsWith('#')), - assert(json['message_text_color'] == null || - (json['message_text_color'] as String).startsWith('#')), - assert(json['button_background'] == null || - (json['button_background'] as String).startsWith('#')), - assert(json['button_text_color'] == null || - (json['button_text_color'] as String).startsWith('#')), - assert(json['content_background_color'] == null || - (json['content_background_color'] as String).startsWith('#')), - titleBackground = json['title_background'], - titleTextColor = json['title_text_color'], - titleIndicatorColor = json['title_indicator_color'], - messageBackground = json['message_background'], - messageTextColor = json['message_text_color'], - buttonBackground = json['button_background'], - buttonTextColor = json['button_text_color'], - contentBackgroundColor = json['content_background_color']; + : assert( + json['title_background'] == null || + (json['title_background'] as String).startsWith('#'), + ), + assert( + json['title_text_color'] == null || + (json['title_text_color'] as String).startsWith('#'), + ), + assert( + json['title_indicator_color'] == null || + (json['title_indicator_color'] as String).startsWith('#'), + ), + assert( + json['message_background'] == null || + (json['message_background'] as String).startsWith('#'), + ), + assert( + json['message_text_color'] == null || + (json['message_text_color'] as String).startsWith('#'), + ), + assert( + json['button_background'] == null || + (json['button_background'] as String).startsWith('#'), + ), + assert( + json['button_text_color'] == null || + (json['button_text_color'] as String).startsWith('#'), + ), + assert( + json['content_background_color'] == null || + (json['content_background_color'] as String).startsWith('#'), + ), + titleBackground = json['title_background'], + titleTextColor = json['title_text_color'], + titleIndicatorColor = json['title_indicator_color'], + messageBackground = json['message_background'], + messageTextColor = json['message_text_color'], + buttonBackground = json['button_background'], + buttonTextColor = json['button_text_color'], + contentBackgroundColor = json['content_background_color']; final String? titleBackground; final String? titleTextColor; @@ -408,27 +435,27 @@ class _TagLineNewsStyle { } AppNewsStyle toTagLineStyle() => AppNewsStyle.fromHex( - titleBackground: titleBackground, - titleTextColor: titleTextColor, - titleIndicatorColor: titleIndicatorColor, - messageBackground: messageBackground, - messageTextColor: messageTextColor, - buttonBackground: buttonBackground, - buttonTextColor: buttonTextColor, - contentBackgroundColor: contentBackgroundColor, - ); + titleBackground: titleBackground, + titleTextColor: titleTextColor, + titleIndicatorColor: titleIndicatorColor, + messageBackground: messageBackground, + messageTextColor: messageTextColor, + buttonBackground: buttonBackground, + buttonTextColor: buttonTextColor, + contentBackgroundColor: contentBackgroundColor, + ); } class _TaglineJSONFeed { _TaglineJSONFeed.fromJson(Map json) - : assert(json.containsKey('default')), - _news = json.map( - (dynamic key, dynamic value) => - MapEntry( - key, - _TagLineJSONFeedLocale.fromJson(value), - ), - ); + : assert(json.containsKey('default')), + _news = json.map( + (dynamic key, dynamic value) => + MapEntry( + key, + _TagLineJSONFeedLocale.fromJson(value), + ), + ); final _TagLineJSONFeedList _news; @@ -458,21 +485,23 @@ typedef _TagLineJSONFeedList = Map; class _TagLineJSONFeedLocale { _TagLineJSONFeedLocale.fromJson(Map json) - : assert(json['news'] is Iterable), - news = (json['news'] as Iterable) - .map((dynamic json) => _TagLineJSONFeedLocaleItem.fromJson(json)); + : assert(json['news'] is Iterable), + news = (json['news'] as Iterable).map( + (dynamic json) => _TagLineJSONFeedLocaleItem.fromJson(json), + ); final Iterable<_TagLineJSONFeedLocaleItem> news; } class _TagLineJSONFeedLocaleItem { _TagLineJSONFeedLocaleItem.fromJson(Map json) - : assert((json['id'] as String).isNotEmpty), - id = json['id'], - overrideContent = json['override'] != null - ? _TagLineJSONFeedNewsItemOverride.fromJson( - json['override'] as Map) - : null; + : assert((json['id'] as String).isNotEmpty), + id = json['id'], + overrideContent = json['override'] != null + ? _TagLineJSONFeedNewsItemOverride.fromJson( + json['override'] as Map, + ) + : null; final String id; final _TagLineJSONFeedNewsItemOverride? overrideContent; @@ -504,17 +533,17 @@ class _TagLineJSONFeedLocaleItem { class _TagLineJSONFeedNewsItemOverride { _TagLineJSONFeedNewsItemOverride.fromJson(Map json) - : assert(json['url'] == null || (json['url'] as String).isNotEmpty), - url = json['url'], - startDate = json['start_date'] != null - ? DateTime.tryParse(json['start_date']) - : null, - endDate = json['end_date'] != null - ? DateTime.tryParse(json['end_date']) - : null, - style = json['style'] == null - ? null - : _TagLineNewsStyle.fromJson(json['style']); + : assert(json['url'] == null || (json['url'] as String).isNotEmpty), + url = json['url'], + startDate = json['start_date'] != null + ? DateTime.tryParse(json['start_date']) + : null, + endDate = json['end_date'] != null + ? DateTime.tryParse(json['end_date']) + : null, + style = json['style'] == null + ? null + : _TagLineNewsStyle.fromJson(json['style']); final String? url; final DateTime? startDate; diff --git a/packages/smooth_app/lib/data_models/news_feed/newsfeed_model.dart b/packages/smooth_app/lib/data_models/news_feed/newsfeed_model.dart index 0aedf96b14..8e97d4927d 100644 --- a/packages/smooth_app/lib/data_models/news_feed/newsfeed_model.dart +++ b/packages/smooth_app/lib/data_models/news_feed/newsfeed_model.dart @@ -1,10 +1,7 @@ import 'dart:ui'; class AppNews { - const AppNews({ - required this.news, - required this.feed, - }); + const AppNews({required this.news, required this.feed}); final AppNewsList news; final AppNewsFeed feed; @@ -88,14 +85,14 @@ class AppNewsStyle { String? buttonBackground, String? buttonTextColor, String? contentBackgroundColor, - }) : titleBackground = _parseColor(titleBackground), - titleTextColor = _parseColor(titleTextColor), - titleIndicatorColor = _parseColor(titleIndicatorColor), - messageBackground = _parseColor(messageBackground), - messageTextColor = _parseColor(messageTextColor), - buttonBackground = _parseColor(buttonBackground), - buttonTextColor = _parseColor(buttonTextColor), - contentBackgroundColor = _parseColor(contentBackgroundColor); + }) : titleBackground = _parseColor(titleBackground), + titleTextColor = _parseColor(titleTextColor), + titleIndicatorColor = _parseColor(titleIndicatorColor), + messageBackground = _parseColor(messageBackground), + messageTextColor = _parseColor(messageTextColor), + buttonBackground = _parseColor(buttonBackground), + buttonTextColor = _parseColor(buttonTextColor), + contentBackgroundColor = _parseColor(contentBackgroundColor); final Color? titleBackground; final Color? titleTextColor; @@ -120,11 +117,7 @@ class AppNewsStyle { } class AppNewsImage { - const AppNewsImage({ - required this.src, - this.width, - this.alt, - }); + const AppNewsImage({required this.src, this.width, this.alt}); final String? src; final double? width; @@ -154,8 +147,8 @@ class AppNewsFeedItem { required this.news, DateTime? startDate, DateTime? endDate, - }) : _startDate = startDate, - _endDate = endDate; + }) : _startDate = startDate, + _endDate = endDate; final AppNewsItem news; final DateTime? _startDate; diff --git a/packages/smooth_app/lib/data_models/news_feed/newsfeed_provider.dart b/packages/smooth_app/lib/data_models/news_feed/newsfeed_provider.dart index abeb9f17c0..f44c8dc03d 100644 --- a/packages/smooth_app/lib/data_models/news_feed/newsfeed_provider.dart +++ b/packages/smooth_app/lib/data_models/news_feed/newsfeed_provider.dart @@ -23,12 +23,14 @@ part 'newsfeed_json.dart'; /// particularly to the [state] property. class AppNewsProvider extends ChangeNotifier { AppNewsProvider(UserPreferences preferences) - : _state = const AppNewsStateLoading(), - _preferences = preferences, - _uriOverride = preferences.getDevModeString( - UserPreferencesDevMode.userPreferencesCustomNewsJSONURI), - _prodEnv = preferences - .getFlag(UserPreferencesDevMode.userPreferencesFlagProd) { + : _state = const AppNewsStateLoading(), + _preferences = preferences, + _uriOverride = preferences.getDevModeString( + UserPreferencesDevMode.userPreferencesCustomNewsJSONURI, + ), + _prodEnv = preferences.getFlag( + UserPreferencesDevMode.userPreferencesFlagProd, + ) { _preferences.addListener(_onPreferencesChanged); loadLatestNews(); } @@ -154,8 +156,9 @@ class AppNewsProvider extends ChangeNotifier { } } - Future get _newsCacheFile => getApplicationCacheDirectory() - .then((Directory dir) => File(join(dir.path, 'tagline.json'))); + Future get _newsCacheFile => getApplicationCacheDirectory().then( + (Directory dir) => File(join(dir.path, 'tagline.json')), + ); Future _saveNewsToCache(final String json) async { final File file = await _newsCacheFile; @@ -165,9 +168,9 @@ class AppNewsProvider extends ChangeNotifier { bool _isNewsCacheValid(File file) => file.existsSync() && file.lengthSync() > 0 && - file - .lastModifiedSync() - .isAfter(DateTime.now().add(const Duration(days: -1))); + file.lastModifiedSync().isAfter( + DateTime.now().add(const Duration(days: -1)), + ); bool? _prodEnv; String? _uriOverride; @@ -175,12 +178,14 @@ class AppNewsProvider extends ChangeNotifier { /// [ProductQuery._uriProductHelper] is not synced yet, /// so we have to check it manually Future _onPreferencesChanged() async { - final String jsonURI = _preferences.getDevModeString( - UserPreferencesDevMode.userPreferencesCustomNewsJSONURI) ?? + final String jsonURI = + _preferences.getDevModeString( + UserPreferencesDevMode.userPreferencesCustomNewsJSONURI, + ) ?? ''; final bool prodEnv = _preferences.getFlag(UserPreferencesDevMode.userPreferencesFlagProd) ?? - true; + true; if (prodEnv != _prodEnv || jsonURI != _uriOverride) { _prodEnv = prodEnv; diff --git a/packages/smooth_app/lib/data_models/onboarding_data_product.dart b/packages/smooth_app/lib/data_models/onboarding_data_product.dart index c66a77b4a1..9a595f1134 100644 --- a/packages/smooth_app/lib/data_models/onboarding_data_product.dart +++ b/packages/smooth_app/lib/data_models/onboarding_data_product.dart @@ -10,19 +10,16 @@ import 'package:smooth_app/query/product_query.dart'; /// Helper around a product we download, store and reuse at onboarding. class OnboardingDataProduct extends AbstractOnboardingData { - OnboardingDataProduct( - super.localDatabase, - this.assetPath, - ); + OnboardingDataProduct(super.localDatabase, this.assetPath); /// Was computed from [downloadDataString] in en_US /// /// Something like https://world.openfoodfacts.org/api/v2/product/example/?fields=product_name%2Cbrands%2Ccode%2Cnutrition_grade_fr%2Cimage_small_url%2Cimage_front_small_url%2Cimage_front_url%2Cimage_ingredients_url%2Cimage_nutrition_url%2Cimage_packaging_url%2Cselected_images%2Cquantity%2Cserving_size%2Cproduct_quantity%2Cnutriments%2Cnutrient_levels%2Cnutriment_energy_unit%2Cadditives_tags%2Cingredients_analysis_tags%2Clabels_tags%2Clabels_tags_fr%2Cenvironment_impact_level_tags%2Ccategories_tags_fr%2Clang%2Cattribute_groups%2Cstates_tags%2Cecoscore_data%2Cecoscore_grade%2Cecoscore_score%2Cenvironment_impact_level_tags%2Cknowledge_panels&lc=en&cc=US OnboardingDataProduct.forProduct(final LocalDatabase localDatabase) - : this( - localDatabase, - AppHelper.getAssetPath('assets/onboarding/sample_product_data.json'), - ); + : this( + localDatabase, + AppHelper.getAssetPath('assets/onboarding/sample_product_data.json'), + ); final String assetPath; diff --git a/packages/smooth_app/lib/data_models/onboarding_loader.dart b/packages/smooth_app/lib/data_models/onboarding_loader.dart index 1a1a50d01f..1a49a9fba4 100644 --- a/packages/smooth_app/lib/data_models/onboarding_loader.dart +++ b/packages/smooth_app/lib/data_models/onboarding_loader.dart @@ -23,8 +23,9 @@ class OnboardingLoader { await LoadingDialog.run( context: context, future: _downloadData().timeout(const Duration(seconds: 4)), - title: AppLocalizations.of(context) - .onboarding_welcome_loading_dialog_title, + title: AppLocalizations.of( + context, + ).onboarding_welcome_loading_dialog_title, dismissible: false, ); case OnboardingPage.NOT_STARTED: diff --git a/packages/smooth_app/lib/data_models/personalized_ranking_model.dart b/packages/smooth_app/lib/data_models/personalized_ranking_model.dart index 03b4b437e2..f42e22ba23 100644 --- a/packages/smooth_app/lib/data_models/personalized_ranking_model.dart +++ b/packages/smooth_app/lib/data_models/personalized_ranking_model.dart @@ -7,10 +7,7 @@ import 'package:smooth_app/pages/product/common/loading_status.dart'; /// Model that computes the scores and sorts the barcodes accordingly. class PersonalizedRankingModel with ChangeNotifier { - PersonalizedRankingModel( - this.initialBarcodes, - this.localDatabase, - ) { + PersonalizedRankingModel(this.initialBarcodes, this.localDatabase) { initialBarcodes.forEach(localDatabase.upToDate.showInterest); } @@ -34,9 +31,7 @@ class PersonalizedRankingModel with ChangeNotifier { } /// Refreshes the computations. - Future refresh( - final ProductPreferences productPreferences, - ) async { + Future refresh(final ProductPreferences productPreferences) async { _clear(); _asyncLoad(localDatabase, productPreferences); } diff --git a/packages/smooth_app/lib/data_models/preferences/migration/user_preferences_migration.dart b/packages/smooth_app/lib/data_models/preferences/migration/user_preferences_migration.dart index c25835de3f..8bc83f4f1d 100644 --- a/packages/smooth_app/lib/data_models/preferences/migration/user_preferences_migration.dart +++ b/packages/smooth_app/lib/data_models/preferences/migration/user_preferences_migration.dart @@ -7,10 +7,10 @@ class UserPreferencesMigrationTool { static final Iterable _versions = [ - const _UserPreferencesMigrationV1(), - const _UserPreferencesMigrationV2(), - const _UserPreferencesMigrationV3(), - ]; + const _UserPreferencesMigrationV1(), + const _UserPreferencesMigrationV2(), + const _UserPreferencesMigrationV3(), + ]; static Future onUpgrade( UserPreferences preferences, @@ -52,8 +52,9 @@ class _UserPreferencesMigrationV1 extends UserPreferencesMigration { int? oldVersion, int newVersion, ) async { - final bool? crashReporting = preferences._sharedPreferences - .getBool(UserPreferences._TAG_CRASH_REPORTS); + final bool? crashReporting = preferences._sharedPreferences.getBool( + UserPreferences._TAG_CRASH_REPORTS, + ); if (crashReporting != null) { await preferences.setUserTracking(crashReporting); } diff --git a/packages/smooth_app/lib/data_models/preferences/user_preferences.dart b/packages/smooth_app/lib/data_models/preferences/user_preferences.dart index c53d047584..1d3802ca09 100644 --- a/packages/smooth_app/lib/data_models/preferences/user_preferences.dart +++ b/packages/smooth_app/lib/data_models/preferences/user_preferences.dart @@ -31,14 +31,14 @@ enum UserPictureSource { static UserPictureSource get defaultValue => UserPictureSource.SELECT; - static UserPictureSource fromString(final String tag) => - UserPictureSource.values - .firstWhere((final UserPictureSource source) => source.tag == tag); + static UserPictureSource fromString(final String tag) => UserPictureSource + .values + .firstWhere((final UserPictureSource source) => source.tag == tag); } class UserPreferences extends ChangeNotifier { UserPreferences._shared(final SharedPreferences sharedPreferences) - : _sharedPreferences = sharedPreferences { + : _sharedPreferences = sharedPreferences { onCrashReportingChanged = ValueNotifier(crashReports); onAnalyticsChanged = ValueNotifier(userTracking); _incrementAppLaunches(); @@ -174,7 +174,9 @@ class UserPreferences extends ChangeNotifier { final String importanceId, ) async { await _sharedPreferences.setString( - _getImportanceTag(attributeId), importanceId); + _getImportanceTag(attributeId), + importanceId, + ); notifyListeners(); } @@ -194,7 +196,9 @@ class UserPreferences extends ChangeNotifier { Future setContrastScheme(final String contrastLevel) async { await _sharedPreferences.setString( - _TAG_CURRENT_CONTRAST_MODE, contrastLevel); + _TAG_CURRENT_CONTRAST_MODE, + contrastLevel, + ); notifyListeners(); } @@ -291,7 +295,9 @@ class UserPreferences extends ChangeNotifier { Future setLastVisitedOnboardingPage(final OnboardingPage page) async { await _sharedPreferences.setInt( - _TAG_LAST_VISITED_ONBOARDING_PAGE, page.index); + _TAG_LAST_VISITED_ONBOARDING_PAGE, + page.index, + ); notifyListeners(); } @@ -304,12 +310,15 @@ class UserPreferences extends ChangeNotifier { } OnboardingPage get lastVisitedOnboardingPage { - final int? pageIndex = - _sharedPreferences.getInt(_TAG_LAST_VISITED_ONBOARDING_PAGE); + final int? pageIndex = _sharedPreferences.getInt( + _TAG_LAST_VISITED_ONBOARDING_PAGE, + ); return pageIndex == null ? OnboardingPage.NOT_STARTED - : OnboardingPage - .values[math.min(pageIndex, OnboardingPage.values.length - 1)]; + : OnboardingPage.values[math.min( + pageIndex, + OnboardingPage.values.length - 1, + )]; } Future incrementScanCount() async { @@ -333,11 +342,14 @@ class UserPreferences extends ChangeNotifier { /// Please use [ProductQuery.setLanguage] as interface Future setAppLanguageCode(String? languageCode) async { if (languageCode == null) { - await _sharedPreferences - .remove(UserPreferencesDevMode.userPreferencesAppLanguageCode); + await _sharedPreferences.remove( + UserPreferencesDevMode.userPreferencesAppLanguageCode, + ); } else { await setDevModeString( - UserPreferencesDevMode.userPreferencesAppLanguageCode, languageCode); + UserPreferencesDevMode.userPreferencesAppLanguageCode, + languageCode, + ); } notifyListeners(); } @@ -348,10 +360,7 @@ class UserPreferences extends ChangeNotifier { String _getFlagTag(final String key) => _TAG_PREFIX_FLAG + key; - Future setFlag( - final String key, - final bool? value, - ) async { + Future setFlag(final String key, final bool? value) async { value == null ? await _sharedPreferences.remove(_getFlagTag(key)) : await _sharedPreferences.setBool(_getFlagTag(key), value); @@ -419,9 +428,9 @@ class UserPreferences extends ChangeNotifier { AttributeGroup.ATTRIBUTE_GROUP_NUTRITIONAL_QUALITY; UserPictureSource get userPictureSource => UserPictureSource.fromString( - _sharedPreferences.getString(_TAG_USER_PICTURE_SOURCE) ?? - UserPictureSource.defaultValue.tag, - ); + _sharedPreferences.getString(_TAG_USER_PICTURE_SOURCE) ?? + UserPictureSource.defaultValue.tag, + ); Future setUserPictureSource(final UserPictureSource source) async { await _sharedPreferences.setString(_TAG_USER_PICTURE_SOURCE, source.tag); @@ -434,7 +443,9 @@ class UserPreferences extends ChangeNotifier { Future setUserKnowledgePanelOrder(final List source) async { await _sharedPreferences.setStringList( - _TAG_USER_KNOWLEDGE_PANEL_ORDER, source); + _TAG_USER_KNOWLEDGE_PANEL_ORDER, + source, + ); notifyListeners(); } @@ -503,19 +514,19 @@ class UserPreferences extends ChangeNotifier { ProductType get latestProductType => ProductType.fromOffTag( - _sharedPreferences.getString(_TAG_LATEST_PRODUCT_TYPE)) ?? + _sharedPreferences.getString(_TAG_LATEST_PRODUCT_TYPE), + ) ?? ProductType.food; set latestProductType(final ProductType value) => unawaited( - _sharedPreferences.setString( - _TAG_LATEST_PRODUCT_TYPE, - value.offTag, - ), - ); + _sharedPreferences.setString(_TAG_LATEST_PRODUCT_TYPE, value.offTag), + ); Future setSearchProductTypeFilter(final bool visible) async { await _sharedPreferences.setBool( - _TAG_SEARCH_SHOW_PRODUCT_TYPE_FILTER, visible); + _TAG_SEARCH_SHOW_PRODUCT_TYPE_FILTER, + visible, + ); notifyListeners(); } @@ -523,8 +534,9 @@ class UserPreferences extends ChangeNotifier { _sharedPreferences.getBool(_TAG_SEARCH_SHOW_PRODUCT_TYPE_FILTER) ?? false; List get productPageActions { - final List? actions = - _sharedPreferences.getStringList(_TAG_PRODUCT_PAGE_ACTIONS); + final List? actions = _sharedPreferences.getStringList( + _TAG_PRODUCT_PAGE_ACTIONS, + ); if (actions == null) { return ProductFooterActionBar.defaultOrder(); @@ -559,10 +571,7 @@ class UserPreferences extends ChangeNotifier { languages[language.code] = (languages[language.code] ?? 0) + 1; unawaited( - _sharedPreferences.setString( - _TAG_LANGUAGES_USAGE, - jsonEncode(languages), - ), + _sharedPreferences.setString(_TAG_LANGUAGES_USAGE, jsonEncode(languages)), ); } @@ -576,13 +585,8 @@ class UserPreferences extends ChangeNotifier { List get productPageTabs => _sharedPreferences.getStringList(_TAG_PRODUCT_PAGE_TABS) ?? []; - Future setProductPageTabs( - final List value, - ) async { - await _sharedPreferences.setStringList( - _TAG_PRODUCT_PAGE_TABS, - value, - ); + Future setProductPageTabs(final List value) async { + await _sharedPreferences.setStringList(_TAG_PRODUCT_PAGE_TABS, value); notifyListeners(); } } diff --git a/packages/smooth_app/lib/data_models/product_image_data.dart b/packages/smooth_app/lib/data_models/product_image_data.dart index 9aaa20fd22..cc2057ed3d 100644 --- a/packages/smooth_app/lib/data_models/product_image_data.dart +++ b/packages/smooth_app/lib/data_models/product_image_data.dart @@ -35,8 +35,10 @@ class ProductImageData { final String baseUrl = imageUrl.substring(0, sizeIndex + 1); final String number = size.number; - final String extension = - imageUrl.substring(extensionIndex, imageUrl.length); + final String extension = imageUrl.substring( + extensionIndex, + imageUrl.length, + ); return baseUrl + number + extension; } } diff --git a/packages/smooth_app/lib/data_models/product_list.dart b/packages/smooth_app/lib/data_models/product_list.dart index b0df3db691..ed98758c4a 100644 --- a/packages/smooth_app/lib/data_models/product_list.dart +++ b/packages/smooth_app/lib/data_models/product_list.dart @@ -58,14 +58,14 @@ class ProductList { required OpenFoodFactsCountry? country, required ProductType productType, }) : this._( - listType: ProductListType.HTTP_SEARCH_KEYWORDS, - parameters: keywords, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - country: country, - productType: productType, - ); + listType: ProductListType.HTTP_SEARCH_KEYWORDS, + parameters: keywords, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + country: country, + productType: productType, + ); ProductList.categorySearch( final String category, { @@ -75,14 +75,14 @@ class ProductList { required OpenFoodFactsCountry? country, required ProductType productType, }) : this._( - listType: ProductListType.HTTP_SEARCH_CATEGORY, - parameters: category, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - country: country, - productType: productType, - ); + listType: ProductListType.HTTP_SEARCH_CATEGORY, + parameters: category, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + country: country, + productType: productType, + ); ProductList.contributor( final String userId, { @@ -91,13 +91,13 @@ class ProductList { required OpenFoodFactsLanguage language, required ProductType productType, }) : this._( - listType: ProductListType.HTTP_USER_CONTRIBUTOR, - parameters: userId, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - productType: productType, - ); + listType: ProductListType.HTTP_USER_CONTRIBUTOR, + parameters: userId, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + productType: productType, + ); ProductList.informer( final String userId, { @@ -106,13 +106,13 @@ class ProductList { required OpenFoodFactsLanguage language, required ProductType productType, }) : this._( - listType: ProductListType.HTTP_USER_INFORMER, - parameters: userId, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - productType: productType, - ); + listType: ProductListType.HTTP_USER_INFORMER, + parameters: userId, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + productType: productType, + ); ProductList.photographer( final String userId, { @@ -121,13 +121,13 @@ class ProductList { required OpenFoodFactsLanguage language, required ProductType productType, }) : this._( - listType: ProductListType.HTTP_USER_PHOTOGRAPHER, - parameters: userId, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - productType: productType, - ); + listType: ProductListType.HTTP_USER_PHOTOGRAPHER, + parameters: userId, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + productType: productType, + ); ProductList.toBeCompleted( final String userId, { @@ -136,13 +136,13 @@ class ProductList { required OpenFoodFactsLanguage language, required ProductType productType, }) : this._( - listType: ProductListType.HTTP_USER_TO_BE_COMPLETED, - parameters: userId, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - productType: productType, - ); + listType: ProductListType.HTTP_USER_TO_BE_COMPLETED, + parameters: userId, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + productType: productType, + ); ProductList.allToBeCompleted({ required int pageSize, @@ -151,13 +151,13 @@ class ProductList { required OpenFoodFactsCountry? country, required ProductType productType, }) : this._( - listType: ProductListType.HTTP_ALL_TO_BE_COMPLETED, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - country: country, - productType: productType, - ); + listType: ProductListType.HTTP_ALL_TO_BE_COMPLETED, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + country: country, + productType: productType, + ); ProductList.history() : this._(listType: ProductListType.HISTORY); @@ -166,10 +166,7 @@ class ProductList { ProductList.scanHistory() : this._(listType: ProductListType.SCAN_HISTORY); ProductList.user(final String name) - : this._( - listType: ProductListType.USER, - parameters: name, - ); + : this._(listType: ProductListType.USER, parameters: name); final ProductListType listType; final String parameters; @@ -227,8 +224,9 @@ class ProductList { List getList() { final List result = []; - final Iterable barcodes = - _isReversed() ? _barcodes.reversed : _barcodes; + final Iterable barcodes = _isReversed() + ? _barcodes.reversed + : _barcodes; result.addAll(barcodes); return result; } diff --git a/packages/smooth_app/lib/data_models/product_list_supplier.dart b/packages/smooth_app/lib/data_models/product_list_supplier.dart index 3ae05b8548..6351bdae73 100644 --- a/packages/smooth_app/lib/data_models/product_list_supplier.dart +++ b/packages/smooth_app/lib/data_models/product_list_supplier.dart @@ -8,11 +8,7 @@ import 'package:smooth_app/query/paged_product_query.dart'; /// Asynchronously loads a [ProductList] with products abstract class ProductListSupplier { - ProductListSupplier( - this.productQuery, - this.localDatabase, { - this.timestamp, - }); + ProductListSupplier(this.productQuery, this.localDatabase, {this.timestamp}); final PagedProductQuery productQuery; final LocalDatabase localDatabase; @@ -48,9 +44,9 @@ abstract class ProductListSupplier { final PagedProductQuery productQuery, final LocalDatabase localDatabase, ) async { - final int? timestamp = await DaoProductList(localDatabase).getTimestamp( - productQuery.getProductList(), - ); + final int? timestamp = await DaoProductList( + localDatabase, + ).getTimestamp(productQuery.getProductList()); return timestamp == null ? QueryProductListSupplier(productQuery, localDatabase) : DatabaseProductListSupplier(productQuery, localDatabase, timestamp); diff --git a/packages/smooth_app/lib/data_models/product_preferences.dart b/packages/smooth_app/lib/data_models/product_preferences.dart index 346e6c54f3..8d8e411484 100644 --- a/packages/smooth_app/lib/data_models/product_preferences.dart +++ b/packages/smooth_app/lib/data_models/product_preferences.dart @@ -8,10 +8,7 @@ import 'package:smooth_app/helpers/app_helper.dart'; import 'package:smooth_app/query/product_query.dart'; class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { - ProductPreferences( - super.productPreferencesSelection, { - this.daoString, - }); + ProductPreferences(super.productPreferencesSelection, {this.daoString}); final DaoString? daoString; @@ -36,11 +33,13 @@ class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { static String _getImportanceAssetPath(final String languageCode) => AppHelper.getAssetPath( - 'assets/metadata/init_preferences_$languageCode.json'); + 'assets/metadata/init_preferences_$languageCode.json', + ); static String _getAttributeAssetPath(final String languageCode) => AppHelper.getAssetPath( - 'assets/metadata/init_attribute_groups_$languageCode.json'); + 'assets/metadata/init_attribute_groups_$languageCode.json', + ); /// Inits with the best available not-network references. /// @@ -48,8 +47,9 @@ class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { Future init(final AssetBundle assetBundle) async { // trying the local database with the latest download language... if (daoString != null) { - final String? latestLanguage = - await daoString!.get(_DAO_STRING_KEY_LANGUAGE); + final String? latestLanguage = await daoString!.get( + _DAO_STRING_KEY_LANGUAGE, + ); if (latestLanguage != null) { final bool successful = await _loadFromDatabase(latestLanguage); if (successful) { @@ -65,8 +65,9 @@ class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { Future refresh() async { final String lc = ProductQuery.getLanguage().code; if (daoString != null) { - final String? latestLanguage = - await daoString!.get(_DAO_STRING_KEY_LANGUAGE); + final String? latestLanguage = await daoString!.get( + _DAO_STRING_KEY_LANGUAGE, + ); if (latestLanguage == null || latestLanguage != lc) { // we restart from scratch // typical use-case: language change @@ -97,12 +98,15 @@ class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { try { const String languageCode = _DEFAULT_LANGUAGE_CODE; final String importanceAssetPath = _getImportanceAssetPath(languageCode); - final String attributeGroupAssetPath = - _getAttributeAssetPath(languageCode); - final String preferenceImportancesString = - await assetBundle.loadString(importanceAssetPath); - final String attributeGroupsString = - await assetBundle.loadString(attributeGroupAssetPath); + final String attributeGroupAssetPath = _getAttributeAssetPath( + languageCode, + ); + final String preferenceImportancesString = await assetBundle.loadString( + importanceAssetPath, + ); + final String attributeGroupsString = await assetBundle.loadString( + attributeGroupAssetPath, + ); _loadFromStrings( languageCode, preferenceImportancesString, @@ -121,21 +125,28 @@ class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { try { final bool differentLanguages; if (daoString != null) { - final String? latestLanguage = - await daoString!.get(_DAO_STRING_KEY_LANGUAGE); + final String? latestLanguage = await daoString!.get( + _DAO_STRING_KEY_LANGUAGE, + ); differentLanguages = latestLanguage != languageCode; } else { differentLanguages = true; } - final String importanceUrl = - AvailablePreferenceImportances.getUrl(languageCode); - final String attributeGroupUrl = - AvailableAttributeGroups.getUrl(languageCode); - final DownloadableString downloadableImportance = - DownloadableString(Uri.parse(importanceUrl), dao: daoString); + final String importanceUrl = AvailablePreferenceImportances.getUrl( + languageCode, + ); + final String attributeGroupUrl = AvailableAttributeGroups.getUrl( + languageCode, + ); + final DownloadableString downloadableImportance = DownloadableString( + Uri.parse(importanceUrl), + dao: daoString, + ); final bool differentImportance = await downloadableImportance.download(); - final DownloadableString downloadableAttributes = - DownloadableString(Uri.parse(attributeGroupUrl), dao: daoString); + final DownloadableString downloadableAttributes = DownloadableString( + Uri.parse(attributeGroupUrl), + dao: daoString, + ); final bool differentAttributes = await downloadableAttributes.download(); if (!(differentImportance || differentAttributes || differentLanguages)) { return false; @@ -159,14 +170,18 @@ class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { return false; } try { - final String importanceUrl = - AvailablePreferenceImportances.getUrl(languageCode); - final String attributeGroupUrl = - AvailableAttributeGroups.getUrl(languageCode); - final String? preferenceImportancesString = - await daoString!.get(importanceUrl); - final String? attributeGroupsString = - await daoString!.get(attributeGroupUrl); + final String importanceUrl = AvailablePreferenceImportances.getUrl( + languageCode, + ); + final String attributeGroupUrl = AvailableAttributeGroups.getUrl( + languageCode, + ); + final String? preferenceImportancesString = await daoString!.get( + importanceUrl, + ); + final String? attributeGroupsString = await daoString!.get( + attributeGroupUrl, + ); if (preferenceImportancesString == null && attributeGroupsString == null) { return false; @@ -192,9 +207,9 @@ class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { ) { final AvailableProductPreferences myAvailableProductPreferences = AvailableProductPreferences.loadFromJSONStrings( - preferenceImportancesString: preferenceImportancesString, - attributeGroupsString: attributeGroupsString, - ); + preferenceImportancesString: preferenceImportancesString, + attributeGroupsString: attributeGroupsString, + ); availableProductPreferences = myAvailableProductPreferences; } diff --git a/packages/smooth_app/lib/data_models/query_product_list_supplier.dart b/packages/smooth_app/lib/data_models/query_product_list_supplier.dart index 3c3a8f4c35..02ace29b57 100644 --- a/packages/smooth_app/lib/data_models/query_product_list_supplier.dart +++ b/packages/smooth_app/lib/data_models/query_product_list_supplier.dart @@ -6,10 +6,7 @@ import 'package:smooth_app/database/dao_product_list.dart'; /// [ProductListSupplier] with a server query flavor class QueryProductListSupplier extends ProductListSupplier { - QueryProductListSupplier( - super.productQuery, - super.localDatabase, - ); + QueryProductListSupplier(super.productQuery, super.localDatabase); @override Future asyncLoad() async { diff --git a/packages/smooth_app/lib/data_models/up_to_date_changes.dart b/packages/smooth_app/lib/data_models/up_to_date_changes.dart index 938bef927b..429af9b31f 100644 --- a/packages/smooth_app/lib/data_models/up_to_date_changes.dart +++ b/packages/smooth_app/lib/data_models/up_to_date_changes.dart @@ -6,7 +6,7 @@ import 'package:smooth_app/database/local_database.dart'; /// Sequence of minimalist product changes. class UpToDateChanges { UpToDateChanges(this.localDatabase) - : _daoTransientProduct = DaoTransientOperation(localDatabase); + : _daoTransientProduct = DaoTransientOperation(localDatabase); final LocalDatabase localDatabase; @@ -23,8 +23,9 @@ class UpToDateChanges { Product getUpToDateProduct(Product product) { final String barcode = product.barcode!; - final Iterable sortedOperations = - getSortedOperations(barcode); + final Iterable sortedOperations = getSortedOperations( + barcode, + ); for (final TransientOperation operation in sortedOperations) { final Product minimalistProduct = operation.product; product = _overwrite(product, minimalistProduct); @@ -130,24 +131,16 @@ class UpToDateChanges { String? emptyMeansNull(final String value) => value.isEmpty ? null : value; if (change.imageFrontUrl != null) { - initial.imageFrontUrl = emptyMeansNull( - change.imageFrontUrl!, - ); + initial.imageFrontUrl = emptyMeansNull(change.imageFrontUrl!); } if (change.imageIngredientsUrl != null) { - initial.imageIngredientsUrl = emptyMeansNull( - change.imageIngredientsUrl!, - ); + initial.imageIngredientsUrl = emptyMeansNull(change.imageIngredientsUrl!); } if (change.imageNutritionUrl != null) { - initial.imageNutritionUrl = emptyMeansNull( - change.imageNutritionUrl!, - ); + initial.imageNutritionUrl = emptyMeansNull(change.imageNutritionUrl!); } if (change.imagePackagingUrl != null) { - initial.imagePackagingUrl = emptyMeansNull( - change.imagePackagingUrl!, - ); + initial.imagePackagingUrl = emptyMeansNull(change.imagePackagingUrl!); } if (change.images != null && change.images!.isNotEmpty) { initial.images ??= []; diff --git a/packages/smooth_app/lib/data_models/up_to_date_product_list_mixin.dart b/packages/smooth_app/lib/data_models/up_to_date_product_list_mixin.dart index eda77dc288..0df47e3db3 100644 --- a/packages/smooth_app/lib/data_models/up_to_date_product_list_mixin.dart +++ b/packages/smooth_app/lib/data_models/up_to_date_product_list_mixin.dart @@ -48,8 +48,8 @@ mixin UpToDateProductListMixin on State { /// To be used in the `build` method, after a call to /// `context.watch()`. void refreshUpToDate() { - final List barcodes = - _localDatabase.upToDateProductList.getLocalUpToDate(_productList); + final List barcodes = _localDatabase.upToDateProductList + .getLocalUpToDate(_productList); _productList.set(barcodes); } } diff --git a/packages/smooth_app/lib/data_models/up_to_date_product_list_provider.dart b/packages/smooth_app/lib/data_models/up_to_date_product_list_provider.dart index 422c54a86a..32b39ad1fd 100644 --- a/packages/smooth_app/lib/data_models/up_to_date_product_list_provider.dart +++ b/packages/smooth_app/lib/data_models/up_to_date_product_list_provider.dart @@ -38,10 +38,7 @@ class UpToDateProductListProvider { String _getKey(final ProductList productList) => DaoProductList.getKey(productList); - void setLocalUpToDate( - final String key, - final List barcodes, - ) { + void setLocalUpToDate(final String key, final List barcodes) { if (!_interest.containsKey(key)) { return; } diff --git a/packages/smooth_app/lib/data_models/up_to_date_product_provider.dart b/packages/smooth_app/lib/data_models/up_to_date_product_provider.dart index c2c35372a4..b2a3ae4c94 100644 --- a/packages/smooth_app/lib/data_models/up_to_date_product_provider.dart +++ b/packages/smooth_app/lib/data_models/up_to_date_product_provider.dart @@ -9,7 +9,7 @@ import 'package:smooth_app/database/local_database.dart'; /// Provider that reflects all the user changes on [Product]s. class UpToDateProductProvider { UpToDateProductProvider(this.localDatabase) - : _changes = UpToDateChanges(localDatabase); + : _changes = UpToDateChanges(localDatabase); final LocalDatabase localDatabase; @@ -74,9 +74,7 @@ class UpToDateProductProvider { } /// Typical use-case: a product list page is refreshed through a pull-gesture. - void setLatestDownloadedProducts( - final Iterable products, - ) { + void setLatestDownloadedProducts(final Iterable products) { if (_interest.isEmpty) { return; } @@ -106,8 +104,8 @@ class UpToDateProductProvider { // TODO(monsieurtanuki): move code to off-dart Product? Product copy(final Product source) => Product.fromJson( - jsonDecode(jsonEncode(source.toJson())) as Map, - ); + jsonDecode(jsonEncode(source.toJson())) as Map, + ); /// Adds a minimalist local change to pending ones. Future addChange( @@ -122,8 +120,8 @@ class UpToDateProductProvider { /// Returns the local pending change ids related to a [barcode]. Iterable? getSortedChangeOperations( - final String barcode) => - _changes.getSortedOperations(barcode); + final String barcode, + ) => _changes.getSortedOperations(barcode); /// Closes a single operation, successful or failed. void terminate(final String operationKey) { diff --git a/packages/smooth_app/lib/data_models/user_management_provider.dart b/packages/smooth_app/lib/data_models/user_management_provider.dart index 3eca477c8d..fbb93e9fa2 100644 --- a/packages/smooth_app/lib/data_models/user_management_provider.dart +++ b/packages/smooth_app/lib/data_models/user_management_provider.dart @@ -45,8 +45,10 @@ class UserManagementProvider with ChangeNotifier { /// Mounts already stored credentials, called at app startup /// /// We can use optional parameters to mock in tests - static Future mountCredentials( - {String? userId, String? password}) async { + static Future mountCredentials({ + String? userId, + String? password, + }) async { String? effectiveUserId; String? effectivePassword; String? effectiveCookie; @@ -87,19 +89,10 @@ class UserManagementProvider with ChangeNotifier { /// Saves user to storage Future putUser(User user) async { OpenFoodAPIConfiguration.globalUser = user; - await DaoSecuredString.put( - key: _USER_ID, - value: user.userId, - ); - await DaoSecuredString.put( - key: _PASSWORD, - value: user.password, - ); + await DaoSecuredString.put(key: _USER_ID, value: user.userId); + await DaoSecuredString.put(key: _PASSWORD, value: user.password); if (user.cookie != null) { - await DaoSecuredString.put( - key: _COOKIE, - value: user.cookie!, - ); + await DaoSecuredString.put(key: _COOKIE, value: user.cookie!); } else { DaoSecuredString.remove(key: _COOKIE); } @@ -114,10 +107,7 @@ class UserManagementProvider with ChangeNotifier { } final User user = ProductQuery.getWriteUser(); final LoginResult loginResult = await LoginResult.getLoginResult( - User( - userId: user.userId, - password: user.password, - ), + User(userId: user.userId, password: user.password), preferences, ); diff --git a/packages/smooth_app/lib/database/bulk_manager.dart b/packages/smooth_app/lib/database/bulk_manager.dart index 11b1932246..dda70200d8 100644 --- a/packages/smooth_app/lib/database/bulk_manager.dart +++ b/packages/smooth_app/lib/database/bulk_manager.dart @@ -36,7 +36,8 @@ class BulkManager { } if (parameters.length % numCols != 0) { throw Exception( - 'Parameter list size (${parameters.length}) cannot be divided by $numCols'); + 'Parameter list size (${parameters.length}) cannot be divided by $numCols', + ); } final String variables = '?${',?' * (columnNames.length - 1)}'; final int maxSlice = (SQLITE_MAX_VARIABLE_NUMBER ~/ numCols) * numCols; diff --git a/packages/smooth_app/lib/database/dao_osm_location.dart b/packages/smooth_app/lib/database/dao_osm_location.dart index a3f6ccae4a..1ec765cbe2 100644 --- a/packages/smooth_app/lib/database/dao_osm_location.dart +++ b/packages/smooth_app/lib/database/dao_osm_location.dart @@ -46,30 +46,32 @@ class DaoOsmLocation extends AbstractSqlDao { final int newVersion, ) async { if (oldVersion < 6) { - await db.execute('create table $_table(' - ' $_columnId INT NOT NULL' - ',$_columnType TEXT NOT NULL' - ',$_columnLongitude REAL NOT NULL' - ',$_columnLatitude REAL NOT NULL' - ',$_columnName TEXT' - ',$_columnStreet TEXT' - ',$_columnCity TEXT' - ',$_columnPostCode TEXT' - ',$_columnCountry TEXT' - ',$_columnCountryCode TEXT' - ',$_columnLastAccess INT NOT NULL' - // cf. https://www.sqlite.org/lang_conflict.html - ',PRIMARY KEY($_columnId,$_columnType) on conflict replace' - ')'); + await db.execute( + 'create table $_table(' + ' $_columnId INT NOT NULL' + ',$_columnType TEXT NOT NULL' + ',$_columnLongitude REAL NOT NULL' + ',$_columnLatitude REAL NOT NULL' + ',$_columnName TEXT' + ',$_columnStreet TEXT' + ',$_columnCity TEXT' + ',$_columnPostCode TEXT' + ',$_columnCountry TEXT' + ',$_columnCountryCode TEXT' + ',$_columnLastAccess INT NOT NULL' + // cf. https://www.sqlite.org/lang_conflict.html + ',PRIMARY KEY($_columnId,$_columnType) on conflict replace' + ')', + ); } /// Not brilliant, but for historical reasons we have to catch that here. bool isDuplicateColumnException( final DatabaseException e, final String column, - ) => - e.toString().startsWith( - 'DatabaseException(duplicate column name: $column (code 1 SQLITE_ERROR'); + ) => e.toString().startsWith( + 'DatabaseException(duplicate column name: $column (code 1 SQLITE_ERROR', + ); if (oldVersion < 7) { try { @@ -80,8 +82,9 @@ class DaoOsmLocation extends AbstractSqlDao { } } try { - await db - .execute('alter table $_table add column $_columnOsmValue TEXT'); + await db.execute( + 'alter table $_table add column $_columnOsmValue TEXT', + ); } on DatabaseException catch (e) { if (!isDuplicateColumnException(e, _columnOsmValue)) { rethrow; @@ -101,12 +104,8 @@ class DaoOsmLocation extends AbstractSqlDao { /// Returns all the [OsmLocation]s, ordered by descending last access. Future> getAll() async { final List result = []; - final List> queryResults = - await localDatabase.database.query( - _table, - columns: _columns, - orderBy: '$_columnLastAccess DESC', - ); + final List> queryResults = await localDatabase.database + .query(_table, columns: _columns, orderBy: '$_columnLastAccess DESC'); for (final Map row in queryResults) { final OsmLocation? item = _getItemFromQueryResult(row); if (item != null) { @@ -117,28 +116,26 @@ class DaoOsmLocation extends AbstractSqlDao { } Future put(final OsmLocation osmLocation) async => - localDatabase.database.insert( - _table, - { - _columnId: osmLocation.osmId, - _columnType: osmLocation.osmType.offTag, - _columnLongitude: osmLocation.longitude, - _columnLatitude: osmLocation.latitude, - _columnName: osmLocation.name, - _columnStreet: osmLocation.street, - _columnCity: osmLocation.city, - _columnPostCode: osmLocation.postcode, - _columnCountry: osmLocation.country, - _columnCountryCode: osmLocation.countryCode, - _columnOsmKey: osmLocation.osmKey, - _columnOsmValue: osmLocation.osmValue, - _columnLastAccess: LocalDatabase.nowInMillis(), - }, - ); + localDatabase.database.insert(_table, { + _columnId: osmLocation.osmId, + _columnType: osmLocation.osmType.offTag, + _columnLongitude: osmLocation.longitude, + _columnLatitude: osmLocation.latitude, + _columnName: osmLocation.name, + _columnStreet: osmLocation.street, + _columnCity: osmLocation.city, + _columnPostCode: osmLocation.postcode, + _columnCountry: osmLocation.country, + _columnCountryCode: osmLocation.countryCode, + _columnOsmKey: osmLocation.osmKey, + _columnOsmValue: osmLocation.osmValue, + _columnLastAccess: LocalDatabase.nowInMillis(), + }); OsmLocation? _getItemFromQueryResult(final Map row) { - final LocationOSMType? type = - LocationOSMType.fromOffTag(row[_columnType] as String); + final LocationOSMType? type = LocationOSMType.fromOffTag( + row[_columnType] as String, + ); if (type == null) { // very very unlikely return null; diff --git a/packages/smooth_app/lib/database/dao_product.dart b/packages/smooth_app/lib/database/dao_product.dart index cd97aa971a..d80757d9c5 100644 --- a/packages/smooth_app/lib/database/dao_product.dart +++ b/packages/smooth_app/lib/database/dao_product.dart @@ -35,28 +35,32 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { final int newVersion, ) async { if (oldVersion < 2) { - await db.execute('create table $_TABLE_PRODUCT(' - // cf. https://www.sqlite.org/lang_conflict.html - '$_TABLE_PRODUCT_COLUMN_BARCODE TEXT PRIMARY KEY on conflict replace' - ',$_TABLE_PRODUCT_COLUMN_GZIPPED_JSON BLOB NOT NULL' - ',$_TABLE_PRODUCT_COLUMN_LAST_UPDATE INT NOT NULL' - ')'); + await db.execute( + 'create table $_TABLE_PRODUCT(' + // cf. https://www.sqlite.org/lang_conflict.html + '$_TABLE_PRODUCT_COLUMN_BARCODE TEXT PRIMARY KEY on conflict replace' + ',$_TABLE_PRODUCT_COLUMN_GZIPPED_JSON BLOB NOT NULL' + ',$_TABLE_PRODUCT_COLUMN_LAST_UPDATE INT NOT NULL' + ')', + ); } if (oldVersion < 4) { - await db.execute('alter table $_TABLE_PRODUCT add column ' - '$_TABLE_PRODUCT_COLUMN_LANGUAGE TEXT'); + await db.execute( + 'alter table $_TABLE_PRODUCT add column ' + '$_TABLE_PRODUCT_COLUMN_LANGUAGE TEXT', + ); } } /// Returns the [Product] that matches the [barcode], or null. Future get(final String barcode) async { - final List> queryResults = - await localDatabase.database.query( - _TABLE_PRODUCT, - columns: _columns, - where: '$_TABLE_PRODUCT_COLUMN_BARCODE = ?', - whereArgs: [barcode], - ); + final List> queryResults = await localDatabase.database + .query( + _TABLE_PRODUCT, + columns: _columns, + where: '$_TABLE_PRODUCT_COLUMN_BARCODE = ?', + whereArgs: [barcode], + ); // O or 1 row expected for (final Map row in queryResults) { return _getProductFromQueryResult(row); @@ -70,20 +74,23 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { if (barcodes.isEmpty) { return result; } - for (int start = 0; - start < barcodes.length; - start += BulkManager.SQLITE_MAX_VARIABLE_NUMBER) { + for ( + int start = 0; + start < barcodes.length; + start += BulkManager.SQLITE_MAX_VARIABLE_NUMBER + ) { final int size = min( barcodes.length - start, BulkManager.SQLITE_MAX_VARIABLE_NUMBER, ); - final List> queryResults = - await localDatabase.database.query( - _TABLE_PRODUCT, - columns: _columns, - where: '$_TABLE_PRODUCT_COLUMN_BARCODE in(? ${',?' * (size - 1)})', - whereArgs: barcodes.sublist(start, start + size), - ); + final List> queryResults = await localDatabase + .database + .query( + _TABLE_PRODUCT, + columns: _columns, + where: '$_TABLE_PRODUCT_COLUMN_BARCODE in(? ${',?' * (size - 1)})', + whereArgs: barcodes.sublist(start, start + size), + ); for (final Map row in queryResults) { result[row[_TABLE_PRODUCT_COLUMN_BARCODE] as String] = _getProductFromQueryResult(row); @@ -100,20 +107,23 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { if (barcodes.isEmpty) { return result; } - for (int start = 0; - start < barcodes.length; - start += BulkManager.SQLITE_MAX_VARIABLE_NUMBER) { + for ( + int start = 0; + start < barcodes.length; + start += BulkManager.SQLITE_MAX_VARIABLE_NUMBER + ) { final int size = min( barcodes.length - start, BulkManager.SQLITE_MAX_VARIABLE_NUMBER, ); - final List> queryResults = - await localDatabase.database.query( - _TABLE_PRODUCT, - columns: _columns, - where: '$_TABLE_PRODUCT_COLUMN_BARCODE in(? ${',?' * (size - 1)})', - whereArgs: barcodes.sublist(start, start + size), - ); + final List> queryResults = await localDatabase + .database + .query( + _TABLE_PRODUCT, + columns: _columns, + where: '$_TABLE_PRODUCT_COLUMN_BARCODE in(? ${',?' * (size - 1)})', + whereArgs: barcodes.sublist(start, start + size), + ); for (final Map row in queryResults) { final Product product = _getProductFromQueryResult(row); final ProductType productType = product.productType ?? ProductType.food; @@ -133,11 +143,8 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { final String Function(Product) splitFunction, ) async { final Map> result = >{}; - final List> queryResults = - await localDatabase.database.query( - _TABLE_PRODUCT, - columns: _columns, - ); + final List> queryResults = await localDatabase.database + .query(_TABLE_PRODUCT, columns: _columns); for (final Map row in queryResults) { final Product product = _getProductFromQueryResult(row); final String splitValue = splitFunction(product); @@ -155,12 +162,7 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { final Product product, final OpenFoodFactsLanguage language, { required final ProductType productType, - }) async => - putAll( - [product], - language, - productType: productType, - ); + }) async => putAll([product], language, productType: productType); /// Replaces products in database Future putAll( @@ -174,23 +176,18 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { product.productType ??= productType; } await localDatabase.database.transaction( - (final Transaction transaction) async => _bulkReplaceLoop( - transaction, - products, - language, - ), + (final Transaction transaction) async => + _bulkReplaceLoop(transaction, products, language), ); } Future> getAllKeys() async { final List result = []; - final List> queryResults = - await localDatabase.database.query( - _TABLE_PRODUCT, - columns: [ - _TABLE_PRODUCT_COLUMN_BARCODE, - ], - ); + final List> queryResults = await localDatabase.database + .query( + _TABLE_PRODUCT, + columns: [_TABLE_PRODUCT_COLUMN_BARCODE], + ); if (queryResults.isEmpty) { return result; } @@ -271,19 +268,20 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { if (!verbose) { return; } - final List> queryResults = - await localDatabase.database.rawQuery( - 'select' - ' $_TABLE_PRODUCT_COLUMN_BARCODE' - ', length($_TABLE_PRODUCT_COLUMN_GZIPPED_JSON) as mylength' - ' from $_TABLE_PRODUCT', - ); + final List> queryResults = await localDatabase.database + .rawQuery( + 'select' + ' $_TABLE_PRODUCT_COLUMN_BARCODE' + ', length($_TABLE_PRODUCT_COLUMN_GZIPPED_JSON) as mylength' + ' from $_TABLE_PRODUCT', + ); debugPrint('Product by product'); debugPrint('barcode;gzipped;string;factor'); for (final Map row in queryResults) { final String barcode = row[_TABLE_PRODUCT_COLUMN_BARCODE] as String; - final int asString = - utf8.encode(jsonEncode(map[barcode]!.toJson())).length; + final int asString = utf8 + .encode(jsonEncode(map[barcode]!.toJson())) + .length; final int asZipped = row['mylength'] as int; final double factor = (asString * 1.0) / asZipped; debugPrint('$barcode;$asZipped;$asString;$factor'); @@ -293,11 +291,8 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { /// Get the total number of products in the database Future> getTotalNoOfProducts() async { final Map result = {}; - final List> queryResults = - await localDatabase.database.query( - _TABLE_PRODUCT, - columns: _columns, - ); + final List> queryResults = await localDatabase.database + .query(_TABLE_PRODUCT, columns: _columns); for (final Map row in queryResults) { final Product product = _getProductFromQueryResult(row); final ProductType productType = product.productType ?? ProductType.food; @@ -349,7 +344,8 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { const String tableJoin = 'p.$_TABLE_PRODUCT_COLUMN_BARCODE = a.${DaoProductLastAccess.COLUMN_BARCODE}'; - final String languageCondition = ' (' + final String languageCondition = + ' (' 'p.$_TABLE_PRODUCT_COLUMN_LANGUAGE is null ' "or p.$_TABLE_PRODUCT_COLUMN_LANGUAGE != '${language.offTag}'" ') '; @@ -385,11 +381,8 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { for (final String query in queries) { // optimization: using a cursor, as we don't want all the rows, // and we don't know how many rows we'll need. - final QueryCursor queryCursor = - await localDatabase.database.rawQueryCursor( - query, - null, - ); + final QueryCursor queryCursor = await localDatabase.database + .rawQueryCursor(query, null); while (await queryCursor.moveNext()) { final Product product = _getProductFromQueryResult(queryCursor.current); final String barcode = product.barcode!; @@ -416,7 +409,7 @@ class DaoProduct extends AbstractSqlDao implements BulkDeletable { /// with a language null or different from the current app language", and use /// the same mechanism as "switch language and refresh products accordingly". Future clearAllLanguages() async => localDatabase.database.update( - _TABLE_PRODUCT, - {_TABLE_PRODUCT_COLUMN_LANGUAGE: null}, - ); + _TABLE_PRODUCT, + {_TABLE_PRODUCT_COLUMN_LANGUAGE: null}, + ); } diff --git a/packages/smooth_app/lib/database/dao_product_last_access.dart b/packages/smooth_app/lib/database/dao_product_last_access.dart index 98f38809ba..72e1884b39 100644 --- a/packages/smooth_app/lib/database/dao_product_last_access.dart +++ b/packages/smooth_app/lib/database/dao_product_last_access.dart @@ -17,11 +17,13 @@ class DaoProductLastAccess extends AbstractSqlDao { final int newVersion, ) async { if (oldVersion < 5) { - await db.execute('create table $TABLE(' - // cf. https://www.sqlite.org/lang_conflict.html - '$COLUMN_BARCODE TEXT PRIMARY KEY on conflict replace' - ',$COLUMN_LAST_ACCESS INT NOT NULL' - ')'); + await db.execute( + 'create table $TABLE(' + // cf. https://www.sqlite.org/lang_conflict.html + '$COLUMN_BARCODE TEXT PRIMARY KEY on conflict replace' + ',$COLUMN_LAST_ACCESS INT NOT NULL' + ')', + ); } } @@ -29,10 +31,7 @@ class DaoProductLastAccess extends AbstractSqlDao { localDatabase.database.rawInsert( 'insert into $TABLE($COLUMN_BARCODE, $COLUMN_LAST_ACCESS) ' 'values(?, ?)', - [ - barcode, - LocalDatabase.nowInMillis(), - ], + [barcode, LocalDatabase.nowInMillis()], ); /// Delete all items from the database diff --git a/packages/smooth_app/lib/database/dao_product_list.dart b/packages/smooth_app/lib/database/dao_product_list.dart index 2ce0883b9c..e1a0cc1edb 100644 --- a/packages/smooth_app/lib/database/dao_product_list.dart +++ b/packages/smooth_app/lib/database/dao_product_list.dart @@ -13,25 +13,17 @@ const int _uselessTotalSizeValue = 0; /// An immutable barcode list; e.g. my search yesterday about "Nutella" class _BarcodeList { - const _BarcodeList( - this.timestamp, - this.barcodes, - this.totalSize, - ); + const _BarcodeList(this.timestamp, this.barcodes, this.totalSize); _BarcodeList.now(final List barcodes) - : this( - LocalDatabase.nowInMillis(), - barcodes, - _uselessTotalSizeValue, - ); + : this(LocalDatabase.nowInMillis(), barcodes, _uselessTotalSizeValue); _BarcodeList.fromProductList(final ProductList productList) - : this( - LocalDatabase.nowInMillis(), - productList.barcodes, - productList.totalSize, - ); + : this( + LocalDatabase.nowInMillis(), + productList.barcodes, + productList.totalSize, + ); /// Freshness indicator: last time the list was updated. /// @@ -186,10 +178,7 @@ class DaoProductList extends AbstractDao { /// One barcode duplicate is potentially removed: /// * If the barcode was already there, it's moved to the end of the list. /// * If the barcode wasn't there, it's added to the end of the list. - Future push( - final ProductList productList, - final String barcode, - ) async { + Future push(final ProductList productList, final String barcode) async { final _BarcodeList? list = await _get(productList); final List barcodes; if (list == null) { diff --git a/packages/smooth_app/lib/database/dao_work_barcode.dart b/packages/smooth_app/lib/database/dao_work_barcode.dart index 93d52afac8..6ef0dd66e2 100644 --- a/packages/smooth_app/lib/database/dao_work_barcode.dart +++ b/packages/smooth_app/lib/database/dao_work_barcode.dart @@ -23,24 +23,26 @@ class DaoWorkBarcode extends AbstractSqlDao { final int newVersion, ) async { if (oldVersion < 3) { - await db.execute('create table $_table(' - '$_columnWork TEXT NOT NULL' - ',$_columnBarcode TEXT NOT NULL' - // cf. https://www.sqlite.org/lang_conflict.html - ',PRIMARY KEY($_columnWork,$_columnBarcode) on conflict replace' - ')'); + await db.execute( + 'create table $_table(' + '$_columnWork TEXT NOT NULL' + ',$_columnBarcode TEXT NOT NULL' + // cf. https://www.sqlite.org/lang_conflict.html + ',PRIMARY KEY($_columnWork,$_columnBarcode) on conflict replace' + ')', + ); } } /// Returns the number of barcodes for that work. Future getCount(final String work) async { - final List> queryResults = - await localDatabase.database.query( - _table, - columns: ['count(1) as my_count'], - where: '$_columnWork = ?', - whereArgs: [work], - ); + final List> queryResults = await localDatabase.database + .query( + _table, + columns: ['count(1) as my_count'], + where: '$_columnWork = ?', + whereArgs: [work], + ); for (final Map row in queryResults) { return row['my_count'] as int; } @@ -53,14 +55,14 @@ class DaoWorkBarcode extends AbstractSqlDao { final int pageSize, ) async { final List result = []; - final List> queryResults = - await localDatabase.database.query( - _table, - columns: [_columnBarcode], - where: '$_columnWork = ?', - whereArgs: [work], - limit: pageSize, - ); + final List> queryResults = await localDatabase.database + .query( + _table, + columns: [_columnBarcode], + where: '$_columnWork = ?', + whereArgs: [work], + limit: pageSize, + ); for (final Map row in queryResults) { result.add(row[_columnBarcode] as String); } @@ -71,11 +73,10 @@ class DaoWorkBarcode extends AbstractSqlDao { Future putAll( final String work, final Iterable barcodes, - ) async => - localDatabase.database.transaction( - (final Transaction transaction) async => - _bulkInsert(transaction, work, barcodes), - ); + ) async => localDatabase.database.transaction( + (final Transaction transaction) async => + _bulkInsert(transaction, work, barcodes), + ); /// Returns the number of inserted rows by optimized bulk insert. Future _bulkInsert( @@ -117,12 +118,8 @@ class DaoWorkBarcode extends AbstractSqlDao { /// Deletes all barcodes for a given work. /// /// Returns the number of rows deleted. - Future deleteWork(final String work) async => - localDatabase.database.delete( - _table, - where: '$_columnWork = ?', - whereArgs: [work], - ); + Future deleteWork(final String work) async => localDatabase.database + .delete(_table, where: '$_columnWork = ?', whereArgs: [work]); /// Deletes all barcodes for a given work. /// @@ -130,11 +127,10 @@ class DaoWorkBarcode extends AbstractSqlDao { Future deleteBarcodes( final String work, final Iterable barcodes, - ) async => - localDatabase.database.transaction( - (final Transaction transaction) async => - _bulkDelete(transaction, work, barcodes), - ); + ) async => localDatabase.database.transaction( + (final Transaction transaction) async => + _bulkDelete(transaction, work, barcodes), + ); /// Returns the number of deleted rows by optimized bulk delete. Future _bulkDelete( @@ -154,7 +150,8 @@ class DaoWorkBarcode extends AbstractSqlDao { } final int deleted = await databaseExecutor.delete( _table, - where: '$_columnWork = ? ' + where: + '$_columnWork = ? ' 'and $_columnBarcode in(?${',?' * (parameters.length - 2)})', whereArgs: parameters, ); diff --git a/packages/smooth_app/lib/database/transient_file.dart b/packages/smooth_app/lib/database/transient_file.dart index 4174c4876c..b0667645fb 100644 --- a/packages/smooth_app/lib/database/transient_file.dart +++ b/packages/smooth_app/lib/database/transient_file.dart @@ -22,8 +22,8 @@ class TransientFile { this.barcode, this.language, [ this.uploadedDate, - ]) : imageField = productImageData.imageField, - url = productImageData.imageUrl; + ]) : imageField = productImageData.imageField, + url = productImageData.imageUrl; factory TransientFile.fromProduct( final Product product, @@ -60,18 +60,13 @@ class TransientFile { static final Map _transientFiles = {}; /// Stores locally [file] as a transient image for [imageField] and [barcode]. - void putImage( - final LocalDatabase localDatabase, - final File file, - ) { + void putImage(final LocalDatabase localDatabase, final File file) { _transientFiles[_getImageKey()] = file.path; localDatabase.notifyListeners(); } /// Removes the current transient image for [imageField] and [barcode]. - void removeImage( - final LocalDatabase localDatabase, - ) { + void removeImage(final LocalDatabase localDatabase) { _transientFiles.remove(_getImageKey()); localDatabase.notifyListeners(); } @@ -93,8 +88,7 @@ class TransientFile { static String _getImageKeyPrefix( final ImageField imageField, final String barcode, - ) => - '$barcode;$imageField;'; + ) => '$barcode;$imageField;'; /// Returns a way to display the image, either locally or from the server. ImageProvider? getImageProvider() { diff --git a/packages/smooth_app/lib/generic_lib/animations/smooth_reveal_animation.dart b/packages/smooth_app/lib/generic_lib/animations/smooth_reveal_animation.dart index a24b9fe04a..e2fe1509ab 100644 --- a/packages/smooth_app/lib/generic_lib/animations/smooth_reveal_animation.dart +++ b/packages/smooth_app/lib/generic_lib/animations/smooth_reveal_animation.dart @@ -3,12 +3,13 @@ import 'dart:async'; import 'package:flutter/material.dart'; class SmoothRevealAnimation extends StatefulWidget { - const SmoothRevealAnimation( - {required this.child, - this.delay = 0, - this.animationCurve = Curves.ease, - this.animationDuration = 400, - this.startOffset = const Offset(1.0, 0.0)}); + const SmoothRevealAnimation({ + required this.child, + this.delay = 0, + this.animationCurve = Curves.ease, + this.animationDuration = 400, + this.startOffset = const Offset(1.0, 0.0), + }); final Widget child; final int delay; @@ -30,13 +31,17 @@ class _SmoothRevealAnimationState extends State void initState() { super.initState(); _animationController = AnimationController( - vsync: this, - duration: Duration(milliseconds: widget.animationDuration)); + vsync: this, + duration: Duration(milliseconds: widget.animationDuration), + ); final CurvedAnimation curve = CurvedAnimation( - curve: widget.animationCurve, parent: _animationController); - _animationOffset = - Tween(begin: widget.startOffset, end: Offset.zero) - .animate(curve); + curve: widget.animationCurve, + parent: _animationController, + ); + _animationOffset = Tween( + begin: widget.startOffset, + end: Offset.zero, + ).animate(curve); _animationTimer = Timer(Duration(milliseconds: widget.delay), () { _animationController.forward(); @@ -54,10 +59,7 @@ class _SmoothRevealAnimationState extends State Widget build(BuildContext context) { return FadeTransition( opacity: _animationController, - child: SlideTransition( - position: _animationOffset, - child: widget.child, - ), + child: SlideTransition(position: _animationOffset, child: widget.child), ); } } diff --git a/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_bottom_sheet.dart b/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_bottom_sheet.dart index 38b3d478ee..c623caec3c 100644 --- a/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_bottom_sheet.dart +++ b/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_bottom_sheet.dart @@ -23,18 +23,11 @@ Future showSmoothModalSheet({ // We can't provide a null value to a [BoxConstraints] constructor if (minHeight != null && maxHeight != null) { - constraints = BoxConstraints( - minHeight: minHeight, - maxHeight: maxHeight, - ); + constraints = BoxConstraints(minHeight: minHeight, maxHeight: maxHeight); } else if (minHeight != null) { - constraints = BoxConstraints( - minHeight: minHeight, - ); + constraints = BoxConstraints(minHeight: minHeight); } else if (maxHeight != null) { - constraints = BoxConstraints( - maxHeight: maxHeight, - ); + constraints = BoxConstraints(maxHeight: maxHeight); } return showModalBottomSheet( @@ -67,10 +60,7 @@ Future showSmoothModalSheetForTextField({ borderRadius: const BorderRadius.vertical(top: ROUNDED_RADIUS), child: Column( mainAxisSize: MainAxisSize.min, - children: [ - header, - bodyBuilder(context), - ], + children: [header, bodyBuilder(context)], ), ), ), @@ -151,7 +141,8 @@ Future showSmoothListOfChoicesModalSheet({ labels.elementAt(i), style: textStyle ?? const TextStyle(fontWeight: FontWeight.w500), ), - contentPadding: contentPadding ?? + contentPadding: + contentPadding ?? EdgeInsetsDirectional.only( start: LARGE_SPACE, end: addEndArrowToItems ? 17.0 : LARGE_SPACE, @@ -159,10 +150,11 @@ Future showSmoothListOfChoicesModalSheet({ trailing: (suffixIcons != null ? IconTheme.merge( data: IconThemeData(color: suffixIconTint), - child: suffixIcons[i]) + child: suffixIcons[i], + ) : (addEndArrowToItems - ? const _SmoothListOfChoicesEndArrow() - : null)), + ? const _SmoothListOfChoicesEndArrow() + : null)), onTap: () { Navigator.of(context).pop(values.elementAt(i)); }, @@ -220,7 +212,8 @@ Future showSmoothListOfChoicesModalSheet({ headerBackgroundColor: headerBackgroundColor, bodyPadding: EdgeInsets.zero, body: IntrinsicHeight( - child: Column(mainAxisSize: MainAxisSize.min, children: items)), + child: Column(mainAxisSize: MainAxisSize.min, children: items), + ), ), ); } @@ -240,8 +233,9 @@ Future showSmoothAlertModalSheet({ final Color headerBackgroundColor = switch (type) { SmoothModalSheetType.error when lightTheme => SmoothModalSheetHeader.ERROR_COLOR.lighten(0.55), - SmoothModalSheetType.error => - SmoothModalSheetHeader.ERROR_COLOR.darken(0.3), + SmoothModalSheetType.error => SmoothModalSheetHeader.ERROR_COLOR.darken( + 0.3, + ), SmoothModalSheetType.info when lightTheme => context.extension().primaryLight, SmoothModalSheetType.info => @@ -260,9 +254,9 @@ Future showSmoothAlertModalSheet({ vertical: MEDIUM_SPACE, ), child: DefaultTextStyle.merge( - style: Theme.of(context).textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.w600, - ), + style: Theme.of( + context, + ).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600), child: message, ), ), @@ -283,16 +277,17 @@ class _SmoothListOfChoicesEndArrow extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return ExcludeSemantics( child: icons.CircledArrow.right( color: lightTheme ? extension.primaryLight : extension.primaryDark, type: icons.CircledArrowType.normal, - circleColor: - lightTheme ? extension.primaryDark : extension.primaryMedium, + circleColor: lightTheme + ? extension.primaryDark + : extension.primaryMedium, size: 24.0, padding: const EdgeInsetsDirectional.only( start: 6.0, @@ -320,21 +315,21 @@ class SmoothModalSheet extends StatelessWidget { this.expandBody = false, double? closeButtonSemanticsOrder, }) : header = SmoothModalSheetHeader( - title: title, - prefix: prefixIndicator - ? SmoothModalSheetHeaderPrefixIndicator( - color: prefixIndicatorColor, - ) - : null, - suffix: closeButton - ? SmoothModalSheetHeaderCloseButton( - semanticsOrder: closeButtonSemanticsOrder, - ) - : null, - backgroundColor: headerBackgroundColor, - foregroundColor: headerForegroundColor, - type: type, - ); + title: title, + prefix: prefixIndicator + ? SmoothModalSheetHeaderPrefixIndicator( + color: prefixIndicatorColor, + ) + : null, + suffix: closeButton + ? SmoothModalSheetHeaderCloseButton( + semanticsOrder: closeButtonSemanticsOrder, + ) + : null, + backgroundColor: headerBackgroundColor, + foregroundColor: headerForegroundColor, + type: type, + ); final SmoothModalSheetHeader header; final Widget body; @@ -361,10 +356,7 @@ class SmoothModalSheet extends StatelessWidget { child: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, - children: [ - header, - bodyChild, - ], + children: [header, bodyChild], ), ), ), @@ -417,7 +409,8 @@ class SmoothModalSheetHeader extends StatelessWidget implements SizeWidget { start: (prefix?.requiresPadding == true ? 0 : VERY_LARGE_SPACE), top: VERY_SMALL_SPACE, bottom: VERY_SMALL_SPACE, - end: VERY_LARGE_SPACE - + end: + VERY_LARGE_SPACE - (suffix?.requiresPadding == true ? 0 : LARGE_SPACE), ), child: IntrinsicHeight( @@ -426,8 +419,9 @@ class SmoothModalSheetHeader extends StatelessWidget implements SizeWidget { children: [ if (prefix != null) Padding( - padding: - const EdgeInsetsDirectional.only(end: BALANCED_SPACE), + padding: const EdgeInsetsDirectional.only( + end: BALANCED_SPACE, + ), child: prefix, ), Expanded( @@ -438,14 +432,14 @@ class SmoothModalSheetHeader extends StatelessWidget implements SizeWidget { maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.titleLarge?.copyWith( - fontWeight: FontWeight.bold, - fontSize: 18.0, - color: tintColor, - ), + fontWeight: FontWeight.bold, + fontSize: 18.0, + color: tintColor, + ), ), ), ), - if (suffix != null) suffix! + if (suffix != null) suffix!, ], ), ), @@ -460,9 +454,10 @@ class SmoothModalSheetHeader extends StatelessWidget implements SizeWidget { return switch (type) { SmoothModalSheetType.error => ERROR_COLOR, - SmoothModalSheetType.info => context.lightTheme() - ? context.extension().primaryBlack - : context.extension().primarySemiDark, + SmoothModalSheetType.info => + context.lightTheme() + ? context.extension().primaryBlack + : context.extension().primarySemiDark, }; } @@ -475,7 +470,8 @@ class SmoothModalSheetHeader extends StatelessWidget implements SizeWidget { @override double widgetHeight(BuildContext context) { - final double size = VERY_SMALL_SPACE * 2 + + final double size = + VERY_SMALL_SPACE * 2 + (Theme.of(context).textTheme.titleLarge?.fontSize ?? 15.0); return math.max(MIN_HEIGHT, size); @@ -510,8 +506,8 @@ class SmoothModalSheetHeaderButton extends StatelessWidget @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return Semantics( @@ -528,17 +524,16 @@ class SmoothModalSheetHeaderButton extends StatelessWidget borderRadius: ROUNDED_BORDER_RADIUS, ), foregroundColor: lightTheme ? Colors.black : Colors.white, - backgroundColor: - lightTheme ? extension.primaryMedium : extension.primaryBlack, + backgroundColor: lightTheme + ? extension.primaryMedium + : extension.primaryBlack, iconColor: lightTheme ? Colors.black : Colors.white, ), child: Row( children: [ if (prefix != null) ...[ prefix!, - const SizedBox( - width: SMALL_SPACE, - ), + const SizedBox(width: SMALL_SPACE), ], Text( label, @@ -549,9 +544,7 @@ class SmoothModalSheetHeaderButton extends StatelessWidget maxLines: 1, ), if (suffix != null) ...[ - const SizedBox( - width: SMALL_SPACE, - ), + const SizedBox(width: SMALL_SPACE), suffix!, ], ], @@ -563,8 +556,10 @@ class SmoothModalSheetHeaderButton extends StatelessWidget @override double widgetHeight(BuildContext context) { - return math.max(MediaQuery.textScalerOf(context).scale(17.0), - suffix is Icon || prefix is Icon ? 20.0 : 0.0) + + return math.max( + MediaQuery.textScalerOf(context).scale(17.0), + suffix is Icon || prefix is Icon ? 20.0 : 0.0, + ) + _padding.vertical; } @@ -599,16 +594,12 @@ class SmoothModalSheetHeaderCloseButton extends StatelessWidget ), margin: const EdgeInsetsDirectional.all(VERY_SMALL_SPACE), padding: const EdgeInsetsDirectional.all(6.0), - child: const icons.Close( - size: 13.0, - ), + child: const icons.Close(size: 13.0), ); } else { icon = const Padding( padding: EdgeInsetsDirectional.all(MEDIUM_SPACE), - child: icons.Close( - size: 15.0, - ), + child: icons.Close(size: 15.0), ); } @@ -648,10 +639,7 @@ class SmoothModalSheetHeaderCloseButton extends StatelessWidget class SmoothModalSheetHeaderPrefixIndicator extends StatelessWidget implements SizeWidget { - const SmoothModalSheetHeaderPrefixIndicator({ - this.color, - super.key, - }); + const SmoothModalSheetHeaderPrefixIndicator({this.color, super.key}); final Color? color; @@ -701,7 +689,8 @@ class SmoothModalSheetBodyContainer extends StatelessWidget { @override Widget build(BuildContext context) { - EdgeInsetsGeometry padding = this.padding ?? + EdgeInsetsGeometry padding = + this.padding ?? const EdgeInsetsDirectional.only( start: MEDIUM_SPACE, end: MEDIUM_SPACE, @@ -719,17 +708,11 @@ class SmoothModalSheetBodyContainer extends StatelessWidget { return Padding( padding: padding, child: DefaultTextStyle.merge( - style: const TextStyle( - fontSize: 15.0, - height: 1.7, - ), + style: const TextStyle(fontSize: 15.0, height: 1.7), child: child, ), ); } } -enum SmoothModalSheetType { - error, - info, -} +enum SmoothModalSheetType { error, info } diff --git a/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_draggable_bottom_sheet.dart b/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_draggable_bottom_sheet.dart index 6cae831cf8..65fdeaaa87 100644 --- a/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_draggable_bottom_sheet.dart +++ b/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_draggable_bottom_sheet.dart @@ -49,13 +49,15 @@ class SmoothDraggableBottomSheetState @override Widget build(BuildContext context) { - final Color backgroundColor = widget.bottomSheetColor ?? + final Color backgroundColor = + widget.bottomSheetColor ?? Theme.of(context).bottomSheetTheme.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor; final double bottomPaddingHeight = MediaQuery.paddingOf(context).bottom; // Fix keyboard glitch - final double keyboardFraction = MediaQuery.viewInsetsOf(context).bottom / + final double keyboardFraction = + MediaQuery.viewInsetsOf(context).bottom / MediaQuery.sizeOf(context).height; return ChangeNotifierProvider( @@ -207,10 +209,8 @@ class _SmoothDraggableContentState extends State<_SmoothDraggableContent> { /// A fixed header class _SliverHeader extends SliverPersistentHeaderDelegate { - _SliverHeader({ - required this.child, - required this.height, - }) : assert(height > 0.0); + _SliverHeader({required this.child, required this.height}) + : assert(height > 0.0); final Widget child; final double height; diff --git a/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_draggable_bottom_sheet_route.dart b/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_draggable_bottom_sheet_route.dart index 6095338547..daaf43e6cc 100644 --- a/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_draggable_bottom_sheet_route.dart +++ b/packages/smooth_app/lib/generic_lib/bottom_sheets/smooth_draggable_bottom_sheet_route.dart @@ -102,10 +102,7 @@ class _FlexibleBottomSheetRoute extends PopupRoute { ), ); - return Theme( - data: Theme.of(context), - child: bottomSheet, - ); + return Theme(data: Theme.of(context), child: bottomSheet); } @override @@ -118,10 +115,10 @@ class _FlexibleBottomSheetRoute extends PopupRoute { const Offset begin = Offset(0.0, 1.0); const Offset end = Offset.zero; const Cubic curve = Curves.ease; - final Animatable tween = - Tween(begin: begin, end: end).chain( - CurveTween(curve: curve), - ); + final Animatable tween = Tween( + begin: begin, + end: end, + ).chain(CurveTween(curve: curve)); return SlideTransition( position: animation.drive(tween), diff --git a/packages/smooth_app/lib/generic_lib/buttons/smooth_boolean_button.dart b/packages/smooth_app/lib/generic_lib/buttons/smooth_boolean_button.dart index 52dc93cc9e..8c14000b91 100644 --- a/packages/smooth_app/lib/generic_lib/buttons/smooth_boolean_button.dart +++ b/packages/smooth_app/lib/generic_lib/buttons/smooth_boolean_button.dart @@ -12,8 +12,8 @@ class SmoothTriStatesButton extends StatefulWidget { required this.onChanged, required this.positiveTooltip, required this.negativeTooltip, - }) : assert(positiveTooltip.length > 0), - assert(negativeTooltip.length > 0); + }) : assert(positiveTooltip.length > 0), + assert(negativeTooltip.length > 0); final bool? value; final Function(bool?) onChanged; @@ -98,8 +98,8 @@ class _SmoothTriStatesButtonState extends State @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return CustomPaint( painter: _SmoothTriStateItemBackgroundBorderPainter( @@ -190,7 +190,8 @@ class _SmoothTriStatesItem extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - width: 12.0 * MediaQuery.textScalerOf(context).scale(1.0) + + width: + 12.0 * MediaQuery.textScalerOf(context).scale(1.0) + (LARGE_SPACE * 2) + 2.0, child: Material( @@ -230,10 +231,7 @@ class _SmoothTriStatesItem extends StatelessWidget { } } -enum SmoothTriStateButtonPosition { - start, - end, -} +enum SmoothTriStateButtonPosition { start, end } class _SmoothTriStateItemBackgroundBorderPainter extends CustomPainter { _SmoothTriStateItemBackgroundBorderPainter({ @@ -272,11 +270,7 @@ class _SmoothTriStateItemBackgroundBorderPainter extends CustomPainter { ); canvas.drawRRect(roundedRect, paint); - paint.color = _getColor( - endDefaultColor, - endSelectedColor, - endPercent, - ); + paint.color = _getColor(endDefaultColor, endSelectedColor, endPercent); roundedRect = RRect.fromRectAndCorners( Rect.fromLTWH(size.width / 2, 0.0, size.width / 2, size.height), @@ -292,8 +286,12 @@ class _SmoothTriStateItemBackgroundBorderPainter extends CustomPainter { horizontalPercent, )!; roundedRect = RRect.fromRectAndCorners( - Rect.fromLTWH((size.width / 2) * horizontalPercent, 0.0, size.width / 2, - size.height), + Rect.fromLTWH( + (size.width / 2) * horizontalPercent, + 0.0, + size.width / 2, + size.height, + ), topLeft: Radius.circular(LARGE_SPACE * (1 - horizontalPercent)), bottomLeft: Radius.circular(LARGE_SPACE * (1 - horizontalPercent)), topRight: Radius.circular(LARGE_SPACE * horizontalPercent), @@ -306,11 +304,7 @@ class _SmoothTriStateItemBackgroundBorderPainter extends CustomPainter { Color _getColor(Color defaultColor, Color selectedColor, double percent) { if (percent > 0.0 && (horizontalPercent == 0.0 || horizontalPercent == 1.0)) { - return Color.lerp( - defaultColor, - selectedColor, - percent, - )!; + return Color.lerp(defaultColor, selectedColor, percent)!; } else { return defaultColor; } @@ -324,14 +318,12 @@ class _SmoothTriStateItemBackgroundBorderPainter extends CustomPainter { @override bool shouldRebuildSemantics( - _SmoothTriStateItemBackgroundBorderPainter oldDelegate) => - false; + _SmoothTriStateItemBackgroundBorderPainter oldDelegate, + ) => false; } class _SmoothTriStateItemForegroundBorderPainter extends CustomPainter { - _SmoothTriStateItemForegroundBorderPainter({ - required this.borderColor, - }); + _SmoothTriStateItemForegroundBorderPainter({required this.borderColor}); final Color borderColor; @@ -343,8 +335,11 @@ class _SmoothTriStateItemForegroundBorderPainter extends CustomPainter { ..strokeWidth = 1.0; // Separator - canvas.drawLine(Offset(size.width / 2, 0.0), - Offset(size.width / 2, size.height), paint); + canvas.drawLine( + Offset(size.width / 2, 0.0), + Offset(size.width / 2, size.height), + paint, + ); // Rounded borders final RRect roundedRect = RRect.fromRectAndRadius( @@ -360,6 +355,6 @@ class _SmoothTriStateItemForegroundBorderPainter extends CustomPainter { @override bool shouldRebuildSemantics( - _SmoothTriStateItemForegroundBorderPainter oldDelegate) => - false; + _SmoothTriStateItemForegroundBorderPainter oldDelegate, + ) => false; } diff --git a/packages/smooth_app/lib/generic_lib/buttons/smooth_button_with_arrow.dart b/packages/smooth_app/lib/generic_lib/buttons/smooth_button_with_arrow.dart index 88398f3fb1..0ef0044fa5 100644 --- a/packages/smooth_app/lib/generic_lib/buttons/smooth_button_with_arrow.dart +++ b/packages/smooth_app/lib/generic_lib/buttons/smooth_button_with_arrow.dart @@ -26,8 +26,8 @@ class SmoothButtonWithArrow extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); return Align( alignment: AlignmentDirectional.centerEnd, @@ -45,9 +45,7 @@ class SmoothButtonWithArrow extends StatelessWidget { ), ), shape: const WidgetStatePropertyAll( - RoundedRectangleBorder( - borderRadius: CIRCULAR_BORDER_RADIUS, - ), + RoundedRectangleBorder(borderRadius: CIRCULAR_BORDER_RADIUS), ), ), child: Row( diff --git a/packages/smooth_app/lib/generic_lib/buttons/smooth_large_button_with_icon.dart b/packages/smooth_app/lib/generic_lib/buttons/smooth_large_button_with_icon.dart index 3699ba7e9a..cccd88fafd 100644 --- a/packages/smooth_app/lib/generic_lib/buttons/smooth_large_button_with_icon.dart +++ b/packages/smooth_app/lib/generic_lib/buttons/smooth_large_button_with_icon.dart @@ -53,9 +53,7 @@ class SmoothLargeButtonWithIcon extends StatelessWidget { borderRadius: borderRadius ?? ROUNDED_BORDER_RADIUS, buttonColor: _getBackgroundColor(themeData), child: IconTheme( - data: IconThemeData( - color: _getForegroundColor(themeData), - ), + data: IconThemeData(color: _getForegroundColor(themeData)), child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ diff --git a/packages/smooth_app/lib/generic_lib/buttons/smooth_simple_button.dart b/packages/smooth_app/lib/generic_lib/buttons/smooth_simple_button.dart index 60f88eea6d..4a473eecc9 100644 --- a/packages/smooth_app/lib/generic_lib/buttons/smooth_simple_button.dart +++ b/packages/smooth_app/lib/generic_lib/buttons/smooth_simple_button.dart @@ -27,10 +27,7 @@ class SmoothSimpleButton extends StatelessWidget { @override Widget build(BuildContext context) { return ConstrainedBox( - constraints: BoxConstraints( - minWidth: minWidth, - minHeight: height, - ), + constraints: BoxConstraints(minWidth: minWidth, minHeight: height), child: ElevatedButton( style: ButtonStyle( elevation: elevation, @@ -45,10 +42,9 @@ class SmoothSimpleButton extends StatelessWidget { overlayColor: context.read().isAmoledTheme ? WidgetStateProperty.resolveWith((Set states) { return states.contains(WidgetState.pressed) - ? Theme.of(context) - .colorScheme - .primary - .withValues(alpha: 0.3) + ? Theme.of( + context, + ).colorScheme.primary.withValues(alpha: 0.3) : null; }) : null, @@ -59,10 +55,7 @@ class SmoothSimpleButton extends StatelessWidget { : null, ), onPressed: onPressed, - child: Padding( - padding: padding, - child: child, - ), + child: Padding(padding: padding, child: child), ), ); } diff --git a/packages/smooth_app/lib/generic_lib/design_constants.dart b/packages/smooth_app/lib/generic_lib/design_constants.dart index d9797ea520..73b0b28cf8 100644 --- a/packages/smooth_app/lib/generic_lib/design_constants.dart +++ b/packages/smooth_app/lib/generic_lib/design_constants.dart @@ -25,8 +25,9 @@ const BorderRadius ROUNDED_BORDER_RADIUS = BorderRadius.all(ROUNDED_RADIUS); /// Topbar… const Radius HEADER_ROUNDED_RADIUS = Radius.circular(30.0); //ignore: non_constant_identifier_names -const BorderRadius HEADER_BORDER_RADIUS = - BorderRadius.all(HEADER_ROUNDED_RADIUS); +const BorderRadius HEADER_BORDER_RADIUS = BorderRadius.all( + HEADER_ROUNDED_RADIUS, +); /// Full screen button, e.g. KnowledgePanel const Radius ANGULAR_RADIUS = Radius.circular(8.0); diff --git a/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart b/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart index 9c0d07ebaf..cfe7dc3248 100644 --- a/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart +++ b/packages/smooth_app/lib/generic_lib/dialogs/smooth_alert_dialog.dart @@ -37,9 +37,9 @@ class SmoothAlertDialog extends StatelessWidget { this.margin, this.contentPadding, }) : assert( - body is! LayoutBuilder, - "LayoutBuilder isn't supported with Dialogs", - ); + body is! LayoutBuilder, + "LayoutBuilder isn't supported with Dialogs", + ); final String? title; final Widget? leadingTitle; @@ -61,19 +61,19 @@ class SmoothAlertDialog extends StatelessWidget { static const EdgeInsetsDirectional _smallContentPadding = EdgeInsetsDirectional.only( - start: SMALL_SPACE, - top: MEDIUM_SPACE, - end: SMALL_SPACE, - bottom: SMALL_SPACE, - ); + start: SMALL_SPACE, + top: MEDIUM_SPACE, + end: SMALL_SPACE, + bottom: SMALL_SPACE, + ); static const EdgeInsetsDirectional _contentPadding = EdgeInsetsDirectional.only( - start: 22.0, - top: VERY_LARGE_SPACE, - end: 22.0, - bottom: 22.0, - ); + start: 22.0, + top: VERY_LARGE_SPACE, + end: 22.0, + bottom: 22.0, + ); @override Widget build(BuildContext context) { @@ -107,7 +107,8 @@ class SmoothAlertDialog extends StatelessWidget { } Padding _buildBottomBar(EdgeInsetsDirectional padding) { - final bool singleButton = (positiveAction != null && + final bool singleButton = + (positiveAction != null && negativeAction == null && neutralAction == null) || (negativeAction != null && @@ -141,20 +142,20 @@ class SmoothAlertDialog extends StatelessWidget { positiveAction != null || negativeAction != null || neutralAction != null; Widget _buildContent(final BuildContext context) => DefaultTextStyle.merge( - style: const TextStyle(height: 1.5), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - if (title != null) - _SmoothDialogTitle( - label: title!, - close: close, - leading: leadingTitle, - ), - body, - ], - ), - ); + style: const TextStyle(height: 1.5), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + if (title != null) + _SmoothDialogTitle( + label: title!, + close: close, + leading: leadingTitle, + ), + body, + ], + ), + ); static EdgeInsetsDirectional defaultContentPadding(BuildContext context) { return (context.isSmallDevice() ? _smallContentPadding : _contentPadding); @@ -195,19 +196,13 @@ class _SmoothDialogTitle extends StatelessWidget { end: SMALL_SPACE, ), child: IconTheme( - data: IconThemeData( - color: textStyle.color, - ), - child: leading!), + data: IconThemeData(color: textStyle.color), + child: leading!, + ), ), _buildCross(true), Expanded( - child: FittedBox( - child: Text( - label, - style: textStyle, - ), - ), + child: FittedBox(child: Text(label, style: textStyle)), ), _buildCross(false), ], @@ -221,9 +216,7 @@ class _SmoothDialogTitle extends StatelessWidget { Widget _buildCross(final bool isPlaceHolder) { if (close) { - return _SmoothDialogCrossButton( - visible: !isPlaceHolder, - ); + return _SmoothDialogCrossButton(visible: !isPlaceHolder); } else { return EMPTY_WIDGET; } @@ -231,9 +224,7 @@ class _SmoothDialogTitle extends StatelessWidget { } class _SmoothDialogCrossButton extends StatelessWidget { - const _SmoothDialogCrossButton({ - required this.visible, - }); + const _SmoothDialogCrossButton({required this.visible}); final bool visible; @@ -290,18 +281,16 @@ class SmoothActionButtonsBar extends StatelessWidget { this.padding, super.key, }) : assert( - positiveAction != null || - negativeAction != null || - neutralAction != null, - 'At least one action must be passed!'); + positiveAction != null || + negativeAction != null || + neutralAction != null, + 'At least one action must be passed!', + ); const SmoothActionButtonsBar.single({ required SmoothActionButton action, Key? key, - }) : this( - positiveAction: action, - key: key, - ); + }) : this(positiveAction: action, key: key); final SmoothActionButton? positiveAction; final SmoothActionButton? negativeAction; @@ -327,16 +316,10 @@ class SmoothActionButtonsBar extends StatelessWidget { if (actions.length > 1) { if (actions.length > 2) { // space injected before 3rd item - actions.insert( - 2, - const SizedBox(width: VERY_SMALL_SPACE), - ); + actions.insert(2, const SizedBox(width: VERY_SMALL_SPACE)); } // space injected before 2nd item - actions.insert( - 1, - const SizedBox(width: VERY_SMALL_SPACE), - ); + actions.insert(1, const SizedBox(width: VERY_SMALL_SPACE)); } return Padding( @@ -391,22 +374,12 @@ List? _buildActions( // Negative action first actions = [ if (negativeAction != null) - Expanded( - child: _SmoothActionFlatButton( - buttonData: negativeAction, - ), - ), + Expanded(child: _SmoothActionFlatButton(buttonData: negativeAction)), if (neutralAction != null) - Expanded( - child: _SmoothActionFlatButton( - buttonData: neutralAction, - ), - ), + Expanded(child: _SmoothActionFlatButton(buttonData: neutralAction)), if (positiveAction != null) Expanded( - child: _SmoothActionElevatedButton( - buttonData: positiveAction, - ), + child: _SmoothActionElevatedButton(buttonData: positiveAction), ), ]; } else { @@ -415,23 +388,17 @@ List? _buildActions( if (positiveAction != null) SizedBox( width: double.infinity, - child: _SmoothActionElevatedButton( - buttonData: positiveAction, - ), + child: _SmoothActionElevatedButton(buttonData: positiveAction), ), if (neutralAction != null) SizedBox( width: double.infinity, - child: _SmoothActionFlatButton( - buttonData: neutralAction, - ), + child: _SmoothActionFlatButton(buttonData: neutralAction), ), if (negativeAction != null) SizedBox( width: double.infinity, - child: _SmoothActionFlatButton( - buttonData: negativeAction, - ), + child: _SmoothActionFlatButton(buttonData: negativeAction), ), ]; @@ -467,9 +434,7 @@ class SmoothActionButton { } class _SmoothActionElevatedButton extends StatelessWidget { - const _SmoothActionElevatedButton({ - required this.buttonData, - }); + const _SmoothActionElevatedButton({required this.buttonData}); final SmoothActionButton buttonData; @@ -505,9 +470,7 @@ class _SmoothActionElevatedButton extends StatelessWidget { } class _SmoothActionFlatButton extends StatelessWidget { - const _SmoothActionFlatButton({ - required this.buttonData, - }); + const _SmoothActionFlatButton({required this.buttonData}); final SmoothActionButton buttonData; @@ -518,9 +481,7 @@ class _SmoothActionFlatButton extends StatelessWidget { return Theme( data: themeData.copyWith( buttonTheme: const ButtonThemeData( - shape: RoundedRectangleBorder( - borderRadius: ROUNDED_BORDER_RADIUS, - ), + shape: RoundedRectangleBorder(borderRadius: ROUNDED_BORDER_RADIUS), ), ), child: Semantics( @@ -538,9 +499,7 @@ class _SmoothActionFlatButton extends StatelessWidget { textStyle: themeData.textTheme.bodyMedium!.copyWith( color: themeData.colorScheme.onPrimary, ), - padding: const EdgeInsets.symmetric( - horizontal: SMALL_SPACE, - ), + padding: const EdgeInsets.symmetric(horizontal: SMALL_SPACE), minimumSize: const Size(0, 46.0), ), child: SizedBox( @@ -590,13 +549,8 @@ class SmoothAlertContentButton extends StatelessWidget { widthFactor: 0.8, child: Row( children: [ - Expanded( - child: Text(label), - ), - if (icon != null) - ExcludeSemantics( - child: Icon(icon), - ), + Expanded(child: Text(label)), + if (icon != null) ExcludeSemantics(child: Icon(icon)), ], ), ), @@ -699,7 +653,8 @@ class SmoothListAlertDialog extends StatelessWidget { vertical: SMALL_SPACE, ), body: SizedBox( - height: MediaQuery.sizeOf(context).height / + height: + MediaQuery.sizeOf(context).height / (context.keyboardVisible ? 1.0 : 1.5), width: MediaQuery.sizeOf(context).width, child: Column( @@ -728,11 +683,8 @@ class SmoothListAlertDialog extends StatelessWidget { child: header, ), Expanded( - child: Scrollbar( - controller: _scrollController, - child: list, - ), - ) + child: Scrollbar(controller: _scrollController, child: list), + ), ], ), ), diff --git a/packages/smooth_app/lib/generic_lib/html/smooth_html_factory.dart b/packages/smooth_app/lib/generic_lib/html/smooth_html_factory.dart index 1d9198e763..dfcab47b7e 100644 --- a/packages/smooth_app/lib/generic_lib/html/smooth_html_factory.dart +++ b/packages/smooth_app/lib/generic_lib/html/smooth_html_factory.dart @@ -5,9 +5,7 @@ import 'package:smooth_app/generic_lib/html/smooth_html_marker_chip.dart'; import 'package:smooth_app/generic_lib/html/smooth_html_marker_decimal.dart'; class SmoothHtmlWidgetFactory extends WidgetFactory { - SmoothHtmlWidgetFactory({ - required this.onLinkClicked, - }); + SmoothHtmlWidgetFactory({required this.onLinkClicked}); final Function(String link) onLinkClicked; @@ -27,9 +25,7 @@ class SmoothHtmlWidgetFactory extends WidgetFactory { child: SelectableText.rich( TextSpan( children: [text], - style: resolved.prepareTextStyle().copyWith( - height: 1.6, - ), + style: resolved.prepareTextStyle().copyWith(height: 1.6), ), ), ); diff --git a/packages/smooth_app/lib/generic_lib/html/smooth_html_fake_button.dart b/packages/smooth_app/lib/generic_lib/html/smooth_html_fake_button.dart index 48f7315fbd..49f0d4f58d 100644 --- a/packages/smooth_app/lib/generic_lib/html/smooth_html_fake_button.dart +++ b/packages/smooth_app/lib/generic_lib/html/smooth_html_fake_button.dart @@ -6,17 +6,14 @@ import 'package:smooth_app/themes/smooth_theme.dart'; import 'package:smooth_app/themes/smooth_theme_colors.dart'; class SmoothHtmlFakeButton extends StatelessWidget { - const SmoothHtmlFakeButton({ - required this.children, - super.key, - }); + const SmoothHtmlFakeButton({required this.children, super.key}); final List children; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return SizedBox( width: double.infinity, @@ -57,10 +54,7 @@ class SmoothHtmlFakeButton extends StatelessWidget { ), ), ), - const icons.ExternalLink( - color: Colors.black, - size: 16.0, - ) + const icons.ExternalLink(color: Colors.black, size: 16.0), ], ), ), diff --git a/packages/smooth_app/lib/generic_lib/html/smooth_html_marker_chip.dart b/packages/smooth_app/lib/generic_lib/html/smooth_html_marker_chip.dart index e3f5c6df89..953f609890 100644 --- a/packages/smooth_app/lib/generic_lib/html/smooth_html_marker_chip.dart +++ b/packages/smooth_app/lib/generic_lib/html/smooth_html_marker_chip.dart @@ -9,14 +9,15 @@ class SmoothHtmlChip extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); /// We can't use top Padding, so we draw on a canvas return CustomPaint( painter: _HtmlChipPainter( - color: - context.lightTheme() ? extension.greyMedium : extension.greyNormal, + color: context.lightTheme() + ? extension.greyMedium + : extension.greyNormal, textDirection: Directionality.of(context), ), child: const SizedBox.square(dimension: 10.0), @@ -25,10 +26,7 @@ class SmoothHtmlChip extends StatelessWidget { } class _HtmlChipPainter extends CustomPainter { - _HtmlChipPainter({ - required this.color, - required this.textDirection, - }); + _HtmlChipPainter({required this.color, required this.textDirection}); final Color color; final TextDirection textDirection; @@ -55,10 +53,7 @@ class _HtmlChipPainter extends CustomPainter { textPainter.layout(); textPainter.paint( canvas, - Offset( - (size.width - dimension) / 2, - (size.height - dimension) / 2, - ), + Offset((size.width - dimension) / 2, (size.height - dimension) / 2), ); } diff --git a/packages/smooth_app/lib/generic_lib/html/smooth_html_marker_decimal.dart b/packages/smooth_app/lib/generic_lib/html/smooth_html_marker_decimal.dart index 5ebc5ccfcc..623751d87d 100644 --- a/packages/smooth_app/lib/generic_lib/html/smooth_html_marker_decimal.dart +++ b/packages/smooth_app/lib/generic_lib/html/smooth_html_marker_decimal.dart @@ -4,22 +4,20 @@ import 'package:smooth_app/themes/smooth_theme_colors.dart'; import 'package:smooth_app/themes/theme_provider.dart'; class SmoothHtmlDecimal extends StatelessWidget { - const SmoothHtmlDecimal({ - required this.index, - super.key, - }); + const SmoothHtmlDecimal({required this.index, super.key}); final int index; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return CustomPaint( painter: _HtmlDecimalPainter( - color: - context.lightTheme() ? extension.greyMedium : extension.greyNormal, + color: context.lightTheme() + ? extension.greyMedium + : extension.greyNormal, index: index, textDirection: Directionality.of(context), textStyle: const TextStyle( @@ -59,10 +57,7 @@ class _HtmlDecimalPainter extends CustomPainter { ); final TextPainter textPainter = TextPainter(textDirection: textDirection); - textPainter.text = TextSpan( - text: index.toString(), - style: textStyle, - ); + textPainter.text = TextSpan(text: index.toString(), style: textStyle); textPainter.layout(); textPainter.paint( canvas, diff --git a/packages/smooth_app/lib/generic_lib/html/smooth_html_widget.dart b/packages/smooth_app/lib/generic_lib/html/smooth_html_widget.dart index 1eb39b2377..33c9083b58 100644 --- a/packages/smooth_app/lib/generic_lib/html/smooth_html_widget.dart +++ b/packages/smooth_app/lib/generic_lib/html/smooth_html_widget.dart @@ -23,22 +23,19 @@ class SmoothHtmlWidget extends StatelessWidget { textStyle: textStyle, customStylesBuilder: (dom.Element element) => element.classes.contains('unknown_ingredient') - ? { - 'font-weight': 'bold', - } - : null, + ? {'font-weight': 'bold'} + : null, onTapUrl: (String url) async { try { await LaunchUrlHelper.launchURL(url); } catch (_) { if (context.mounted) { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); + final AppLocalizations appLocalizations = AppLocalizations.of( + context, + ); ScaffoldMessenger.maybeOf(context)?.showSnackBar( - SnackBar( - content: Text(appLocalizations.link_cant_be_opened), - ), + SnackBar(content: Text(appLocalizations.link_cant_be_opened)), ); } } diff --git a/packages/smooth_app/lib/generic_lib/loading_dialog.dart b/packages/smooth_app/lib/generic_lib/loading_dialog.dart index e4aa04a3c2..c5ac376daa 100644 --- a/packages/smooth_app/lib/generic_lib/loading_dialog.dart +++ b/packages/smooth_app/lib/generic_lib/loading_dialog.dart @@ -41,57 +41,53 @@ class LoadingDialog { required final BuildContext context, final String? title, final bool shouldOpenNewIssue = false, - }) async => - showDialog( - context: context, - builder: (BuildContext context) { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); - return SmoothAlertDialog( - body: Column( - children: [ - SvgPicture.asset( - 'assets/misc/error.svg', - width: MINIMUM_TOUCH_SIZE * 2, - package: AppHelper.APP_PACKAGE, - ), - Padding( - padding: const EdgeInsets.symmetric(vertical: MEDIUM_SPACE), - child: Text( - shouldOpenNewIssue - ? appLocalizations.server_error_open_new_issue - : title ?? - appLocalizations - .loading_dialog_default_error_message, - textAlign: TextAlign.center, + }) async => showDialog( + context: context, + builder: (BuildContext context) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + return SmoothAlertDialog( + body: Column( + children: [ + SvgPicture.asset( + 'assets/misc/error.svg', + width: MINIMUM_TOUCH_SIZE * 2, + package: AppHelper.APP_PACKAGE, + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: MEDIUM_SPACE), + child: Text( + shouldOpenNewIssue + ? appLocalizations.server_error_open_new_issue + : title ?? + appLocalizations.loading_dialog_default_error_message, + textAlign: TextAlign.center, + ), + ), + if (shouldOpenNewIssue) + Padding( + padding: const EdgeInsets.only(bottom: MEDIUM_SPACE), + child: RichText( + textAlign: TextAlign.center, + text: TextSpan( + style: Theme.of( + context, + ).textTheme.bodyMedium?.copyWith(color: Colors.blue), + text: Status.openNewIssueUrl, + recognizer: TapGestureRecognizer() + ..onTap = () => + LaunchUrlHelper.launchURL(Status.openNewIssueUrl), ), ), - if (shouldOpenNewIssue) - Padding( - padding: const EdgeInsets.only(bottom: MEDIUM_SPACE), - child: RichText( - textAlign: TextAlign.center, - text: TextSpan( - style: Theme.of(context).textTheme.bodyMedium?.copyWith( - color: Colors.blue, - ), - text: Status.openNewIssueUrl, - recognizer: TapGestureRecognizer() - ..onTap = () => LaunchUrlHelper.launchURL( - Status.openNewIssueUrl, - ), - ), - ), - ), - ], - ), - positiveAction: SmoothActionButton( - text: appLocalizations.close, - onPressed: () => Navigator.maybePop(context), - ), - ); - }, + ), + ], + ), + positiveAction: SmoothActionButton( + text: appLocalizations.close, + onPressed: () => Navigator.maybePop(context), + ), ); + }, + ); /// Displays "downloading" dialog while actually downloading Future _run({ @@ -99,14 +95,13 @@ class LoadingDialog { required final Future future, required final String title, final bool? dismissible, - }) async => - showDialog( - barrierDismissible: dismissible ?? true, - context: context, - builder: (BuildContext context) { - return _getDialog(context, title, future); - }, - ); + }) async => showDialog( + barrierDismissible: dismissible ?? true, + context: context, + builder: (BuildContext context) { + return _getDialog(context, title, future); + }, + ); /// Closes the dialog if relevant, pop'ing the [value] void _popDialog(final BuildContext context, final T? value) { diff --git a/packages/smooth_app/lib/generic_lib/loading_sliver.dart b/packages/smooth_app/lib/generic_lib/loading_sliver.dart index a7a274b5d9..250297d8d8 100644 --- a/packages/smooth_app/lib/generic_lib/loading_sliver.dart +++ b/packages/smooth_app/lib/generic_lib/loading_sliver.dart @@ -12,10 +12,10 @@ class LoadingSliverChildBuilderDelegate extends SliverChildBuilderDelegate { Widget? loadingWidget, int loadingCount = 4, bool loading = false, - }) : assert(loading == false || loadingWidget != null), - super( - (BuildContext context, int index) => - loading ? loadingWidget : childBuilder(context, index), - childCount: loading ? loadingCount : childCount, - ); + }) : assert(loading == false || loadingWidget != null), + super( + (BuildContext context, int index) => + loading ? loadingWidget : childBuilder(context, index), + childCount: loading ? loadingCount : childCount, + ); } diff --git a/packages/smooth_app/lib/generic_lib/svg_icon_chip.dart b/packages/smooth_app/lib/generic_lib/svg_icon_chip.dart index b1081c9675..6ca62fcb6e 100644 --- a/packages/smooth_app/lib/generic_lib/svg_icon_chip.dart +++ b/packages/smooth_app/lib/generic_lib/svg_icon_chip.dart @@ -2,17 +2,14 @@ import 'package:flutter/material.dart'; import 'package:smooth_app/cards/category_cards/svg_cache.dart'; class SvgIconChip extends StatelessWidget { - const SvgIconChip( - this.iconUrl, { - required this.height, - }); + const SvgIconChip(this.iconUrl, {required this.height}); final String iconUrl; final double height; @override Widget build(BuildContext context) => ConstrainedBox( - constraints: BoxConstraints(minWidth: height), - child: SvgCache(iconUrl, height: height), - ); + constraints: BoxConstraints(minWidth: height), + child: SvgCache(iconUrl, height: height), + ); } diff --git a/packages/smooth_app/lib/generic_lib/widgets/images/smooth_image.dart b/packages/smooth_app/lib/generic_lib/widgets/images/smooth_image.dart index 2955beeec5..efb2376af5 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/images/smooth_image.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/images/smooth_image.dart @@ -19,14 +19,14 @@ class SmoothImage extends StatelessWidget { this.heroTag, this.cacheWidth, this.cacheHeight, - }) : assert( - cacheWidth == null || imageProvider is NetworkImage, - 'cacheWidth requires a NetworkImage', - ), - assert( - cacheHeight == null || imageProvider is NetworkImage, - 'cacheHeight requires a NetworkImage', - ); + }) : assert( + cacheWidth == null || imageProvider is NetworkImage, + 'cacheWidth requires a NetworkImage', + ), + assert( + cacheHeight == null || imageProvider is NetworkImage, + 'cacheHeight requires a NetworkImage', + ); final ImageProvider? imageProvider; final double? height; @@ -43,28 +43,26 @@ class SmoothImage extends StatelessWidget { Widget build(BuildContext context) { Widget child = switch (imageProvider) { NetworkImage(url: final String url) => Image.network( - url, - fit: fit, - loadingBuilder: _loadingBuilder, - errorBuilder: _errorBuilder, - frameBuilder: (_, Widget child, int? frame, ____) { - if (frame == null) { - return const Center( - child: CircularProgressIndicator(), - ); - } + url, + fit: fit, + loadingBuilder: _loadingBuilder, + errorBuilder: _errorBuilder, + frameBuilder: (_, Widget child, int? frame, ____) { + if (frame == null) { + return const Center(child: CircularProgressIndicator()); + } - return child; - }, - cacheWidth: cacheWidth, - cacheHeight: cacheHeight, - ), + return child; + }, + cacheWidth: cacheWidth, + cacheHeight: cacheHeight, + ), ImageProvider() => Image( - image: imageProvider!, - fit: fit, - loadingBuilder: _loadingBuilder, - errorBuilder: _errorBuilder, - ), + image: imageProvider!, + fit: fit, + loadingBuilder: _loadingBuilder, + errorBuilder: _errorBuilder, + ), _ => const PictureNotFound(), }; @@ -73,17 +71,15 @@ class SmoothImage extends StatelessWidget { } child = Container( - decoration: decoration, - width: width, - height: height, - color: color, - child: child); + decoration: decoration, + width: width, + height: height, + color: color, + child: child, + ); if (rounded) { - child = ClipRRect( - borderRadius: ROUNDED_BORDER_RADIUS, - child: child, - ); + child = ClipRRect(borderRadius: ROUNDED_BORDER_RADIUS, child: child); } return child; @@ -109,35 +105,26 @@ class SmoothImage extends StatelessWidget { padding: const EdgeInsets.all(SMALL_SPACE), child: const SmoothAnimatedLogo(), ), - layoutBuilder: ( - Widget topChild, - Key topChildKey, - Widget bottomChild, - Key bottomChildKey, - ) { - return Stack( - clipBehavior: Clip.none, - children: [ - Positioned.fill( - key: bottomChildKey, - child: bottomChild, - ), - Positioned.fill( - key: topChildKey, - child: topChild, - ), - ], - ); - }, + layoutBuilder: + ( + Widget topChild, + Key topChildKey, + Widget bottomChild, + Key bottomChildKey, + ) { + return Stack( + clipBehavior: Clip.none, + children: [ + Positioned.fill(key: bottomChildKey, child: bottomChild), + Positioned.fill(key: topChildKey, child: topChild), + ], + ); + }, ), ); } - Widget _errorBuilder( - BuildContext context, - Object _, - StackTrace? __, - ) { + Widget _errorBuilder(BuildContext context, Object _, StackTrace? __) { return Container( color: Theme.of(context).primaryColor.withValues(alpha: 0.1), padding: const EdgeInsets.all(SMALL_SPACE), @@ -146,9 +133,7 @@ class SmoothImage extends StatelessWidget { Colors.grey.withValues(alpha: 0.7), BlendMode.srcIn, ), - child: const PictureNotFound( - style: PictureNotFoundStyle.sad, - ), + child: const PictureNotFound(style: PictureNotFoundStyle.sad), ), ); } diff --git a/packages/smooth_app/lib/generic_lib/widgets/languages_selector.dart b/packages/smooth_app/lib/generic_lib/widgets/languages_selector.dart index 71a9998461..b55c139f42 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/languages_selector.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/languages_selector.dart @@ -58,13 +58,14 @@ class LanguagesSelector extends StatelessWidget { final String currentLanguageCode = ProductQuery.getLanguage().code; language = LanguageHelper.fromJson(currentLanguageCode); } - final DaoStringList daoStringList = - DaoStringList(context.read()); + final DaoStringList daoStringList = DaoStringList( + context.read(), + ); - final TextStyle textStyle = Theme.of(context) - .textTheme - .bodyMedium - ?.copyWith(color: foregroundColor) ?? + final TextStyle textStyle = + Theme.of( + context, + ).textTheme.bodyMedium?.copyWith(color: foregroundColor) ?? TextStyle(color: foregroundColor); return Material( @@ -94,10 +95,7 @@ class LanguagesSelector extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Icon( - Icons.language, - color: foregroundColor, - ), + Icon(Icons.language, color: foregroundColor), Expanded( flex: 1, child: Padding( @@ -111,9 +109,7 @@ class LanguagesSelector extends StatelessWidget { ), ), IconTheme( - data: IconThemeData( - color: foregroundColor ?? textStyle.color, - ), + data: IconThemeData(color: foregroundColor ?? textStyle.color), child: icon ?? const Icon(Icons.arrow_drop_down), ), ], @@ -137,8 +133,8 @@ class LanguagesSelector extends StatelessWidget { final AppLocalizations appLocalizations = AppLocalizations.of(context); final UserPreferences userPreferences = context.read(); - final List allLanguages = - _languages.getSupportedLanguagesNameInEnglish(); + final List allLanguages = _languages + .getSupportedLanguagesNameInEnglish(); final Map popularList = userPreferences.languagesUsage; @@ -165,9 +161,10 @@ class LanguagesSelector extends StatelessWidget { } // Only keep the 3 most popular languages - popularLanguagesList = - _filterLanguagesByPopularity(popularLanguagesList, popularList) - .toList(growable: false); + popularLanguagesList = _filterLanguagesByPopularity( + popularLanguagesList, + popularList, + ).toList(growable: false); // Sort the languages alphabetically final Languages languagesHelper = Languages(); @@ -180,21 +177,21 @@ class LanguagesSelector extends StatelessWidget { final OpenFoodFactsLanguage? language = await showSmoothModalSheetForTextField( - context: context, - header: SmoothModalSheetHeader( - title: title ?? appLocalizations.language_selector_title, - prefix: const SmoothModalSheetHeaderPrefixIndicator(), - suffix: const SmoothModalSheetHeaderCloseButton(), - ), - bodyBuilder: (BuildContext context) { - return _LanguagesList( - selectedLanguages: selectedLanguagesList, - popularLanguages: popularLanguagesList, - otherLanguages: otherLanguagesList, - checkedIcon: checkedIcon, + context: context, + header: SmoothModalSheetHeader( + title: title ?? appLocalizations.language_selector_title, + prefix: const SmoothModalSheetHeaderPrefixIndicator(), + suffix: const SmoothModalSheetHeaderCloseButton(), + ), + bodyBuilder: (BuildContext context) { + return _LanguagesList( + selectedLanguages: selectedLanguagesList, + popularLanguages: popularLanguagesList, + otherLanguages: otherLanguagesList, + checkedIcon: checkedIcon, + ); + }, ); - }, - ); if (language != null) { userPreferences.increaseLanguageUsage(language); @@ -203,9 +200,7 @@ class LanguagesSelector extends StatelessWidget { return language; } - static String _getCompleteName( - final OpenFoodFactsLanguage language, - ) { + static String _getCompleteName(final OpenFoodFactsLanguage language) { final String nameInLanguage = _languages.getNameInLanguage(language); final String nameInEnglish = _languages.getNameInEnglish(language); return '$nameInLanguage ($nameInEnglish)'; @@ -215,8 +210,10 @@ class LanguagesSelector extends StatelessWidget { List languages, Languages languagesHelper, ) { - return languages - .sort((final OpenFoodFactsLanguage a, final OpenFoodFactsLanguage b) { + return languages.sort(( + final OpenFoodFactsLanguage a, + final OpenFoodFactsLanguage b, + ) { return languagesHelper .getNameInEnglish(a) .compareTo(languagesHelper.getNameInEnglish(b)); @@ -228,13 +225,11 @@ class LanguagesSelector extends StatelessWidget { List languagesList, Map popularList, ) { - languagesList.sort( - (OpenFoodFactsLanguage a, OpenFoodFactsLanguage b) { - final int aUsage = popularList[a.offTag] ?? 0; - final int bUsage = popularList[b.offTag] ?? 0; - return bUsage.compareTo(aUsage); - }, - ); + languagesList.sort((OpenFoodFactsLanguage a, OpenFoodFactsLanguage b) { + final int aUsage = popularList[a.offTag] ?? 0; + final int bUsage = popularList[b.offTag] ?? 0; + return bUsage.compareTo(aUsage); + }); return languagesList.take(3); } @@ -269,15 +264,16 @@ class _LanguagesListState extends State<_LanguagesList> { super.initState(); _otherLanguages = List.of(widget.otherLanguages); _popularLanguages = List.of(widget.popularLanguages); - _selectedLanguages = - List.of(widget.selectedLanguages); + _selectedLanguages = List.of( + widget.selectedLanguages, + ); } @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final double keyboardHeight = MediaQuery.viewInsetsOf(context).bottom; @@ -285,7 +281,8 @@ class _LanguagesListState extends State<_LanguagesList> { children: [ SizedBox( width: double.infinity, - height: MediaQuery.sizeOf(context).height * + height: + MediaQuery.sizeOf(context).height * (widget.selectedLanguages.isNotEmpty ? 0.4 : 0.3), child: Theme( data: Theme.of(context).copyWith( @@ -341,7 +338,7 @@ class _LanguagesListState extends State<_LanguagesList> { height: keyboardHeight > 0.0 ? keyboardHeight : MediaQuery.viewPaddingOf(context).bottom, - ) + ), ], ); } @@ -363,9 +360,9 @@ class _LanguagesListState extends State<_LanguagesList> { type == _LanguageType.selectedTitle ? appLocalizations.language_selector_section_selected : appLocalizations.language_selector_section_frequently_used, - style: Theme.of(context).textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.bold, - ), + style: Theme.of( + context, + ).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.bold), ), ); } @@ -410,7 +407,7 @@ class _LanguagesListState extends State<_LanguagesList> { if (index < selectedLength + popularLength + diff) { return ( _popularLanguages[index - selectedLength - diff], - _LanguageType.popular + _LanguageType.popular, ); } else if (index == selectedLength + popularLength + diff) { return (null, _LanguageType.popularTitle); @@ -420,7 +417,7 @@ class _LanguagesListState extends State<_LanguagesList> { return ( _otherLanguages[index - selectedLength - popularLength - diff], - _LanguageType.other + _LanguageType.other, ); } @@ -450,24 +447,20 @@ class _LanguagesListState extends State<_LanguagesList> { final String queryForComparison = query.toLowerCase(); return list - .where((OpenFoodFactsLanguage item) => - Languages() - .getNameInEnglish(item) - .getComparisonSafeString() - .contains(queryForComparison) || - Languages() - .getNameInLanguage(item) - .getComparisonSafeString() - .contains(queryForComparison) || - item.code.contains(query)) + .where( + (OpenFoodFactsLanguage item) => + Languages() + .getNameInEnglish(item) + .getComparisonSafeString() + .contains(queryForComparison) || + Languages() + .getNameInLanguage(item) + .getComparisonSafeString() + .contains(queryForComparison) || + item.code.contains(query), + ) .toList(growable: false); } } -enum _LanguageType { - selected, - selectedTitle, - popular, - popularTitle, - other, -} +enum _LanguageType { selected, selectedTitle, popular, popularTitle, other } diff --git a/packages/smooth_app/lib/generic_lib/widgets/picture_not_found.dart b/packages/smooth_app/lib/generic_lib/widgets/picture_not_found.dart index d2bbbc1bde..aeaca1d736 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/picture_not_found.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/picture_not_found.dart @@ -7,24 +7,24 @@ class PictureNotFound extends StatelessWidget { this.foregroundColor, this.style = PictureNotFoundStyle.happy, super.key, - }) : backgroundDecoration = null, - _useInk = false; + }) : backgroundDecoration = null, + _useInk = false; const PictureNotFound.decoration({ this.backgroundDecoration, this.foregroundColor, this.style = PictureNotFoundStyle.happy, super.key, - }) : backgroundColor = null, - _useInk = false; + }) : backgroundColor = null, + _useInk = false; const PictureNotFound.ink({ this.backgroundDecoration, this.foregroundColor, this.style = PictureNotFoundStyle.happy, super.key, - }) : _useInk = true, - backgroundColor = null; + }) : _useInk = true, + backgroundColor = null; final BoxDecoration? backgroundDecoration; final Color? backgroundColor; @@ -56,18 +56,19 @@ class PictureNotFound extends StatelessWidget { if (_useInk) { return Ink( - decoration: BoxDecoration( - color: backgroundColor ?? defaultBackgroundColor, - ).copyWith( - color: backgroundDecoration?.color, - image: backgroundDecoration?.image, - border: backgroundDecoration?.border, - borderRadius: backgroundDecoration?.borderRadius, - boxShadow: backgroundDecoration?.boxShadow, - gradient: backgroundDecoration?.gradient, - backgroundBlendMode: backgroundDecoration?.backgroundBlendMode, - shape: BoxShape.rectangle, - ), + decoration: + BoxDecoration( + color: backgroundColor ?? defaultBackgroundColor, + ).copyWith( + color: backgroundDecoration?.color, + image: backgroundDecoration?.image, + border: backgroundDecoration?.border, + borderRadius: backgroundDecoration?.borderRadius, + boxShadow: backgroundDecoration?.boxShadow, + gradient: backgroundDecoration?.gradient, + backgroundBlendMode: backgroundDecoration?.backgroundBlendMode, + shape: BoxShape.rectangle, + ), child: child, ); } else { @@ -82,16 +83,9 @@ class PictureNotFound extends StatelessWidget { ); } - return DecoratedBox( - decoration: decoration, - child: child, - ); + return DecoratedBox(decoration: decoration, child: child); } } } -enum PictureNotFoundStyle { - happy, - sad, - add, -} +enum PictureNotFoundStyle { happy, sad, add } diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_app_logo.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_app_logo.dart index 951a306224..978a772cd0 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_app_logo.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_app_logo.dart @@ -5,10 +5,7 @@ import 'package:smooth_app/themes/theme_provider.dart'; /// An animated logo which can depend on [SmoothSharedAnimationController] /// to ensure animations are synced class SmoothAnimatedLogo extends StatefulWidget { - const SmoothAnimatedLogo({ - this.opacityMax = 0.65, - this.opacityMin = 0.2, - }); + const SmoothAnimatedLogo({this.opacityMax = 0.65, this.opacityMin = 0.2}); final double opacityMin; final double opacityMax; @@ -31,8 +28,10 @@ class _SmoothAnimatedLogoState extends State vsync: this, )..addListener(_onAnimationChanged); - _animation = Tween(begin: widget.opacityMin, end: widget.opacityMax) - .animate(_controller!); + _animation = Tween( + begin: widget.opacityMin, + end: widget.opacityMax, + ).animate(_controller!); _controller!.repeat(reverse: true); } diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_back_button.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_back_button.dart index b1b33246a2..d47ff0ff5b 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_back_button.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_back_button.dart @@ -6,19 +6,16 @@ import 'package:smooth_app/themes/constant_icons.dart'; /// Displays an [IconButton] containing the platform-specific default /// back button icon. class SmoothBackButton extends StatelessWidget { - const SmoothBackButton({ - this.onPressed, - this.iconColor, - super.key, - }); + const SmoothBackButton({this.onPressed, this.iconColor, super.key}); final VoidCallback? onPressed; final Color? iconColor; @override Widget build(BuildContext context) { - final MaterialLocalizations localizations = - MaterialLocalizations.of(context); + final MaterialLocalizations localizations = MaterialLocalizations.of( + context, + ); return Material( type: MaterialType.transparency, @@ -35,7 +32,8 @@ class SmoothBackButton extends StatelessWidget { padding: _iconPadding, child: Icon( ConstantIcons.backIcon, - color: iconColor ?? + color: + iconColor ?? (Theme.of(context).colorScheme.brightness == Brightness.light ? Colors.black diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart index 7aeaada8f4..40b0bc15db 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_card.dart @@ -69,10 +69,7 @@ class SmoothCard extends StatelessWidget { Widget result = child; if (padding != null) { - result = Padding( - padding: padding!, - child: result, - ); + result = Padding(padding: padding!, child: result); } if (ignoreDefaultSemantics) { @@ -87,7 +84,8 @@ class SmoothCard extends StatelessWidget { elevation: elevation, shadowColor: const Color.fromARGB(25, 0, 0, 0), borderRadius: borderRadius ?? ROUNDED_BORDER_RADIUS, - color: color ?? + color: + color ?? (Theme.of(context).brightness == Brightness.light ? Colors.white : Colors.black), @@ -95,12 +93,7 @@ class SmoothCard extends StatelessWidget { child: result, ); - return margin == null - ? result - : Padding( - padding: margin!, - child: result, - ); + return margin == null ? result : Padding(padding: margin!, child: result); } } @@ -178,16 +171,14 @@ class SmoothCardWithRoundedHeader extends StatelessWidget { } class SmoothCardWithRoundedHeaderBanner extends StatelessWidget { - const SmoothCardWithRoundedHeaderBanner({ - required this.child, - }); + const SmoothCardWithRoundedHeaderBanner({required this.child}); final Widget child; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return CustomPaint( painter: _SmoothCardWithRoundedHeaderBackgroundPainter( @@ -195,7 +186,7 @@ class SmoothCardWithRoundedHeaderBanner extends StatelessWidget { radius: ROUNDED_RADIUS, shadowElevation: SmoothCardWithRoundedHeaderTopShadowProvider.of(context)?.shadow ?? - 0.0, + 0.0, ), child: child, ); @@ -244,12 +235,14 @@ class SmoothCardWithRoundedHeaderTop extends StatelessWidget { color: color, radius: borderRadius?.topRight ?? ROUNDED_RADIUS, shadowElevation: - SmoothCardWithRoundedHeaderTopShadowProvider.of(context) - ?.shadow ?? - 0.0, + SmoothCardWithRoundedHeaderTopShadowProvider.of( + context, + )?.shadow ?? + 0.0, ), child: Padding( - padding: titlePadding ?? + padding: + titlePadding ?? (trailing != null ? const EdgeInsetsDirectional.only( top: 2.0, @@ -275,7 +268,8 @@ class SmoothCardWithRoundedHeaderTop extends StatelessWidget { shape: BoxShape.circle, ), child: Padding( - padding: leadingPadding ?? + padding: + leadingPadding ?? const EdgeInsetsDirectional.all(6.0), child: leading, ), @@ -287,11 +281,10 @@ class SmoothCardWithRoundedHeaderTop extends StatelessWidget { title, maxLines: 1, overflow: TextOverflow.ellipsis, - style: (titleTextStyle ?? - Theme.of(context).textTheme.displaySmall) - ?.copyWith( - color: Colors.white, - ), + style: + (titleTextStyle ?? + Theme.of(context).textTheme.displaySmall) + ?.copyWith(color: Colors.white), ), ), if (trailing != null) ...[ @@ -314,8 +307,8 @@ class SmoothCardWithRoundedHeaderTop extends StatelessWidget { } static Color getHeaderColor(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return context.lightTheme(listen: false) ? extension.primaryBlack : Colors.black; @@ -332,16 +325,19 @@ class SmoothCardWithRoundedHeaderTopShadowProvider extends InheritedWidget { final double shadow; static SmoothCardWithRoundedHeaderTopShadowProvider? of( - BuildContext context) { - final SmoothCardWithRoundedHeaderTopShadowProvider? result = - context.dependOnInheritedWidgetOfExactType< - SmoothCardWithRoundedHeaderTopShadowProvider>(); + BuildContext context, + ) { + final SmoothCardWithRoundedHeaderTopShadowProvider? result = context + .dependOnInheritedWidgetOfExactType< + SmoothCardWithRoundedHeaderTopShadowProvider + >(); return result; } @override bool updateShouldNotify( - SmoothCardWithRoundedHeaderTopShadowProvider oldWidget) { + SmoothCardWithRoundedHeaderTopShadowProvider oldWidget, + ) { return oldWidget.shadow != shadow; } } @@ -363,16 +359,15 @@ class SmoothCardWithRoundedHeaderBody extends StatelessWidget { Widget build(BuildContext context) { return SmoothCard( margin: EdgeInsets.zero, - padding: contentPadding ?? - const EdgeInsetsDirectional.only( - top: MEDIUM_SPACE, - ), + padding: + contentPadding ?? const EdgeInsetsDirectional.only(top: MEDIUM_SPACE), borderRadius: borderRadius ?? ROUNDED_BORDER_RADIUS, - color: contentBackgroundColor ?? + color: + contentBackgroundColor ?? (context.darkTheme() ? context - .extension() - .primaryUltraBlack + .extension() + .primaryUltraBlack : null), child: child, ); @@ -414,11 +409,7 @@ class _SmoothCardWithRoundedHeaderBackgroundPainter extends CustomPainter { clockwise: false, ) ..lineTo(radius.x, 0) - ..arcToPoint( - Offset(0, radius.y), - radius: radius, - clockwise: false, - ) + ..arcToPoint(Offset(0, radius.y), radius: radius, clockwise: false) ..close(); if (shadowElevation > 0.0) { @@ -435,14 +426,12 @@ class _SmoothCardWithRoundedHeaderBackgroundPainter extends CustomPainter { @override bool shouldRepaint( _SmoothCardWithRoundedHeaderBackgroundPainter oldDelegate, - ) => - shadowElevation != oldDelegate.shadowElevation; + ) => shadowElevation != oldDelegate.shadowElevation; @override bool shouldRebuildSemantics( _SmoothCardWithRoundedHeaderBackgroundPainter oldDelegate, - ) => - false; + ) => false; } class SmoothCardHeaderButton extends StatelessWidget { diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_error_card.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_error_card.dart index 821dec9346..778a8cfe90 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_error_card.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_error_card.dart @@ -35,9 +35,7 @@ class _SmoothErrorCardState extends State { Widget _getTryAgainButton() { return Padding( - padding: EdgeInsets.symmetric( - horizontal: _horizontalPaddingButtons, - ), + padding: EdgeInsets.symmetric(horizontal: _horizontalPaddingButtons), child: SmoothSimpleButton( onPressed: widget.tryAgainFunction, minWidth: double.infinity, @@ -52,31 +50,29 @@ class _SmoothErrorCardState extends State { child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Icon( - Icons.error_outline, - size: 40, - color: Colors.red, - ), + const Icon(Icons.error_outline, size: 40, color: Colors.red), Expanded( child: Padding( padding: const EdgeInsets.symmetric( - horizontal: SMALL_SPACE, vertical: VERY_SMALL_SPACE), + horizontal: SMALL_SPACE, + vertical: VERY_SMALL_SPACE, + ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( _appLocalizations.error_occurred, style: Theme.of(context).textTheme.bodyMedium?.apply( - fontWeightDelta: 500, - color: Colors.red, - ), + fontWeightDelta: 500, + color: Colors.red, + ), ), const SizedBox(height: VERY_LARGE_SPACE), Text( widget.errorMessage, - style: Theme.of(context).textTheme.bodyMedium?.apply( - fontWeightDelta: 500, - ), + style: Theme.of( + context, + ).textTheme.bodyMedium?.apply(fontWeightDelta: 500), ).selectable(), ], ), @@ -93,9 +89,7 @@ class _SmoothErrorCardState extends State { } return Padding( - padding: EdgeInsets.symmetric( - horizontal: _horizontalPaddingButtons, - ), + padding: EdgeInsets.symmetric(horizontal: _horizontalPaddingButtons), child: SmoothSimpleButton( onPressed: _setShowErrorText, minWidth: double.infinity, @@ -106,9 +100,7 @@ class _SmoothErrorCardState extends State { Widget _getBody() { return Padding( - padding: const EdgeInsets.symmetric( - vertical: VERY_LARGE_SPACE, - ), + padding: const EdgeInsets.symmetric(vertical: VERY_LARGE_SPACE), child: Column( children: [ _getTryAgainButton(), @@ -124,10 +116,7 @@ class _SmoothErrorCardState extends State { padding: const EdgeInsets.symmetric(horizontal: SMALL_SPACE), child: Text( _appLocalizations.there_was_an_error, - style: const TextStyle( - fontSize: 24.0, - fontWeight: FontWeight.bold, - ), + style: const TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), ), ); } @@ -148,11 +137,7 @@ class _SmoothErrorCardState extends State { child: SmoothCard( child: Column( mainAxisSize: MainAxisSize.min, - children: [ - _getErrorSvg(), - _getTitle(), - _getBody(), - ], + children: [_getErrorSvg(), _getTitle(), _getBody()], ), ), ); diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_list_tile_card.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_list_tile_card.dart index 76affed640..44e3dd8ceb 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_list_tile_card.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_list_tile_card.dart @@ -27,17 +27,17 @@ class SmoothListTileCard extends StatelessWidget { EdgeInsetsGeometry? margin, Key? key, }) : this( - title: title, - subtitle: subtitle, - key: key, - onTap: onTap, - // we use a Column to have the icon centered vertically - leading: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [icon ?? const Icon(Icons.edit)], - ), - margin: margin, - ); + title: title, + subtitle: subtitle, + key: key, + onTap: onTap, + // we use a Column to have the icon centered vertically + leading: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [icon ?? const Icon(Icons.edit)], + ), + margin: margin, + ); final Widget? title; final Widget? subtitle; @@ -47,8 +47,8 @@ class SmoothListTileCard extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return SmoothCard( diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_responsive.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_responsive.dart index 29995691ca..0fd49f5083 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_responsive.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_responsive.dart @@ -104,9 +104,4 @@ class SmoothResponsiveBuilder extends StatelessWidget { } } -enum DeviceType { - small, - smartphone, - tablet, - large, -} +enum DeviceType { small, smartphone, tablet, large } diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_sliver_card.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_sliver_card.dart index f0951e6459..3d386d31c8 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_sliver_card.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_sliver_card.dart @@ -76,20 +76,21 @@ class _SliverCardWithRoundedHeaderState if (_height == null) { return SliverToBoxAdapter( - child: Column( - children: [ - if (widget.banner != null) + child: Column( + children: [ + if (widget.banner != null) + MeasureSize( + onChange: (Size size) => + setState(() => _bannerHeight = size.height), + child: widget.banner!, + ), MeasureSize( - onChange: (Size size) => - setState(() => _bannerHeight = size.height), - child: widget.banner!, + onChange: (Size size) => setState(() => _height = size.height), + child: Opacity(opacity: 0.0, child: child), ), - MeasureSize( - onChange: (Size size) => setState(() => _height = size.height), - child: Opacity(opacity: 0.0, child: child), - ), - ], - )); + ], + ), + ); } return MultiSliver( @@ -146,10 +147,7 @@ class _SliverCardWithRoundedHeaderDelegate radius: ROUNDED_RADIUS, ) : null, - child: const SizedBox( - height: MEDIUM_SPACE, - width: double.infinity, - ), + child: const SizedBox(height: MEDIUM_SPACE, width: double.infinity), ), SmoothCardWithRoundedHeaderTopShadowProvider( shadow: shrinkOffset.progressAndClamp(0.0, 30.0, 1.0), @@ -203,14 +201,11 @@ class _SliverCardWithRoundedHeaderClipPainter extends CustomPainter { } @override - bool shouldRepaint( - _SliverCardWithRoundedHeaderClipPainter oldDelegate, - ) => + bool shouldRepaint(_SliverCardWithRoundedHeaderClipPainter oldDelegate) => oldDelegate._paint.color != _paint.color; @override bool shouldRebuildSemantics( _SliverCardWithRoundedHeaderClipPainter oldDelegate, - ) => - false; + ) => false; } diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_snackbar.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_snackbar.dart index 03adfe34a6..309d34d36e 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_snackbar.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_snackbar.dart @@ -28,13 +28,14 @@ class SmoothFloatingSnackbar extends SnackBar { Duration? duration, super.key, }) : super( - margin: margin ?? const EdgeInsetsDirectional.all(SMALL_SPACE), - duration: duration ?? - (action != null - ? const Duration(seconds: 10) - : SnackBarDuration.short), - behavior: SnackBarBehavior.floating, - ); + margin: margin ?? const EdgeInsetsDirectional.all(SMALL_SPACE), + duration: + duration ?? + (action != null + ? const Duration(seconds: 10) + : SnackBarDuration.short), + behavior: SnackBarBehavior.floating, + ); SmoothFloatingSnackbar.positive({ required BuildContext context, @@ -56,25 +57,24 @@ class SmoothFloatingSnackbar extends SnackBar { Duration? duration, super.key, }) : super( - margin: margin ?? const EdgeInsetsDirectional.all(SMALL_SPACE), - duration: duration ?? - (action != null - ? const Duration(seconds: 10) - : SnackBarDuration.short), - behavior: SnackBarBehavior.floating, - backgroundColor: - context.extension().success, - content: Row( - children: [ - Expanded(child: Text(text)), - const SizedBox(width: SMALL_SPACE), - const Icon( - Icons.check_circle, - color: Colors.white, - ), - ], - ), - ); + margin: margin ?? const EdgeInsetsDirectional.all(SMALL_SPACE), + duration: + duration ?? + (action != null + ? const Duration(seconds: 10) + : SnackBarDuration.short), + behavior: SnackBarBehavior.floating, + backgroundColor: context + .extension() + .success, + content: Row( + children: [ + Expanded(child: Text(text)), + const SizedBox(width: SMALL_SPACE), + const Icon(Icons.check_circle, color: Colors.white), + ], + ), + ); SmoothFloatingSnackbar.error({ required BuildContext context, @@ -95,55 +95,51 @@ class SmoothFloatingSnackbar extends SnackBar { Duration? duration, super.key, }) : super( - margin: const EdgeInsetsDirectional.all(SMALL_SPACE), - duration: duration ?? - (action != null - ? const Duration(seconds: 10) - : SnackBarDuration.short), - behavior: SnackBarBehavior.floating, - backgroundColor: - context.extension().error, - action: action?.copyWith( - backgroundColor: Colors.white38, - textColor: Colors.white, - ), - content: Row( - children: [ - ExcludeSemantics( - child: DecoratedBox( - decoration: const BoxDecoration( - color: Colors.white, - shape: BoxShape.circle, - ), - child: Padding( - padding: const EdgeInsetsDirectional.only( - start: 6.0, - end: SMALL_SPACE, - top: 6.5, - bottom: SMALL_SPACE, - ), - child: Builder( - builder: (BuildContext context) { - return icons.Warning( - color: context - .extension() - .error, - size: 15.0, - ); - }, - ), - ), - ), - ), - const SizedBox(width: LARGE_SPACE), - Expanded( - child: Text( - text, - ), - ), - ], - ), - ); + margin: const EdgeInsetsDirectional.all(SMALL_SPACE), + duration: + duration ?? + (action != null + ? const Duration(seconds: 10) + : SnackBarDuration.short), + behavior: SnackBarBehavior.floating, + backgroundColor: context.extension().error, + action: action?.copyWith( + backgroundColor: Colors.white38, + textColor: Colors.white, + ), + content: Row( + children: [ + ExcludeSemantics( + child: DecoratedBox( + decoration: const BoxDecoration( + color: Colors.white, + shape: BoxShape.circle, + ), + child: Padding( + padding: const EdgeInsetsDirectional.only( + start: 6.0, + end: SMALL_SPACE, + top: 6.5, + bottom: SMALL_SPACE, + ), + child: Builder( + builder: (BuildContext context) { + return icons.Warning( + color: context + .extension() + .error, + size: 15.0, + ); + }, + ), + ), + ), + ), + const SizedBox(width: LARGE_SPACE), + Expanded(child: Text(text)), + ], + ), + ); } extension SnackBarActionExtension on SnackBarAction { diff --git a/packages/smooth_app/lib/generic_lib/widgets/smooth_text_form_field.dart b/packages/smooth_app/lib/generic_lib/widgets/smooth_text_form_field.dart index 180017595c..ce15d1d616 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/smooth_text_form_field.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/smooth_text_form_field.dart @@ -5,10 +5,7 @@ import 'package:smooth_app/helpers/strings_helper.dart'; import 'package:smooth_app/l10n/app_localizations.dart'; import 'package:smooth_app/themes/theme_provider.dart'; -enum TextFieldTypes { - PLAIN_TEXT, - PASSWORD, -} +enum TextFieldTypes { PLAIN_TEXT, PASSWORD } class SmoothTextFormField extends StatefulWidget { const SmoothTextFormField({ @@ -62,11 +59,11 @@ class SmoothTextFormField extends StatefulWidget { State createState() => _SmoothTextFormFieldState(); static TextStyle defaultHintTextStyle(BuildContext context) => TextStyle( - fontStyle: FontStyle.italic, - color: context.lightTheme() - ? const Color(0x99000000) - : const Color(0xBBFFFFFF), - ); + fontStyle: FontStyle.italic, + color: context.lightTheme() + ? const Color(0x99000000) + : const Color(0xBBFFFFFF), + ); } class _SmoothTextFormFieldState extends State { @@ -82,9 +79,9 @@ class _SmoothTextFormFieldState extends State { Widget build(BuildContext context) { final bool enableSuggestions = widget.type == TextFieldTypes.PLAIN_TEXT; final bool autocorrect = widget.type == TextFieldTypes.PLAIN_TEXT; - final TextStyle textStyle = DefaultTextStyle.of(context).style.copyWith( - fontSize: 15.0, - ); + final TextStyle textStyle = DefaultTextStyle.of( + context, + ).style.copyWith(fontSize: 15.0); final double textSize = textStyle.fontSize ?? 20.0; final AppLocalizations appLocalization = AppLocalizations.of(context); @@ -103,14 +100,16 @@ class _SmoothTextFormFieldState extends State { autofocus: widget.autofocus ?? false, maxLines: widget.maxLines, autovalidateMode: AutovalidateMode.onUserInteraction, - onChanged: widget.onChanged ?? + onChanged: + widget.onChanged ?? (String data) { // Rebuilds for changing the eye icon if (widget.type == TextFieldTypes.PASSWORD && data.length != 1) { setState(() {}); } }, - spellCheckConfiguration: widget.spellCheckConfiguration ?? + spellCheckConfiguration: + widget.spellCheckConfiguration ?? const SpellCheckConfiguration.disabled(), onFieldSubmitted: widget.onFieldSubmitted, style: TextStyle(fontSize: textSize), @@ -120,7 +119,8 @@ class _SmoothTextFormFieldState extends State { FilteringTextInputFormatter.deny(TextHelper.emojiRegex), ], decoration: InputDecoration( - contentPadding: widget.contentPadding ?? + contentPadding: + widget.contentPadding ?? const EdgeInsets.symmetric( horizontal: LARGE_SPACE, vertical: SMALL_SPACE, @@ -138,12 +138,10 @@ class _SmoothTextFormFieldState extends State { ), enabledBorder: OutlineInputBorder( borderRadius: widget.borderRadius ?? CIRCULAR_BORDER_RADIUS, - borderSide: const BorderSide( - color: Colors.transparent, - width: 5.0, - ), + borderSide: const BorderSide(color: Colors.transparent, width: 5.0), ), - suffixIcon: widget.suffixIcon ?? + suffixIcon: + widget.suffixIcon ?? (widget.type == TextFieldTypes.PASSWORD ? IconButton( tooltip: appLocalization.show_password, diff --git a/packages/smooth_app/lib/generic_lib/widgets/svg_icon.dart b/packages/smooth_app/lib/generic_lib/widgets/svg_icon.dart index 240b827af4..c78da7b1de 100644 --- a/packages/smooth_app/lib/generic_lib/widgets/svg_icon.dart +++ b/packages/smooth_app/lib/generic_lib/widgets/svg_icon.dart @@ -14,17 +14,17 @@ class SvgIcon extends StatelessWidget { @override Widget build(BuildContext context) => SvgPicture.asset( - assetName, - height: DEFAULT_ICON_SIZE, - width: DEFAULT_ICON_SIZE, - colorFilter: dontAddColor - ? null - : ui.ColorFilter.mode( - _iconColor(Theme.of(context)), - ui.BlendMode.srcIn, - ), - package: AppHelper.APP_PACKAGE, - ); + assetName, + height: DEFAULT_ICON_SIZE, + width: DEFAULT_ICON_SIZE, + colorFilter: dontAddColor + ? null + : ui.ColorFilter.mode( + _iconColor(Theme.of(context)), + ui.BlendMode.srcIn, + ), + package: AppHelper.APP_PACKAGE, + ); /// Returns the standard icon color in a [ListTile]. /// diff --git a/packages/smooth_app/lib/helpers/analytics_helper.dart b/packages/smooth_app/lib/helpers/analytics_helper.dart index 6d5f2df814..76644c9fcf 100644 --- a/packages/smooth_app/lib/helpers/analytics_helper.dart +++ b/packages/smooth_app/lib/helpers/analytics_helper.dart @@ -42,7 +42,9 @@ enum AnalyticsEvent { registerAction(tag: 'register', category: AnalyticsCategory.userManagement), logoutAction(tag: 'logged out', category: AnalyticsCategory.userManagement), producerSignup( - tag: 'signed up as producer', category: AnalyticsCategory.userManagement), + tag: 'signed up as producer', + category: AnalyticsCategory.userManagement, + ), couldNotScanProduct( tag: 'could not scan product', category: AnalyticsCategory.couldNotFindProduct, @@ -123,14 +125,8 @@ enum AnalyticsEvent { tag: 'closed new product page without any input', category: AnalyticsCategory.newProduct, ), - shareList( - tag: 'shared a list', - category: AnalyticsCategory.list, - ), - openListWeb( - tag: 'open a list in wbe', - category: AnalyticsCategory.list, - ), + shareList(tag: 'shared a list', category: AnalyticsCategory.list), + openListWeb(tag: 'open a list in wbe', category: AnalyticsCategory.list), productDeepLink( tag: 'open a product from an URL', category: AnalyticsCategory.deepLink, @@ -151,14 +147,8 @@ enum AnalyticsEvent { tag: 'hunger game opened', category: AnalyticsCategory.hungerGame, ), - appRatingSatisfied( - tag: 'satisfied', - category: AnalyticsCategory.appRating, - ), - appRatingNeutral( - tag: 'neutral', - category: AnalyticsCategory.appRating, - ), + appRatingSatisfied(tag: 'satisfied', category: AnalyticsCategory.appRating), + appRatingNeutral(tag: 'neutral', category: AnalyticsCategory.appRating), appRatingNotSatisfied( tag: 'not satisfied', category: AnalyticsCategory.appRating, @@ -171,15 +161,9 @@ enum AnalyticsEvent { } enum AnalyticsRobotoffEvents { - robotoffNutritionExtracted( - name: 'robotoff nutrition extracted', - ), - robotoffNutritionInsightAccepted( - name: 'robotoff nutrition insight accepted', - ), - robotoffNutritionInsightRejected( - name: 'robotoff nutrition insight rejected', - ); + robotoffNutritionExtracted(name: 'robotoff nutrition extracted'), + robotoffNutritionInsightAccepted(name: 'robotoff nutrition insight accepted'), + robotoffNutritionInsightRejected(name: 'robotoff nutrition insight rejected'); const AnalyticsRobotoffEvents({required this.name}); @@ -246,35 +230,27 @@ class AnalyticsHelper { _uniqueRandom = await userPreferences.getUniqueRandom(); } - static Future initSentry({ - required Function()? appRunner, - }) async { - await SentryFlutter.init( - (SentryOptions options) { - options - ..dsn = - 'https://22ec5d0489534b91ba455462d3736680@o241488.ingest.sentry.io/5376745' - ..beforeSend = ( - SentryEvent event, - Hint hint, - ) async { - return event.copyWith( - tags: { - 'store': GlobalVars.storeLabel.name, - 'scanner': GlobalVars.scannerLabel.name, - }, - ); - }; - // To set a uniform sample rate - options - ..tracesSampleRate = 1.0 - ..beforeSend = _beforeSend - ..captureFailedRequests = false - ..environment = - '${GlobalVars.storeLabel.name}-${GlobalVars.scannerLabel.name}'; - }, - appRunner: appRunner, - ); + static Future initSentry({required Function()? appRunner}) async { + await SentryFlutter.init((SentryOptions options) { + options + ..dsn = + 'https://22ec5d0489534b91ba455462d3736680@o241488.ingest.sentry.io/5376745' + ..beforeSend = (SentryEvent event, Hint hint) async { + return event.copyWith( + tags: { + 'store': GlobalVars.storeLabel.name, + 'scanner': GlobalVars.scannerLabel.name, + }, + ); + }; + // To set a uniform sample rate + options + ..tracesSampleRate = 1.0 + ..beforeSend = _beforeSend + ..captureFailedRequests = false + ..environment = + '${GlobalVars.storeLabel.name}-${GlobalVars.scannerLabel.name}'; + }, appRunner: appRunner); } /// Don't call this method directly, it is automatically updated via the @@ -312,9 +288,7 @@ class AnalyticsHelper { static late PackageInfo _packageInfo; - static Future initMatomo( - final bool screenshotMode, - ) async { + static Future initMatomo(final bool screenshotMode) async { _packageInfo = await PackageInfo.fromPlatform(); if (screenshotMode) { _setCrashReports(false); @@ -360,13 +334,12 @@ class AnalyticsHelper { AnalyticsEvent msg, { int? eventValue, String? barcode, - }) => - trackCustomEvent( - msg.name, - msg.category.tag, - eventValue: eventValue, - barcode: barcode, - ); + }) => trackCustomEvent( + msg.name, + msg.category.tag, + eventValue: eventValue, + barcode: barcode, + ); // Used by code which is outside of the core:smooth_app code // e.g. the scanner implementation @@ -400,40 +373,37 @@ class AnalyticsHelper { AnalyticsRobotoffEvents event, Nutrient nutrient, Product product, - ) => - trackCustomEvent( - event.name, - AnalyticsCategory.robotoff.tag, - action: nutrient.name, - barcode: product.barcode, - productType: product.productType ?? ProductType.food, - ); + ) => trackCustomEvent( + event.name, + AnalyticsCategory.robotoff.tag, + action: nutrient.name, + barcode: product.barcode, + productType: product.productType ?? ProductType.food, + ); static void trackProductEdit( AnalyticsEditEvents editEventName, Product product, [ bool saved = false, - ]) => - trackCustomEvent( - saved ? '${editEventName.name}-saved' : editEventName.name, - AnalyticsCategory.productEdit.tag, - action: editEventName.name, - barcode: product.barcode, - productType: product.productType ?? ProductType.food, - ); + ]) => trackCustomEvent( + saved ? '${editEventName.name}-saved' : editEventName.name, + AnalyticsCategory.productEdit.tag, + action: editEventName.name, + barcode: product.barcode, + productType: product.productType ?? ProductType.food, + ); static void trackProductEvent( AnalyticsEvent msg, { int? eventValue, required Product product, - }) => - trackCustomEvent( - msg.name, - msg.category.tag, - eventValue: eventValue, - barcode: product.barcode, - productType: product.productType ?? ProductType.food, - ); + }) => trackCustomEvent( + msg.name, + msg.category.tag, + eventValue: eventValue, + barcode: product.barcode, + productType: product.productType ?? ProductType.food, + ); static void trackSearch({ required String search, diff --git a/packages/smooth_app/lib/helpers/attributes_card_helper.dart b/packages/smooth_app/lib/helpers/attributes_card_helper.dart index 65206a8b93..e6b35582fe 100644 --- a/packages/smooth_app/lib/helpers/attributes_card_helper.dart +++ b/packages/smooth_app/lib/helpers/attributes_card_helper.dart @@ -14,7 +14,7 @@ enum AttributeEvaluation { GOOD, VERY_GOOD; -// TODO(monsieurtanuki): not sure to see the added value of keeping both CardEvaluation and AttributeEvaluation + // TODO(monsieurtanuki): not sure to see the added value of keeping both CardEvaluation and AttributeEvaluation CardEvaluation getCardEvaluation() { switch (this) { case AttributeEvaluation.UNKNOWN: @@ -33,8 +33,11 @@ enum AttributeEvaluation { } } -Widget getAttributeDisplayIcon(final Attribute attribute, - {bool? isFoodPreferences = false, BuildContext? context}) { +Widget getAttributeDisplayIcon( + final Attribute attribute, { + bool? isFoodPreferences = false, + BuildContext? context, +}) { return Container( child: attribute.getCircledIcon( backgroundColor: isFoodPreferences! @@ -114,13 +117,14 @@ String? _getNovaDisplayTitle(final Attribute attribute) => /// Compares the match score from [attribute] with various thresholds and returns appropriate result. T _attributeMatchComparison( - final Attribute attribute, - T invalidAttributeResult, - T lowestMatchResult, - T lowMatchResult, - T midMatchResult, - T highMatchResult, - T highestMatchResult) { + final Attribute attribute, + T invalidAttributeResult, + T lowestMatchResult, + T lowMatchResult, + T midMatchResult, + T highMatchResult, + T highestMatchResult, +) { final AttributeEvaluation evaluation = getAttributeEvaluation(attribute); switch (evaluation) { case AttributeEvaluation.UNKNOWN: diff --git a/packages/smooth_app/lib/helpers/collections_helper.dart b/packages/smooth_app/lib/helpers/collections_helper.dart index d2098cefbd..33638dd8f4 100644 --- a/packages/smooth_app/lib/helpers/collections_helper.dart +++ b/packages/smooth_app/lib/helpers/collections_helper.dart @@ -27,9 +27,8 @@ class AverageList with ListMixin { int get length => _elements.length; @override - T operator [](int index) => throw UnsupportedError( - 'Please only use the "add" method', - ); + T operator [](int index) => + throw UnsupportedError('Please only use the "add" method'); @override void operator []=(int index, T value) { diff --git a/packages/smooth_app/lib/helpers/color_extension.dart b/packages/smooth_app/lib/helpers/color_extension.dart index d67adfa98b..fcc01fb81e 100644 --- a/packages/smooth_app/lib/helpers/color_extension.dart +++ b/packages/smooth_app/lib/helpers/color_extension.dart @@ -6,8 +6,9 @@ extension ColorExtension on Color { assert(amount >= 0 && amount <= 1); final HSLColor hsl = HSLColor.fromColor(this); - final HSLColor hslDark = - hsl.withLightness((hsl.lightness - amount).clamp(0.0, 1.0)); + final HSLColor hslDark = hsl.withLightness( + (hsl.lightness - amount).clamp(0.0, 1.0), + ); return hslDark.toColor(); } @@ -16,8 +17,9 @@ extension ColorExtension on Color { assert(amount >= 0 && amount <= 1); final HSLColor hsl = HSLColor.fromColor(this); - final HSLColor hslLight = - hsl.withLightness((hsl.lightness + amount).clamp(0.0, 1.0)); + final HSLColor hslLight = hsl.withLightness( + (hsl.lightness + amount).clamp(0.0, 1.0), + ); return hslLight.toColor(); } diff --git a/packages/smooth_app/lib/helpers/database_helper.dart b/packages/smooth_app/lib/helpers/database_helper.dart index 5b35bab4de..a6cd4ea70d 100644 --- a/packages/smooth_app/lib/helpers/database_helper.dart +++ b/packages/smooth_app/lib/helpers/database_helper.dart @@ -6,10 +6,7 @@ import 'package:smooth_app/database/dao_int.dart'; /// The [key] is a string that is used to identify the sequence. /// /// The progressive number is saved in the database, so that it is persistent. -Future getNextSequenceNumber( - final DaoInt daoInt, - final String key, -) async { +Future getNextSequenceNumber(final DaoInt daoInt, final String key) async { int? result = daoInt.get(key); if (result == null) { result = 1; diff --git a/packages/smooth_app/lib/helpers/entry_points_helper.dart b/packages/smooth_app/lib/helpers/entry_points_helper.dart index 3df3ef0001..01f9e624e6 100644 --- a/packages/smooth_app/lib/helpers/entry_points_helper.dart +++ b/packages/smooth_app/lib/helpers/entry_points_helper.dart @@ -1,13 +1,3 @@ -enum StoreLabel { - GooglePlayStore, - AppleAppStore, - FDroid, - AmazonAppStore, - Test, -} +enum StoreLabel { GooglePlayStore, AppleAppStore, FDroid, AmazonAppStore, Test } -enum ScannerLabel { - ZXing, - MLKit, - Test, -} +enum ScannerLabel { ZXing, MLKit, Test } diff --git a/packages/smooth_app/lib/helpers/extension_on_text_helper.dart b/packages/smooth_app/lib/helpers/extension_on_text_helper.dart index 0245e85830..e266d676e5 100644 --- a/packages/smooth_app/lib/helpers/extension_on_text_helper.dart +++ b/packages/smooth_app/lib/helpers/extension_on_text_helper.dart @@ -15,10 +15,7 @@ extension Selectable on Text { maxLines: maxLines, // TODO(m123): Fix or remove alltogether // ignore: deprecated_member_use - toolbarOptions: const ToolbarOptions( - copy: true, - selectAll: true, - ), + toolbarOptions: const ToolbarOptions(copy: true, selectAll: true), ) : Text( data!, @@ -68,17 +65,16 @@ extension TextSpanExtension on TextSpan { String? semanticsLabel, Locale? locale, bool? spellOut, - }) => - TextSpan( - style: style ?? this.style, - children: children ?? this.children, - text: text ?? this.text, - recognizer: recognizer ?? this.recognizer, - mouseCursor: mouseCursor ?? this.mouseCursor, - onEnter: onEnter ?? this.onEnter, - onExit: onExit ?? this.onExit, - semanticsLabel: semanticsLabel ?? this.semanticsLabel, - locale: locale ?? this.locale, - spellOut: spellOut ?? this.spellOut, - ); + }) => TextSpan( + style: style ?? this.style, + children: children ?? this.children, + text: text ?? this.text, + recognizer: recognizer ?? this.recognizer, + mouseCursor: mouseCursor ?? this.mouseCursor, + onEnter: onEnter ?? this.onEnter, + onExit: onExit ?? this.onExit, + semanticsLabel: semanticsLabel ?? this.semanticsLabel, + locale: locale ?? this.locale, + spellOut: spellOut ?? this.spellOut, + ); } diff --git a/packages/smooth_app/lib/helpers/haptic_feedback_helper.dart b/packages/smooth_app/lib/helpers/haptic_feedback_helper.dart index 1a66f1e1fe..738bb8b9a5 100644 --- a/packages/smooth_app/lib/helpers/haptic_feedback_helper.dart +++ b/packages/smooth_app/lib/helpers/haptic_feedback_helper.dart @@ -71,8 +71,9 @@ class SmoothHapticFeedback { } static Future _areHapticFeedbackEnabled() async { - return UserPreferences.getUserPreferences() - .then((UserPreferences userPreferences) { + return UserPreferences.getUserPreferences().then(( + UserPreferences userPreferences, + ) { return userPreferences.hapticFeedbackEnabled; }); } diff --git a/packages/smooth_app/lib/helpers/image_compute_container.dart b/packages/smooth_app/lib/helpers/image_compute_container.dart index 707491381e..9a3aabfafb 100644 --- a/packages/smooth_app/lib/helpers/image_compute_container.dart +++ b/packages/smooth_app/lib/helpers/image_compute_container.dart @@ -104,14 +104,13 @@ Future _convertImageFromUI( final ByteData rawData, final int width, final int height, -) async => - image.Image.fromBytes( - width: width, - height: height, - bytes: rawData.buffer, - format: image.Format.uint8, - order: image.ChannelOrder.rgba, - ); +) async => image.Image.fromBytes( + width: width, + height: height, + bytes: rawData.buffer, + format: image.Format.uint8, + order: image.ChannelOrder.rgba, +); /// Saves an image to a BMP file. As BMP for better performances. Future _saveBmp( @@ -126,10 +125,7 @@ Future _saveBmp( container.width, container.height, ); - await container.file.writeAsBytes( - image.encodeBmp(rawImage), - flush: true, - ); + await container.file.writeAsBytes(image.encodeBmp(rawImage), flush: true); } /// Saves an image to a JPEG file. diff --git a/packages/smooth_app/lib/helpers/image_field_extension.dart b/packages/smooth_app/lib/helpers/image_field_extension.dart index cf8039c06e..c1a912a2f0 100644 --- a/packages/smooth_app/lib/helpers/image_field_extension.dart +++ b/packages/smooth_app/lib/helpers/image_field_extension.dart @@ -7,24 +7,23 @@ import 'package:smooth_app/pages/product/product_image_swipeable_view.dart'; extension ImageFieldSmoothieExtension on ImageField { static List getOrderedMainImageFields( final ProductType? productType, - ) => - switch (productType) { - ProductType.product => const [ - ImageField.FRONT, - ImageField.PACKAGING, - ], - ProductType.beauty => const [ - ImageField.FRONT, - ImageField.INGREDIENTS, - ImageField.PACKAGING, - ], - null || ProductType.food || ProductType.petFood => const [ - ImageField.FRONT, - ImageField.INGREDIENTS, - ImageField.NUTRITION, - ImageField.PACKAGING, - ], - }; + ) => switch (productType) { + ProductType.product => const [ + ImageField.FRONT, + ImageField.PACKAGING, + ], + ProductType.beauty => const [ + ImageField.FRONT, + ImageField.INGREDIENTS, + ImageField.PACKAGING, + ], + null || ProductType.food || ProductType.petFood => const [ + ImageField.FRONT, + ImageField.INGREDIENTS, + ImageField.NUTRITION, + ImageField.PACKAGING, + ], + }; void setUrl(final Product product, final String url) { switch (this) { @@ -87,56 +86,49 @@ extension ImageFieldSmoothieExtension on ImageField { String getPictureAccessibilityLabel( final AppLocalizations appLocalizations, - ) => - switch (this) { - ImageField.FRONT => - appLocalizations.product_image_front_accessibility_label, - ImageField.INGREDIENTS => - appLocalizations.product_image_ingredients_accessibility_label, - ImageField.NUTRITION => - appLocalizations.product_image_nutrition_accessibility_label, - ImageField.PACKAGING => - appLocalizations.product_image_packaging_accessibility_label, - ImageField.OTHER => - appLocalizations.product_image_other_accessibility_label, - }; + ) => switch (this) { + ImageField.FRONT => + appLocalizations.product_image_front_accessibility_label, + ImageField.INGREDIENTS => + appLocalizations.product_image_ingredients_accessibility_label, + ImageField.NUTRITION => + appLocalizations.product_image_nutrition_accessibility_label, + ImageField.PACKAGING => + appLocalizations.product_image_packaging_accessibility_label, + ImageField.OTHER => + appLocalizations.product_image_other_accessibility_label, + }; Widget getPhotoButton( final BuildContext context, final Product product, final bool isLoggedInMandatory, - ) => - SmoothLargeButtonWithIcon( - onPressed: () async => openDetails( - context, - product, - isLoggedInMandatory, - ), - leadingIcon: const Icon(Icons.camera_alt), - text: getProductImageButtonText(AppLocalizations.of(context)), - ); + ) => SmoothLargeButtonWithIcon( + onPressed: () async => openDetails(context, product, isLoggedInMandatory), + leadingIcon: const Icon(Icons.camera_alt), + text: getProductImageButtonText(AppLocalizations.of(context)), + ); Future openDetails( final BuildContext context, final Product product, final bool isLoggedInMandatory, - ) => - Navigator.push( - context, - MaterialPageRoute( - builder: (_) => ProductImageSwipeableView.imageField( - imageField: this, - product: product, - isLoggedInMandatory: isLoggedInMandatory, - ), - ), - ); + ) => Navigator.push( + context, + MaterialPageRoute( + builder: (_) => ProductImageSwipeableView.imageField( + imageField: this, + product: product, + isLoggedInMandatory: isLoggedInMandatory, + ), + ), + ); String? getImageUrl(Product product) => switch (this) { - ImageField.FRONT => product.imageFrontUrl, - ImageField.INGREDIENTS => product.imageIngredientsUrl, - ImageField.NUTRITION => product.imageNutritionUrl, - ImageField.PACKAGING => product.imagePackagingUrl, - ImageField.OTHER => null, - }; + ImageField.FRONT => product.imageFrontUrl, + ImageField.INGREDIENTS => product.imageIngredientsUrl, + ImageField.NUTRITION => product.imageNutritionUrl, + ImageField.PACKAGING => product.imagePackagingUrl, + ImageField.OTHER => null, + }; } diff --git a/packages/smooth_app/lib/helpers/launch_url_helper.dart b/packages/smooth_app/lib/helpers/launch_url_helper.dart index 145a19d8fd..91c60271f1 100644 --- a/packages/smooth_app/lib/helpers/launch_url_helper.dart +++ b/packages/smooth_app/lib/helpers/launch_url_helper.dart @@ -15,9 +15,11 @@ class LaunchUrlHelper { ) async { assert(url.isNotEmpty); - if (url.startsWith(RegExp( - r'http(s)?://[a-z\-]*.open(food|beauty|products|petfood)facts.(net|org)', - ))) { + if (url.startsWith( + RegExp( + r'http(s)?://[a-z\-]*.open(food|beauty|products|petfood)facts.(net|org)', + ), + )) { AnalyticsHelper.trackOutlink(url: url); GoRouter.of(context).push(url); } else { @@ -26,16 +28,14 @@ class LaunchUrlHelper { } /// Launches the url in an external browser. - static Future launchURL( - String url, { - LaunchMode? mode, - }) async { + static Future launchURL(String url, {LaunchMode? mode}) async { AnalyticsHelper.trackOutlink(url: url); try { await launchUrl( Uri.parse(url), - mode: mode ?? + mode: + mode ?? (Platform.isAndroid ? LaunchMode.externalApplication : LaunchMode.platformDefault), @@ -51,9 +51,11 @@ class LaunchUrlHelper { String url, { LaunchMode? mode, }) async { - if (url.startsWith(RegExp( - r'http(s)?://[a-z\-]*.open(food|beauty|products|petfood)facts.(net|org)', - ))) { + if (url.startsWith( + RegExp( + r'http(s)?://[a-z\-]*.open(food|beauty|products|petfood)facts.(net|org)', + ), + )) { AppNavigator.of(context).push(AppRoutes.EXTERNAL_WEBVIEW(url)); } else { return launchURL(url, mode: mode); diff --git a/packages/smooth_app/lib/helpers/network_config.dart b/packages/smooth_app/lib/helpers/network_config.dart index c6234fa0c0..43c151df79 100644 --- a/packages/smooth_app/lib/helpers/network_config.dart +++ b/packages/smooth_app/lib/helpers/network_config.dart @@ -38,11 +38,12 @@ Future _initUserAgent() async { id: id, ); OpenFoodAPIConfiguration.userAgent = UserAgent( - name: name, - version: version, - system: system, - url: 'https://world.openfoodfacts.org/', - comment: comment); + name: name, + version: version, + system: system, + url: 'https://world.openfoodfacts.org/', + comment: comment, + ); } String _getAppInfoComment({ diff --git a/packages/smooth_app/lib/helpers/paint_helper.dart b/packages/smooth_app/lib/helpers/paint_helper.dart index b3ced9b6dc..4215f5bff4 100644 --- a/packages/smooth_app/lib/helpers/paint_helper.dart +++ b/packages/smooth_app/lib/helpers/paint_helper.dart @@ -6,8 +6,8 @@ class DashedLinePainter extends CustomPainter { this.dashGap = 3.0, this.dashSpace = 3.0, }) : _paint = Paint() - ..color = color - ..strokeWidth = 1.0; + ..color = color + ..strokeWidth = 1.0; final double dashGap; final double dashSpace; @@ -19,11 +19,7 @@ class DashedLinePainter extends CustomPainter { double startX = 0.0; while (startX < size.width) { - canvas.drawLine( - Offset(startX, 0), - Offset(startX + dashGap, 0), - _paint, - ); + canvas.drawLine(Offset(startX, 0), Offset(startX + dashGap, 0), _paint); startX += dashGap + dashSpace; } diff --git a/packages/smooth_app/lib/helpers/permission_helper.dart b/packages/smooth_app/lib/helpers/permission_helper.dart index f081e83c33..098730d3a1 100644 --- a/packages/smooth_app/lib/helpers/permission_helper.dart +++ b/packages/smooth_app/lib/helpers/permission_helper.dart @@ -6,10 +6,9 @@ import 'package:smooth_app/helpers/camera_helper.dart'; import 'package:smooth_app/services/smooth_services.dart'; class PermissionListener extends ValueNotifier { - PermissionListener({ - required this.permission, - }) : _status = _DevicePermissionStatus.initial, - super(DevicePermission._initial(permission)); + PermissionListener({required this.permission}) + : _status = _DevicePermissionStatus.initial, + super(DevicePermission._initial(permission)); final Permission permission; _DevicePermissionStatus _status = _DevicePermissionStatus.initial; @@ -83,20 +82,14 @@ class PermissionListener extends ValueNotifier { Future _requestPermission() async { final PermissionStatus status = await permission.request(); - value = DevicePermission._fromPermissionStatus( - permission, - status, - ); + value = DevicePermission._fromPermissionStatus(permission, status); } @override set value(DevicePermission newValue) { super.value = newValue; - Logs.d( - 'New permission value: $newValue', - tag: 'PermissionListener', - ); + Logs.d('New permission value: $newValue', tag: 'PermissionListener'); } } @@ -104,11 +97,12 @@ class DevicePermission { const DevicePermission._(this.permission, this.status); const DevicePermission._initial(this.permission) - : status = DevicePermissionStatus.checking; + : status = DevicePermissionStatus.checking; DevicePermission._fromPermissionStatus( - this.permission, PermissionStatus status) - : status = _extractFromPermissionStatus(status); + this.permission, + PermissionStatus status, + ) : status = _extractFromPermissionStatus(status); final Permission permission; final DevicePermissionStatus status; diff --git a/packages/smooth_app/lib/helpers/physics.dart b/packages/smooth_app/lib/helpers/physics.dart index 9a9e47ec60..ccb11c4c88 100644 --- a/packages/smooth_app/lib/helpers/physics.dart +++ b/packages/smooth_app/lib/helpers/physics.dart @@ -35,9 +35,7 @@ class _VerticalClampScrollState extends State { Widget build(BuildContext context) { return ScrollConfiguration( behavior: _CustomScrollBehavior( - VerticalSnapScrollPhysics.get( - steps: widget.steps, - ), + VerticalSnapScrollPhysics.get(steps: widget.steps), ), child: NotificationListener( onNotification: (ScrollNotification notif) { @@ -88,10 +86,10 @@ class _VerticalClampScrollState extends State { if (context.mounted) { // ignore: use_build_context_synchronously context.read().animateTo( - scrollTo!, - curve: Curves.easeOutCubic, - duration: const Duration(milliseconds: 500), - ); + scrollTo!, + curve: Curves.easeOutCubic, + duration: const Duration(milliseconds: 500), + ); } }); } @@ -110,7 +108,10 @@ class _VerticalClampScrollState extends State { for (int i = 0; i != _reversedSteps.length; i++) { if (_blockScrollIfNecessary( - notif, _reversedSteps.elementAt(i), i == _reversedSteps.length - 1)) { + notif, + _reversedSteps.elementAt(i), + i == _reversedSteps.length - 1, + )) { break; } } @@ -168,10 +169,7 @@ class _VerticalSnapClampingScrollPhysics extends ClampingScrollPhysics required List steps, bool lastStepBlocking = true, }) { - _init( - steps: steps, - lastStepBlocking: lastStepBlocking, - ); + _init(steps: steps, lastStepBlocking: lastStepBlocking); } @override @@ -198,10 +196,7 @@ class _VerticalSnapBouncingScrollPhysics extends BouncingScrollPhysics required List steps, bool lastStepBlocking = true, }) { - _init( - steps: steps, - lastStepBlocking: lastStepBlocking, - ); + _init(steps: steps, lastStepBlocking: lastStepBlocking); } @override @@ -224,10 +219,7 @@ class _VerticalSnapBouncingScrollPhysics extends BouncingScrollPhysics /// A custom [ScrollPhysics] that snaps to specific [steps]. /// ignore: must_be_immutable mixin _VerticalSnapScrollPhysicsHelper on ScrollPhysics { - void _init({ - required List steps, - bool lastStepBlocking = true, - }) { + void _init({required List steps, bool lastStepBlocking = true}) { _steps = steps.toList()..sort(); _lastStepBlocking = lastStepBlocking; _ignoreNextScroll = false; @@ -259,8 +251,10 @@ mixin _VerticalSnapScrollPhysicsHelper on ScrollPhysics { return null; } - final Simulation? simulation = - super.createBallisticSimulation(position, velocity); + final Simulation? simulation = super.createBallisticSimulation( + position, + velocity, + ); double? proposedPixels = simulation?.x(double.infinity); if (simulation == null || proposedPixels == null) { @@ -385,7 +379,9 @@ class HorizontalSnapScrollPhysics extends ScrollPhysics { @override HorizontalSnapScrollPhysics applyTo(ScrollPhysics? ancestor) { return HorizontalSnapScrollPhysics( - parent: buildParent(ancestor), snapSize: snapSize); + parent: buildParent(ancestor), + snapSize: snapSize, + ); } double _getPage(ScrollMetrics position) { @@ -397,7 +393,10 @@ class HorizontalSnapScrollPhysics extends ScrollPhysics { } double _getTargetPixels( - ScrollMetrics position, Tolerance tolerance, double velocity) { + ScrollMetrics position, + Tolerance tolerance, + double velocity, + ) { double page = _getPage(position); if (velocity < -tolerance.velocity) { page -= 0.5; @@ -421,8 +420,13 @@ class HorizontalSnapScrollPhysics extends ScrollPhysics { final Tolerance tolerance = toleranceFor(position); final double target = _getTargetPixels(position, tolerance, velocity); if (target != position.pixels) { - return ScrollSpringSimulation(spring, position.pixels, target, velocity, - tolerance: tolerance); + return ScrollSpringSimulation( + spring, + position.pixels, + target, + velocity, + tolerance: tolerance, + ); } return null; } diff --git a/packages/smooth_app/lib/helpers/product_cards_helper.dart b/packages/smooth_app/lib/helpers/product_cards_helper.dart index 4738f25c58..8140bfe970 100644 --- a/packages/smooth_app/lib/helpers/product_cards_helper.dart +++ b/packages/smooth_app/lib/helpers/product_cards_helper.dart @@ -20,23 +20,18 @@ SmoothAppBar buildEditProductAppBar({ required final Product product, final PreferredSizeWidget? bottom, final List? actions, -}) => - SmoothAppBar( - centerTitle: false, - title: Text( - title, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - subTitle: Text( - getProductNameAndBrands(product, AppLocalizations.of(context)), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - actions: actions, - bottom: bottom, - ignoreSemanticsForSubtitle: true, - ); +}) => SmoothAppBar( + centerTitle: false, + title: Text(title, maxLines: 1, overflow: TextOverflow.ellipsis), + subTitle: Text( + getProductNameAndBrands(product, AppLocalizations.of(context)), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + actions: actions, + bottom: bottom, + ignoreSemanticsForSubtitle: true, +); String getProductNameAndBrands( final Product product, @@ -64,10 +59,10 @@ String getProductName( ) => _clearString(product.productNameInLanguages?[ProductQuery.getLanguage()]) ?? _clearString(product.productName) ?? - /// Fallback to the first language available _clearString( - product.productNameInLanguages?[OpenFoodFactsLanguage.ENGLISH]) ?? + product.productNameInLanguages?[OpenFoodFactsLanguage.ENGLISH], + ) ?? _clearString(product.productNameInLanguages?.values.firstOrNull) ?? appLocalizations.unknownProductName; @@ -119,20 +114,14 @@ Widget buildProductSmoothCard({ child = Column( mainAxisSize: MainAxisSize.min, children: [ - _ProductSmoothCardTitle( - title: title, - padding: titlePadding, - ), + _ProductSmoothCardTitle(title: title, padding: titlePadding), body, ], ); } else if (header != null) { child = Column( mainAxisSize: MainAxisSize.min, - children: [ - header, - body, - ], + children: [header, body], ); } else { child = body; @@ -147,22 +136,19 @@ Widget buildProductSmoothCard({ } class _ProductSmoothCardTitle extends StatelessWidget { - const _ProductSmoothCardTitle({ - required this.title, - this.padding, - }); + const _ProductSmoothCardTitle({required this.title, this.padding}); final Widget title; final EdgeInsetsGeometry? padding; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; - final EdgeInsetsGeometry effectivePadding = padding ?? - const EdgeInsetsDirectional.symmetric( - vertical: MEDIUM_SPACE, - ); + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; + final EdgeInsetsGeometry effectivePadding = + padding ?? + const EdgeInsetsDirectional.symmetric(vertical: MEDIUM_SPACE); final TextStyle titleStyle = Theme.of(context).textTheme.displaySmall ?? const TextStyle(); final double fontSize = titleStyle.fontSize ?? 15.0; @@ -176,19 +162,14 @@ class _ProductSmoothCardTitle extends StatelessWidget { color: context.lightTheme() ? colors.primaryMedium : colors.primarySemiDark, - borderRadius: const BorderRadius.vertical( - top: ROUNDED_RADIUS, - ), + borderRadius: const BorderRadius.vertical(top: ROUNDED_RADIUS), ), padding: effectivePadding, child: Center( child: DefaultTextStyle( style: titleStyle, textAlign: TextAlign.center, - child: SizedBox( - width: double.infinity, - child: title, - ), + child: SizedBox(width: double.infinity, child: title), ), ), ); @@ -208,11 +189,11 @@ List getPopulatedAttributes( continue; } Attribute? attribute = attributes[attributeId]; -// Some attributes selected in the user preferences might be unavailable for some products + // Some attributes selected in the user preferences might be unavailable for some products if (attribute == null) { continue; } else if (attribute.id == Attribute.ATTRIBUTE_ADDITIVES) { -// TODO(stephanegigandet): remove that cheat when additives are more standard + // TODO(stephanegigandet): remove that cheat when additives are more standard final List? additiveNames = product.additives?.names; attribute = Attribute( id: attribute.id, @@ -232,14 +213,13 @@ List getMandatoryAttributes( final List attributeGroupOrder, final Set attributesToExcludeIfStatusIsUnknown, final ProductPreferences preferences, -) => - getSortedAttributes( - product, - attributeGroupOrder, - attributesToExcludeIfStatusIsUnknown, - preferences, - PreferenceImportance.ID_MANDATORY, - ); +) => getSortedAttributes( + product, + attributeGroupOrder, + attributesToExcludeIfStatusIsUnknown, + preferences, + PreferenceImportance.ID_MANDATORY, +); /// Returns the attributes, ordered by importance desc and attribute group order List getSortedAttributes( @@ -256,7 +236,7 @@ List getSortedAttributes( } final Map> mandatoryAttributesByGroup = >{}; -// collecting all the mandatory attributes, by group + // collecting all the mandatory attributes, by group for (final AttributeGroup attributeGroup in product.attributeGroups!) { mandatoryAttributesByGroup[attributeGroup.id!] = getFilteredAttributes( attributeGroup, @@ -267,7 +247,7 @@ List getSortedAttributes( ); } -// now ordering by attribute group order + // now ordering by attribute group order for (final String attributeGroupId in attributeGroupOrder) { final List? attributes = mandatoryAttributesByGroup[attributeGroupId]; @@ -302,8 +282,9 @@ List getFilteredAttributes( if (attributeGroup.id == AttributeGroup.ATTRIBUTE_GROUP_LABELS) { attributesToExcludeIfStatusIsUnknown.add(attributeId); } - final String importanceId = - preferences.getImportanceIdForAttributeId(attributeId); + final String importanceId = preferences.getImportanceIdForAttributeId( + attributeId, + ); if (importance == importanceId) { result.add(attribute); } @@ -320,22 +301,21 @@ Widget addPanelButton( required final Function() onPressed, BorderRadiusGeometry? borderRadius, WidgetStateProperty? elevation, -}) => - Padding( - padding: const EdgeInsets.symmetric(vertical: SMALL_SPACE), - child: SmoothLargeButtonWithIcon( - text: label, - leadingIcon: leadingIcon, - trailingIcon: trailingIcon, - borderRadius: borderRadius, - elevation: elevation, - onPressed: onPressed, - textAlign: leadingIcon == null && trailingIcon == null - ? TextAlign.center - : null, - padding: padding, - ), - ); +}) => Padding( + padding: const EdgeInsets.symmetric(vertical: SMALL_SPACE), + child: SmoothLargeButtonWithIcon( + text: label, + leadingIcon: leadingIcon, + trailingIcon: trailingIcon, + borderRadius: borderRadius, + elevation: elevation, + onPressed: onPressed, + textAlign: leadingIcon == null && trailingIcon == null + ? TextAlign.center + : null, + padding: padding, + ), +); List getProductMainImagesData( final Product product, @@ -344,7 +324,8 @@ List getProductMainImagesData( final List result = []; for (final ImageField imageField in ImageFieldSmoothieExtension.getOrderedMainImageFields( - product.productType)) { + product.productType, + )) { result.add(getProductImageData(product, imageField, language)); } return result; @@ -362,7 +343,7 @@ ProductImageData getProductImageData( language, ); if (productImage != null) { -// we found a localized version for this image + // we found a localized version for this image return ProductImageData( imageId: productImage.imgid, imageField: imageField, @@ -439,7 +420,7 @@ List getRawProductImages( for (final ProductImage productImage in rawImages) { final int? imageId = int.tryParse(productImage.imgid!); if (imageId == null) { -// highly unlikely + // highly unlikely continue; } final ProductImage? previous = map[imageId]; @@ -449,32 +430,27 @@ List getRawProductImages( } final ImageSize? currentImageSize = productImage.size; if (currentImageSize == null) { -// highly unlikely + // highly unlikely continue; } final ImageSize? previousImageSize = previous.size; if (previousImageSize == imageSize) { -// we already have the best + // we already have the best continue; } map[imageId] = productImage; } final List result = List.of(map.values); - result.sort( - ( - final ProductImage a, - final ProductImage b, - ) { - final int result = (a.uploaded?.millisecondsSinceEpoch ?? 0).compareTo( - b.uploaded?.millisecondsSinceEpoch ?? 0, - ); - if (result != 0) { - return result; - } - return (int.tryParse(a.imgid ?? '0') ?? 0).compareTo( - int.tryParse(b.imgid ?? '0') ?? 0, - ); - }, - ); + result.sort((final ProductImage a, final ProductImage b) { + final int result = (a.uploaded?.millisecondsSinceEpoch ?? 0).compareTo( + b.uploaded?.millisecondsSinceEpoch ?? 0, + ); + if (result != 0) { + return result; + } + return (int.tryParse(a.imgid ?? '0') ?? 0).compareTo( + int.tryParse(b.imgid ?? '0') ?? 0, + ); + }); return result; } diff --git a/packages/smooth_app/lib/helpers/product_compatibility_helper.dart b/packages/smooth_app/lib/helpers/product_compatibility_helper.dart index 86db6dee22..a21660d4e0 100644 --- a/packages/smooth_app/lib/helpers/product_compatibility_helper.dart +++ b/packages/smooth_app/lib/helpers/product_compatibility_helper.dart @@ -7,8 +7,8 @@ import 'package:smooth_app/themes/smooth_theme_colors.dart'; class ProductCompatibilityHelper { ProductCompatibilityHelper.product(final MatchedProductV2 product) - : status = product.status, - _score = product.score; + : status = product.status, + _score = product.score; const ProductCompatibilityHelper.status(this.status) : _score = null; @@ -16,8 +16,8 @@ class ProductCompatibilityHelper { final MatchedProductStatusV2 status; Color getColor(BuildContext context) { - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); return switch (status) { MatchedProductStatusV2.VERY_GOOD_MATCH => theme.success, diff --git a/packages/smooth_app/lib/helpers/provider_helper.dart b/packages/smooth_app/lib/helpers/provider_helper.dart index 437ed4d918..935e893200 100644 --- a/packages/smooth_app/lib/helpers/provider_helper.dart +++ b/packages/smooth_app/lib/helpers/provider_helper.dart @@ -4,17 +4,10 @@ import 'package:provider/single_child_widget.dart'; /// Same as [Consumer] but only notifies of a new value class Listener extends SingleChildStatefulWidget { - const Listener({ - required this.listener, - super.key, - super.child, - }); + const Listener({required this.listener, super.key, super.child}); - final void Function( - BuildContext context, - T? previousValue, - T currentValue, - ) listener; + final void Function(BuildContext context, T? previousValue, T currentValue) + listener; @override State> createState() => _ListenerState(); @@ -29,11 +22,7 @@ class _ListenerState extends SingleChildState> { final T newValue = context.watch(); _oldValue = newValue; - widget.listener( - context, - oldValue, - newValue, - ); + widget.listener(context, oldValue, newValue); return child ?? const SizedBox.shrink(); } @@ -90,22 +79,20 @@ class ValueNotifierListener, S> super.key, super.child, }) : assert( - listener != null || listenerWithValueNotifier != null, - 'At least one listener must be provided', - ); + listener != null || listenerWithValueNotifier != null, + 'At least one listener must be provided', + ); - final void Function( - BuildContext context, - S? previousValue, - S currentValue, - )? listener; + final void Function(BuildContext context, S? previousValue, S currentValue)? + listener; final void Function( BuildContext context, T valueNotifier, S? previousValue, S currentValue, - )? listenerWithValueNotifier; + )? + listenerWithValueNotifier; @override State> createState() => @@ -123,11 +110,7 @@ class _ValueNotifierListenerState, S> final S newValue = valueNotifier.value; _oldValue = newValue; - widget.listener?.call( - context, - oldValue, - newValue, - ); + widget.listener?.call(context, oldValue, newValue); widget.listenerWithValueNotifier?.call( context, @@ -150,11 +133,7 @@ class ConsumerFilter extends StatefulWidget { super.key, }); - final Widget Function( - BuildContext context, - T value, - Widget? child, - ) builder; + final Widget Function(BuildContext context, T value, Widget? child) builder; final bool Function(T? previousValue, T currentValue) buildWhen; final Widget? child; @@ -172,20 +151,12 @@ class _ConsumerFilterState extends State> { return Consumer( builder: (BuildContext context, T value, Widget? child) { if (widget.buildWhen(oldValue, value) || oldWidget == null) { - oldWidget = widget.builder( - context, - value, - child, - ); + oldWidget = widget.builder(context, value, child); } oldValue = value; - return widget.builder( - context, - value, - oldWidget, - ); + return widget.builder(context, value, oldWidget); }, child: widget.child, ); @@ -203,11 +174,7 @@ class ConsumerValueNotifierFilter, S> super.key, }); - final Widget Function( - BuildContext context, - S value, - Widget? child, - ) builder; + final Widget Function(BuildContext context, S value, Widget? child) builder; final bool Function(S? previousValue, S currentValue)? buildWhen; final Widget? child; @@ -230,20 +197,12 @@ class _ConsumerValueNotifierFilterState, S> widget.buildWhen!.call(oldValue, provider.value)) || widget.buildWhen == null && oldValue != provider.value || oldWidget == null) { - oldWidget = widget.builder( - context, - provider.value, - child, - ); + oldWidget = widget.builder(context, provider.value, child); } oldValue = provider.value; - return widget.builder( - context, - provider.value, - oldWidget, - ); + return widget.builder(context, provider.value, oldWidget); }, child: widget.child, ); diff --git a/packages/smooth_app/lib/helpers/robotoff_insight_helper.dart b/packages/smooth_app/lib/helpers/robotoff_insight_helper.dart index 96411e7e91..d729891f22 100644 --- a/packages/smooth_app/lib/helpers/robotoff_insight_helper.dart +++ b/packages/smooth_app/lib/helpers/robotoff_insight_helper.dart @@ -18,8 +18,9 @@ class RobotoffInsightHelper { Future areQuestionsAlreadyVoted( List questions, ) async { - final Map> votedHist = - await DaoStringListMap(_localDatabase).getAll(); + final Map> votedHist = await DaoStringListMap( + _localDatabase, + ).getAll(); final Set newIdsSet = questions .map((RobotoffQuestion e) => e.insightId) @@ -39,11 +40,13 @@ class RobotoffInsightHelper { } Future clearInsightAnnotationsSaved() async { - final Map> records = - await DaoStringListMap(_localDatabase).getAll(); + final Map> records = await DaoStringListMap( + _localDatabase, + ).getAll(); for (final String barcode in records.keys) { - final List questions = - await ProductQuestionsQuery(barcode).getQuestions(_localDatabase, 1); + final List questions = await ProductQuestionsQuery( + barcode, + ).getQuestions(_localDatabase, 1); if (questions.isEmpty) { await DaoStringListMap(_localDatabase).removeKey(barcode); } diff --git a/packages/smooth_app/lib/helpers/score_card_helper.dart b/packages/smooth_app/lib/helpers/score_card_helper.dart index 2d039f28e0..0b1d504dbf 100644 --- a/packages/smooth_app/lib/helpers/score_card_helper.dart +++ b/packages/smooth_app/lib/helpers/score_card_helper.dart @@ -28,5 +28,4 @@ extension GradeExtension on Grade? { CardEvaluation getCardEvaluationFromKnowledgePanelTitleElement( TitleElement titleElement, -) => - titleElement.grade.getCardEvaluation(); +) => titleElement.grade.getCardEvaluation(); diff --git a/packages/smooth_app/lib/helpers/strings_helper.dart b/packages/smooth_app/lib/helpers/strings_helper.dart index 73cd6b4c35..41dffeaf7e 100644 --- a/packages/smooth_app/lib/helpers/strings_helper.dart +++ b/packages/smooth_app/lib/helpers/strings_helper.dart @@ -4,10 +4,7 @@ extension StringExtensions on String { /// Returns a list containing all positions of a [charCode] /// By default, the case is taken into account. /// Set [ignoreCase] to true, to disable the case verification. - List indexesOf( - String charCode, { - bool ignoreCase = false, - }) { + List indexesOf(String charCode, {bool ignoreCase = false}) { assert(charCode.length == 1); if (ignoreCase) { charCode = charCode.toLowerCase(); @@ -50,7 +47,8 @@ class TextHelper { /// From [https://github.com/duocnguyen6799/remove_emoji_input_formatter/blob/main/lib/src/constant.dart] static final RegExp emojiRegex = RegExp( - '/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFF\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFE\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFD\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFC\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFB\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|[\u2695\u2696\u2708]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])))|\u200D(?:\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\u200D[\u2695\u2696\u2708])?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F?\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F?\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83D\uDC41\uFE0F?\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83C\uDFF3\uFE0F?\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F?\u200D\u26A7|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDEF1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764(?:\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\u200D(?:\uD83D\uDD25|\uD83E\uDE79))|\uD83D\uDC41\uFE0F?|\uD83C\uDFF3\uFE0F?|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#*0-9]\uFE0F?\u20E3|\uD83E\uDD3C(?:\uD83C[\uDFFB-\uDFFF])|\u2764\uFE0F?|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF6])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD3C\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF6]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDDDE\uDDDF]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\uD83C[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDD-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC2\uDED0-\uDED9\uDEE0-\uDEE7]'); + '/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFF\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFE\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFD\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFC\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])|\uD83E\uDEF1\uD83C\uDFFB\u200D\uD83E\uDEF2)(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|[\u2695\u2696\u2708]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])))|\u200D(?:\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?|\u200D(?:\uD83D\uDC8B\u200D)?)\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\u200D[\u2695\u2696\u2708])?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764(?:\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F?\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F?\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83D\uDC41\uFE0F?\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83C\uDFF3\uFE0F?\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F?\u200D\u26A7|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDEF1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764(?:\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\u200D(?:\uD83D\uDD25|\uD83E\uDE79))|\uD83D\uDC41\uFE0F?|\uD83C\uDFF3\uFE0F?|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#*0-9]\uFE0F?\u20E3|\uD83E\uDD3C(?:\uD83C[\uDFFB-\uDFFF])|\u2764\uFE0F?|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF6])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD3C\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF6]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDDDE\uDDDF]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\uD83C[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDD-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7C\uDE80-\uDE86\uDE90-\uDEAC\uDEB0-\uDEBA\uDEC0-\uDEC2\uDED0-\uDED9\uDEE0-\uDEE7]', + ); /// Split the text into parts. /// Eg: with the symbol '*' @@ -64,32 +62,37 @@ class TextHelper { }) { text = text.replaceAll(r'\n', '\n'); - final Iterable highlightedParts = - RegExp('$symbol[^$symbol]+$symbol').allMatches(text); + final Iterable highlightedParts = RegExp( + '$symbol[^$symbol]+$symbol', + ).allMatches(text); final List<(String, TextStyle?)> parts = <(String, TextStyle?)>[]; if (highlightedParts.isEmpty) { parts.add((text, defaultStyle)); } else { - parts - .add((text.substring(0, highlightedParts.first.start), defaultStyle)); + parts.add(( + text.substring(0, highlightedParts.first.start), + defaultStyle, + )); for (int i = 0; i != highlightedParts.length; i++) { final RegExpMatch subPart = highlightedParts.elementAt(i); - parts.add( - ( - text.substring( - subPart.start + symbolLength, subPart.end - symbolLength), - highlightedStyle + parts.add(( + text.substring( + subPart.start + symbolLength, + subPart.end - symbolLength, ), - ); + highlightedStyle, + )); if (i < highlightedParts.length - 1) { parts.add(( text.substring( - subPart.end, highlightedParts.elementAt(i + 1).start), - defaultStyle + subPart.end, + highlightedParts.elementAt(i + 1).start, + ), + defaultStyle, )); } else if (subPart.end < text.length) { parts.add((text.substring(subPart.end, text.length), defaultStyle)); diff --git a/packages/smooth_app/lib/helpers/temp_product_list_share_helper.dart b/packages/smooth_app/lib/helpers/temp_product_list_share_helper.dart index 09f9922878..cd71bbb3cb 100644 --- a/packages/smooth_app/lib/helpers/temp_product_list_share_helper.dart +++ b/packages/smooth_app/lib/helpers/temp_product_list_share_helper.dart @@ -9,10 +9,9 @@ Uri shareProductList( final String barcodesString = barcodes.join(','); return UriHelper.replaceSubdomain( - ProductQuery.getUriProductHelper(productType: productType).getUri( - path: 'products/$barcodesString', - addUserAgentParameters: false, - ), + ProductQuery.getUriProductHelper( + productType: productType, + ).getUri(path: 'products/$barcodesString', addUserAgentParameters: false), language: OpenFoodAPIConfiguration.globalLanguages?.first, ); } diff --git a/packages/smooth_app/lib/helpers/text_input_formatters_helper.dart b/packages/smooth_app/lib/helpers/text_input_formatters_helper.dart index b6cfb36b87..8f0d984298 100644 --- a/packages/smooth_app/lib/helpers/text_input_formatters_helper.dart +++ b/packages/smooth_app/lib/helpers/text_input_formatters_helper.dart @@ -16,8 +16,8 @@ import 'package:smooth_app/helpers/strings_helper.dart'; /// position class DecimalSeparatorRewriter extends TextInputFormatter { DecimalSeparatorRewriter(NumberFormat format) - : _decimalSeparator = format.symbols.DECIMAL_SEP, - _separatorToReplace = _findSeparatorToReplace(format) { + : _decimalSeparator = format.symbols.DECIMAL_SEP, + _separatorToReplace = _findSeparatorToReplace(format) { // Here we check that there are no group separators. // The formatted string should // * contain the nine digits 1..9 @@ -68,8 +68,10 @@ class DecimalSeparatorRewriter extends TextInputFormatter { text: separatorResult.newText, selection: newValue.selection.copyWith( baseOffset: math.min(separatorResult.newBasePosition, newTextLength), - extentOffset: - math.min(separatorResult.newExtentPosition, newTextLength), + extentOffset: math.min( + separatorResult.newExtentPosition, + newTextLength, + ), ), ); } @@ -117,10 +119,7 @@ class DecimalSeparatorRewriter extends TextInputFormatter { /// Replaces a "." by a "," or a "," by a ".". String replaceSeparator(String newTextValue) { if (newTextValue.contains(_separatorToReplace)) { - return newTextValue.replaceAll( - _separatorToReplace, - _decimalSeparator, - ); + return newTextValue.replaceAll(_separatorToReplace, _decimalSeparator); } else { return newTextValue; } @@ -133,8 +132,8 @@ class MoveSeparatorResult { required this.newText, required this.newBasePosition, required this.newExtentPosition, - }) : assert(newBasePosition >= 0), - assert(newExtentPosition >= 0); + }) : assert(newBasePosition >= 0), + assert(newExtentPosition >= 0); final String newText; final int newBasePosition; diff --git a/packages/smooth_app/lib/helpers/ui_helpers.dart b/packages/smooth_app/lib/helpers/ui_helpers.dart index e67ba88f34..2a87d9c0b6 100644 --- a/packages/smooth_app/lib/helpers/ui_helpers.dart +++ b/packages/smooth_app/lib/helpers/ui_helpers.dart @@ -86,10 +86,5 @@ extension ScrollControllerExtension on ScrollController { double offset, { required Duration duration, required Curve curve, - }) => - animateTo( - position.pixels + offset, - duration: duration, - curve: curve, - ); + }) => animateTo(position.pixels + offset, duration: duration, curve: curve); } diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_action_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_action_card.dart index 6b5462e151..74ef04f162 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_action_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_action_card.dart @@ -40,12 +40,10 @@ class KnowledgePanelActionCard extends StatelessWidget { ); } - Widget? _getButton( - final BuildContext context, - final String action, - ) { - final KnowledgePanelAction? kpAction = - KnowledgePanelAction.fromOffTag(action); + Widget? _getButton(final BuildContext context, final String action) { + final KnowledgePanelAction? kpAction = KnowledgePanelAction.fromOffTag( + action, + ); if (kpAction == null) { Logs.e('unknown knowledge panel action: $action'); return null; @@ -59,9 +57,7 @@ class KnowledgePanelActionCard extends StatelessWidget { ); } if (_isPackaging(kpAction)) { - return AddPackagingButton( - product: product, - ); + return AddPackagingButton(product: product); } if (_isIngredient(kpAction)) { return AddOcrButton( @@ -92,9 +88,7 @@ class KnowledgePanelActionCard extends StatelessWidget { case KnowledgePanelAction.addLabels: return SimpleInputPageLabelHelper(); case KnowledgePanelAction.addCountries: - return SimpleInputPageCountryHelper( - context.read(), - ); + return SimpleInputPageCountryHelper(context.read()); default: return null; } diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_card.dart index 4c1dbeeb7c..33add05b4d 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_card.dart @@ -29,8 +29,10 @@ class KnowledgePanelCard extends StatelessWidget { @override Widget build(BuildContext context) { final UserPreferences userPreferences = context.watch(); - final KnowledgePanel? panel = - KnowledgePanelsBuilder.getKnowledgePanel(product, panelId); + final KnowledgePanel? panel = KnowledgePanelsBuilder.getKnowledgePanel( + product, + panelId, + ); if (panel == null) { return EMPTY_WIDGET; @@ -46,33 +48,31 @@ class KnowledgePanelCard extends StatelessWidget { // in some cases there's nothing to click about. // cf. https://github.com/openfoodfacts/smooth-app/issues/5700 - final bool improvedIsClickable = isClickable && - KnowledgePanelsBuilder.hasSomethingToDisplay( - product, - panelId, - ); + final bool improvedIsClickable = + isClickable && + KnowledgePanelsBuilder.hasSomethingToDisplay(product, panelId); return Padding( - padding: const EdgeInsetsDirectional.symmetric( - vertical: SMALL_SPACE, - ), + padding: const EdgeInsetsDirectional.symmetric(vertical: SMALL_SPACE), child: InkWell( borderRadius: ANGULAR_BORDER_RADIUS, onTap: !improvedIsClickable ? null : () async => Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => SmoothBrightnessOverride( - brightness: - SmoothBrightnessOverride.of(context)?.brightness, - child: KnowledgePanelPage( - panelId: panelId, - product: product, - ), + context, + MaterialPageRoute( + builder: (BuildContext context) => SmoothBrightnessOverride( + brightness: SmoothBrightnessOverride.of( + context, + )?.brightness, + child: KnowledgePanelPage( + panelId: panelId, + product: product, ), ), ), - child: KnowledgePanelsBuilder.getPanelSummaryWidget( + ), + child: + KnowledgePanelsBuilder.getPanelSummaryWidget( panel, isClickable: improvedIsClickable, margin: EdgeInsets.zero, @@ -93,9 +93,10 @@ class KnowledgePanelCard extends StatelessWidget { for (final String panelId in expandedPanelIds) { if (panel.titleElement != null && panel.titleElement!.title == - KnowledgePanelsBuilder.getKnowledgePanel(product, panelId) - ?.titleElement - ?.title) { + KnowledgePanelsBuilder.getKnowledgePanel( + product, + panelId, + )?.titleElement?.title) { if (userPreferences.getFlag(getExpandFlagTag(panelId)) ?? false) { return true; } diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart index 1a6a6375f7..7aa22d24fb 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_expanded_card.dart @@ -90,10 +90,8 @@ class KnowledgePanelExpandedCard extends StatelessWidget { ]; } else { return [ - _KnowledgePanelSummaryCardTitle( - child: summary, - ), - const SizedBox(height: SMALL_SPACE) + _KnowledgePanelSummaryCardTitle(child: summary), + const SizedBox(height: SMALL_SPACE), ]; } } else { @@ -109,10 +107,7 @@ class KnowledgePanelExpandedCard extends StatelessWidget { super.debugFillProperties(properties); properties.add(StringProperty('panelId', panelId)); properties.add( - DiagnosticsProperty( - 'initiallyExpanded', - isInitiallyExpanded, - ), + DiagnosticsProperty('initiallyExpanded', isInitiallyExpanded), ); properties.add(DiagnosticsProperty('clickable', isClickable)); } @@ -120,25 +115,21 @@ class KnowledgePanelExpandedCard extends StatelessWidget { /// Force a background around a summary Widget class _KnowledgePanelSummaryCardTitle extends StatelessWidget { - const _KnowledgePanelSummaryCardTitle({ - required this.child, - }); + const _KnowledgePanelSummaryCardTitle({required this.child}); final Widget child; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return DecoratedBox( decoration: BoxDecoration( color: context.lightTheme() ? extension.primaryMedium : extension.primaryUltraBlack, - borderRadius: const BorderRadius.vertical( - top: ROUNDED_RADIUS, - ), + borderRadius: const BorderRadius.vertical(top: ROUNDED_RADIUS), ), child: Padding( padding: const EdgeInsetsDirectional.symmetric( @@ -147,9 +138,7 @@ class _KnowledgePanelSummaryCardTitle extends StatelessWidget { ), child: DefaultTextStyle.merge( child: child, - style: const TextStyle( - fontWeight: FontWeight.bold, - ), + style: const TextStyle(fontWeight: FontWeight.bold), ), ), ); diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_group_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_group_card.dart index aa29b1ca03..1fc39a2436 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_group_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_group_card.dart @@ -27,8 +27,8 @@ class KnowledgePanelGroupCard extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData themeData = Theme.of(context); - final SmoothColorsThemeExtension themeExtension = - context.extension(); + final SmoothColorsThemeExtension themeExtension = context + .extension(); final bool lightTheme = context.lightTheme(); final Widget child = Provider( @@ -94,15 +94,13 @@ class KnowledgePanelGroupCard extends StatelessWidget { product: product, isClickable: isClickable, ), - ) + ), ], ), ); if (isTextSelectable) { - return SelectionArea( - child: child, - ); + return SelectionArea(child: child); } else { return child; } diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_image_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_image_card.dart index 263f8135df..c3817a32ba 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_image_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_image_card.dart @@ -5,9 +5,7 @@ import 'package:smooth_app/helpers/launch_url_helper.dart'; /// Card that displays a Knowledge Panel _Image_ element. class KnowledgePanelImageCard extends StatelessWidget { - const KnowledgePanelImageCard({ - required this.imageElement, - }); + const KnowledgePanelImageCard({required this.imageElement}); final KnowledgePanelImageElement imageElement; diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_page.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_page.dart index 4095e27c9c..de9107176c 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_page.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_page.dart @@ -25,10 +25,7 @@ import 'package:smooth_app/widgets/smooth_scaffold.dart'; /// Detail page of knowledge panels (if you click on the forward/more button). class KnowledgePanelPage extends StatefulWidget { - const KnowledgePanelPage({ - required this.panelId, - required this.product, - }); + const KnowledgePanelPage({required this.panelId, required this.product}); final String panelId; final Product product; @@ -74,11 +71,7 @@ class _KnowledgePanelPageState extends State appBar: SmoothAppBar( title: Semantics( label: _getTitleForAccessibility(appLocalizations, title), - child: Text( - title, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), + child: Text(title, maxLines: 1, overflow: TextOverflow.ellipsis), ), subTitle: Text( getProductNameAndBrands(upToDateProduct, appLocalizations), @@ -145,8 +138,9 @@ class _KnowledgePanelPageState extends State } String _getTitle() { - final KnowledgePanelPanelGroupElement? groupElement = - _groupElementOf(context); + final KnowledgePanelPanelGroupElement? groupElement = _groupElementOf( + context, + ); if (groupElement?.title != null && groupElement?.title!.isNotEmpty == true) { return groupElement!.title!; @@ -165,23 +159,23 @@ class _KnowledgePanelPageState extends State AppLocalizations appLocalizations, String title, ) { - final String productName = upToDateProduct.productName ?? + final String productName = + upToDateProduct.productName ?? upToDateProduct.abbreviatedName ?? upToDateProduct.genericName ?? ''; if (title.isEmpty) { return appLocalizations.knowledge_panel_page_title_no_title(productName); } else { - return appLocalizations.knowledge_panel_page_title( - title, - productName, - ); + return appLocalizations.knowledge_panel_page_title(title, productName); } } List? _actions() { - if (['ingredients', 'ingredients_analysis_details'] - .contains(widget.panelId)) { + if ([ + 'ingredients', + 'ingredients_analysis_details', + ].contains(widget.panelId)) { return [ _KnowledgePanelPageEditAction( tooltip: AppLocalizations.of(context).ingredients_editing_title, @@ -204,16 +198,14 @@ class _KnowledgePanelPageState extends State ]; } else if ([ 'origins_of_ingredients', - 'environmental_score_origins_of_ingredients' + 'environmental_score_origins_of_ingredients', ].contains(widget.panelId)) { return [ _KnowledgePanelPageEditAction( tooltip: AppLocalizations.of(context).origins_editing_title, - onPressed: () async => - ProductFieldSimpleEditor(SimpleInputPageOriginHelper()).edit( - context: context, - product: upToDateProduct, - ), + onPressed: () async => ProductFieldSimpleEditor( + SimpleInputPageOriginHelper(), + ).edit(context: context, product: upToDateProduct), ), ]; } else if (widget.panelId == 'environmental_score_packaging') { @@ -250,16 +242,17 @@ class _KnowledgePanelPageEditAction extends StatelessWidget { @override Widget build(BuildContext context) { return SmoothPopupMenuButton( - buttonIcon: const Icon(Icons.more_vert), - onSelected: (_) => onPressed(), - itemBuilder: (BuildContext context) { - return >[ - SmoothPopupMenuItem( - label: tooltip, - value: null, - icon: Icons.edit, - ), - ]; - }); + buttonIcon: const Icon(Icons.more_vert), + onSelected: (_) => onPressed(), + itemBuilder: (BuildContext context) { + return >[ + SmoothPopupMenuItem( + label: tooltip, + value: null, + icon: Icons.edit, + ), + ]; + }, + ); } } diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_product_cards.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_product_cards.dart index 0801af42a9..75094c79c4 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_product_cards.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_product_cards.dart @@ -11,48 +11,45 @@ class KnowledgePanelProductCards extends StatelessWidget { @override Widget build(BuildContext context) { - final List widgetsWrappedInSmoothCards = - knowledgePanelWidgets.map((Widget widget) { - /// When we have a panel with a title (e.g. "Health"), we change - /// a bit the layout - final bool hasTitle = - widget is Column && widget.children.first is KnowledgePanelTitle; - final Widget content; + final List widgetsWrappedInSmoothCards = knowledgePanelWidgets + .map((Widget widget) { + /// When we have a panel with a title (e.g. "Health"), we change + /// a bit the layout + final bool hasTitle = + widget is Column && widget.children.first is KnowledgePanelTitle; + final Widget content; - if (hasTitle) { - content = buildProductSmoothCard( - title: Text((widget.children.first as KnowledgePanelTitle).title), - body: Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: SMALL_SPACE, - vertical: SMALL_SPACE, - ), - child: Column( - children: widget.children.sublist(1), - ), - ), - padding: EdgeInsets.zero, - margin: EdgeInsets.zero, - ); - } else { - content = buildProductSmoothCard( - body: widget, - padding: SMOOTH_CARD_PADDING, - margin: EdgeInsets.zero, - ); - } + if (hasTitle) { + content = buildProductSmoothCard( + title: Text((widget.children.first as KnowledgePanelTitle).title), + body: Padding( + padding: const EdgeInsetsDirectional.symmetric( + horizontal: SMALL_SPACE, + vertical: SMALL_SPACE, + ), + child: Column(children: widget.children.sublist(1)), + ), + padding: EdgeInsets.zero, + margin: EdgeInsets.zero, + ); + } else { + content = buildProductSmoothCard( + body: widget, + padding: SMOOTH_CARD_PADDING, + margin: EdgeInsets.zero, + ); + } - return Padding( - padding: const EdgeInsetsDirectional.only(top: VERY_LARGE_SPACE), - child: content, - ); - }).toList(growable: false); + return Padding( + padding: const EdgeInsetsDirectional.only(top: VERY_LARGE_SPACE), + child: content, + ); + }) + .toList(growable: false); return Center( child: Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: SMALL_SPACE, - ), + padding: const EdgeInsetsDirectional.symmetric(horizontal: SMALL_SPACE), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart index 275c0eba7d..5af43a1792 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_table_card.dart @@ -94,12 +94,11 @@ class _KnowledgePanelTableCardState extends State { @override Widget build(BuildContext context) { return LayoutBuilder( - builder: ( - BuildContext context, - BoxConstraints constraints, - ) { - final List> rowsWidgets = - _buildRowWidgets(_buildRowCells(), constraints); + builder: (BuildContext context, BoxConstraints constraints) { + final List> rowsWidgets = _buildRowWidgets( + _buildRowCells(), + constraints, + ); return Column( children: [ @@ -162,7 +161,8 @@ class _KnowledgePanelTableCardState extends State { TableCell( text: cell.text, color: getTextColorFromKnowledgePanelElementEvaluation( - cell.evaluation ?? Evaluation.UNKNOWN), + cell.evaluation ?? Evaluation.UNKNOWN, + ), isHeader: false, ), ); @@ -172,13 +172,16 @@ class _KnowledgePanelTableCardState extends State { } List> _buildRowWidgets( - List> rows, BoxConstraints constraints) { + List> rows, + BoxConstraints constraints, + ) { // [availableWidth] is parent's width - total padding we want in between columns. final double availableWidth = constraints.maxWidth - LARGE_SPACE; // We now allocate width to each column as follows: // [availableWidth] / [column's largest cell width] * [totalMaxColumnWidth]. - final int totalMaxColumnWidth = - _columnsMaxLength.reduce((int sum, int width) => sum + width); + final int totalMaxColumnWidth = _columnsMaxLength.reduce( + (int sum, int width) => sum + width, + ); final List> rowsWidgets = >[]; final Widget verticalDivider = _verticalDivider; @@ -211,12 +214,7 @@ class _KnowledgePanelTableCardState extends State { ); } - rowWidgets.add( - Expanded( - flex: cellWidth, - child: tableCellWidget, - ), - ); + rowWidgets.add(Expanded(flex: cellWidth, child: tableCellWidget)); if (index < row.length) { rowWidgets.add(verticalDivider); @@ -228,8 +226,8 @@ class _KnowledgePanelTableCardState extends State { } Widget get _verticalDivider { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return VerticalDivider( width: 1.0, @@ -240,8 +238,8 @@ class _KnowledgePanelTableCardState extends State { } Widget get _horizontalDivider { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return Divider( height: 1.0, @@ -269,12 +267,14 @@ class _KnowledgePanelTableCardState extends State { ); } else { // Try to find the group if it already exists. - final bool groupExists = - groupIdToColumnGroup.containsKey(column.columnGroupId); + final bool groupExists = groupIdToColumnGroup.containsKey( + column.columnGroupId, + ); if (!groupExists) { // Create a group since one doesn't exist yet. - final ColumnGroup newGroup = - ColumnGroup(columns: []); + final ColumnGroup newGroup = ColumnGroup( + columns: [], + ); _columnGroups.add(newGroup); groupIdToColumnGroup[column.columnGroupId!] = newGroup; } @@ -311,10 +311,11 @@ class _KnowledgePanelTableCardState extends State { // Set value for the header row. _columnsMaxLength.add( math.max( - cell.text.length, - type != _TableCellType.TEXT - ? kMinCellLengthInARowValue - : kMinCellLengthInARow), + cell.text.length, + type != _TableCellType.TEXT + ? kMinCellLengthInARowValue + : kMinCellLengthInARow, + ), ); _columnsType.add(type); @@ -373,8 +374,9 @@ class _KnowledgePanelTableCardState extends State { void debugFillProperties(DiagnosticPropertiesBuilder properties) { super.debugFillProperties(properties); properties.add(StringProperty('tableElementId', widget.tableElement.id)); - properties - .add(DiagnosticsProperty('expanded', widget.isInitiallyExpanded)); + properties.add( + DiagnosticsProperty('expanded', widget.isInitiallyExpanded), + ); } } @@ -410,8 +412,8 @@ class _TableCellWidgetState extends State<_TableCellWidget> { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final EdgeInsetsGeometry padding; @@ -481,8 +483,9 @@ class _TableCellWidgetState extends State<_TableCellWidget> { required AlignmentDirectional alignment, Color? backgroundColor, }) { - final StringBuffer styleBuilder = - StringBuffer('text-align:${alignment.toHTMLTextAlign()}'); + final StringBuffer styleBuilder = StringBuffer( + 'text-align:${alignment.toHTMLTextAlign()}', + ); if (!_isExpanded) { styleBuilder.write(''' @@ -513,10 +516,7 @@ class _TableCellWidgetState extends State<_TableCellWidget> { ); if (backgroundColor != null) { - return ColoredBox( - color: backgroundColor, - child: child, - ); + return ColoredBox(color: backgroundColor, child: child); } else { return child; } @@ -539,18 +539,19 @@ class _TableCellWidgetState extends State<_TableCellWidget> { value: widget.cell.columnGroup!.currentColumn, items: widget.cell.columnGroup!.columns .map((KnowledgePanelTableColumn column) { - return DropdownMenuItem( - value: column, - child: SizedBox( - width: width.toDouble() - 21.0 - padding.horizontal, - child: Text( - column.textForSmallScreens ?? column.text, - overflow: TextOverflow.ellipsis, - maxLines: 2, - ), - ), - ); - }).toList(growable: false), + return DropdownMenuItem( + value: column, + child: SizedBox( + width: width.toDouble() - 21.0 - padding.horizontal, + child: Text( + column.textForSmallScreens ?? column.text, + overflow: TextOverflow.ellipsis, + maxLines: 2, + ), + ), + ); + }) + .toList(growable: false), onChanged: (KnowledgePanelTableColumn? selectedColumn) { if (selectedColumn == null) { return; @@ -592,14 +593,17 @@ class _TableCellWidgetState extends State<_TableCellWidget> { enum _TableCellType { TEXT( - headerTextAlignment: AlignmentDirectional.centerStart, - contentTextAlignment: AlignmentDirectional.centerStart), + headerTextAlignment: AlignmentDirectional.centerStart, + contentTextAlignment: AlignmentDirectional.centerStart, + ), PERCENT( - headerTextAlignment: AlignmentDirectional.center, - contentTextAlignment: AlignmentDirectional.centerStart), + headerTextAlignment: AlignmentDirectional.center, + contentTextAlignment: AlignmentDirectional.centerStart, + ), PER_100G( - headerTextAlignment: AlignmentDirectional.center, - contentTextAlignment: AlignmentDirectional.center); + headerTextAlignment: AlignmentDirectional.center, + contentTextAlignment: AlignmentDirectional.center, + ); const _TableCellType({ required this.headerTextAlignment, diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_text_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_text_card.dart index 1375fd5ed1..8fa8ae61c0 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_text_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_text_card.dart @@ -14,16 +14,15 @@ import 'package:smooth_app/widgets/smooth_text.dart'; /// Card that displays a Knowledge Panel _Text_ element. class KnowledgePanelTextCard extends StatelessWidget { - const KnowledgePanelTextCard({ - required this.textElement, - }); + const KnowledgePanelTextCard({required this.textElement}); final KnowledgePanelTextElement textElement; @override Widget build(BuildContext context) { - final String warningLabel = - AppLocalizations.of(context).knowledge_panel_warning_text; + final String warningLabel = AppLocalizations.of( + context, + ).knowledge_panel_warning_text; final RegExp regExp = RegExp('$warningLabel\\s?:\\s?'); final Widget text; @@ -43,10 +42,8 @@ class KnowledgePanelTextCard extends StatelessWidget { child: MergeSemantics( child: SmoothHtmlWidget( textElement.html, - textStyle: - WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED.copyWith( - fontSize: 15.5, - ), + textStyle: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED + .copyWith(fontSize: 15.5), ), ), ); @@ -66,12 +63,11 @@ class KnowledgePanelTextCard extends StatelessWidget { // TODO(g123k): Would it be difficult to remove the Icon directly? // Remove Icon IconTheme.merge( - data: const IconThemeData( - size: 0.0, - ), + data: const IconThemeData(size: 0.0), child: addPanelButton( - appLocalizations - .knowledge_panel_text_source(textElement.sourceText!), + appLocalizations.knowledge_panel_text_source( + textElement.sourceText!, + ), trailingIcon: Icon(ConstantIcons.forwardIcon), onPressed: () async => LaunchUrlHelper.launchURLInWebViewOrBrowser( context, @@ -122,10 +118,7 @@ class _KnowledgePanelWarningTextCard extends StatelessWidget { contentBackgroundColor: const Color(0xFFF3F3F3), borderRadius: BorderRadius.circular(14.0), leading: const Padding( - padding: EdgeInsetsDirectional.only( - bottom: 1.0, - end: 1.0, - ), + padding: EdgeInsetsDirectional.only(bottom: 1.0, end: 1.0), child: icons.Warning(size: 15.0), ), contentPadding: const EdgeInsetsDirectional.symmetric( @@ -134,10 +127,7 @@ class _KnowledgePanelWarningTextCard extends StatelessWidget { ), child: Text( text.firstLetterInUppercase(), - style: const TextStyle( - color: Colors.black, - height: 1.5, - ), + style: const TextStyle(color: Colors.black, height: 1.5), ), ), ), diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_title_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_title_card.dart index 2549aecf4b..40a0542a21 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_title_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_title_card.dart @@ -30,12 +30,14 @@ class KnowledgePanelTitleCard extends StatelessWidget { Color? colorFromEvaluation; IconData? iconData; if (userPreferences.getFlag( - UserPreferencesDevMode.userPreferencesFlagAccessibilityEmoji) ?? + UserPreferencesDevMode.userPreferencesFlagAccessibilityEmoji, + ) ?? false) { iconData = _getIconDataFromEvaluation(evaluation); } if (!(userPreferences.getFlag( - UserPreferencesDevMode.userPreferencesFlagAccessibilityNoColor) ?? + UserPreferencesDevMode.userPreferencesFlagAccessibilityNoColor, + ) ?? false)) { if (knowledgePanelTitleElement.iconColorFromEvaluation ?? false) { if (context.darkTheme()) { @@ -63,9 +65,7 @@ class KnowledgePanelTitleCard extends StatelessWidget { ), ), ), - const Padding( - padding: EdgeInsetsDirectional.only(start: SMALL_SPACE), - ), + const Padding(padding: EdgeInsetsDirectional.only(start: SMALL_SPACE)), if (iconData != null) Padding( padding: const EdgeInsetsDirectional.only(end: SMALL_SPACE), @@ -107,8 +107,8 @@ class KnowledgePanelTitleCard extends StatelessWidget { fontSize: hasSubtitle ? 15.5 : 15.0, fontWeight: hasSubtitle ? isClickable - ? FontWeight.w600 - : FontWeight.bold + ? FontWeight.w600 + : FontWeight.bold : FontWeight.normal, ), ), @@ -124,9 +124,7 @@ class KnowledgePanelTitleCard extends StatelessWidget { knowledgePanelTitleElement.subtitle!, style: WellSpacedTextHelper .TEXT_STYLE_WITH_WELL_SPACED - .copyWith( - fontWeight: FontWeight.w500, - ), + .copyWith(fontWeight: FontWeight.w500), ).selectable(isSelectable: !isClickable), ), ), @@ -233,9 +231,7 @@ class KnowledgePanelTitleCard extends StatelessWidget { properties.add( EnumProperty('grade', knowledgePanelTitleElement.grade), ); - properties.add( - DiagnosticsProperty('clickable', isClickable), - ); + properties.add(DiagnosticsProperty('clickable', isClickable)); properties.add(EnumProperty('evaluation', evaluation)); } } diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_world_map_card.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_world_map_card.dart index f1734946be..1b65d09700 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_world_map_card.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels/knowledge_panel_world_map_card.dart @@ -64,8 +64,9 @@ class KnowledgePanelWorldMapCard extends StatelessWidget { return Padding( padding: const EdgeInsetsDirectional.only(bottom: MEDIUM_SPACE), child: Semantics( - label: AppLocalizations.of(context) - .knowledge_panel_world_map_accessibility_label(kpTitle ?? '?'), + label: AppLocalizations.of( + context, + ).knowledge_panel_world_map_accessibility_label(kpTitle ?? '?'), image: true, button: true, child: SizedBox( @@ -80,10 +81,7 @@ class KnowledgePanelWorldMapCard extends StatelessWidget { borderRadius: const BorderRadius.all(Radius.circular(6.0)), child: FlutterMap( options: mapOptions, - children: [ - ...children, - const _ExpandMapIcon(), - ], + children: [...children, const _ExpandMapIcon()], ), ), ), diff --git a/packages/smooth_app/lib/knowledge_panel/knowledge_panels_builder.dart b/packages/smooth_app/lib/knowledge_panel/knowledge_panels_builder.dart index 5b00e02567..40ecba1c01 100644 --- a/packages/smooth_app/lib/knowledge_panel/knowledge_panels_builder.dart +++ b/packages/smooth_app/lib/knowledge_panel/knowledge_panels_builder.dart @@ -29,8 +29,9 @@ class KnowledgePanelsBuilder { required bool onboardingMode, }) { final String? panelId = panelElement.panelElement?.panelId; - final KnowledgePanel? rootPanel = - panelId == null ? null : getKnowledgePanel(product, panelId); + final KnowledgePanel? rootPanel = panelId == null + ? null + : getKnowledgePanel(product, panelId); final List children = []; if (rootPanel != null) { children.add(KnowledgePanelTitle(title: rootPanel.titleElement!.title)); @@ -53,8 +54,10 @@ class KnowledgePanelsBuilder { } if (!onboardingMode) { if (panelId == 'health_card') { - final bool nutritionAddOrUpdate = product.statesTags?.contains( - ProductState.NUTRITION_FACTS_COMPLETED.toBeCompletedTag) ?? + final bool nutritionAddOrUpdate = + product.statesTags?.contains( + ProductState.NUTRITION_FACTS_COMPLETED.toBeCompletedTag, + ) ?? false; if (nutritionAddOrUpdate) { if (AddNutritionButton.acceptsNutritionFacts(product)) { @@ -62,10 +65,10 @@ class KnowledgePanelsBuilder { } } - final bool needEditIngredients = context - .read() - .getFlag(UserPreferencesDevMode - .userPreferencesFlagEditIngredients) ?? + final bool needEditIngredients = + context.read().getFlag( + UserPreferencesDevMode.userPreferencesFlagEditIngredients, + ) ?? false; if ((product.ingredientsText == null || product.ingredientsText!.isEmpty) && @@ -83,7 +86,8 @@ class KnowledgePanelsBuilder { } if (children.isEmpty) { Logs.e( - 'Unexpected empty panel data for product "${product.barcode}" and panelId "$panelId"'); + 'Unexpected empty panel data for product "${product.barcode}" and panelId "$panelId"', + ); } return children; } @@ -125,8 +129,7 @@ class KnowledgePanelsBuilder { static KnowledgePanel? getKnowledgePanel( final Product product, final String panelId, - ) => - product.knowledgePanels?.panelIdToPanelMap[panelId]; + ) => product.knowledgePanels?.panelIdToPanelMap[panelId]; /// Returns the unique "root" panel element that matches [panelId], or `null`. static KnowledgePanelElement? getRootPanelElement( @@ -148,8 +151,10 @@ class KnowledgePanelsBuilder { final Product product, final String panelId, ) { - final KnowledgePanel panel = - KnowledgePanelsBuilder.getKnowledgePanel(product, panelId)!; + final KnowledgePanel panel = KnowledgePanelsBuilder.getKnowledgePanel( + product, + panelId, + )!; if (panel.elements == null) { return false; } @@ -211,14 +216,10 @@ class KnowledgePanelsBuilder { }) { switch (element.elementType) { case KnowledgePanelElementType.TEXT: - return KnowledgePanelTextCard( - textElement: element.textElement!, - ); + return KnowledgePanelTextCard(textElement: element.textElement!); case KnowledgePanelElementType.IMAGE: - return KnowledgePanelImageCard( - imageElement: element.imageElement!, - ); + return KnowledgePanelImageCard(imageElement: element.imageElement!); case KnowledgePanelElementType.PANEL: final String panelId = element.panelElement!.panelId; @@ -230,9 +231,7 @@ class KnowledgePanelsBuilder { (product.productType ?? ProductType.food) != ProductType.food) { // just ignore } else { - Logs.w( - 'unknown panel "$panelId" for barcode "${product.barcode}"', - ); + Logs.w('unknown panel "$panelId" for barcode "${product.barcode}"'); } return null; } @@ -265,10 +264,7 @@ class KnowledgePanelsBuilder { return null; case KnowledgePanelElementType.ACTION: - return KnowledgePanelActionCard( - element.actionElement!, - product, - ); + return KnowledgePanelActionCard(element.actionElement!, product); } } @@ -335,10 +331,7 @@ class KnowledgePanelsBuilder { } class KnowledgePanelTitle extends StatelessWidget { - const KnowledgePanelTitle({ - required this.title, - super.key, - }); + const KnowledgePanelTitle({required this.title, super.key}); final String title; @@ -348,10 +341,7 @@ class KnowledgePanelTitle extends StatelessWidget { padding: const EdgeInsetsDirectional.symmetric( vertical: VERY_SMALL_SPACE, ), - child: Text( - title, - style: Theme.of(context).textTheme.displaySmall, - ), + child: Text(title, style: Theme.of(context).textTheme.displaySmall), ); } } diff --git a/packages/smooth_app/lib/l10n/app_localizations.dart b/packages/smooth_app/lib/l10n/app_localizations.dart index 57d487e1f4..d304c9a4d8 100644 --- a/packages/smooth_app/lib/l10n/app_localizations.dart +++ b/packages/smooth_app/lib/l10n/app_localizations.dart @@ -187,7 +187,7 @@ import 'app_localizations_zu.dart'; /// property. abstract class AppLocalizations { AppLocalizations(String locale) - : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); final String localeName; @@ -210,11 +210,11 @@ abstract class AppLocalizations { /// of delegates is preferred or required. static const List> localizationsDelegates = >[ - delegate, - GlobalMaterialLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - ]; + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; /// A list of this localizations delegate's supported locales. static const List supportedLocales = [ @@ -344,7 +344,7 @@ abstract class AppLocalizations { Locale('yi'), Locale('yo'), Locale('zh'), - Locale('zu') + Locale('zu'), ]; /// Separator just before a colon (':'). Probably only populated in French and empty in other languages. @@ -1779,8 +1779,12 @@ abstract class AppLocalizations { /// /// In en, this message translates to: /// **'The minimum size in pixels for picture upload is {expectedMinWidth}x{expectedMinHeight}. The current picture is {actualWidth}x{actualHeight}.'** - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight); + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ); /// Action being performed on the crop page /// @@ -2753,7 +2757,9 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Do you want to change the currency from {previousCurrency} to {possibleCurrency}?'** String currency_auto_change_message( - String previousCurrency, String possibleCurrency); + String previousCurrency, + String possibleCurrency, + ); /// The label shown above a selector where the user can select their country (in the onboarding) /// @@ -3053,22 +3059,35 @@ abstract class AppLocalizations { /// /// In en, this message translates to: /// **'OS: Android (SDK Int: {sdkInt} / Release: {release})\nModel: {model}\nProduct: {product}\nDevice: {device}\nBrand:{brand}'** - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand); + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ); /// Contact form content for iOS devices /// /// In en, this message translates to: /// **'OS: iOS ({version})\nModel: {model}\nLocalized model: {localizedModel}'** String contact_form_body_ios( - String? version, String? model, String? localizedModel); + String? version, + String? model, + String? localizedModel, + ); /// Contact form content /// /// In en, this message translates to: /// **'{osContent}\nApp version:{appVersion}\nApp build number:{appBuildNumber}\nApp package name:{appPackageName}'** - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName); + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ); /// No description provided for @authorize_button_label. /// @@ -4749,7 +4768,11 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Price: {price} / Store: \"{location}\" / Published on {date} by \"{user}\"'** String prices_entry_accessibility_label( - String price, String location, String date, String user); + String price, + String location, + String date, + String user, + ); /// Button to open the proofs of a user /// @@ -4996,7 +5019,9 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Your current currency is **{currency}**. Would you like to change it to **{newCurrency}**?'** String prices_currency_change_proposal_message( - String currency, String newCurrency); + String currency, + String newCurrency, + ); /// Button to approve the currency change /// @@ -5093,7 +5118,10 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Download {count} more products\nAlready downloaded {downloaded} out of {totalSize}.'** String product_search_button_download_more( - int count, int downloaded, int totalSize); + int count, + int downloaded, + int totalSize, + ); /// This message will be displayed when a search is in progress. /// @@ -8137,133 +8165,133 @@ class _AppLocalizationsDelegate @override bool isSupported(Locale locale) => [ - 'aa', - 'af', - 'ak', - 'am', - 'ar', - 'as', - 'az', - 'be', - 'bg', - 'bm', - 'bn', - 'bo', - 'br', - 'bs', - 'ca', - 'ce', - 'co', - 'cs', - 'cv', - 'cy', - 'da', - 'de', - 'el', - 'en', - 'eo', - 'es', - 'et', - 'eu', - 'fa', - 'fi', - 'fo', - 'fr', - 'ga', - 'gd', - 'gl', - 'gu', - 'ha', - 'he', - 'hi', - 'hr', - 'ht', - 'hu', - 'hy', - 'id', - 'ii', - 'is', - 'it', - 'iu', - 'ja', - 'jv', - 'ka', - 'kk', - 'km', - 'kn', - 'ko', - 'ku', - 'kw', - 'ky', - 'la', - 'lb', - 'lo', - 'lt', - 'lv', - 'mg', - 'mi', - 'ml', - 'mn', - 'mr', - 'ms', - 'mt', - 'my', - 'nb', - 'ne', - 'nl', - 'nn', - 'no', - 'nr', - 'oc', - 'or', - 'pa', - 'pl', - 'pt', - 'qu', - 'rm', - 'ro', - 'ru', - 'sa', - 'sc', - 'sd', - 'sg', - 'si', - 'sk', - 'sl', - 'sn', - 'so', - 'sq', - 'sr', - 'ss', - 'st', - 'sv', - 'sw', - 'ta', - 'te', - 'tg', - 'th', - 'ti', - 'tl', - 'tn', - 'tr', - 'ts', - 'tt', - 'tw', - 'ty', - 'ug', - 'uk', - 'ur', - 'uz', - 've', - 'vi', - 'wa', - 'wo', - 'xh', - 'yi', - 'yo', - 'zh', - 'zu' - ].contains(locale.languageCode); + 'aa', + 'af', + 'ak', + 'am', + 'ar', + 'as', + 'az', + 'be', + 'bg', + 'bm', + 'bn', + 'bo', + 'br', + 'bs', + 'ca', + 'ce', + 'co', + 'cs', + 'cv', + 'cy', + 'da', + 'de', + 'el', + 'en', + 'eo', + 'es', + 'et', + 'eu', + 'fa', + 'fi', + 'fo', + 'fr', + 'ga', + 'gd', + 'gl', + 'gu', + 'ha', + 'he', + 'hi', + 'hr', + 'ht', + 'hu', + 'hy', + 'id', + 'ii', + 'is', + 'it', + 'iu', + 'ja', + 'jv', + 'ka', + 'kk', + 'km', + 'kn', + 'ko', + 'ku', + 'kw', + 'ky', + 'la', + 'lb', + 'lo', + 'lt', + 'lv', + 'mg', + 'mi', + 'ml', + 'mn', + 'mr', + 'ms', + 'mt', + 'my', + 'nb', + 'ne', + 'nl', + 'nn', + 'no', + 'nr', + 'oc', + 'or', + 'pa', + 'pl', + 'pt', + 'qu', + 'rm', + 'ro', + 'ru', + 'sa', + 'sc', + 'sd', + 'sg', + 'si', + 'sk', + 'sl', + 'sn', + 'so', + 'sq', + 'sr', + 'ss', + 'st', + 'sv', + 'sw', + 'ta', + 'te', + 'tg', + 'th', + 'ti', + 'tl', + 'tn', + 'tr', + 'ts', + 'tt', + 'tw', + 'ty', + 'ug', + 'uk', + 'ur', + 'uz', + 've', + 'vi', + 'wa', + 'wo', + 'xh', + 'yi', + 'yo', + 'zh', + 'zu', + ].contains(locale.languageCode); @override bool shouldReload(_AppLocalizationsDelegate old) => false; @@ -8539,8 +8567,9 @@ AppLocalizations lookupAppLocalizations(Locale locale) { } throw FlutterError( - 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' - 'an issue with the localizations generation tool. Please file an issue ' - 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.'); + 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.', + ); } diff --git a/packages/smooth_app/lib/l10n/app_localizations_aa.dart b/packages/smooth_app/lib/l10n/app_localizations_aa.dart index 0fa8eafc6f..cc8d7b4bc9 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_aa.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_aa.dart @@ -792,8 +792,12 @@ class AppLocalizationsAa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsAa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsAa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsAa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsAa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsAa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_af.dart b/packages/smooth_app/lib/l10n/app_localizations_af.dart index dbc5cfb752..ccf0fc51c4 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_af.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_af.dart @@ -792,8 +792,12 @@ class AppLocalizationsAf extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsAf extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsAf extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsAf extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsAf extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsAf extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ak.dart b/packages/smooth_app/lib/l10n/app_localizations_ak.dart index dedd8ea2ab..f47971726e 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ak.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ak.dart @@ -792,8 +792,12 @@ class AppLocalizationsAk extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsAk extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsAk extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsAk extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsAk extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsAk extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_am.dart b/packages/smooth_app/lib/l10n/app_localizations_am.dart index 56f9c81e37..949b16d257 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_am.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_am.dart @@ -792,8 +792,12 @@ class AppLocalizationsAm extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsAm extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsAm extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsAm extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsAm extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsAm extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ar.dart b/packages/smooth_app/lib/l10n/app_localizations_ar.dart index 59a2346e8a..6dad5db6a1 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ar.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ar.dart @@ -789,8 +789,12 @@ class AppLocalizationsAr extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1351,7 +1355,9 @@ class AppLocalizationsAr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1568,20 +1574,33 @@ class AppLocalizationsAr extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2607,7 +2626,11 @@ class AppLocalizationsAr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2791,7 +2814,9 @@ class AppLocalizationsAr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2850,7 +2875,10 @@ class AppLocalizationsAr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_as.dart b/packages/smooth_app/lib/l10n/app_localizations_as.dart index 3cda369f76..26d48d86b4 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_as.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_as.dart @@ -792,8 +792,12 @@ class AppLocalizationsAs extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsAs extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsAs extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsAs extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsAs extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsAs extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_az.dart b/packages/smooth_app/lib/l10n/app_localizations_az.dart index 79aed3b911..f040df4ee3 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_az.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_az.dart @@ -792,8 +792,12 @@ class AppLocalizationsAz extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsAz extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsAz extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsAz extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsAz extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsAz extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_be.dart b/packages/smooth_app/lib/l10n/app_localizations_be.dart index 2029662cbb..5d13533dfd 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_be.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_be.dart @@ -801,8 +801,12 @@ class AppLocalizationsBe extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1373,7 +1377,9 @@ class AppLocalizationsBe extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1591,20 +1597,33 @@ class AppLocalizationsBe extends AppLocalizations { 'Калі вы перадумаеце, гэту опцыю можна ўключыць і адключыць у наладах у любы час.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'АС: Android (SDK Int: $sdkInt / Выпуск: $release)\nМадэль: $model\nПрадукт: $product\nПрылада: $device\nБрэнд:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'АС: iOS ($version)\nМадэль: $model\nЛакалізаваная мадэль: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nВерсія праграмы:$appVersion\nНумар зборкі праграмы:$appBuildNumber\nНазва пакета праграмы:$appPackageName'; } @@ -2636,7 +2655,11 @@ class AppLocalizationsBe extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2820,7 +2843,9 @@ class AppLocalizationsBe extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2879,7 +2904,10 @@ class AppLocalizationsBe extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Спампаваць яшчэ прадукты: $count\nУжо спампавана $downloaded з $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_bg.dart b/packages/smooth_app/lib/l10n/app_localizations_bg.dart index aeb03aa653..5aa9700f3c 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_bg.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_bg.dart @@ -800,8 +800,12 @@ class AppLocalizationsBg extends AppLocalizations { String get crop_page_too_small_image_title => 'Снимката е прекалено малка!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1374,7 +1378,9 @@ class AppLocalizationsBg extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1593,20 +1599,33 @@ class AppLocalizationsBg extends AppLocalizations { 'Ако промениш решението си, тази опция може да бъде активирана и деактивирана по всяко време от настройките.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'ОС: Android (SDK Int: $sdkInt / Версия: $release)\nМодел: $model\nПродукт: $product\nУстройство: $device\nМарка:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'ОС: iOS ($version)\nМодел: $model\nЛокализиран модел: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp версия:$appVersion\nApp номер на build:$appBuildNumber\nApp име на пакета:$appPackageName'; } @@ -2644,7 +2663,11 @@ class AppLocalizationsBg extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2828,7 +2851,9 @@ class AppLocalizationsBg extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2887,7 +2912,10 @@ class AppLocalizationsBg extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Изтегли още $count продукта\nВече изтеглени $downloaded от $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_bm.dart b/packages/smooth_app/lib/l10n/app_localizations_bm.dart index c73b84df1d..abbdb77520 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_bm.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_bm.dart @@ -792,8 +792,12 @@ class AppLocalizationsBm extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsBm extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsBm extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsBm extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsBm extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsBm extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_bn.dart b/packages/smooth_app/lib/l10n/app_localizations_bn.dart index e469525171..51d0c664d7 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_bn.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_bn.dart @@ -795,8 +795,12 @@ class AppLocalizationsBn extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1357,7 +1361,9 @@ class AppLocalizationsBn extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1575,20 +1581,33 @@ class AppLocalizationsBn extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2616,7 +2635,11 @@ class AppLocalizationsBn extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2800,7 +2823,9 @@ class AppLocalizationsBn extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2859,7 +2884,10 @@ class AppLocalizationsBn extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_bo.dart b/packages/smooth_app/lib/l10n/app_localizations_bo.dart index 6a07012a4b..f9b6950608 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_bo.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_bo.dart @@ -792,8 +792,12 @@ class AppLocalizationsBo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsBo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsBo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsBo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsBo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsBo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_br.dart b/packages/smooth_app/lib/l10n/app_localizations_br.dart index 6efdb0502f..076b971333 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_br.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_br.dart @@ -793,8 +793,12 @@ class AppLocalizationsBr extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1355,7 +1359,9 @@ class AppLocalizationsBr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1573,20 +1579,33 @@ class AppLocalizationsBr extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsBr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsBr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsBr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_bs.dart b/packages/smooth_app/lib/l10n/app_localizations_bs.dart index 2313aa4932..f5e737d246 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_bs.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_bs.dart @@ -793,8 +793,12 @@ class AppLocalizationsBs extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1355,7 +1359,9 @@ class AppLocalizationsBs extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1573,20 +1579,33 @@ class AppLocalizationsBs extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2614,7 +2633,11 @@ class AppLocalizationsBs extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2798,7 +2821,9 @@ class AppLocalizationsBs extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2857,7 +2882,10 @@ class AppLocalizationsBs extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ca.dart b/packages/smooth_app/lib/l10n/app_localizations_ca.dart index 685957a2d4..765a69740c 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ca.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ca.dart @@ -804,8 +804,12 @@ class AppLocalizationsCa extends AppLocalizations { String get crop_page_too_small_image_title => 'La imatge és massa petita!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'La mida mínima en píxels per pujar imatges és ${expectedMinWidth}x$expectedMinHeight. La imatge actual és de ${actualWidth}x$actualHeight.'; } @@ -1380,7 +1384,9 @@ class AppLocalizationsCa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1598,20 +1604,33 @@ class AppLocalizationsCa extends AppLocalizations { 'Si canvieu d\'opinió, aquesta opció es pot activar o desactivar en qualsevol moment des de la configuració.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'Sistema operatiu: Android (SDK Int: $sdkInt / Versió: $release)\nModel: $model\nProducte: $product\nDispositiu: $device\nMarca:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'Sistema operatiu: iOS ($version)\nModel: $model\nModel localitzat: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVersió de l\'aplicació:$appVersion\nNúmero de compilació de l\'aplicació:$appBuildNumber\nNom del paquet de l\'aplicació:$appPackageName'; } @@ -2648,7 +2667,11 @@ class AppLocalizationsCa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2832,7 +2855,9 @@ class AppLocalizationsCa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2891,7 +2916,10 @@ class AppLocalizationsCa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Descarrega $count productes més\nJa s\'han descarregat $downloaded de $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ce.dart b/packages/smooth_app/lib/l10n/app_localizations_ce.dart index 1be200a418..76440c414b 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ce.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ce.dart @@ -792,8 +792,12 @@ class AppLocalizationsCe extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsCe extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsCe extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsCe extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsCe extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsCe extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_co.dart b/packages/smooth_app/lib/l10n/app_localizations_co.dart index a626de02f0..22f6421354 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_co.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_co.dart @@ -792,8 +792,12 @@ class AppLocalizationsCo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsCo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsCo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsCo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsCo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsCo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_cs.dart b/packages/smooth_app/lib/l10n/app_localizations_cs.dart index 0aeb280950..87e8bede52 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_cs.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_cs.dart @@ -799,8 +799,12 @@ class AppLocalizationsCs extends AppLocalizations { String get crop_page_too_small_image_title => 'Obrázek je příliš malý!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Minimální velikost v pixelech pro nahrávání obrázků je ${expectedMinWidth}x$expectedMinHeight. Aktuální obrázek je ${actualWidth}x$actualHeight.'; } @@ -1369,7 +1373,9 @@ class AppLocalizationsCs extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Chcete změnit měnu z $previousCurrency na $possibleCurrency?'; } @@ -1589,20 +1595,33 @@ class AppLocalizationsCs extends AppLocalizations { 'Pokud si to rozmyslíte, můžete tuto možnost kdykoli povolit nebo zakázat v nastavení.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProdukt: $product\nZařízení: $device\nZnačka:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLokalizovaný model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVerze aplikace:$appVersion\nČíslo sestavení aplikace:$appBuildNumber\nNázev balíčku aplikace:$appPackageName'; } @@ -2635,7 +2654,11 @@ class AppLocalizationsCs extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Cena: $price / Obchod: \"$location\" / Zveřejněno dne $date od \"$user\"'; } @@ -2818,7 +2841,9 @@ class AppLocalizationsCs extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Vaše současná měna je **$currency**. Chcete ji změnit na **$newCurrency**?'; } @@ -2878,7 +2903,10 @@ class AppLocalizationsCs extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Stáhnout $count dalších produktů\nJiž staženo $downloaded ze $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_cv.dart b/packages/smooth_app/lib/l10n/app_localizations_cv.dart index 4fdb109a97..24a9fbde68 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_cv.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_cv.dart @@ -792,8 +792,12 @@ class AppLocalizationsCv extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsCv extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsCv extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsCv extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsCv extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsCv extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_cy.dart b/packages/smooth_app/lib/l10n/app_localizations_cy.dart index 736b08d4c3..35343e036a 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_cy.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_cy.dart @@ -792,8 +792,12 @@ class AppLocalizationsCy extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsCy extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsCy extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsCy extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsCy extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsCy extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_da.dart b/packages/smooth_app/lib/l10n/app_localizations_da.dart index 446d182595..0060eab492 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_da.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_da.dart @@ -793,8 +793,12 @@ class AppLocalizationsDa extends AppLocalizations { String get crop_page_too_small_image_title => 'Foto for lille!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Minimumsstørrelsen i pixels for foto-upload udgør ${expectedMinWidth}x$expectedMinHeight. Det aktuelle foto er ${actualWidth}x$actualHeight.'; } @@ -1361,7 +1365,9 @@ class AppLocalizationsDa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Vil du ændre valutaen fra $previousCurrency til $possibleCurrency?'; } @@ -1578,20 +1584,33 @@ class AppLocalizationsDa extends AppLocalizations { 'Ombestemmer man sig, kan denne indstilling altid aktiveres/deaktiveres via Indstillingerne.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt/Udgivelse: $release)\nModel: $model\nProdukt: $product\nEnhed: $device\nMærke:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLokaliseret model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp-version:$appVersion\nApp-buildnummer:$appBuildNumber\nApp-pakkenavn:$appPackageName'; } @@ -2624,7 +2643,11 @@ class AppLocalizationsDa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Pris: $price / Butik: \"$location\" / Udgivet på $date af \"$user\"'; } @@ -2808,7 +2831,9 @@ class AppLocalizationsDa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Din nuværende valuta er **$currency**. Vil du ændre det til **$newCurrency**?'; } @@ -2869,7 +2894,10 @@ class AppLocalizationsDa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download yderligere $count produkter\nAllerede downloadet $downloaded ud af $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_de.dart b/packages/smooth_app/lib/l10n/app_localizations_de.dart index 73bed3b2ac..4e679a8996 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_de.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_de.dart @@ -808,8 +808,12 @@ class AppLocalizationsDe extends AppLocalizations { String get crop_page_too_small_image_title => 'Das Bild ist zu klein!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Die Mindestgröße in Pixeln für das Hochladen von Bildern ist $expectedMinWidth×$expectedMinHeight. Das aktuelle Bild hat die Maße $actualWidth×$actualHeight.'; } @@ -1387,7 +1391,9 @@ class AppLocalizationsDe extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Möchten Sie die Währung von $previousCurrency in $possibleCurrency ändern?'; } @@ -1605,20 +1611,33 @@ class AppLocalizationsDe extends AppLocalizations { 'Wenn Sie Ihre Meinung ändern, können Sie diese Option jederzeit in den Einstellungen aktivieren und deaktivieren.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModell: $model\nProdukt: $product\nGerät: $device\nMarke: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModell: $model\nLokalisiertes Modell: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp-Version: $appVersion\nApp-Build-Nummer: $appBuildNumber\nApp-Paketname: $appPackageName'; } @@ -2664,7 +2683,11 @@ class AppLocalizationsDe extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Preis: $price / Laden: „$location” / Veröffentlicht am $date von „$user”'; } @@ -2848,7 +2871,9 @@ class AppLocalizationsDe extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Ihre aktuelle Währung ist **$currency**. Möchten Sie diese in **$newCurrency** ändern?'; } @@ -2910,7 +2935,10 @@ class AppLocalizationsDe extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Downloade $count weitere Produkte\nBereits heruntergeladen $downloaded von $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_el.dart b/packages/smooth_app/lib/l10n/app_localizations_el.dart index c2ecbb230a..8652ac36da 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_el.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_el.dart @@ -809,8 +809,12 @@ class AppLocalizationsEl extends AppLocalizations { String get crop_page_too_small_image_title => 'Η εικόνα είναι πολύ μικρή!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Το ελάχιστο μέγεθος σε pixel για μεταφόρτωση εικόνας είναι ${expectedMinWidth}x$expectedMinHeight. Η τρέχουσα εικόνα είναι ${actualWidth}x$actualHeight.'; } @@ -1395,7 +1399,9 @@ class AppLocalizationsEl extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Θέλετε να αλλάξετε το νόμισμα από $previousCurrency σε $possibleCurrency;'; } @@ -1615,20 +1621,33 @@ class AppLocalizationsEl extends AppLocalizations { 'Αν αλλάξετε γνώμη, αυτή η επιλογή μπορεί να ενεργοποιηθεί και να απενεργοποιηθεί ανά πάσα στιγμή από τις ρυθμίσεις.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Έκδοση: $release)\nΜοντέλο: $model\nΠροϊόν: $product\nΣυσκευή: $device\nΜάρκα:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nΜοντέλο: $model\nΤοπικό μοντέλο: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nΈκδοση εφαρμογής:$appVersion\nΑριθμός έκδοσης εφαρμογής:$appBuildNumber\nΌνομα πακέτου εφαρμογής:$appPackageName'; } @@ -2675,7 +2694,11 @@ class AppLocalizationsEl extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Τιμή: $price / Κατάστημα: \"$location\" / Δημοσιεύθηκε στις $date από \"$user\"'; } @@ -2858,7 +2881,9 @@ class AppLocalizationsEl extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Το τρέχον νόμισμά σας είναι **$currency**. Θέλετε να το αλλάξετε σε **$newCurrency**;'; } @@ -2920,7 +2945,10 @@ class AppLocalizationsEl extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Λήψη $count ακόμη προϊόντων\nΈχει ήδη γίνει λήψη $downloaded από $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_en.dart b/packages/smooth_app/lib/l10n/app_localizations_en.dart index ace9e03a82..49ffedf2f3 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_en.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_en.dart @@ -792,8 +792,12 @@ class AppLocalizationsEn extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsEn extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsEn extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsEn extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsEn extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_eo.dart b/packages/smooth_app/lib/l10n/app_localizations_eo.dart index b3680bc2cd..5918a53062 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_eo.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_eo.dart @@ -792,8 +792,12 @@ class AppLocalizationsEo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsEo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsEo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsEo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsEo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsEo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_es.dart b/packages/smooth_app/lib/l10n/app_localizations_es.dart index e55f1d5826..f0938013ca 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_es.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_es.dart @@ -813,8 +813,12 @@ class AppLocalizationsEs extends AppLocalizations { '¡La imagen es demasiado pequeña!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'El tamaño mínimo para la subida de imágenes es de $expectedMinWidth x $expectedMinHeight. Esta imagen tiene $actualWidth x $actualHeight.'; } @@ -1387,7 +1391,9 @@ class AppLocalizationsEs extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1606,20 +1612,33 @@ class AppLocalizationsEs extends AppLocalizations { 'En cualquier caso, recuerda que si cambias de opinión, puedes activar y desactivar esta opción desde la configuración cuando quieras.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'SO: Android (SDK Int: $sdkInt / Lanzamiento: $release)\nModelo: $model\nProducto: $product\nDispositivo: $device\nMarca: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'SO: iOS ($version)\nModelo: $model\nModelo localizado: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVersión de la aplicación: $appVersion\nNúmero de compilación de la aplicación: $appBuildNumber\nNombre del paquete de la aplicación: $appPackageName'; } @@ -2660,7 +2679,11 @@ class AppLocalizationsEs extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2844,7 +2867,9 @@ class AppLocalizationsEs extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2905,7 +2930,10 @@ class AppLocalizationsEs extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Descargar $count productos más.\nSe han descargado $downloaded de $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_et.dart b/packages/smooth_app/lib/l10n/app_localizations_et.dart index 155c7c495d..69afdde569 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_et.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_et.dart @@ -792,8 +792,12 @@ class AppLocalizationsEt extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsEt extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsEt extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsEt extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsEt extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsEt extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_eu.dart b/packages/smooth_app/lib/l10n/app_localizations_eu.dart index e261d72dc3..181c574fc0 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_eu.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_eu.dart @@ -795,8 +795,12 @@ class AppLocalizationsEu extends AppLocalizations { String get crop_page_too_small_image_title => 'Irudia txikiegia da!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Gutxieneko tamaina, pixeletan, irudiak igotzeko ${expectedMinWidth}x$expectedMinHeight da. Oraingo irudia ${actualWidth}x$actualHeight da.'; } @@ -1357,7 +1361,9 @@ class AppLocalizationsEu extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1575,20 +1581,33 @@ class AppLocalizationsEu extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2618,7 +2637,11 @@ class AppLocalizationsEu extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2802,7 +2825,9 @@ class AppLocalizationsEu extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2862,7 +2887,10 @@ class AppLocalizationsEu extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_fa.dart b/packages/smooth_app/lib/l10n/app_localizations_fa.dart index 70fdf16977..27d07aa4ec 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_fa.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_fa.dart @@ -792,8 +792,12 @@ class AppLocalizationsFa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsFa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsFa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsFa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsFa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsFa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_fi.dart b/packages/smooth_app/lib/l10n/app_localizations_fi.dart index 232b698996..389096facb 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_fi.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_fi.dart @@ -796,8 +796,12 @@ class AppLocalizationsFi extends AppLocalizations { String get crop_page_too_small_image_title => 'Kuva on liian pieni!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Vähimmäiskoko pikseleinä kuvan lähettämiseen on ${expectedMinWidth}x$expectedMinHeight. Nykyinen kuva on ${actualWidth}x$actualHeight.'; } @@ -1356,7 +1360,9 @@ class AppLocalizationsFi extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Haluatko vaihtaa valuutan $previousCurrency arvoon $possibleCurrency?'; } @@ -1573,20 +1579,33 @@ class AppLocalizationsFi extends AppLocalizations { 'Voit muuttaa tätä koska tahansa asetuksissa.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'Käyttöjärjestelmä: Android (SDK Int: $sdkInt / Julkaisu: $release)\nMalli: $model\nTuote: $product\nLaite: $device\nTuotemerkki:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'Käyttöjärjestelmä: iOS ($version)\nMalli: $model\nLokalisoitu malli: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nSovelluksen versio:$appVersion\nSovelluksen koontiversion numero:$appBuildNumber\nSovelluspaketin nimi:$appPackageName'; } @@ -2614,7 +2633,11 @@ class AppLocalizationsFi extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Hinta: $price / Kauppa: \"$location\" / tekijän \"$user\" päivämääränä $date julkaisema'; } @@ -2798,7 +2821,9 @@ class AppLocalizationsFi extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2858,7 +2883,10 @@ class AppLocalizationsFi extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Lataa $count tuotetta lisää\nLadattu $downloaded tuotetta $totalSize tuotteesta.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_fo.dart b/packages/smooth_app/lib/l10n/app_localizations_fo.dart index 72afe267cc..a6326663b5 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_fo.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_fo.dart @@ -792,8 +792,12 @@ class AppLocalizationsFo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsFo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsFo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsFo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsFo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsFo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_fr.dart b/packages/smooth_app/lib/l10n/app_localizations_fr.dart index 8bff1370fe..4f0f7aa994 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_fr.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_fr.dart @@ -815,8 +815,12 @@ class AppLocalizationsFr extends AppLocalizations { String get crop_page_too_small_image_title => 'L\'image est trop petite !'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'La taille minimale en pixels pour le téléchargement d\'images est ${expectedMinWidth}x$expectedMinHeight. L\'image actuelle est ${actualWidth}x$actualHeight.'; } @@ -1394,7 +1398,9 @@ class AppLocalizationsFr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Voulez-vous changer la devise de $previousCurrency à $possibleCurrency?'; } @@ -1614,20 +1620,33 @@ class AppLocalizationsFr extends AppLocalizations { 'Si vous changez d\'avis, cette option peut être activée et désactivée à tout moment depuis les paramètres.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'Système d\'exploitation : Android (SDK Int : $sdkInt / Version : $release)\nModèle : $model\nProduit : $product\nAppareil : $device\nMarque : $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS : iOS ($version)\nModèle : $model\nModèle localisé : $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVersion de l\'application : $appVersion\nNuméro de build de l\'application : $appBuildNumber\nNom du package de l\'application : $appPackageName'; } @@ -2678,7 +2697,11 @@ class AppLocalizationsFr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Prix : $price / Magasin : \"$location\" / Publié le $date par \"$user\"'; } @@ -2862,7 +2885,9 @@ class AppLocalizationsFr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Votre monnaie actuelle est **$currency**. Souhaitez-vous la changer en **$newCurrency** ?'; } @@ -2925,7 +2950,10 @@ class AppLocalizationsFr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Télécharger $count autres produits\n$downloaded sur $totalSize déjà téléchargés.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ga.dart b/packages/smooth_app/lib/l10n/app_localizations_ga.dart index 4a728bcd8a..bc9ed81f8d 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ga.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ga.dart @@ -792,8 +792,12 @@ class AppLocalizationsGa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsGa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsGa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsGa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsGa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsGa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_gd.dart b/packages/smooth_app/lib/l10n/app_localizations_gd.dart index d5b625e541..c1b9ec3dd2 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_gd.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_gd.dart @@ -792,8 +792,12 @@ class AppLocalizationsGd extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsGd extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsGd extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsGd extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsGd extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsGd extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_gl.dart b/packages/smooth_app/lib/l10n/app_localizations_gl.dart index d036315a2a..8f8d1f0ca6 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_gl.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_gl.dart @@ -792,8 +792,12 @@ class AppLocalizationsGl extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsGl extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsGl extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2614,7 +2633,11 @@ class AppLocalizationsGl extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2798,7 +2821,9 @@ class AppLocalizationsGl extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2857,7 +2882,10 @@ class AppLocalizationsGl extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_gu.dart b/packages/smooth_app/lib/l10n/app_localizations_gu.dart index 24b96dfbf4..65f125661d 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_gu.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_gu.dart @@ -792,8 +792,12 @@ class AppLocalizationsGu extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsGu extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsGu extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsGu extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsGu extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsGu extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ha.dart b/packages/smooth_app/lib/l10n/app_localizations_ha.dart index 2da351028f..9dcade7d93 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ha.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ha.dart @@ -792,8 +792,12 @@ class AppLocalizationsHa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsHa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsHa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsHa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsHa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsHa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_he.dart b/packages/smooth_app/lib/l10n/app_localizations_he.dart index 1e3691de6f..5d2f09d876 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_he.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_he.dart @@ -779,8 +779,12 @@ class AppLocalizationsHe extends AppLocalizations { String get crop_page_too_small_image_title => 'התמונה קטנה מדי!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'הגודל המזערי בפיקסלים להעלאת תמונה הוא ‎$expectedMinWidth×$expectedMinHeight. גודל התמונה הנוכחית הוא ‎$actualWidth×$actualHeight.'; } @@ -1332,7 +1336,9 @@ class AppLocalizationsHe extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'להחליף מהמטבע $previousCurrency למטבע $possibleCurrency?'; } @@ -1561,20 +1567,33 @@ class AppLocalizationsHe extends AppLocalizations { 'אפשר להפעיל או להשבית את האפשרות הזאת דרך ההגדרות במקרה של חרטה.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'מערכת הפעלה: Android (SDK Int: $sdkInt / מהדורה: $release)\nדגם: $model\nמוצר: $product\nמכשיר: $device\nמותג: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'מערכת הפעלה: iOS ($version)\nדגם: $model\nדגם מתורגם: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nגרסת יישומון:$appVersion\nמספר בניית יישומון:$appBuildNumber\nשם חבילת יישומון:$appPackageName'; } @@ -2602,7 +2621,11 @@ class AppLocalizationsHe extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'מחיר: $price / חנות: „$location” / פורסם ב־$date על ידי „$user”'; } @@ -2795,7 +2818,9 @@ class AppLocalizationsHe extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'המטבע הנוכחי שלך הוא **$currency**. לשנות אותו למטבע **$newCurrency**?'; } @@ -2853,7 +2878,10 @@ class AppLocalizationsHe extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'הורדת $count מוצרים נוספים\nכבר הורדת $downloaded מתוך $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_hi.dart b/packages/smooth_app/lib/l10n/app_localizations_hi.dart index e113974c30..60d18ae9e3 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_hi.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_hi.dart @@ -791,8 +791,12 @@ class AppLocalizationsHi extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1353,7 +1357,9 @@ class AppLocalizationsHi extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1571,20 +1577,33 @@ class AppLocalizationsHi extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsHi extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsHi extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsHi extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_hr.dart b/packages/smooth_app/lib/l10n/app_localizations_hr.dart index d37c30bb8f..0b04696b74 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_hr.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_hr.dart @@ -793,8 +793,12 @@ class AppLocalizationsHr extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1355,7 +1359,9 @@ class AppLocalizationsHr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1573,20 +1579,33 @@ class AppLocalizationsHr extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2614,7 +2633,11 @@ class AppLocalizationsHr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2798,7 +2821,9 @@ class AppLocalizationsHr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2857,7 +2882,10 @@ class AppLocalizationsHr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ht.dart b/packages/smooth_app/lib/l10n/app_localizations_ht.dart index 257e644521..dc998ecc37 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ht.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ht.dart @@ -792,8 +792,12 @@ class AppLocalizationsHt extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsHt extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsHt extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsHt extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsHt extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsHt extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_hu.dart b/packages/smooth_app/lib/l10n/app_localizations_hu.dart index 6d0c3f28fa..554a951a38 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_hu.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_hu.dart @@ -805,8 +805,12 @@ class AppLocalizationsHu extends AppLocalizations { String get crop_page_too_small_image_title => 'A fénykép túl kicsi!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Képfeltöltésnél a minimális méret ${expectedMinWidth}x$expectedMinHeight pixel. Az aktuális kép ${actualWidth}x$actualHeight pixeles.'; } @@ -1369,7 +1373,9 @@ class AppLocalizationsHu extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Meg akarja változtatni a pénznemet erről: $previousCurrency erre: $possibleCurrency?'; } @@ -1588,20 +1594,33 @@ class AppLocalizationsHu extends AppLocalizations { 'Ha meggondolná magát, ez az opció bármikor engedélyezhető vagy letiltható a beállításokban.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Kiadás: $release)\nModell: $model\nTermék: $product\nKészülék: $device\nMárka:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModell: $model\nLokalizált modell: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp verziója:$appVersion\nApp build száma:$appBuildNumber\nApp csomagneve:$appPackageName'; } @@ -2641,7 +2660,11 @@ class AppLocalizationsHu extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Ár: $price / Bolt: \"$location\" / Hozzáadva $date, „$user” által'; } @@ -2825,7 +2848,9 @@ class AppLocalizationsHu extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Jelenlegi pénzneme **$currency**. Szeretné módosítani a következőre: **$newCurrency**?'; } @@ -2885,7 +2910,10 @@ class AppLocalizationsHu extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'További $count termék letöltése\n $downloaded már letöltve ennyiből: $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_hy.dart b/packages/smooth_app/lib/l10n/app_localizations_hy.dart index 40634ff8aa..bef53a2edb 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_hy.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_hy.dart @@ -792,8 +792,12 @@ class AppLocalizationsHy extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsHy extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsHy extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsHy extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsHy extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsHy extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_id.dart b/packages/smooth_app/lib/l10n/app_localizations_id.dart index 12b6af7843..34048b54d7 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_id.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_id.dart @@ -799,8 +799,12 @@ class AppLocalizationsId extends AppLocalizations { String get crop_page_too_small_image_title => 'Gambar terlalu kecil!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Ukuran minimum piksel untuk unggahan gambar adalah ${expectedMinWidth}x$expectedMinHeight. Gambar ini $actualHeight×$actualWidth.'; } @@ -1372,7 +1376,9 @@ class AppLocalizationsId extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Apakah Anda ingin mengganti mata uang dari $previousCurrency ke $possibleCurrency?'; } @@ -1592,20 +1598,33 @@ class AppLocalizationsId extends AppLocalizations { 'Jika anda berubah pikiran, pilihan ini dapat diaktikan dan dinonaktifkan kapan saja dari pengaturan.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Rilis: $release)\nModel: $model\nProduk: $product\nPerangkat: $device\nJenama:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nModel lokal: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVersi aplikasi:$appVersion\nNomor pembuatan aplikasi:$appBuildNumber\nNama paket aplikasi:$appPackageName'; } @@ -2636,7 +2655,11 @@ class AppLocalizationsId extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Harga: $price / Toko: \"$location\" / Diterbitkan pada $date oleh \"$user\"'; } @@ -2820,7 +2843,9 @@ class AppLocalizationsId extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Mata uang Anda saat ini adalah **$currency**. Apa Anda mau mengubahnya ke **$newCurrency**?'; } @@ -2879,7 +2904,10 @@ class AppLocalizationsId extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Unduh $count lebih banyak produk\nSudah mengunduh $downloaded dari $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ii.dart b/packages/smooth_app/lib/l10n/app_localizations_ii.dart index 16e6aa8537..9e88a74c36 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ii.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ii.dart @@ -792,8 +792,12 @@ class AppLocalizationsIi extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsIi extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsIi extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsIi extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsIi extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsIi extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_is.dart b/packages/smooth_app/lib/l10n/app_localizations_is.dart index 17d2e7f487..98391b2e63 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_is.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_is.dart @@ -792,8 +792,12 @@ class AppLocalizationsIs extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsIs extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsIs extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsIs extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsIs extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsIs extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_it.dart b/packages/smooth_app/lib/l10n/app_localizations_it.dart index ce18aa5f8b..909f348c22 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_it.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_it.dart @@ -800,8 +800,12 @@ class AppLocalizationsIt extends AppLocalizations { String get crop_page_too_small_image_title => 'L\'immagine è troppo piccola!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'La dimensione minima in pixel per il caricamento dell\'immagine è ${expectedMinWidth}x$expectedMinHeight. L\'immagine corrente è ${actualWidth}x$actualHeight.'; } @@ -1375,7 +1379,9 @@ class AppLocalizationsIt extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Vuoi cambiare la valuta da $previousCurrency a $possibleCurrency?'; } @@ -1594,20 +1600,33 @@ class AppLocalizationsIt extends AppLocalizations { 'Se cambi idea, quest\'opzione può essere abilitata e disabilitata in qualsiasi momento dalle impostazioni.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (Int SDK: $sdkInt / Release: $release)\nModello: $model\nProdotto: $product\nDispositivo: $device\nMarca:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModello: $model\nModello localizzato: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVersione app:$appVersion\nNumero build app:$appBuildNumber\nNome pacchetto app:$appPackageName'; } @@ -2654,7 +2673,11 @@ class AppLocalizationsIt extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Prezzo: $price / Negozio: \"$location\" / Pubblicato il $date da \"$user\"'; } @@ -2838,7 +2861,9 @@ class AppLocalizationsIt extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2900,7 +2925,10 @@ class AppLocalizationsIt extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Scarica altri $count prodotti\nGià scaricati $downloaded su $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_iu.dart b/packages/smooth_app/lib/l10n/app_localizations_iu.dart index 043e3f71af..b08a1747b3 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_iu.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_iu.dart @@ -792,8 +792,12 @@ class AppLocalizationsIu extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsIu extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsIu extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsIu extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsIu extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsIu extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ja.dart b/packages/smooth_app/lib/l10n/app_localizations_ja.dart index 2a29871b8f..cd47527fc6 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ja.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ja.dart @@ -773,8 +773,12 @@ class AppLocalizationsJa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1325,7 +1329,9 @@ class AppLocalizationsJa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return '通貨を $previousCurrency から $possibleCurrency に変更しますか?'; } @@ -1539,20 +1545,33 @@ class AppLocalizationsJa extends AppLocalizations { String get permissions_page_body2 => '気が変わった場合、設定からいつでも切り替えることができます。'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nモデル: $model\n製品: $product\nデバイス: $device\nブランド:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nモデル: $model\nローカライズされたモデル: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nアプリのバージョン:$appVersion\nアプリのビルド番号:$appBuildNumber\nアプリのパッケージ名:$appPackageName'; } @@ -2559,7 +2578,11 @@ class AppLocalizationsJa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2743,7 +2766,9 @@ class AppLocalizationsJa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return '現在の通貨は**$currency** です。**$newCurrency**に変更しますか?'; } @@ -2802,7 +2827,10 @@ class AppLocalizationsJa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'あと $count 製品をダウンロード\n$totalSize 製品中 $downloaded 製品はダウンロード済みです。'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_jv.dart b/packages/smooth_app/lib/l10n/app_localizations_jv.dart index 0f164b795b..0aab4577b2 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_jv.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_jv.dart @@ -792,8 +792,12 @@ class AppLocalizationsJv extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsJv extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsJv extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsJv extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsJv extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsJv extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ka.dart b/packages/smooth_app/lib/l10n/app_localizations_ka.dart index a7f9bca79f..a61a13701a 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ka.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ka.dart @@ -792,8 +792,12 @@ class AppLocalizationsKa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsKa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsKa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsKa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsKa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsKa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_kk.dart b/packages/smooth_app/lib/l10n/app_localizations_kk.dart index ae98141cfa..c0b8d65b68 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_kk.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_kk.dart @@ -792,8 +792,12 @@ class AppLocalizationsKk extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsKk extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsKk extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsKk extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsKk extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsKk extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_km.dart b/packages/smooth_app/lib/l10n/app_localizations_km.dart index 3b096745e5..9dc4f1797b 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_km.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_km.dart @@ -792,8 +792,12 @@ class AppLocalizationsKm extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsKm extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsKm extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsKm extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsKm extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsKm extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_kn.dart b/packages/smooth_app/lib/l10n/app_localizations_kn.dart index ed73e69100..2240681b8c 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_kn.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_kn.dart @@ -792,8 +792,12 @@ class AppLocalizationsKn extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1355,7 +1359,9 @@ class AppLocalizationsKn extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1573,20 +1579,33 @@ class AppLocalizationsKn extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsKn extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsKn extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsKn extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ko.dart b/packages/smooth_app/lib/l10n/app_localizations_ko.dart index 41b359b8cb..2730f18f4a 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ko.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ko.dart @@ -774,8 +774,12 @@ class AppLocalizationsKo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1331,7 +1335,9 @@ class AppLocalizationsKo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1546,20 +1552,33 @@ class AppLocalizationsKo extends AppLocalizations { '마음이 바뀌면 언제든지 설정에서 이 옵션을 활성화하거나 비활성화할 수 있습니다.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return '운영체제: Android (SDK Int: $sdkInt / Release: $release)\n모델: $model\n제품: $product\n기기: $device\n브랜드:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return '운영체제: iOS ($version)\n모델: $model\n현지화 모델: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\n앱 버전:$appVersion\n앱 빌드 번호:$appBuildNumber\n앱 패키지 이름:$appPackageName'; } @@ -2572,7 +2591,11 @@ class AppLocalizationsKo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2756,7 +2779,9 @@ class AppLocalizationsKo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2815,7 +2840,10 @@ class AppLocalizationsKo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return '더 많은 제품 $count 개 다운로드\n이미 $totalSize중 $downloaded 다운로드했습니다.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ku.dart b/packages/smooth_app/lib/l10n/app_localizations_ku.dart index ed8515dbb1..41862b34ab 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ku.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ku.dart @@ -792,8 +792,12 @@ class AppLocalizationsKu extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsKu extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsKu extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsKu extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsKu extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsKu extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_kw.dart b/packages/smooth_app/lib/l10n/app_localizations_kw.dart index 134135102f..79ab6dbcce 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_kw.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_kw.dart @@ -792,8 +792,12 @@ class AppLocalizationsKw extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsKw extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsKw extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsKw extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsKw extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsKw extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ky.dart b/packages/smooth_app/lib/l10n/app_localizations_ky.dart index cf5663d817..153c97ebfe 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ky.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ky.dart @@ -792,8 +792,12 @@ class AppLocalizationsKy extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsKy extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsKy extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsKy extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsKy extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsKy extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_la.dart b/packages/smooth_app/lib/l10n/app_localizations_la.dart index f26f6e6200..7eb901ba1e 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_la.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_la.dart @@ -792,8 +792,12 @@ class AppLocalizationsLa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsLa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsLa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsLa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsLa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsLa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_lb.dart b/packages/smooth_app/lib/l10n/app_localizations_lb.dart index 007741f179..7454004aa2 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_lb.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_lb.dart @@ -792,8 +792,12 @@ class AppLocalizationsLb extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsLb extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsLb extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsLb extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsLb extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsLb extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_lo.dart b/packages/smooth_app/lib/l10n/app_localizations_lo.dart index fa9262ac34..4056a38c96 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_lo.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_lo.dart @@ -792,8 +792,12 @@ class AppLocalizationsLo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsLo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsLo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsLo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsLo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsLo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_lt.dart b/packages/smooth_app/lib/l10n/app_localizations_lt.dart index 8a31fb432e..8c509c35da 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_lt.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_lt.dart @@ -805,8 +805,12 @@ class AppLocalizationsLt extends AppLocalizations { String get crop_page_too_small_image_title => 'Paveikslėlis per mažas!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Mažiausias įkeliamų nuotraukų dydis pikseliais yra ${expectedMinWidth}x$expectedMinHeight. Dabartinė nuotrauka yra ${actualWidth}x$actualHeight.'; } @@ -1382,7 +1386,9 @@ class AppLocalizationsLt extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1600,20 +1606,33 @@ class AppLocalizationsLt extends AppLocalizations { 'Jei apsigalvosite, šią parinktį galite bet kada įjungti ir išjungti nustatymuose.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'Operacinė sistema: „Android“ („SDK“ Int: $sdkInt / Išleidimas: $release)\nModelis: $model\nProduktas: $product\nĮrenginys: $device\nGamintojas: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'Operacinė sistema: iOS ($version)\nModelis: $model\nLokalizuotas modelis: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nProgramos versija: $appVersion\nProgramos versijos numeris: $appBuildNumber\nProgramos paketo pavadinimas: $appPackageName'; } @@ -2651,7 +2670,11 @@ class AppLocalizationsLt extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Kaina: $price / parduotuvė: \"$location\" / Paskėlbė $date \"$user\"'; } @@ -2836,7 +2859,9 @@ class AppLocalizationsLt extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Jūsų dabartinė valiuta yra **$currency**. Ar norėtumėte ją pakeisti į **$newCurrency**?'; } @@ -2898,7 +2923,10 @@ class AppLocalizationsLt extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Atsisiųskite dar $count produktų\nJau atsisiųsta $downloaded iš $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_lv.dart b/packages/smooth_app/lib/l10n/app_localizations_lv.dart index 55c091d929..4ed38f0e96 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_lv.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_lv.dart @@ -793,8 +793,12 @@ class AppLocalizationsLv extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1355,7 +1359,9 @@ class AppLocalizationsLv extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1573,20 +1579,33 @@ class AppLocalizationsLv extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsLv extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsLv extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsLv extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_mg.dart b/packages/smooth_app/lib/l10n/app_localizations_mg.dart index 6d1026666d..150978958b 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_mg.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_mg.dart @@ -792,8 +792,12 @@ class AppLocalizationsMg extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsMg extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsMg extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsMg extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsMg extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsMg extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_mi.dart b/packages/smooth_app/lib/l10n/app_localizations_mi.dart index 6e4c863ba2..d0cbb8743f 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_mi.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_mi.dart @@ -792,8 +792,12 @@ class AppLocalizationsMi extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsMi extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsMi extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsMi extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsMi extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsMi extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ml.dart b/packages/smooth_app/lib/l10n/app_localizations_ml.dart index e183d8a787..78ee9ab0cb 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ml.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ml.dart @@ -792,8 +792,12 @@ class AppLocalizationsMl extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsMl extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsMl extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsMl extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsMl extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsMl extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_mn.dart b/packages/smooth_app/lib/l10n/app_localizations_mn.dart index 59893d807a..e7cb3c94b6 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_mn.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_mn.dart @@ -792,8 +792,12 @@ class AppLocalizationsMn extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsMn extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsMn extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsMn extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsMn extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsMn extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_mr.dart b/packages/smooth_app/lib/l10n/app_localizations_mr.dart index 013a05a47b..7efe15c124 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_mr.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_mr.dart @@ -793,8 +793,12 @@ class AppLocalizationsMr extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1355,7 +1359,9 @@ class AppLocalizationsMr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1573,20 +1579,33 @@ class AppLocalizationsMr extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2614,7 +2633,11 @@ class AppLocalizationsMr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2798,7 +2821,9 @@ class AppLocalizationsMr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2857,7 +2882,10 @@ class AppLocalizationsMr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ms.dart b/packages/smooth_app/lib/l10n/app_localizations_ms.dart index d4b7127749..ad0a7ee9ce 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ms.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ms.dart @@ -792,8 +792,12 @@ class AppLocalizationsMs extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1356,7 +1360,9 @@ class AppLocalizationsMs extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1575,20 +1581,33 @@ class AppLocalizationsMs extends AppLocalizations { 'Jika anda berubah fikiran, pilihan ini boleh didayakan dan dilumpuhkan pada bila-bila masa daripada tetapan.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2615,7 +2634,11 @@ class AppLocalizationsMs extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2799,7 +2822,9 @@ class AppLocalizationsMs extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2858,7 +2883,10 @@ class AppLocalizationsMs extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_mt.dart b/packages/smooth_app/lib/l10n/app_localizations_mt.dart index e5a3373fef..328485524c 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_mt.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_mt.dart @@ -792,8 +792,12 @@ class AppLocalizationsMt extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsMt extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsMt extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsMt extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsMt extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsMt extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_my.dart b/packages/smooth_app/lib/l10n/app_localizations_my.dart index 7025ba5aad..ed6670dd84 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_my.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_my.dart @@ -792,8 +792,12 @@ class AppLocalizationsMy extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsMy extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsMy extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2615,7 +2634,11 @@ class AppLocalizationsMy extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2799,7 +2822,9 @@ class AppLocalizationsMy extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2858,7 +2883,10 @@ class AppLocalizationsMy extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_nb.dart b/packages/smooth_app/lib/l10n/app_localizations_nb.dart index daac6a5c50..5a6f5b8d4b 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_nb.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_nb.dart @@ -796,8 +796,12 @@ class AppLocalizationsNb extends AppLocalizations { String get crop_page_too_small_image_title => 'Bildet er for lite!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Minimumsstørrelsen i piksler for bildeopplastning er $expectedMinWidth x$expectedMinHeight. Bildet er nå ${actualWidth}x$actualHeight.'; } @@ -1361,7 +1365,9 @@ class AppLocalizationsNb extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Vil du endre valutaen fra $previousCurrency til $possibleCurrency?'; } @@ -1580,20 +1586,33 @@ class AppLocalizationsNb extends AppLocalizations { 'Hvis du ombestemmer deg, kan du skru av eller på denne invstillingen senere.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModell: $model\nProdukt: $product\nEnhet: $device\nMerke: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModell: $model\nLokalisert modell: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nAppversjon:$appVersion\nApp-build-nummer:$appBuildNumber\nApp-pakke-nummer:$appPackageName'; } @@ -2624,7 +2643,11 @@ class AppLocalizationsNb extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2808,7 +2831,9 @@ class AppLocalizationsNb extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2867,7 +2892,10 @@ class AppLocalizationsNb extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ne.dart b/packages/smooth_app/lib/l10n/app_localizations_ne.dart index 8b5e532671..54747d91b3 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ne.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ne.dart @@ -792,8 +792,12 @@ class AppLocalizationsNe extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1353,7 +1357,9 @@ class AppLocalizationsNe extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1571,20 +1577,33 @@ class AppLocalizationsNe extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsNe extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsNe extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsNe extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_nl.dart b/packages/smooth_app/lib/l10n/app_localizations_nl.dart index 5a7c5bfbde..8f13cf953d 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_nl.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_nl.dart @@ -799,8 +799,12 @@ class AppLocalizationsNl extends AppLocalizations { String get crop_page_too_small_image_title => 'De afbeelding is te klein!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'De minimale grootte in pixels voor het uploaden van afbeeldingen is ${expectedMinWidth}x$expectedMinHeight. De huidige afbeelding is ${actualWidth}x$actualHeight.'; } @@ -1371,7 +1375,9 @@ class AppLocalizationsNl extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Wilt u de valuta wijzigen van $previousCurrency naar $possibleCurrency?'; } @@ -1590,20 +1596,33 @@ class AppLocalizationsNl extends AppLocalizations { 'Als u van gedachten verandert, kan deze optie op elk moment in de instellingen worden aan- en uitgeschakeld.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'Besturingssysteem: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nApparaat: $device\nMerk:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'Besturingssysteem: iOS ($version)\nModel: $model\nGelokaliseerd model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp-versie:$appVersion\nApp-buildnummer:$appBuildNumber\nApp-pakketnaam:$appPackageName'; } @@ -2650,7 +2669,11 @@ class AppLocalizationsNl extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Prijs: $price / Winkel: \"$location\" / Gepubliceerd op $date door \"$user\"'; } @@ -2833,7 +2856,9 @@ class AppLocalizationsNl extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Uw huidige valuta is **$currency**. Wilt u dit wijzigen naar **$newCurrency**?'; } @@ -2895,7 +2920,10 @@ class AppLocalizationsNl extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count meer producten\nReeds gedownload $downloaded van de $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_nn.dart b/packages/smooth_app/lib/l10n/app_localizations_nn.dart index 681f1a4562..606d46fab1 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_nn.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_nn.dart @@ -792,8 +792,12 @@ class AppLocalizationsNn extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsNn extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Vil du endre valutaen fra $previousCurrency til $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsNn extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsNn extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsNn extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsNn extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_no.dart b/packages/smooth_app/lib/l10n/app_localizations_no.dart index 556ef786d4..e0e179edbd 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_no.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_no.dart @@ -792,8 +792,12 @@ class AppLocalizationsNo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsNo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Vil du endre valutaen fra $previousCurrency til $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsNo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsNo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsNo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsNo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_nr.dart b/packages/smooth_app/lib/l10n/app_localizations_nr.dart index 4651db37cb..88396a1b99 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_nr.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_nr.dart @@ -792,8 +792,12 @@ class AppLocalizationsNr extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsNr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsNr extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsNr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsNr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsNr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_oc.dart b/packages/smooth_app/lib/l10n/app_localizations_oc.dart index 12b3f87e50..29a226e48f 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_oc.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_oc.dart @@ -792,8 +792,12 @@ class AppLocalizationsOc extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsOc extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsOc extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsOc extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsOc extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsOc extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_or.dart b/packages/smooth_app/lib/l10n/app_localizations_or.dart index 217da6a79b..51883b69fe 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_or.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_or.dart @@ -795,8 +795,12 @@ class AppLocalizationsOr extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1357,7 +1361,9 @@ class AppLocalizationsOr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1575,20 +1581,33 @@ class AppLocalizationsOr extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2616,7 +2635,11 @@ class AppLocalizationsOr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2800,7 +2823,9 @@ class AppLocalizationsOr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2859,7 +2884,10 @@ class AppLocalizationsOr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_pa.dart b/packages/smooth_app/lib/l10n/app_localizations_pa.dart index dcca79ccc3..a332ff50a6 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_pa.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_pa.dart @@ -792,8 +792,12 @@ class AppLocalizationsPa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsPa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsPa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsPa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsPa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsPa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_pl.dart b/packages/smooth_app/lib/l10n/app_localizations_pl.dart index e808282e4f..7ea8cc1539 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_pl.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_pl.dart @@ -805,8 +805,12 @@ class AppLocalizationsPl extends AppLocalizations { String get crop_page_too_small_image_title => 'Obraz jest za mały!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Minimalny rozmiar obrazu w pikselach wynosi: ${expectedMinWidth}x$expectedMinHeight. Obecne wymiary obrazu wynoszą: ${actualWidth}x$actualHeight.'; } @@ -1379,7 +1383,9 @@ class AppLocalizationsPl extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Czy chcesz zmienić walutę z $previousCurrency na $possibleCurrency?'; } @@ -1597,20 +1603,33 @@ class AppLocalizationsPl extends AppLocalizations { 'Jeśli zmienisz zdanie, tę opcję możesz włączyć i wyłączyć w dowolnym momencie w ustawieniach.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'System operacyjny: Android (SDK Int: $sdkInt / Wprowadzona: $release)\nModel: $model\nProdukt: $product\nUrządzenie: $device\nMarka: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'System operacyjny: iOS ($version)\nModel: $model\nZlokalizowany model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nWersja aplikacji:$appVersion\nNumer kompilacji aplikacji:$appBuildNumber\nNazwa pakietu aplikacji:$appPackageName'; } @@ -2646,7 +2665,11 @@ class AppLocalizationsPl extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2830,7 +2853,9 @@ class AppLocalizationsPl extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2890,7 +2915,10 @@ class AppLocalizationsPl extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Pobierz $count produktów więcej\nPobrano $downloaded z $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_pt.dart b/packages/smooth_app/lib/l10n/app_localizations_pt.dart index 67f18e5a79..cdb312e0d4 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_pt.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_pt.dart @@ -805,8 +805,12 @@ class AppLocalizationsPt extends AppLocalizations { String get crop_page_too_small_image_title => 'A imagem é muito pequena!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Para carregar imagens o tamanho mínimo em píxeis é ${expectedMinWidth}x$expectedMinHeight. A imagem selecionada tem ${actualWidth}x$actualHeight.'; } @@ -1383,7 +1387,9 @@ class AppLocalizationsPt extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Quer alterar a moeda de $previousCurrency para $possibleCurrency?'; } @@ -1601,20 +1607,33 @@ class AppLocalizationsPt extends AppLocalizations { 'Se mudar de ideias, esta opção pode ser ativada e desativada a qualquer momento nas configurações.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'SO: Android (SDK Int: $sdkInt / lançamento: $release)\nModelo: $model\nProduto: $product\nDispositivo: $device\nMarca: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'SO: iOS ($version)\nModelo: $model\nModelo localizado: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVersão da aplicação: $appVersion\nNúmero de compilação da aplicação: $appBuildNumber\nNome do pacote da aplicação: $appPackageName'; } @@ -2664,7 +2683,11 @@ class AppLocalizationsPt extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Preço: $price / Loja: \"$location\" / Publicado em $date por \"$user\"'; } @@ -2847,7 +2870,9 @@ class AppLocalizationsPt extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'A moeda atual é **$currency**. Quer alterá-la para **$newCurrency**?'; } @@ -2908,7 +2933,10 @@ class AppLocalizationsPt extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Descarregar mais $count produtos\nJá descarregou $downloaded de $totalSize.'; } @@ -5519,8 +5547,12 @@ class AppLocalizationsPtBr extends AppLocalizationsPt { String get crop_page_too_small_image_title => 'A imagem é muito pequena!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Para carregar imagens o tamanho mínimo em píxeis é ${expectedMinWidth}x$expectedMinHeight. A imagem selecionada tem ${actualWidth}x$actualHeight.'; } @@ -6097,7 +6129,9 @@ class AppLocalizationsPtBr extends AppLocalizationsPt { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Quer alterar a moeda de $previousCurrency para $possibleCurrency?'; } @@ -6315,20 +6349,33 @@ class AppLocalizationsPtBr extends AppLocalizationsPt { 'Se mudar de ideias, esta opção pode ser ativada e desativada a qualquer momento nas configurações.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'SO: Android (SDK Int: $sdkInt / lançamento: $release)\nModelo: $model\nProduto: $product\nDispositivo: $device\nMarca: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'SO: iOS ($version)\nModelo: $model\nModelo localizado: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVersão da aplicação: $appVersion\nNúmero de compilação da aplicação: $appBuildNumber\nNome do pacote da aplicação: $appPackageName'; } @@ -7354,7 +7401,11 @@ class AppLocalizationsPtBr extends AppLocalizationsPt { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Preço: $price / Loja: \"$location\" / Publicado em $date por \"$user\"'; } @@ -7534,7 +7585,9 @@ class AppLocalizationsPtBr extends AppLocalizationsPt { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'A moeda atual é **$currency**. Quer alterá-la para **$newCurrency**?'; } @@ -7595,7 +7648,10 @@ class AppLocalizationsPtBr extends AppLocalizationsPt { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Descarregar mais $count produtos\nJá descarregou $downloaded de $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_qu.dart b/packages/smooth_app/lib/l10n/app_localizations_qu.dart index 6ab3947932..c0b577d2f4 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_qu.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_qu.dart @@ -792,8 +792,12 @@ class AppLocalizationsQu extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsQu extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsQu extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsQu extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsQu extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsQu extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_rm.dart b/packages/smooth_app/lib/l10n/app_localizations_rm.dart index 78af4ddd27..b8efb74b53 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_rm.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_rm.dart @@ -792,8 +792,12 @@ class AppLocalizationsRm extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsRm extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsRm extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsRm extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsRm extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsRm extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ro.dart b/packages/smooth_app/lib/l10n/app_localizations_ro.dart index 236074f95e..13d6941b55 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ro.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ro.dart @@ -803,8 +803,12 @@ class AppLocalizationsRo extends AppLocalizations { String get crop_page_too_small_image_title => 'Imaginea este prea mică!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Dimensiunea minimă în pixeli pentru încărcarea imaginii este ${expectedMinWidth}x$expectedMinHeight. Poza curentă este ${actualWidth}x$actualHeight.'; } @@ -1378,7 +1382,9 @@ class AppLocalizationsRo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1603,20 +1609,33 @@ class AppLocalizationsRo extends AppLocalizations { 'Dacă vă răzgândiți, această opțiune poate fi activată și dezactivată în orice moment din setări.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Lansare: $release)\nModel: $model\nProdus: $product\nDispozitiv: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nModel localizat: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVersiunea aplicației:$appVersion\nNumărul versiunii aplicației:$appBuildNumber\nNumele pachetului aplicației:$appPackageName'; } @@ -2654,7 +2673,11 @@ class AppLocalizationsRo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2838,7 +2861,9 @@ class AppLocalizationsRo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2898,7 +2923,10 @@ class AppLocalizationsRo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Descarcă încă $count produse\nDeja descărcate $downloaded din $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ru.dart b/packages/smooth_app/lib/l10n/app_localizations_ru.dart index 83097042c0..53466b86d3 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ru.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ru.dart @@ -805,8 +805,12 @@ class AppLocalizationsRu extends AppLocalizations { 'Изображение слишком маленькое!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Минимальный размер загружаемого изображения ${expectedMinWidth}x$expectedMinHeight пикселей. Текущее изображение имеет размер ${actualWidth}x$actualHeight.'; } @@ -1379,7 +1383,9 @@ class AppLocalizationsRu extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1597,20 +1603,33 @@ class AppLocalizationsRu extends AppLocalizations { 'Если вы передумаете, эту опцию можно включить и отключить в настройках в любое время.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'ОС: Android (SDK Int: $sdkInt / Выпуск: \$$release)\nМодель: \$$model\nПродукт: \$$product\nУстройство: \$$device\nМарка:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'ОС: iOS ($version)\nМодель: $model\nЛокализованная модель: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nВерсия приложения:$appVersion\nНомер сборки приложения:$appBuildNumber\nИмя пакета приложения:$appPackageName'; } @@ -2647,7 +2666,11 @@ class AppLocalizationsRu extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2831,7 +2854,9 @@ class AppLocalizationsRu extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2890,7 +2915,10 @@ class AppLocalizationsRu extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sa.dart b/packages/smooth_app/lib/l10n/app_localizations_sa.dart index ce4d4adece..a8100f556a 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sa.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sa.dart @@ -792,8 +792,12 @@ class AppLocalizationsSa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsSa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsSa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsSa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sc.dart b/packages/smooth_app/lib/l10n/app_localizations_sc.dart index d99a83bb1e..c61fdc6442 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sc.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sc.dart @@ -792,8 +792,12 @@ class AppLocalizationsSc extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSc extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSc extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsSc extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsSc extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsSc extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sd.dart b/packages/smooth_app/lib/l10n/app_localizations_sd.dart index 7c1b1a95e7..4bea23112e 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sd.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sd.dart @@ -792,8 +792,12 @@ class AppLocalizationsSd extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSd extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSd extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsSd extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsSd extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsSd extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sg.dart b/packages/smooth_app/lib/l10n/app_localizations_sg.dart index 7bccbc97cb..bb79540123 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sg.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sg.dart @@ -792,8 +792,12 @@ class AppLocalizationsSg extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSg extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSg extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsSg extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsSg extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsSg extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_si.dart b/packages/smooth_app/lib/l10n/app_localizations_si.dart index 2a968fab63..7292a3ba1e 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_si.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_si.dart @@ -792,8 +792,12 @@ class AppLocalizationsSi extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSi extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSi extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsSi extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsSi extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsSi extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sk.dart b/packages/smooth_app/lib/l10n/app_localizations_sk.dart index fa3f5ca92d..17c6b6474f 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sk.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sk.dart @@ -803,8 +803,12 @@ class AppLocalizationsSk extends AppLocalizations { String get crop_page_too_small_image_title => 'Obrázok je príliš malý!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Minimálna veľkosť obrázka v pixeloch je ${expectedMinWidth}x$expectedMinHeight. Aktuálny obrázok je ${actualWidth}x$actualHeight.'; } @@ -1375,7 +1379,9 @@ class AppLocalizationsSk extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Chcete zmeniť menu z $previousCurrency na $possibleCurrency?'; } @@ -1593,20 +1599,33 @@ class AppLocalizationsSk extends AppLocalizations { 'Ak zmeníte názor, túto možnosť môžete kedykoľvek povoliť alebo zakázať v nastaveniach.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProdukt: $product\nZariadenie: $device\nZnačka:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLokalizovaný model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nVerzia aplikácie: $appVersion\nČíslo zostavy aplikácie: $appBuildNumber\nNázov balíka aplikácie: $appPackageName'; } @@ -2639,7 +2658,11 @@ class AppLocalizationsSk extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Cena: $price / Obchod: \"$location\" / Publikované dňa $date používateľom \"$user\"'; } @@ -2823,7 +2846,9 @@ class AppLocalizationsSk extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Vaša aktuálna mena je **$currency**. Chcete ju zmeniť na **$newCurrency**?'; } @@ -2883,7 +2908,10 @@ class AppLocalizationsSk extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Stiahnuť $count viac produktov\nUž stiahnuté $downloaded z $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sl.dart b/packages/smooth_app/lib/l10n/app_localizations_sl.dart index 882444c7c1..a7a4b5b0de 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sl.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sl.dart @@ -795,8 +795,12 @@ class AppLocalizationsSl extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1363,7 +1367,9 @@ class AppLocalizationsSl extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1582,20 +1588,33 @@ class AppLocalizationsSl extends AppLocalizations { 'To opcijo lahko onemogočite ali ponovno omogočite kadarkoli v nastavitvah.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2629,7 +2648,11 @@ class AppLocalizationsSl extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2813,7 +2836,9 @@ class AppLocalizationsSl extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2872,7 +2897,10 @@ class AppLocalizationsSl extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Prenesi še $count izdelkov\nŽe prenesenih $downloaded od $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sn.dart b/packages/smooth_app/lib/l10n/app_localizations_sn.dart index 63167c7f97..31ee8fc35d 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sn.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sn.dart @@ -792,8 +792,12 @@ class AppLocalizationsSn extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSn extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSn extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsSn extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsSn extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsSn extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_so.dart b/packages/smooth_app/lib/l10n/app_localizations_so.dart index 752d4230a3..4a77c3ff5a 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_so.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_so.dart @@ -792,8 +792,12 @@ class AppLocalizationsSo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsSo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsSo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsSo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sq.dart b/packages/smooth_app/lib/l10n/app_localizations_sq.dart index d310b66474..41c6c7f052 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sq.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sq.dart @@ -801,8 +801,12 @@ class AppLocalizationsSq extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1366,7 +1370,9 @@ class AppLocalizationsSq extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1584,20 +1590,33 @@ class AppLocalizationsSq extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2624,7 +2643,11 @@ class AppLocalizationsSq extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2808,7 +2831,9 @@ class AppLocalizationsSq extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2867,7 +2892,10 @@ class AppLocalizationsSq extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sr.dart b/packages/smooth_app/lib/l10n/app_localizations_sr.dart index 3388e6fb18..a5cf98b9c3 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sr.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sr.dart @@ -792,8 +792,12 @@ class AppLocalizationsSr extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSr extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsSr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsSr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsSr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ss.dart b/packages/smooth_app/lib/l10n/app_localizations_ss.dart index 4de31eb2f6..5234d4b4bb 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ss.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ss.dart @@ -792,8 +792,12 @@ class AppLocalizationsSs extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSs extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSs extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsSs extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsSs extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsSs extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_st.dart b/packages/smooth_app/lib/l10n/app_localizations_st.dart index da1c40844e..23f6f06a12 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_st.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_st.dart @@ -792,8 +792,12 @@ class AppLocalizationsSt extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsSt extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsSt extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsSt extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsSt extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsSt extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sv.dart b/packages/smooth_app/lib/l10n/app_localizations_sv.dart index 0290481b23..b3edd6b665 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sv.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sv.dart @@ -793,8 +793,12 @@ class AppLocalizationsSv extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1357,7 +1361,9 @@ class AppLocalizationsSv extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1575,20 +1581,33 @@ class AppLocalizationsSv extends AppLocalizations { 'Om du ändrar dig kan det här alternativet aktiveras och inaktiveras när som helst från inställningarna.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2619,7 +2638,11 @@ class AppLocalizationsSv extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2803,7 +2826,9 @@ class AppLocalizationsSv extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2862,7 +2887,10 @@ class AppLocalizationsSv extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_sw.dart b/packages/smooth_app/lib/l10n/app_localizations_sw.dart index a694162aa7..f31b4c497e 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_sw.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_sw.dart @@ -791,8 +791,12 @@ class AppLocalizationsSw extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1353,7 +1357,9 @@ class AppLocalizationsSw extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1571,20 +1577,33 @@ class AppLocalizationsSw extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2611,7 +2630,11 @@ class AppLocalizationsSw extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2795,7 +2818,9 @@ class AppLocalizationsSw extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2854,7 +2879,10 @@ class AppLocalizationsSw extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ta.dart b/packages/smooth_app/lib/l10n/app_localizations_ta.dart index baecd05a83..59f9a14510 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ta.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ta.dart @@ -793,8 +793,12 @@ class AppLocalizationsTa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1357,7 +1361,9 @@ class AppLocalizationsTa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'உங்களின் முந்தைய நாணயத்திலிருந்து $previousCurrency சாத்தியமான நாணயத்திற்கு $possibleCurrency மாற்ற விரும்புகிறீர்களா?'; } @@ -1575,20 +1581,33 @@ class AppLocalizationsTa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2618,7 +2637,11 @@ class AppLocalizationsTa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2802,7 +2825,9 @@ class AppLocalizationsTa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'உங்கள் தற்போதைய நாணயத்தை **$currency**. இதை **$newCurrency** ஆக மாற்ற விரும்புகிறீர்களா?'; } @@ -2861,7 +2886,10 @@ class AppLocalizationsTa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_te.dart b/packages/smooth_app/lib/l10n/app_localizations_te.dart index 2c7cc7f8eb..ef2682de6d 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_te.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_te.dart @@ -792,8 +792,12 @@ class AppLocalizationsTe extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTe extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTe extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsTe extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsTe extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsTe extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_tg.dart b/packages/smooth_app/lib/l10n/app_localizations_tg.dart index 3183336fae..bcb28f9fef 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_tg.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_tg.dart @@ -792,8 +792,12 @@ class AppLocalizationsTg extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTg extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTg extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsTg extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsTg extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsTg extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_th.dart b/packages/smooth_app/lib/l10n/app_localizations_th.dart index 30482859f2..fd7a5805af 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_th.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_th.dart @@ -787,8 +787,12 @@ class AppLocalizationsTh extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1350,7 +1354,9 @@ class AppLocalizationsTh extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1568,20 +1574,33 @@ class AppLocalizationsTh extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2608,7 +2627,11 @@ class AppLocalizationsTh extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2792,7 +2815,9 @@ class AppLocalizationsTh extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2851,7 +2876,10 @@ class AppLocalizationsTh extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ti.dart b/packages/smooth_app/lib/l10n/app_localizations_ti.dart index 4402c50001..9ef62f3461 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ti.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ti.dart @@ -792,8 +792,12 @@ class AppLocalizationsTi extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTi extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTi extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsTi extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsTi extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsTi extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_tl.dart b/packages/smooth_app/lib/l10n/app_localizations_tl.dart index 2312810c6a..6c27abc3c1 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_tl.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_tl.dart @@ -792,8 +792,12 @@ class AppLocalizationsTl extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTl extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTl extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsTl extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsTl extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsTl extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_tn.dart b/packages/smooth_app/lib/l10n/app_localizations_tn.dart index e3e7b6eacb..7875cedc38 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_tn.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_tn.dart @@ -792,8 +792,12 @@ class AppLocalizationsTn extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTn extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTn extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsTn extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsTn extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsTn extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_tr.dart b/packages/smooth_app/lib/l10n/app_localizations_tr.dart index 3e3f483742..6c973d552a 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_tr.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_tr.dart @@ -795,8 +795,12 @@ class AppLocalizationsTr extends AppLocalizations { String get crop_page_too_small_image_title => 'Resim çok küçük!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Resim yükleme için minimum piksel boyutu ${expectedMinWidth}x$expectedMinHeight. Mevcut resim ${actualWidth}x$actualHeight.'; } @@ -1366,7 +1370,9 @@ class AppLocalizationsTr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Para birimini $previousCurrency yerine $possibleCurrency olarak değiştirmek istiyor musunuz?'; } @@ -1584,20 +1590,33 @@ class AppLocalizationsTr extends AppLocalizations { 'Fikrinizi değiştirirseniz, bu seçenek istediğiniz zaman ayarlardan etkinleştirilebilir ve devre dışı bırakılabilir.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Sürüm: $release)\nModel: $model\nÜrün: $product\nCihaz: $device\nMarka:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'İşletim Sistemi: iOS ($version)\nModel: $model\nYerelleştirilmiş model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nUygulama sürümü:$appVersion\nUygulama yapı numarası:$appBuildNumber\nUygulama paketi adı:$appPackageName'; } @@ -2627,7 +2646,11 @@ class AppLocalizationsTr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2811,7 +2834,9 @@ class AppLocalizationsTr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2871,7 +2896,10 @@ class AppLocalizationsTr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return '$count ürün daha indir\n$totalSize üründen $downloaded tanesi indirildi.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ts.dart b/packages/smooth_app/lib/l10n/app_localizations_ts.dart index 59e14f1409..3274927380 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ts.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ts.dart @@ -792,8 +792,12 @@ class AppLocalizationsTs extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTs extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTs extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsTs extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsTs extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsTs extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_tt.dart b/packages/smooth_app/lib/l10n/app_localizations_tt.dart index 4a8eaac0b2..f7ace8924f 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_tt.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_tt.dart @@ -792,8 +792,12 @@ class AppLocalizationsTt extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTt extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTt extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsTt extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsTt extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsTt extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_tw.dart b/packages/smooth_app/lib/l10n/app_localizations_tw.dart index a7c0368b69..81f0ee1c11 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_tw.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_tw.dart @@ -792,8 +792,12 @@ class AppLocalizationsTw extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTw extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTw extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2613,7 +2632,11 @@ class AppLocalizationsTw extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2797,7 +2820,9 @@ class AppLocalizationsTw extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2856,7 +2881,10 @@ class AppLocalizationsTw extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ty.dart b/packages/smooth_app/lib/l10n/app_localizations_ty.dart index c35065cf70..164295fc99 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ty.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ty.dart @@ -792,8 +792,12 @@ class AppLocalizationsTy extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsTy extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsTy extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsTy extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsTy extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsTy extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ug.dart b/packages/smooth_app/lib/l10n/app_localizations_ug.dart index 1a779fca27..a389f2d55f 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ug.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ug.dart @@ -792,8 +792,12 @@ class AppLocalizationsUg extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsUg extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsUg extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsUg extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsUg extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsUg extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_uk.dart b/packages/smooth_app/lib/l10n/app_localizations_uk.dart index 38f9e26c6c..934dff3e3d 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_uk.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_uk.dart @@ -801,8 +801,12 @@ class AppLocalizationsUk extends AppLocalizations { String get crop_page_too_small_image_title => 'Зрбраження занадто маленьке!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Мінімальний розмір зображення у пікселях - ${expectedMinWidth}x$expectedMinHeight. Поточна картинка ${actualWidth}x$actualHeight.'; } @@ -1375,7 +1379,9 @@ class AppLocalizationsUk extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Ви хочете змінити валюту з $previousCurrency на $possibleCurrency?'; } @@ -1593,20 +1599,33 @@ class AppLocalizationsUk extends AppLocalizations { 'Якщо ви передумаєте, цю опцію можна будь-коли ввімкнути або вимкнути в налаштуваннях.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'ОС: Android (SDK Int: $sdkInt / Випуск: $release)\nМодель: $model\nПродукт: $product\nПрилад: $device\nМарка: $brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'ОС: iOS ($version)\nМодель: $model\nЛокалізована модель: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nВерсія додатку:$appVersion\nПартія збірки додатку:$appBuildNumber\nПартія пакету:$appPackageName'; } @@ -2645,7 +2664,11 @@ class AppLocalizationsUk extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Ціна: $price / Магазин: \"$location\" / Опубліковано $date користувачем \"$user\"'; } @@ -2830,7 +2853,9 @@ class AppLocalizationsUk extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2891,7 +2916,10 @@ class AppLocalizationsUk extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Завантажити ще $count товарів\nВже завантажено $downloaded з $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ur.dart b/packages/smooth_app/lib/l10n/app_localizations_ur.dart index d4e17e12f7..66f386d4ff 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ur.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ur.dart @@ -792,8 +792,12 @@ class AppLocalizationsUr extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsUr extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsUr extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsUr extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsUr extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsUr extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_uz.dart b/packages/smooth_app/lib/l10n/app_localizations_uz.dart index 7cfa0a26b2..392ea540c6 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_uz.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_uz.dart @@ -792,8 +792,12 @@ class AppLocalizationsUz extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsUz extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsUz extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsUz extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsUz extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsUz extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_ve.dart b/packages/smooth_app/lib/l10n/app_localizations_ve.dart index b8fc39e6af..9d5edda493 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_ve.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_ve.dart @@ -792,8 +792,12 @@ class AppLocalizationsVe extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsVe extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsVe extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsVe extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsVe extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsVe extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_vi.dart b/packages/smooth_app/lib/l10n/app_localizations_vi.dart index 0c7be276eb..27064aa443 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_vi.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_vi.dart @@ -794,8 +794,12 @@ class AppLocalizationsVi extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1365,7 +1369,9 @@ class AppLocalizationsVi extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1584,20 +1590,33 @@ class AppLocalizationsVi extends AppLocalizations { 'Nếu bạn thay đổi ý định, lựa chọn này có thể được bật hoặc tắt bất kì lúc nào trong phần cài đặt.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Phát hành: $release)\nMẫu: $model\nSản phẩm: $product\nThiết bị: $device\nNhãn hiệu:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nMẫu: $model\nMẫu bản địa hóa: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nPhiên bản ứng dụng:$appVersion\nBản dựng ứng dụng số:$appBuildNumber\nTên gói ứng dụng:$appPackageName'; } @@ -2628,7 +2647,11 @@ class AppLocalizationsVi extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2812,7 +2835,9 @@ class AppLocalizationsVi extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2871,7 +2896,10 @@ class AppLocalizationsVi extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Tải thêm $count sản phẩm\nĐã tải $downloaded trên tổng $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_wa.dart b/packages/smooth_app/lib/l10n/app_localizations_wa.dart index 50e9eed314..4beac7f8de 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_wa.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_wa.dart @@ -792,8 +792,12 @@ class AppLocalizationsWa extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsWa extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsWa extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsWa extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsWa extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsWa extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_wo.dart b/packages/smooth_app/lib/l10n/app_localizations_wo.dart index 1fc92e6fad..a5087ba4da 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_wo.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_wo.dart @@ -792,8 +792,12 @@ class AppLocalizationsWo extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsWo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsWo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsWo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsWo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsWo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_xh.dart b/packages/smooth_app/lib/l10n/app_localizations_xh.dart index f4235fbaed..f7af048df0 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_xh.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_xh.dart @@ -792,8 +792,12 @@ class AppLocalizationsXh extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsXh extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsXh extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsXh extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsXh extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsXh extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_yi.dart b/packages/smooth_app/lib/l10n/app_localizations_yi.dart index 6ebb753376..5530a9a8e7 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_yi.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_yi.dart @@ -792,8 +792,12 @@ class AppLocalizationsYi extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsYi extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsYi extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsYi extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsYi extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsYi extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_yo.dart b/packages/smooth_app/lib/l10n/app_localizations_yo.dart index 00da7f61d3..be21934fd6 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_yo.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_yo.dart @@ -792,8 +792,12 @@ class AppLocalizationsYo extends AppLocalizations { String get crop_page_too_small_image_title => 'Aworan naa kere ju!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'Iwọn to kere julọ ni awọn piksẹli fun gbigbe aworan jẹ ${expectedMinWidth}x$expectedMinHeight. Aworan ti o wa lọwọlọwọ jẹ ${actualWidth}x$actualHeight.'; } @@ -1354,7 +1358,9 @@ class AppLocalizationsYo extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1572,20 +1578,33 @@ class AppLocalizationsYo extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2612,7 +2631,11 @@ class AppLocalizationsYo extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2796,7 +2819,9 @@ class AppLocalizationsYo extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2855,7 +2880,10 @@ class AppLocalizationsYo extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_zh.dart b/packages/smooth_app/lib/l10n/app_localizations_zh.dart index beff8b5867..916805a130 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_zh.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_zh.dart @@ -767,8 +767,12 @@ class AppLocalizationsZh extends AppLocalizations { String get crop_page_too_small_image_title => '图片尺寸过小'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return '图片上传的最小尺寸(以像素为单位)为 ${expectedMinWidth}x$expectedMinHeight。当前图片的尺寸为 ${actualWidth}x$actualHeight。'; } @@ -1318,7 +1322,9 @@ class AppLocalizationsZh extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1533,20 +1539,33 @@ class AppLocalizationsZh extends AppLocalizations { String get permissions_page_body2 => '如果您改变主意,可以随时在设置里启用或禁用此功能。'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return '操作系统:Android(SDK Int: $sdkInt / 版本: $release)\n型号: $model\n产品: $product\n设备: $device\n品牌:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return '操作系统: iOS ($version)\n型: $model\n本地化模型: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\n应用版本:$appVersion\n应用内部版本号:$appBuildNumber\n应用包名称:$appPackageName'; } @@ -2547,7 +2566,11 @@ class AppLocalizationsZh extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2731,7 +2754,9 @@ class AppLocalizationsZh extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2790,7 +2815,10 @@ class AppLocalizationsZh extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return '再加载 $count 产品\n已经加载 $totalSize 产品中的 $downloaded 产品.'; } diff --git a/packages/smooth_app/lib/l10n/app_localizations_zu.dart b/packages/smooth_app/lib/l10n/app_localizations_zu.dart index 4257034e9c..3385c669ee 100644 --- a/packages/smooth_app/lib/l10n/app_localizations_zu.dart +++ b/packages/smooth_app/lib/l10n/app_localizations_zu.dart @@ -791,8 +791,12 @@ class AppLocalizationsZu extends AppLocalizations { String get crop_page_too_small_image_title => 'The image is too small!'; @override - String crop_page_too_small_image_message(int expectedMinWidth, - int expectedMinHeight, int actualWidth, int actualHeight) { + String crop_page_too_small_image_message( + int expectedMinWidth, + int expectedMinHeight, + int actualWidth, + int actualHeight, + ) { return 'The minimum size in pixels for picture upload is ${expectedMinWidth}x$expectedMinHeight. The current picture is ${actualWidth}x$actualHeight.'; } @@ -1353,7 +1357,9 @@ class AppLocalizationsZu extends AppLocalizations { @override String currency_auto_change_message( - String previousCurrency, String possibleCurrency) { + String previousCurrency, + String possibleCurrency, + ) { return 'Do you want to change the currency from $previousCurrency to $possibleCurrency?'; } @@ -1571,20 +1577,33 @@ class AppLocalizationsZu extends AppLocalizations { 'If you change your mind, this option can be enabled and disabled at any time from the settings.'; @override - String contact_form_body_android(int? sdkInt, String? release, String? model, - String? product, String? device, String? brand) { + String contact_form_body_android( + int? sdkInt, + String? release, + String? model, + String? product, + String? device, + String? brand, + ) { return 'OS: Android (SDK Int: $sdkInt / Release: $release)\nModel: $model\nProduct: $product\nDevice: $device\nBrand:$brand'; } @override String contact_form_body_ios( - String? version, String? model, String? localizedModel) { + String? version, + String? model, + String? localizedModel, + ) { return 'OS: iOS ($version)\nModel: $model\nLocalized model: $localizedModel'; } @override - String contact_form_body(String osContent, String appVersion, - String appBuildNumber, String appPackageName) { + String contact_form_body( + String osContent, + String appVersion, + String appBuildNumber, + String appPackageName, + ) { return '$osContent\nApp version:$appVersion\nApp build number:$appBuildNumber\nApp package name:$appPackageName'; } @@ -2611,7 +2630,11 @@ class AppLocalizationsZu extends AppLocalizations { @override String prices_entry_accessibility_label( - String price, String location, String date, String user) { + String price, + String location, + String date, + String user, + ) { return 'Price: $price / Store: \"$location\" / Published on $date by \"$user\"'; } @@ -2795,7 +2818,9 @@ class AppLocalizationsZu extends AppLocalizations { @override String prices_currency_change_proposal_message( - String currency, String newCurrency) { + String currency, + String newCurrency, + ) { return 'Your current currency is **$currency**. Would you like to change it to **$newCurrency**?'; } @@ -2854,7 +2879,10 @@ class AppLocalizationsZu extends AppLocalizations { @override String product_search_button_download_more( - int count, int downloaded, int totalSize) { + int count, + int downloaded, + int totalSize, + ) { return 'Download $count more products\nAlready downloaded $downloaded out of $totalSize.'; } diff --git a/packages/smooth_app/lib/main.dart b/packages/smooth_app/lib/main.dart index 6639dce33f..ea443f048a 100644 --- a/packages/smooth_app/lib/main.dart +++ b/packages/smooth_app/lib/main.dart @@ -48,7 +48,8 @@ void main() { debugPrint(' - flutter run -t lib/entrypoints/android/main_google_play.dart'); debugPrint(' - flutter run -t lib/entrypoints/ios/main_ios.dart'); debugPrint( - 'More information here: https://github.com/openfoodfacts/smooth-app#how-to-run-the-project'); + 'More information here: https://github.com/openfoodfacts/smooth-app#how-to-run-the-project', + ); debugPrint('--------'); if (Platform.isAndroid) { @@ -89,7 +90,8 @@ Future launchSmoothApp({ if (kReleaseMode) { await AnalyticsHelper.initSentry( - appRunner: () => runApp(const SmoothApp())); + appRunner: () => runApp(const SmoothApp()), + ); } else { runApp(const SmoothApp()); } @@ -99,9 +101,7 @@ void _enableEdgeToEdgeMode() { if (Platform.isAndroid) { SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); SystemChrome.setSystemUIOverlayStyle( - const SystemUiOverlayStyle( - systemNavigationBarColor: Colors.transparent, - ), + const SystemUiOverlayStyle(systemNavigationBarColor: Colors.transparent), ); } } @@ -226,9 +226,7 @@ class _SmoothAppState extends State { _provide(_themeProvider), /// The next two providers are only used with the AMOLED theme - _lazyProvide( - (_) => ColorProvider(_userPreferences), - ), + _lazyProvide((_) => ColorProvider(_userPreferences)), _lazyProvide( (_) => TextContrastProvider(_userPreferences), ), @@ -257,32 +255,27 @@ class _SmoothAppState extends State { } ChangeNotifierProvider _provide(T value) => - ChangeNotifierProvider( - create: (BuildContext context) => value, - ); + ChangeNotifierProvider(create: (BuildContext context) => value); ChangeNotifierProvider _lazyProvide( T Function(BuildContext) valueBuilder, - ) => - ChangeNotifierProvider( - create: valueBuilder, - lazy: true, - ); + ) => ChangeNotifierProvider(create: valueBuilder, lazy: true); Widget _buildApp(BuildContext context) { final ThemeProvider themeProvider = context.watch(); final OnboardingPage lastVisitedOnboardingPage = _userPreferences.lastVisitedOnboardingPage; OnboardingFlowNavigator(_userPreferences); - final bool isOnboardingComplete = - lastVisitedOnboardingPage.isOnboardingComplete(); + final bool isOnboardingComplete = lastVisitedOnboardingPage + .isOnboardingComplete(); themeProvider.setOnboardingComplete(isOnboardingComplete); // Still need the value from the UserPreferences here, not the ProductQuery // as the value is not available at this time // will refresh each time the language changes - final String? languageCode = - context.select((UserPreferences up) => up.appLanguageCode); + final String? languageCode = context.select( + (UserPreferences up) => up.appLanguageCode, + ); return SentryScreenshotWidget( child: MaterialApp.router( @@ -312,11 +305,7 @@ class _SmoothAppState extends State { return MaterialApp( theme: ThemeData(), home: SmoothScaffold( - body: Center( - child: Text( - 'Fatal Error: ${snapshot.error}', - ), - ), + body: Center(child: Text('Fatal Error: ${snapshot.error}')), ), ); } diff --git a/packages/smooth_app/lib/pages/all_product_list_modal.dart b/packages/smooth_app/lib/pages/all_product_list_modal.dart index 43a872e02d..e23306e42b 100644 --- a/packages/smooth_app/lib/pages/all_product_list_modal.dart +++ b/packages/smooth_app/lib/pages/all_product_list_modal.dart @@ -16,9 +16,7 @@ import 'package:smooth_app/themes/theme_provider.dart'; /// Page that lists all product lists. class AllProductListModal extends StatelessWidget { - AllProductListModal({ - required this.currentList, - }); + AllProductListModal({required this.currentList}); final ProductList currentList; @@ -34,46 +32,47 @@ class AllProductListModal extends StatelessWidget { final DaoProductList daoProductList = DaoProductList(localDatabase); final List userLists = daoProductList.getUserLists(); - final List productLists = - List.from(_hardcodedProductLists); + final List productLists = List.from( + _hardcodedProductLists, + ); for (final String userList in userLists) { productLists.add(ProductList.user(userList)); } return SliverList( - delegate: SliverChildBuilderDelegate( - childCount: productLists.length, - (final BuildContext context, final int index) { - final ProductList productList = productLists[index]; - return Column( - children: [ - ConstrainedBox( - constraints: BoxConstraints( - minWidth: double.infinity, - minHeight: MediaQuery.textScalerOf(context).scale(80.0), - ), - child: FutureBuilder( - future: daoProductList.get(productList), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.connectionState != ConnectionState.done) { - return const Center( - child: CircularProgressIndicator.adaptive(), - ); - } - return _ModalProductListItem( - productList: productList, - selected: productList.listType == currentList.listType && - productList.parameters == currentList.parameters, - ); - }, - ), + delegate: SliverChildBuilderDelegate(childCount: productLists.length, ( + final BuildContext context, + final int index, + ) { + final ProductList productList = productLists[index]; + return Column( + children: [ + ConstrainedBox( + constraints: BoxConstraints( + minWidth: double.infinity, + minHeight: MediaQuery.textScalerOf(context).scale(80.0), ), - if (index < productLists.length - 1) const Divider(height: 1.0), - ], - ); - }, - ), + child: FutureBuilder( + future: daoProductList.get(productList), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState != ConnectionState.done) { + return const Center( + child: CircularProgressIndicator.adaptive(), + ); + } + return _ModalProductListItem( + productList: productList, + selected: + productList.listType == currentList.listType && + productList.parameters == currentList.parameters, + ); + }, + ), + ), + if (index < productLists.length - 1) const Divider(height: 1.0), + ], + ); + }), ); } } @@ -89,8 +88,8 @@ class _ModalProductListItem extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); final AppLocalizations appLocalizations = AppLocalizations.of(context); @@ -102,8 +101,10 @@ class _ModalProductListItem extends StatelessWidget { final bool hasProducts = productsLength > 0; final UserPreferences userPreferences = context.watch(); - final bool showImport = userPreferences.getFlag( - UserPreferencesDevMode.userPreferencesFlagProductListImport) ?? + final bool showImport = + userPreferences.getFlag( + UserPreferencesDevMode.userPreferencesFlagProductListImport, + ) ?? false; return UserPreferencesListTile( @@ -113,9 +114,7 @@ class _ModalProductListItem extends StatelessWidget { appLocalizations, ), ), - subtitle: Text( - appLocalizations.user_list_length(productsLength), - ), + subtitle: Text(appLocalizations.user_list_length(productsLength)), trailing: (enableRename || hasProducts || productList.isEditable) ? PopupMenuButton( itemBuilder: (BuildContext context) { @@ -157,8 +156,9 @@ class _ModalProductListItem extends StatelessWidget { ) : null, selected: selected, - selectedColor: - lightTheme ? extension.primaryMedium : extension.primarySemiDark, + selectedColor: lightTheme + ? extension.primaryMedium + : extension.primarySemiDark, contentPadding: const EdgeInsetsDirectional.only( start: VERY_LARGE_SPACE, end: LARGE_SPACE, diff --git a/packages/smooth_app/lib/pages/app_review.dart b/packages/smooth_app/lib/pages/app_review.dart index fa1081e2bb..d63ca38470 100644 --- a/packages/smooth_app/lib/pages/app_review.dart +++ b/packages/smooth_app/lib/pages/app_review.dart @@ -46,14 +46,6 @@ class AppReviewProvider extends ValueNotifier { } } -enum AppReviewState { - checking, - askForReview, - ignore, -} +enum AppReviewState { checking, askForReview, ignore } -enum AppReviewResult { - satisfied, - neutral, - unsatisfied, -} +enum AppReviewResult { satisfied, neutral, unsatisfied } diff --git a/packages/smooth_app/lib/pages/crop_helper.dart b/packages/smooth_app/lib/pages/crop_helper.dart index 230eeda6e9..6edbc350eb 100644 --- a/packages/smooth_app/lib/pages/crop_helper.dart +++ b/packages/smooth_app/lib/pages/crop_helper.dart @@ -66,9 +66,7 @@ abstract class CropHelper { /// Full-size crop, aka no crop. static const Rect fullImageCropRect = Rect.fromLTRB(0, 0, 1, 1); - static List getEraserCoordinates( - final List offsets, - ) { + static List getEraserCoordinates(final List offsets) { final List eraserCoordinates = []; for (final Offset offset in offsets) { eraserCoordinates.add(offset.dx); @@ -77,9 +75,7 @@ abstract class CropHelper { return eraserCoordinates; } - static List getOffsets( - final List? eraserCoordinates, - ) { + static List getOffsets(final List? eraserCoordinates) { final List offsets = []; if (eraserCoordinates != null) { for (int i = 0; i < eraserCoordinates.length; i += 2) { diff --git a/packages/smooth_app/lib/pages/crop_page.dart b/packages/smooth_app/lib/pages/crop_page.dart index ae18aa7147..59c6e933d3 100644 --- a/packages/smooth_app/lib/pages/crop_page.dart +++ b/packages/smooth_app/lib/pages/crop_page.dart @@ -221,19 +221,16 @@ class _CropPageState extends State { _IconButton( iconData: Icons.rotate_90_degrees_ccw_outlined, tooltip: appLocalizations.photo_rotate_left, - onPressed: () => setState( - () { - _controller.rotateLeft(); - _eraserModel.rotation = _controller.rotation; - }, - ), + onPressed: () => setState(() { + _controller.rotateLeft(); + _eraserModel.rotation = _controller.rotation; + }), ), if (widget.cropHelper.enableEraser) _IconButton( iconData: _isErasing ? Icons.crop : Icons.brush, - onPressed: () => setState( - () => _isErasing = !_isErasing, - ), + onPressed: () => + setState(() => _isErasing = !_isErasing), ), if (_isErasing) _IconButton( @@ -241,20 +238,16 @@ class _CropPageState extends State { tooltip: appLocalizations.photo_undo_action, onPressed: _eraserModel.isEmpty ? null - : () => setState( - () => _eraserModel.undo(), - ), + : () => setState(() => _eraserModel.undo()), ), if (!_isErasing) _IconButton( iconData: Icons.rotate_90_degrees_cw_outlined, tooltip: appLocalizations.photo_rotate_right, - onPressed: () => setState( - () { - _controller.rotateRight(); - _eraserModel.rotation = _controller.rotation; - }, - ), + onPressed: () => setState(() { + _controller.rotateRight(); + _eraserModel.rotation = _controller.rotation; + }), ), ], ), @@ -274,41 +267,40 @@ class _CropPageState extends State { alwaysMove: true, overlayPainter: !widget.cropHelper.enableEraser ? null - : EraserPainter( - eraserModel: _eraserModel, - ), + : EraserPainter(eraserModel: _eraserModel), ), ), if (_isErasing) LayoutBuilder( - builder: ( - final BuildContext context, - final BoxConstraints constraints, - ) => - Center( - child: GestureDetector( - onPanStart: - (final DragStartDetails details) => - setState( - () => _eraserModel.panStart( - details.localPosition, - constraints, + builder: + ( + final BuildContext context, + final BoxConstraints constraints, + ) => Center( + child: GestureDetector( + onPanStart: + (final DragStartDetails details) => + setState( + () => _eraserModel.panStart( + details.localPosition, + constraints, + ), + ), + onPanUpdate: + (final DragUpdateDetails details) => + setState( + () => _eraserModel.panUpdate( + details.localPosition, + constraints, + ), + ), + onPanEnd: + (final DragEndDetails details) => + setState( + () => _eraserModel.panEnd(), + ), ), ), - onPanUpdate: - (final DragUpdateDetails details) => - setState( - () => _eraserModel.panUpdate( - details.localPosition, - constraints, - ), - ), - onPanEnd: (final DragEndDetails details) => - setState( - () => _eraserModel.panEnd(), - ), - ), - ), ), ], ), @@ -322,8 +314,9 @@ class _CropPageState extends State { width: double.infinity, child: EditImageButton.center( iconData: widget.cropHelper.getProcessIcon(), - label: widget.cropHelper - .getProcessLabel(appLocalizations), + label: widget.cropHelper.getProcessLabel( + appLocalizations, + ), onPressed: () async => _saveImageAndPop(), ), ), @@ -364,8 +357,10 @@ class _CropPageState extends State { setState(() => _progress = appLocalizations.crop_page_action_local); try { - await saveBmp(file: result, source: cropped) - .timeout(const Duration(seconds: 10)); + await saveBmp( + file: result, + source: cropped, + ).timeout(const Duration(seconds: 10)); } catch (e, trace) { AnalyticsHelper.sendException(e, stackTrace: trace); rethrow; @@ -432,8 +427,10 @@ class _CropPageState extends State { } final LocalDatabase localDatabase = context.read(); final DaoInt daoInt = DaoInt(localDatabase); - final int sequenceNumber = - await getNextSequenceNumber(daoInt, _CROP_PAGE_SEQUENCE_KEY); + final int sequenceNumber = await getNextSequenceNumber( + daoInt, + _CROP_PAGE_SEQUENCE_KEY, + ); final Directory directory = await BackgroundTaskUpload.getDirectory(); final File smallCroppedFile = await _getSmallCroppedImageFile( @@ -441,9 +438,7 @@ class _CropPageState extends State { sequenceNumber, ); - setState( - () => _progress = appLocalizations.crop_page_action_server, - ); + setState(() => _progress = appLocalizations.crop_page_action_server); if (!mounted) { return null; } @@ -520,11 +515,11 @@ class _CropPageState extends State { } // the cropped image has changed, but the user went back without saving - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog( - context, - title: widget.cropHelper.getPageTitle(AppLocalizations.of(context)), - ); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog( + context, + title: widget.cropHelper.getPageTitle(AppLocalizations.of(context)), + ); if (pleaseSave == null) { return (false, null); } @@ -594,17 +589,11 @@ class _IconButton extends StatelessWidget { final Widget icon = ElevatedButton( onPressed: onPressed, style: ElevatedButton.styleFrom(shape: const CircleBorder()), - child: Icon( - iconData, - semanticLabel: tooltip, - ), + child: Icon(iconData, semanticLabel: tooltip), ); if (tooltip != null) { - return Tooltip( - message: tooltip, - child: icon, - ); + return Tooltip(message: tooltip, child: icon); } else { return icon; } diff --git a/packages/smooth_app/lib/pages/crop_parameters.dart b/packages/smooth_app/lib/pages/crop_parameters.dart index ee3b652384..e619b5ca26 100644 --- a/packages/smooth_app/lib/pages/crop_parameters.dart +++ b/packages/smooth_app/lib/pages/crop_parameters.dart @@ -9,10 +9,10 @@ class CropParameters { required this.rotation, required Rect cropRect, this.eraserCoordinates, - }) : x1 = cropRect.left.ceil(), - y1 = cropRect.top.ceil(), - x2 = cropRect.right.floor(), - y2 = cropRect.bottom.floor(); + }) : x1 = cropRect.left.ceil(), + y1 = cropRect.top.ceil(), + x2 = cropRect.right.floor(), + y2 = cropRect.bottom.floor(); /// File of the full image. final File? fullFile; diff --git a/packages/smooth_app/lib/pages/folksonomy/folksonomy_card.dart b/packages/smooth_app/lib/pages/folksonomy/folksonomy_card.dart index 652d061c7f..383af40060 100644 --- a/packages/smooth_app/lib/pages/folksonomy/folksonomy_card.dart +++ b/packages/smooth_app/lib/pages/folksonomy/folksonomy_card.dart @@ -50,53 +50,50 @@ class _FolksonomyCard extends StatelessWidget { children: [ Expanded(child: Text(appLocalizations.product_tags_title)), IconButton( - onPressed: () => _openFolksonomyPage( - context, - context.read(), - ), + onPressed: () => + _openFolksonomyPage(context, context.read()), icon: Consumer( - builder: ( - BuildContext context, - FolksonomyProvider provider, - _, - ) { - Widget getIcon(List tags) { - if (tags.isNotEmpty == true) { - return Tooltip( - message: appLocalizations.add_edit_tags, - child: const icons.Edit(size: 15.0), - ); - } else { - return Tooltip( - message: appLocalizations.add_tags, - child: const icons.Add(), - ); - } - } + builder: + (BuildContext context, FolksonomyProvider provider, _) { + Widget getIcon(List tags) { + if (tags.isNotEmpty == true) { + return Tooltip( + message: appLocalizations.add_edit_tags, + child: const icons.Edit(size: 15.0), + ); + } else { + return Tooltip( + message: appLocalizations.add_tags, + child: const icons.Add(), + ); + } + } - return switch (provider.value) { - FolksonomyStateError(action: final FolksonomyAction? action) - when action == null => - EMPTY_WIDGET, - FolksonomyStateError( - tags: final List tags, - ) => - getIcon(tags), - FolksonomyStateLoaded( - tags: final List tags, - ) => - getIcon(tags), - FolksonomyStateAddedItem( - tags: final List tags - ) => - getIcon(tags), - FolksonomyStateRemovedItem( - tags: final List tags - ) => - getIcon(tags), - _ => EMPTY_WIDGET, - }; - }, + return switch (provider.value) { + FolksonomyStateError( + action: final FolksonomyAction? action, + ) + when action == null => + EMPTY_WIDGET, + FolksonomyStateError( + tags: final List tags, + ) => + getIcon(tags), + FolksonomyStateLoaded( + tags: final List tags, + ) => + getIcon(tags), + FolksonomyStateAddedItem( + tags: final List tags, + ) => + getIcon(tags), + FolksonomyStateRemovedItem( + tags: final List tags, + ) => + getIcon(tags), + _ => EMPTY_WIDGET, + }; + }, ), ), ], @@ -105,10 +102,8 @@ class _FolksonomyCard extends StatelessWidget { width: double.infinity, padding: const EdgeInsetsDirectional.all(LARGE_SPACE), child: _FolksonomyCardBody( - onEmptyPageTag: () => _openFolksonomyPage( - context, - context.read(), - ), + onEmptyPageTag: () => + _openFolksonomyPage(context, context.read()), ), ), ), @@ -144,9 +139,7 @@ class _FolksonomyCard extends StatelessWidget { } class _FolksonomyCardBody extends StatelessWidget { - const _FolksonomyCardBody({ - required this.onEmptyPageTag, - }); + const _FolksonomyCardBody({required this.onEmptyPageTag}); final VoidCallback onEmptyPageTag; @@ -155,15 +148,9 @@ class _FolksonomyCardBody extends StatelessWidget { final AppLocalizations appLocalizations = AppLocalizations.of(context); return Consumer( - builder: ( - BuildContext context, - FolksonomyProvider provider, - _, - ) { + builder: (BuildContext context, FolksonomyProvider provider, _) { if (provider.value is FolksonomyStateLoading) { - return const Center( - child: CircularProgressIndicator.adaptive(), - ); + return const Center(child: CircularProgressIndicator.adaptive()); } else if (provider.value.tags?.isNotEmpty != true) { return InkWell( onTap: onEmptyPageTag, @@ -189,11 +176,14 @@ class _FolksonomyCardBody extends StatelessWidget { padding: const EdgeInsets.all(SMALL_SPACE), child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: displayTags.map((ProductTag tag) { - return Tag( - text: - '${tag.key}${appLocalizations.sep}: ${tag.value}'); - }).toList(growable: false), + children: displayTags + .map((ProductTag tag) { + return Tag( + text: + '${tag.key}${appLocalizations.sep}: ${tag.value}', + ); + }) + .toList(growable: false), ), ), ], diff --git a/packages/smooth_app/lib/pages/folksonomy/folksonomy_create_edit_modal.dart b/packages/smooth_app/lib/pages/folksonomy/folksonomy_create_edit_modal.dart index a7922bd82a..e348b8b669 100644 --- a/packages/smooth_app/lib/pages/folksonomy/folksonomy_create_edit_modal.dart +++ b/packages/smooth_app/lib/pages/folksonomy/folksonomy_create_edit_modal.dart @@ -54,9 +54,7 @@ class FolksonomyEditTagContentState extends State { isValueValid: isValueValid, onSave: _onSubmit, ), - _FolksonomyEditTagContentFooter( - onSave: _onSubmit, - ), + _FolksonomyEditTagContentFooter(onSave: _onSubmit), ], ); } @@ -68,7 +66,8 @@ class FolksonomyEditTagContentState extends State { isKeyValid = isKeyValid && !widget.existingKeys!.contains(keyController.text); } else if (widget.action == FolksonomyAction.edit) { - isKeyValid = isKeyValid && + isKeyValid = + isKeyValid && (keyController.text == widget.oldKey || !widget.existingKeys!.contains(keyController.text)); } @@ -80,12 +79,9 @@ class FolksonomyEditTagContentState extends State { return SmoothHapticFeedback.error(); } - return Navigator.of(context).pop( - FolksonomyTag( - key: keyController.text, - value: valueController.text, - ), - ); + return Navigator.of( + context, + ).pop(FolksonomyTag(key: keyController.text, value: valueController.text)); } @override @@ -142,9 +138,7 @@ class _FolksonomyEditTagContentBody extends StatelessWidget { textCapitalization: TextCapitalization.none, keyboardType: TextInputType.text, inputFormatters: [ - FilteringTextInputFormatter.allow( - RegExp(r'[a-zA-Z0-9_\-\:]'), - ), + FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9_\-\:]')), LowerCaseTextFormatter(), ], decoration: InputDecoration( @@ -200,16 +194,17 @@ class _FolksonomyEditTagContentTitleState void initState() { super.initState(); - _controller = AnimationController( - duration: const Duration(milliseconds: 500), - vsync: this, - ) - ..addListener(() => setState(() {})) - ..addStatusListener((AnimationStatus status) { - if (status == AnimationStatus.completed) { - _controller.reverse(); - } - }); + _controller = + AnimationController( + duration: const Duration(milliseconds: 500), + vsync: this, + ) + ..addListener(() => setState(() {})) + ..addStatusListener((AnimationStatus status) { + if (status == AnimationStatus.completed) { + _controller.reverse(); + } + }); } @override @@ -224,8 +219,8 @@ class _FolksonomyEditTagContentTitleState @override Widget build(BuildContext context) { if (_animation == null) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); _animation = ColorTween( begin: DefaultTextStyle.of(context).style.color, @@ -249,10 +244,7 @@ class _FolksonomyEditTagContentTitleState text, Text( widget.explanation!, - style: TextStyle( - color: _animation!.value, - fontSize: 14.5, - ), + style: TextStyle(color: _animation!.value, fontSize: 14.5), ), ], ); @@ -263,9 +255,7 @@ class _FolksonomyEditTagContentTitleState } class _FolksonomyEditTagContentFooter extends StatelessWidget { - const _FolksonomyEditTagContentFooter({ - required this.onSave, - }); + const _FolksonomyEditTagContentFooter({required this.onSave}); final VoidCallback onSave; @@ -311,10 +301,7 @@ class LowerCaseTextFormatter extends TextInputFormatter { } class FolksonomyTag { - FolksonomyTag({ - required this.key, - required this.value, - }); + FolksonomyTag({required this.key, required this.value}); final String key; final String value; diff --git a/packages/smooth_app/lib/pages/folksonomy/folksonomy_page.dart b/packages/smooth_app/lib/pages/folksonomy/folksonomy_page.dart index d78d2d7097..9cedb529a6 100644 --- a/packages/smooth_app/lib/pages/folksonomy/folksonomy_page.dart +++ b/packages/smooth_app/lib/pages/folksonomy/folksonomy_page.dart @@ -17,10 +17,7 @@ import 'package:smooth_app/widgets/v2/smooth_leading_button.dart'; import 'package:smooth_app/widgets/v2/smooth_topbar2.dart'; class FolksonomyPage extends StatelessWidget { - const FolksonomyPage({ - required this.product, - required this.provider, - }); + const FolksonomyPage({required this.product, required this.provider}); final Product product; final FolksonomyProvider provider; @@ -71,34 +68,32 @@ class _FolksonomyContentState extends State<_FolksonomyContent> { key: _listKey, controller: _scrollController, initialItemCount: provider.value.tags!.length, - itemBuilder: ( - BuildContext context, - int index, - Animation animation, - ) { - final ProductTag entry = provider.value.tags![index]; + itemBuilder: + ( + BuildContext context, + int index, + Animation animation, + ) { + final ProductTag entry = provider.value.tags![index]; - return _buildItem( - context, - entry, - animation, - provider.isAuthorized, - ); - }, + return _buildItem( + context, + entry, + animation, + provider.isAuthorized, + ); + }, separatorBuilder: (_, __, Animation animation) => - SizeTransition( - sizeFactor: animation, - child: const Divider(), - ), - removedSeparatorBuilder: ( - BuildContext context, - int index, - Animation animation, - ) => - SizeTransition( - sizeFactor: animation, - child: const Divider(), - ), + SizeTransition(sizeFactor: animation, child: const Divider()), + removedSeparatorBuilder: + ( + BuildContext context, + int index, + Animation animation, + ) => SizeTransition( + sizeFactor: animation, + child: const Divider(), + ), ); }, ), @@ -145,9 +140,7 @@ class _FolksonomyContentState extends State<_FolksonomyContent> { text: appLocalizations.tag_key_item, style: const TextStyle(fontWeight: FontWeight.bold), ), - TextSpan( - text: ' ${entry.key}', - ), + TextSpan(text: ' ${entry.key}'), ], style: Theme.of(context).textTheme.bodyLarge, ), @@ -159,9 +152,7 @@ class _FolksonomyContentState extends State<_FolksonomyContent> { text: appLocalizations.tag_value_item, style: const TextStyle(fontWeight: FontWeight.bold), ), - TextSpan( - text: ' ${entry.value}', - ), + TextSpan(text: ' ${entry.value}'), ], style: Theme.of(context).textTheme.bodyLarge, ), @@ -238,16 +229,10 @@ class _FolksonomyContentState extends State<_FolksonomyContent> { if (res != null && mounted) { if (action == FolksonomyAction.edit) { - context.read().editTag( - res.key, - res.value, - ); + context.read().editTag(res.key, res.value); } else if (action == FolksonomyAction.add) { try { - context.read().addTag( - res.key, - res.value, - ); + context.read().addTag(res.key, res.value); } catch (e) { ScaffoldMessenger.of(context).showSnackBar( SmoothFloatingSnackbar.error( @@ -274,20 +259,20 @@ class _FolksonomyContentState extends State<_FolksonomyContent> { } else if (provider.value is FolksonomyStateRemovedItem) { final FolksonomyStateRemovedItem state = provider.value as FolksonomyStateRemovedItem; - _listKey.currentState!.removeItem( - state.removedPosition, - (BuildContext context, Animation animation) { - return FadeTransition( - opacity: animation, - child: _buildItem( - context, - state.item, - animation, - provider.isAuthorized, - ), - ); - }, - ); + _listKey.currentState!.removeItem(state.removedPosition, ( + BuildContext context, + Animation animation, + ) { + return FadeTransition( + opacity: animation, + child: _buildItem( + context, + state.item, + animation, + provider.isAuthorized, + ), + ); + }); onNextFrame(() => provider.markAsConsumed()); } diff --git a/packages/smooth_app/lib/pages/folksonomy/folksonomy_provider.dart b/packages/smooth_app/lib/pages/folksonomy/folksonomy_provider.dart index 163a4e27c0..ca1a968141 100644 --- a/packages/smooth_app/lib/pages/folksonomy/folksonomy_provider.dart +++ b/packages/smooth_app/lib/pages/folksonomy/folksonomy_provider.dart @@ -28,10 +28,10 @@ class FolksonomyProvider extends ValueNotifier { try { final MaybeError token = await FolksonomyAPIClient.getAuthenticationToken( - username: user.userId, - password: user.password, - uriHelper: ProductQuery.uriFolksonomyHelper, - ); + username: user.userId, + password: user.password, + uriHelper: ProductQuery.uriFolksonomyHelper, + ); if (token.isError) { throw Exception('Could not get token: ${token.error}'); @@ -54,9 +54,9 @@ class FolksonomyProvider extends ValueNotifier { final Map tags = await FolksonomyAPIClient.getProductTags( - barcode: barcode, - uriHelper: ProductQuery.uriFolksonomyHelper, - ); + barcode: barcode, + uriHelper: ProductQuery.uriFolksonomyHelper, + ); _tags.clear(); _tags.addAll(tags.values); @@ -208,9 +208,7 @@ class FolksonomyProvider extends ValueNotifier { } sealed class FolksonomyState { - const FolksonomyState({ - required this.tags, - }); + const FolksonomyState({required this.tags}); final List? tags; } @@ -220,9 +218,7 @@ class FolksonomyStateLoading extends FolksonomyState { } class FolksonomyStateLoaded extends FolksonomyState { - FolksonomyStateLoaded({ - required List tags, - }) : super(tags: tags); + FolksonomyStateLoaded({required List tags}) : super(tags: tags); @override List? get tags => super.tags!; @@ -271,11 +267,7 @@ class FolksonomyStateEditedItem extends FolksonomyState { } class FolksonomyStateError extends FolksonomyState { - FolksonomyStateError({ - required this.error, - this.action, - super.tags, - }); + FolksonomyStateError({required this.error, this.action, super.tags}); final dynamic error; final FolksonomyAction? action; diff --git a/packages/smooth_app/lib/pages/folksonomy/tag.dart b/packages/smooth_app/lib/pages/folksonomy/tag.dart index b01b701518..928e3cd84c 100644 --- a/packages/smooth_app/lib/pages/folksonomy/tag.dart +++ b/packages/smooth_app/lib/pages/folksonomy/tag.dart @@ -22,8 +22,8 @@ class Tag extends StatelessWidget { child: Text( text, style: Theme.of(context).textTheme.bodyMedium?.copyWith( - color: context.darkTheme() ? Colors.white : Colors.black, - ), + color: context.darkTheme() ? Colors.white : Colors.black, + ), ), ), ); diff --git a/packages/smooth_app/lib/pages/guides/guide/guide_nutriscore_v2.dart b/packages/smooth_app/lib/pages/guides/guide/guide_nutriscore_v2.dart index 4ed92217e3..98b7848740 100644 --- a/packages/smooth_app/lib/pages/guides/guide/guide_nutriscore_v2.dart +++ b/packages/smooth_app/lib/pages/guides/guide/guide_nutriscore_v2.dart @@ -61,12 +61,7 @@ class _NutriScoreHeaderIllustration extends StatelessWidget { SvgCache.getAssetsCacheForNutriscore(NutriScoreValue.a, false), ), ), - const Expanded( - flex: 28, - child: Arrow.down( - color: Colors.white, - ), - ), + const Expanded(flex: 28, child: Arrow.down(color: Colors.white)), Expanded( flex: 40, child: SvgPicture.asset( @@ -119,9 +114,7 @@ class _NutriScoreSection2 extends StatelessWidget { return GuidesParagraph( title: appLocalizations.guide_nutriscore_v2_why_v2_title, content: [ - GuidesText( - text: appLocalizations.guide_nutriscore_v2_why_v2_intro, - ), + GuidesText(text: appLocalizations.guide_nutriscore_v2_why_v2_intro), GuidesTitleWithText( title: appLocalizations.guide_nutriscore_v2_why_v2_arg1_title, icon: const Milk(), @@ -162,9 +155,7 @@ class _NutriScoreSection3 extends StatelessWidget { return GuidesParagraph( title: appLocalizations.guide_nutriscore_v2_new_logo_title, content: [ - GuidesText( - text: appLocalizations.guide_nutriscore_v2_new_logo_text, - ), + GuidesText(text: appLocalizations.guide_nutriscore_v2_new_logo_text), GuidesImage( imagePath: SvgCache.getAssetsCacheForNutriscore( NutriScoreValue.a, @@ -194,7 +185,7 @@ class _NutriScoreSection4 extends StatelessWidget { text: appLocalizations.guide_nutriscore_v2_where_paragraph3, imagePath: 'assets/app/release_icon_light_transparent_no_border.svg', desiredWidthPercent: 0.15, - ) + ), ], ); } diff --git a/packages/smooth_app/lib/pages/guides/helpers/guides_content.dart b/packages/smooth_app/lib/pages/guides/helpers/guides_content.dart index 838104bfd0..d885ff90b6 100644 --- a/packages/smooth_app/lib/pages/guides/helpers/guides_content.dart +++ b/packages/smooth_app/lib/pages/guides/helpers/guides_content.dart @@ -33,21 +33,15 @@ class GuidesPage extends StatelessWidget { brightness: Brightness.light, body: _GuidesPageBody( pageName: pageName, - slivers: [ - header, - ...body, - if (footer != null) footer!, - ], + slivers: [header, ...body, if (footer != null) footer!], ), ); } } class _GuidesPageBody extends StatefulWidget { - const _GuidesPageBody({ - required this.slivers, - required this.pageName, - }) : assert(pageName.length > 0); + const _GuidesPageBody({required this.slivers, required this.pageName}) + : assert(pageName.length > 0); final List slivers; final String pageName; @@ -74,16 +68,20 @@ class _GuidesPageBodyState extends State<_GuidesPageBody> if (notification.metrics.pixels < 125) { Future.delayed(Duration.zero, () { - _controller.animateTo(0, - duration: const Duration(milliseconds: 500), - curve: Curves.ease); + _controller.animateTo( + 0, + duration: const Duration(milliseconds: 500), + curve: Curves.ease, + ); }); return true; } else if (notification.metrics.pixels < 250) { Future.delayed(Duration.zero, () { - _controller.animateTo(250 - kToolbarHeight, - duration: const Duration(milliseconds: 500), - curve: Curves.ease); + _controller.animateTo( + 250 - kToolbarHeight, + duration: const Duration(milliseconds: 500), + curve: Curves.ease, + ); }); } return true; @@ -127,25 +125,18 @@ class GuidesParagraph extends StatelessWidget { pushPinnedChildren: true, children: [ SliverPadding( - padding: const EdgeInsetsDirectional.only( - bottom: 8.0, - ), + padding: const EdgeInsetsDirectional.only(bottom: 8.0), sliver: SliverPinnedHeader( child: _GuidesParagraphTitle(title: title), ), ), DefaultTextStyle.merge( - style: const TextStyle( - fontSize: 15.0, - height: 1.75, - ), + style: const TextStyle(fontSize: 15.0, height: 1.75), child: AppIconTheme( size: 21.0, color: Colors.white, child: SliverPadding( - padding: const EdgeInsetsDirectional.only( - bottom: 15.0, - ), + padding: const EdgeInsetsDirectional.only(bottom: 15.0), sliver: SliverList.builder( itemCount: content.length, itemBuilder: (BuildContext context, int position) { @@ -161,16 +152,15 @@ class GuidesParagraph extends StatelessWidget { } class _GuidesParagraphTitle extends StatelessWidget { - const _GuidesParagraphTitle({ - required this.title, - }) : assert(title.length > 0); + const _GuidesParagraphTitle({required this.title}) : assert(title.length > 0); final String title; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; return Semantics( label: title, @@ -215,8 +205,9 @@ class _GuidesParagraphArrow extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; return SizedBox.square( dimension: 20.0, @@ -225,20 +216,14 @@ class _GuidesParagraphArrow extends StatelessWidget { color: colors.secondaryVibrant, shape: BoxShape.circle, ), - child: const Arrow.right( - color: Colors.white, - size: 12.0, - ), + child: const Arrow.right(color: Colors.white, size: 12.0), ), ); } } class GuidesText extends StatelessWidget { - const GuidesText({ - required this.text, - super.key, - }); + const GuidesText({required this.text, super.key}); final String text; @@ -250,17 +235,13 @@ class GuidesText extends StatelessWidget { start: GuidesParagraph._HORIZONTAL_PADDING, end: GuidesParagraph._HORIZONTAL_PADDING, ), - child: _GuidesFormattedText( - text: text, - ), + child: _GuidesFormattedText(text: text), ); } } class _GuidesFormattedText extends StatelessWidget { - const _GuidesFormattedText({ - required this.text, - }); + const _GuidesFormattedText({required this.text}); final String text; @@ -276,8 +257,8 @@ class GuidesIllustratedText extends StatelessWidget { required this.imagePath, required this.desiredWidthPercent, super.key, - }) : assert(text.length > 0), - assert(imagePath.length > 0); + }) : assert(text.length > 0), + assert(imagePath.length > 0); final String text; final String imagePath; @@ -285,20 +266,19 @@ class GuidesIllustratedText extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; final int imageWidth = (desiredWidthPercent != null ? desiredWidthPercent! : 0.25) * - 100.0 ~/ - 1; + 100.0 ~/ + 1; return Semantics( label: text, excludeSemantics: true, child: Padding( - padding: const EdgeInsetsDirectional.only( - top: VERY_LARGE_SPACE, - ), + padding: const EdgeInsetsDirectional.only(top: VERY_LARGE_SPACE), child: ColoredBox( color: colors.primaryMedium, child: Padding( @@ -310,9 +290,7 @@ class GuidesIllustratedText extends StatelessWidget { children: [ Expanded( flex: imageWidth, - child: _ImageFromAssets( - imagePath: imagePath, - ), + child: _ImageFromAssets(imagePath: imagePath), ), const SizedBox(width: 15.0), Expanded( @@ -355,16 +333,11 @@ class GuidesTitleWithText extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _GuidesTextTitle( - title: title, - icon: icon, - ), + _GuidesTextTitle(title: title, icon: icon), const SizedBox(height: 15.0), Padding( padding: const EdgeInsets.symmetric(horizontal: 2.0), - child: _GuidesFormattedText( - text: text, - ), + child: _GuidesFormattedText(text: text), ), ], ), @@ -373,18 +346,17 @@ class GuidesTitleWithText extends StatelessWidget { } class _GuidesTextTitle extends StatelessWidget { - const _GuidesTextTitle({ - required this.title, - required this.icon, - }) : assert(title.length > 0); + const _GuidesTextTitle({required this.title, required this.icon}) + : assert(title.length > 0); final String title; final AppIcon icon; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; return DecoratedBox( decoration: BoxDecoration( @@ -433,11 +405,15 @@ class GuidesImage extends StatelessWidget { this.desiredWidthPercent, this.desiredHeightPercent, super.key, - }) : assert(caption.length > 0), - assert(desiredWidthPercent == null || - desiredWidthPercent >= 0.0 && desiredWidthPercent <= 1.0), - assert(desiredHeightPercent == null || - desiredHeightPercent >= 0.0 && desiredHeightPercent <= 1.0); + }) : assert(caption.length > 0), + assert( + desiredWidthPercent == null || + desiredWidthPercent >= 0.0 && desiredWidthPercent <= 1.0, + ), + assert( + desiredHeightPercent == null || + desiredHeightPercent >= 0.0 && desiredHeightPercent <= 1.0, + ); final String imagePath; final double? desiredWidthPercent; @@ -446,8 +422,9 @@ class GuidesImage extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; return Semantics( label: caption, @@ -461,8 +438,9 @@ class GuidesImage extends StatelessWidget { ), child: DecoratedBox( decoration: BoxDecoration( - color: colors.primaryMedium, - borderRadius: BorderRadius.circular(20.0)), + color: colors.primaryMedium, + borderRadius: BorderRadius.circular(20.0), + ), child: Padding( padding: const EdgeInsetsDirectional.only( top: 14.0, @@ -500,10 +478,14 @@ class _ImageFromAssets extends StatelessWidget { required this.imagePath, this.desiredWidthPercent, this.desiredHeightPercent, - }) : assert(desiredWidthPercent == null || - desiredWidthPercent >= 0.0 && desiredWidthPercent <= 1.0), - assert(desiredHeightPercent == null || - desiredHeightPercent >= 0.0 && desiredHeightPercent <= 1.0); + }) : assert( + desiredWidthPercent == null || + desiredWidthPercent >= 0.0 && desiredWidthPercent <= 1.0, + ), + assert( + desiredHeightPercent == null || + desiredHeightPercent >= 0.0 && desiredHeightPercent <= 1.0, + ); final String imagePath; final double? desiredWidthPercent; diff --git a/packages/smooth_app/lib/pages/guides/helpers/guides_footer.dart b/packages/smooth_app/lib/pages/guides/helpers/guides_footer.dart index 2864600c13..115c377a9b 100644 --- a/packages/smooth_app/lib/pages/guides/helpers/guides_footer.dart +++ b/packages/smooth_app/lib/pages/guides/helpers/guides_footer.dart @@ -8,19 +8,16 @@ import 'package:smooth_app/l10n/app_localizations.dart'; import 'package:smooth_app/themes/smooth_theme_colors.dart'; class GuidesFooter extends StatelessWidget { - const GuidesFooter({ - required this.shareUrl, - this.shareMessage, - super.key, - }); + const GuidesFooter({required this.shareUrl, this.shareMessage, super.key}); final String? shareMessage; final String shareUrl; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; return CustomPaint( painter: _FooterPainter( @@ -75,13 +72,11 @@ class GuidesFooter extends StatelessWidget { } class _FooterPainter extends CustomPainter { - _FooterPainter({ - this.wazeSize = WAVE_SIZE, - required Color color, - }) : assert(color.a > 0.0), - _localPaint = Paint() - ..color = color - ..style = PaintingStyle.fill; + _FooterPainter({this.wazeSize = WAVE_SIZE, required Color color}) + : assert(color.a > 0.0), + _localPaint = Paint() + ..color = color + ..style = PaintingStyle.fill; static const double WAVE_SIZE = 24.0; final double wazeSize; @@ -94,11 +89,7 @@ class _FooterPainter extends CustomPainter { /// Draw top waves while (true) { canvas.drawArc( - Rect.fromCenter( - center: offset, - height: wazeSize, - width: wazeSize, - ), + Rect.fromCenter(center: offset, height: wazeSize, width: wazeSize), math.pi, math.pi, false, @@ -113,14 +104,15 @@ class _FooterPainter extends CustomPainter { /// Draw background color canvas.drawRect( - Rect.fromLTWH( - 0, - // 0.5 to eliminate some glitches - (wazeSize / 2) - 0.5, - size.width, - size.height, - ), - _localPaint); + Rect.fromLTWH( + 0, + // 0.5 to eliminate some glitches + (wazeSize / 2) - 0.5, + size.width, + size.height, + ), + _localPaint, + ); } @override diff --git a/packages/smooth_app/lib/pages/guides/helpers/guides_header.dart b/packages/smooth_app/lib/pages/guides/helpers/guides_header.dart index cc98163ccf..8fc139e6d7 100644 --- a/packages/smooth_app/lib/pages/guides/helpers/guides_header.dart +++ b/packages/smooth_app/lib/pages/guides/helpers/guides_header.dart @@ -32,9 +32,7 @@ class GuidesHeader extends StatelessWidget { return DefaultTextStyle.merge( style: const TextStyle(color: Colors.white), child: SliverPadding( - padding: const EdgeInsetsDirectional.only( - bottom: BALANCED_SPACE, - ), + padding: const EdgeInsetsDirectional.only(bottom: BALANCED_SPACE), // Pinned = for the header to stay at the top of the screen sliver: SliverPersistentHeader( floating: false, @@ -55,8 +53,8 @@ class _GuidesHeaderDelegate extends SliverPersistentHeaderDelegate { required this.title, required this.illustration, required this.topPadding, - }) : assert(title.length > 0), - assert(topPadding >= 0.0); + }) : assert(title.length > 0), + assert(topPadding >= 0.0); final String title; final Widget illustration; @@ -68,10 +66,14 @@ class _GuidesHeaderDelegate extends SliverPersistentHeaderDelegate { double shrinkOffset, bool overlapsContent, ) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; - final double progress = - shrinkOffset.progressAndClamp(0.0, maxExtent - minExtent, 1.0); + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; + final double progress = shrinkOffset.progressAndClamp( + 0.0, + maxExtent - minExtent, + 1.0, + ); return Provider.value( value: progress, @@ -85,8 +87,9 @@ class _GuidesHeaderDelegate extends SliverPersistentHeaderDelegate { color: colors.primaryDark, shadows: [ BoxShadow( - color: Colors.black - .withValues(alpha: progress.progressAndClamp(0.5, 1, 0.2)), + color: Colors.black.withValues( + alpha: progress.progressAndClamp(0.5, 1, 0.2), + ), offset: const Offset(0.5, 0.5), blurRadius: 2.0, ), @@ -97,9 +100,7 @@ class _GuidesHeaderDelegate extends SliverPersistentHeaderDelegate { ), child: ClipRRect( child: CustomMultiChildLayout( - delegate: _GuidesHeaderLayout( - topPadding: topPadding, - ), + delegate: _GuidesHeaderLayout(topPadding: topPadding), children: [ LayoutId( id: _GuidesHeaderLayoutId.expandedTitle, @@ -107,7 +108,8 @@ class _GuidesHeaderDelegate extends SliverPersistentHeaderDelegate { opacity: 1 - progress, child: OverflowBox( fit: OverflowBoxFit.deferToChild, - maxHeight: GuidesHeader.HEADER_HEIGHT - + maxHeight: + GuidesHeader.HEADER_HEIGHT - 10 - _CloseButtonLayout._CLOSE_BUTTON_SIZE, child: Align( @@ -136,10 +138,7 @@ class _GuidesHeaderDelegate extends SliverPersistentHeaderDelegate { fit: OverflowBoxFit.deferToChild, child: Offstage( offstage: progress == 1.0, - child: Opacity( - opacity: 1 - progress, - child: illustration, - ), + child: Opacity(opacity: 1 - progress, child: illustration), ), ), ), @@ -185,9 +184,7 @@ class _GuidesHeaderDelegate extends SliverPersistentHeaderDelegate { } class _GuidesHeaderLayout extends MultiChildLayoutDelegate { - _GuidesHeaderLayout({ - required this.topPadding, - }); + _GuidesHeaderLayout({required this.topPadding}); final double topPadding; @@ -199,31 +196,20 @@ class _GuidesHeaderLayout extends MultiChildLayoutDelegate { final Size closeButtonSize = layoutChild( _GuidesHeaderLayoutId.closeButton, BoxConstraints.loose( - Size( - size.width * 0.6, - _CloseButtonLayout._CLOSE_BUTTON_SIZE, - ), + Size(size.width * 0.6, _CloseButtonLayout._CLOSE_BUTTON_SIZE), ), ); layoutChild( _GuidesHeaderLayoutId.expandedTitle, BoxConstraints.loose( - Size( - size.width * 0.6, - maxHeight - closeButtonSize.height, - ), + Size(size.width * 0.6, maxHeight - closeButtonSize.height), ), ); final Size illustrationSize = layoutChild( _GuidesHeaderLayoutId.illustration, - BoxConstraints.loose( - Size( - size.width * 0.4, - maxHeight, - ), - ), + BoxConstraints.loose(Size(size.width * 0.4, maxHeight)), ); layoutChild( @@ -243,8 +229,10 @@ class _GuidesHeaderLayout extends MultiChildLayoutDelegate { ); positionChild( _GuidesHeaderLayoutId.illustration, - Offset(size.width * 0.6, - topPadding + (maxHeight - illustrationSize.height) + 5.0), + Offset( + size.width * 0.6, + topPadding + (maxHeight - illustrationSize.height) + 5.0, + ), ); positionChild( @@ -274,8 +262,9 @@ class _BackButton extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; return SizedBox( height: _CloseButtonLayout._CLOSE_BUTTON_SIZE, @@ -284,9 +273,7 @@ class _BackButton extends StatelessWidget { child: Consumer( builder: (_, double progress, __) { return CustomMultiChildLayout( - delegate: _CloseButtonLayout( - progress: 1 - progress, - ), + delegate: _CloseButtonLayout(progress: 1 - progress), children: [ LayoutId( id: _CloseButtonLayoutId.text, @@ -322,18 +309,16 @@ class _BackButton extends StatelessWidget { ), child: SizedBox.square( dimension: 36.0, - child: Close( - size: 16.0, - color: colors.primaryBlack, - ), + child: Close(size: 16.0, color: colors.primaryBlack), ), ), ), LayoutId( id: _CloseButtonLayoutId.background, child: Tooltip( - message: - MaterialLocalizations.of(context).closeButtonTooltip, + message: MaterialLocalizations.of( + context, + ).closeButtonTooltip, child: InkWell( onTap: () => Navigator.of(context).maybePop(true), borderRadius: ROUNDED_BORDER_RADIUS, @@ -342,10 +327,7 @@ class _BackButton extends StatelessWidget { child: Container( decoration: const ShapeDecoration( shape: RoundedRectangleBorder( - side: BorderSide( - color: Colors.white, - width: 1.0, - ), + side: BorderSide(color: Colors.white, width: 1.0), borderRadius: ROUNDED_BORDER_RADIUS, ), ), @@ -365,7 +347,7 @@ class _BackButton extends StatelessWidget { class _CloseButtonLayout extends MultiChildLayoutDelegate { _CloseButtonLayout({required this.progress}) - : assert(progress >= 0.0 && progress <= 1.0); + : assert(progress >= 0.0 && progress <= 1.0); static const double _CLOSE_BUTTON_SIZE = 36.0; @@ -382,10 +364,7 @@ class _CloseButtonLayout extends MultiChildLayoutDelegate { ); if (progress == 0.0) { - layoutChild( - _CloseButtonLayoutId.text, - BoxConstraints.loose(Size.zero), - ); + layoutChild(_CloseButtonLayoutId.text, BoxConstraints.loose(Size.zero)); layoutChild( _CloseButtonLayoutId.background, @@ -437,8 +416,4 @@ class _CloseButtonLayout extends MultiChildLayoutDelegate { } } -enum _CloseButtonLayoutId { - closeButton, - text, - background, -} +enum _CloseButtonLayoutId { closeButton, text, background } diff --git a/packages/smooth_app/lib/pages/html_page.dart b/packages/smooth_app/lib/pages/html_page.dart index 76382b48a3..3af14e08ca 100644 --- a/packages/smooth_app/lib/pages/html_page.dart +++ b/packages/smooth_app/lib/pages/html_page.dart @@ -5,17 +5,14 @@ import 'package:smooth_app/widgets/smooth_scaffold.dart'; /// Displays in widgets a HTML page class HtmlPage extends StatelessWidget { - const HtmlPage({ - required this.pageTitle, - required this.htmlString, - }); + const HtmlPage({required this.pageTitle, required this.htmlString}); final String pageTitle; final String htmlString; @override Widget build(BuildContext context) => SmoothScaffold( - appBar: SmoothAppBar(title: Text(pageTitle)), - body: SingleChildScrollView(child: SmoothHtmlWidget(htmlString)), - ); + appBar: SmoothAppBar(title: Text(pageTitle)), + body: SingleChildScrollView(child: SmoothHtmlWidget(htmlString)), + ); } diff --git a/packages/smooth_app/lib/pages/hunger_games/congrats.dart b/packages/smooth_app/lib/pages/hunger_games/congrats.dart index 3fbfd25532..1023ccb4c6 100644 --- a/packages/smooth_app/lib/pages/hunger_games/congrats.dart +++ b/packages/smooth_app/lib/pages/hunger_games/congrats.dart @@ -33,8 +33,8 @@ class CongratsWidget extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final UserManagementProvider userManagementProvider = - context.watch(); + final UserManagementProvider userManagementProvider = context + .watch(); return Center( child: SmoothCard( @@ -53,20 +53,21 @@ class CongratsWidget extends StatelessWidget { ), FractionallySizedBox( child: FutureBuilder( - future: userManagementProvider.credentialsInStorage(), - builder: - (BuildContext context, AsyncSnapshot snapshot) { - if (!snapshot.hasData) { - return EMPTY_WIDGET; - } - final bool isUserLoggedIn = snapshot.data!; - if (isUserLoggedIn) { - // TODO(jasmeet): Show leaderboard button. - return EMPTY_WIDGET; - } else { - return _buildSignInButton(context, appLocalizations); - } - }), + future: userManagementProvider.credentialsInStorage(), + builder: + (BuildContext context, AsyncSnapshot snapshot) { + if (!snapshot.hasData) { + return EMPTY_WIDGET; + } + final bool isUserLoggedIn = snapshot.data!; + if (isUserLoggedIn) { + // TODO(jasmeet): Show leaderboard button. + return EMPTY_WIDGET; + } else { + return _buildSignInButton(context, appLocalizations); + } + }, + ), ), if (continueButtonLabel != null) SmoothSimpleButton( @@ -110,9 +111,7 @@ class CongratsWidget extends StatelessWidget { onPressed: () async { await Navigator.push( context, - MaterialPageRoute( - builder: (_) => const LoginPage(), - ), + MaterialPageRoute(builder: (_) => const LoginPage()), ); if (OpenFoodAPIConfiguration.globalUser != null) { if (!context.mounted) { @@ -121,9 +120,7 @@ class CongratsWidget extends StatelessWidget { LoadingDialog.run( context: context, title: appLocalizations.saving_answer, - future: _postInsightAnnotations( - anonymousAnnotationList, - ), + future: _postInsightAnnotations(anonymousAnnotationList), ); } }, diff --git a/packages/smooth_app/lib/pages/hunger_games/question_answers_options.dart b/packages/smooth_app/lib/pages/hunger_games/question_answers_options.dart index ef3e42afaf..f4adab0056 100755 --- a/packages/smooth_app/lib/pages/hunger_games/question_answers_options.dart +++ b/packages/smooth_app/lib/pages/hunger_games/question_answers_options.dart @@ -110,16 +110,10 @@ class QuestionAnswersOptions extends StatelessWidget { style: ButtonStyle( backgroundColor: WidgetStateProperty.all(backgroundColor), shape: WidgetStateProperty.all( - const RoundedRectangleBorder( - borderRadius: ROUNDED_BORDER_RADIUS, - ), + const RoundedRectangleBorder(borderRadius: ROUNDED_BORDER_RADIUS), ), ), - icon: Icon( - iconData, - color: contentColor, - size: 36, - ), + icon: Icon(iconData, color: contentColor, size: 36), label: Text( buttonText, style: theme.textTheme.displayMedium!.apply(color: contentColor), diff --git a/packages/smooth_app/lib/pages/hunger_games/question_card.dart b/packages/smooth_app/lib/pages/hunger_games/question_card.dart index e37dfbbf9f..14ef65f3a7 100755 --- a/packages/smooth_app/lib/pages/hunger_games/question_card.dart +++ b/packages/smooth_app/lib/pages/hunger_games/question_card.dart @@ -12,11 +12,7 @@ import 'package:smooth_app/pages/product/common/product_refresher.dart'; /// Display of a Robotoff question text. class QuestionCard extends StatelessWidget { - const QuestionCard( - this.question, { - this.initialProduct, - super.key, - }); + const QuestionCard(this.question, {this.initialProduct, super.key}); final RobotoffQuestion question; final Product? initialProduct; @@ -32,10 +28,7 @@ class QuestionCard extends StatelessWidget { return FutureBuilder( future: productFuture, - builder: ( - BuildContext context, - AsyncSnapshot snapshot, - ) { + builder: (BuildContext context, AsyncSnapshot snapshot) { Product? product; if (snapshot.connectionState == ConnectionState.done) { product = snapshot.data?.product; @@ -74,11 +67,7 @@ class QuestionCard extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - ProductTitleCard( - product, - true, - dense: true, - ), + ProductTitleCard(product, true, dense: true), ], ), ), @@ -104,10 +93,9 @@ class QuestionCard extends StatelessWidget { padding: const EdgeInsetsDirectional.only(bottom: SMALL_SPACE), child: Text( question.question!, - style: Theme.of(context) - .textTheme - .headlineMedium! - .apply(color: Colors.black), + style: Theme.of( + context, + ).textTheme.headlineMedium!.apply(color: Colors.black), ), ), Container( @@ -118,10 +106,9 @@ class QuestionCard extends StatelessWidget { padding: const EdgeInsets.all(SMALL_SPACE), child: Text( question.value!, - style: Theme.of(context) - .textTheme - .headlineMedium! - .apply(color: Colors.white), + style: Theme.of( + context, + ).textTheme.headlineMedium!.apply(color: Colors.white), ), ), ], @@ -144,17 +131,13 @@ class QuestionCard extends StatelessWidget { } Widget _buildQuestionShimmer() => Shimmer.fromColors( - baseColor: robotoffBackground, - highlightColor: Colors.white, - child: Card( - elevation: 4, - clipBehavior: Clip.antiAlias, - shape: const RoundedRectangleBorder( - borderRadius: ROUNDED_BORDER_RADIUS, - ), - child: Container( - height: LARGE_SPACE * 10, - ), - ), - ); + baseColor: robotoffBackground, + highlightColor: Colors.white, + child: Card( + elevation: 4, + clipBehavior: Clip.antiAlias, + shape: const RoundedRectangleBorder(borderRadius: ROUNDED_BORDER_RADIUS), + child: Container(height: LARGE_SPACE * 10), + ), + ); } diff --git a/packages/smooth_app/lib/pages/hunger_games/question_image_full_page.dart b/packages/smooth_app/lib/pages/hunger_games/question_image_full_page.dart index a2930940e0..0ca3cea07f 100644 --- a/packages/smooth_app/lib/pages/hunger_games/question_image_full_page.dart +++ b/packages/smooth_app/lib/pages/hunger_games/question_image_full_page.dart @@ -16,28 +16,28 @@ class QuestionImageFullPage extends StatelessWidget { @override Widget build(BuildContext context) => Scaffold( - appBar: SmoothAppBar( - title: AutoSizeText( - '${question.question!} (${question.value!})', - maxLines: 2, - ), - ), - body: ConstrainedBox( - constraints: const BoxConstraints.expand(), - child: InteractiveViewer( - minScale: 0.1, - maxScale: 5, - child: HeroMode( - enabled: heroTag?.isNotEmpty == true, - child: Hero( - tag: heroTag ?? '', - child: Image( - fit: BoxFit.contain, - image: NetworkImage(question.imageUrl!), - ), - ), + appBar: SmoothAppBar( + title: AutoSizeText( + '${question.question!} (${question.value!})', + maxLines: 2, + ), + ), + body: ConstrainedBox( + constraints: const BoxConstraints.expand(), + child: InteractiveViewer( + minScale: 0.1, + maxScale: 5, + child: HeroMode( + enabled: heroTag?.isNotEmpty == true, + child: Hero( + tag: heroTag ?? '', + child: Image( + fit: BoxFit.contain, + image: NetworkImage(question.imageUrl!), ), ), ), - ); + ), + ), + ); } diff --git a/packages/smooth_app/lib/pages/hunger_games/question_image_thumbnail.dart b/packages/smooth_app/lib/pages/hunger_games/question_image_thumbnail.dart index a4f57e819a..b0da2e920a 100644 --- a/packages/smooth_app/lib/pages/hunger_games/question_image_thumbnail.dart +++ b/packages/smooth_app/lib/pages/hunger_games/question_image_thumbnail.dart @@ -11,30 +11,26 @@ class QuestionImageThumbnail extends StatelessWidget { @override Widget build(BuildContext context) => Container( - margin: const EdgeInsets.fromLTRB(0, 0, 5, 0), - decoration: const BoxDecoration(color: Colors.black12), - child: GestureDetector( - onTap: () async => Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => - QuestionImageFullPage(question: question), - fullscreenDialog: true, - ), - ), - child: Image( - image: NetworkImage(question.imageUrl!), - fit: BoxFit.cover, - height: double.infinity, - errorBuilder: (_, __, ___) => EMPTY_WIDGET, - loadingBuilder: ( - _, - Widget child, - ImageChunkEvent? progress, - ) => - progress == null - ? child - : const CircularProgressIndicator.adaptive(), - ), + margin: const EdgeInsets.fromLTRB(0, 0, 5, 0), + decoration: const BoxDecoration(color: Colors.black12), + child: GestureDetector( + onTap: () async => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => + QuestionImageFullPage(question: question), + fullscreenDialog: true, ), - ); + ), + child: Image( + image: NetworkImage(question.imageUrl!), + fit: BoxFit.cover, + height: double.infinity, + errorBuilder: (_, __, ___) => EMPTY_WIDGET, + loadingBuilder: (_, Widget child, ImageChunkEvent? progress) => + progress == null + ? child + : const CircularProgressIndicator.adaptive(), + ), + ), + ); } diff --git a/packages/smooth_app/lib/pages/hunger_games/question_page.dart b/packages/smooth_app/lib/pages/hunger_games/question_page.dart index 4dac2e5e50..0db301cb33 100755 --- a/packages/smooth_app/lib/pages/hunger_games/question_page.dart +++ b/packages/smooth_app/lib/pages/hunger_games/question_page.dart @@ -19,10 +19,7 @@ import 'package:smooth_app/query/questions_query.dart'; import 'package:smooth_app/query/random_questions_query.dart'; class QuestionsPage extends StatefulWidget { - const QuestionsPage({ - this.product, - this.questions, - }); + const QuestionsPage({this.product, this.questions}); final Product? product; final List? questions; @@ -60,9 +57,7 @@ class _QuestionsPageState extends State _loadQuestions(); } - Future _loadQuestions({ - Future>? request, - }) async { + Future _loadQuestions({Future>? request}) async { _updateState(const _RobotoffQuestionLoadingState()); final List? widgetQuestions = widget.questions; @@ -73,10 +68,10 @@ class _QuestionsPageState extends State request ?? switch (widgetQuestions) { null => _questionsQuery.getQuestions( - _localDatabase, - _numberQuestionsInit, - ), - _ => Future>.value(widgetQuestions) + _localDatabase, + _numberQuestionsInit, + ), + _ => Future>.value(widgetQuestions), }, ); @@ -101,12 +96,14 @@ class _QuestionsPageState extends State _state = const _RobotoffQuestionLoadingState(); }); } - unawaited(_loadQuestions( - request: _questionsQuery.getQuestions( - _localDatabase, - _numberQuestionsNext, + unawaited( + _loadQuestions( + request: _questionsQuery.getQuestions( + _localDatabase, + _numberQuestionsNext, + ), ), - )); + ); _currentQuestionIndex = 0; } catch (e) { _updateState(_RobotoffQuestionErrorState(Exception(e.toString()))); @@ -116,58 +113,58 @@ class _QuestionsPageState extends State @override Widget build(BuildContext context) { return ChangeNotifierProvider<_QuestionsAnsweredNotifier>( - create: (BuildContext context) => _QuestionsAnsweredNotifier(), - child: Scaffold( - appBar: AppBar( - title: const Text('Hunger Games'), - leading: IconButton( - icon: const Icon(Icons.close), - onPressed: () => Navigator.of(context).pop(_questionsAnswered), - ), + create: (BuildContext context) => _QuestionsAnsweredNotifier(), + child: Scaffold( + appBar: AppBar( + title: const Text('Hunger Games'), + leading: IconButton( + icon: const Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(_questionsAnswered), ), - body: SafeArea( - child: Center( - child: AnimatedSwitcher( - duration: SmoothAnimationsDuration.medium, - transitionBuilder: (Widget child, Animation animation) { - final Offset animationStartOffset = - _getAnimationStartOffset(); - final Animation inAnimation = Tween( - begin: animationStartOffset, - end: Offset.zero, - ).animate(animation); - final Animation outAnimation = Tween( - begin: animationStartOffset.scale(-1, -1), - end: Offset.zero, - ).animate(animation); + ), + body: SafeArea( + child: Center( + child: AnimatedSwitcher( + duration: SmoothAnimationsDuration.medium, + transitionBuilder: (Widget child, Animation animation) { + final Offset animationStartOffset = _getAnimationStartOffset(); + final Animation inAnimation = Tween( + begin: animationStartOffset, + end: Offset.zero, + ).animate(animation); + final Animation outAnimation = Tween( + begin: animationStartOffset.scale(-1, -1), + end: Offset.zero, + ).animate(animation); - return ClipRect( - child: SlideTransition( - position: - child.key == ValueKey(_currentQuestionIndex) - ? inAnimation - : outAnimation, - child: Padding( - padding: const EdgeInsets.all(SMALL_SPACE), - child: child, - ), + return ClipRect( + child: SlideTransition( + position: child.key == ValueKey(_currentQuestionIndex) + ? inAnimation + : outAnimation, + child: Padding( + padding: const EdgeInsets.all(SMALL_SPACE), + child: child, ), - ); + ), + ); + }, + child: KeyedSubtree( + key: ValueKey(_currentQuestionIndex), + child: switch (_state) { + _RobotoffQuestionLoadingState _ => + const _LoadingQuestionsView(), + _RobotoffQuestionSuccessState _ => _buildQuestionsWidget(), + _RobotoffQuestionErrorState _ => _ErrorLoadingView( + onRetry: _loadQuestions, + ), }, - child: KeyedSubtree( - key: ValueKey(_currentQuestionIndex), - child: switch (_state) { - _RobotoffQuestionLoadingState _ => - const _LoadingQuestionsView(), - _RobotoffQuestionSuccessState _ => _buildQuestionsWidget(), - _RobotoffQuestionErrorState _ => - _ErrorLoadingView(onRetry: _loadQuestions), - }, - ), ), ), ), - )); + ), + ), + ); } Widget _buildQuestionsWidget() { @@ -287,18 +284,19 @@ class _LoadingQuestionsView extends StatelessWidget { Text( appLocalizations.hunger_games_loading_line1, style: theme.textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.bold, fontSize: 19.0), + fontWeight: FontWeight.bold, + fontSize: 19.0, + ), ), SizedBox(height: screenHeight * 0.05), - LinearProgressIndicator( - color: colorScheme.primary, - ), + LinearProgressIndicator(color: colorScheme.primary), SizedBox(height: screenHeight * 0.10), Text( appLocalizations.hunger_games_loading_line2, textAlign: TextAlign.center, - style: - theme.textTheme.bodyLarge?.copyWith(fontSize: 17.0), + style: theme.textTheme.bodyLarge?.copyWith( + fontSize: 17.0, + ), ), ], ), @@ -328,16 +326,8 @@ class _QuestionView extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.max, children: [ - Expanded( - child: QuestionCard( - question, - initialProduct: initialProduct, - ), - ), - QuestionAnswersOptions( - question, - onAnswer: onAnswer, - ), + Expanded(child: QuestionCard(question, initialProduct: initialProduct)), + QuestionAnswersOptions(question, onAnswer: onAnswer), ], ); } @@ -357,7 +347,8 @@ class _QuestionsSuccessView extends StatelessWidget { return CongratsWidget( continueButtonLabel: onContinue != null ? AppLocalizations.of(context).robotoff_next_n_questions( - _QuestionsPageState._numberQuestionsNext) + _QuestionsPageState._numberQuestionsNext, + ) : null, anonymousAnnotationList: anonymousAnnotationList, onContinue: onContinue, @@ -367,9 +358,7 @@ class _QuestionsSuccessView extends StatelessWidget { } class _ErrorLoadingView extends StatelessWidget { - const _ErrorLoadingView({ - required this.onRetry, - }); + const _ErrorLoadingView({required this.onRetry}); final VoidCallback onRetry; @@ -383,7 +372,8 @@ class _ErrorLoadingView extends StatelessWidget { return Center( child: DefaultTextStyle( textAlign: TextAlign.center, - style: textTheme.bodyLarge?.copyWith( + style: + textTheme.bodyLarge?.copyWith( fontWeight: FontWeight.bold, fontSize: 20.0, color: colorScheme.onSurface, @@ -404,10 +394,7 @@ class _ErrorLoadingView extends StatelessWidget { const SizedBox(height: VERY_LARGE_SPACE), SmoothLargeButtonWithIcon( text: appLocalizations.hunger_games_error_retry_button, - leadingIcon: Icon( - Icons.refresh, - color: colorScheme.onPrimary, - ), + leadingIcon: Icon(Icons.refresh, color: colorScheme.onPrimary), onPressed: onRetry, textStyle: textTheme.labelLarge?.copyWith( fontSize: 18.0, @@ -431,7 +418,8 @@ class _QuestionsAnsweredNotifier extends ValueNotifier { value++; } - static _QuestionsAnsweredNotifier of(BuildContext context, - {bool listen = true}) => - Provider.of<_QuestionsAnsweredNotifier>(context, listen: listen); + static _QuestionsAnsweredNotifier of( + BuildContext context, { + bool listen = true, + }) => Provider.of<_QuestionsAnsweredNotifier>(context, listen: listen); } diff --git a/packages/smooth_app/lib/pages/image/product_image_gallery_other_view.dart b/packages/smooth_app/lib/pages/image/product_image_gallery_other_view.dart index 6ba6a6281f..3e856d0ea3 100644 --- a/packages/smooth_app/lib/pages/image/product_image_gallery_other_view.dart +++ b/packages/smooth_app/lib/pages/image/product_image_gallery_other_view.dart @@ -61,47 +61,48 @@ class _ProductImageGalleryOtherViewState final double squareSize = _getSquareSize(context); return FutureBuilder( future: _loadOtherPics(product), - builder: ( - final BuildContext context, - final AsyncSnapshot snapshot, - ) { - if (snapshot.connectionState != ConnectionState.done) { - return SliverToBoxAdapter( - child: Center( - child: SizedBox( - width: squareSize, - height: squareSize, - child: const CircularProgressIndicator.adaptive(), - ), - ), - ); - } - if (snapshot.data == null) { - return SliverToBoxAdapter( - child: Text( - snapshot.error?.toString() ?? - appLocalizations.loading_dialog_default_error_message, - ), - ); - } - final FetchedProduct fetchedProduct = snapshot.data!; - if (fetchedProduct.product != null) { - rawImages = getRawProductImages( - fetchedProduct.product!, - ImageSize.DISPLAY, - ); - } - if (rawImages.isNotEmpty) { - widget.onPhotosAvailable(true); - return _RawGridGallery( - fetchedProduct.product ?? product, - rawImages, - ); - } + builder: + ( + final BuildContext context, + final AsyncSnapshot snapshot, + ) { + if (snapshot.connectionState != ConnectionState.done) { + return SliverToBoxAdapter( + child: Center( + child: SizedBox( + width: squareSize, + height: squareSize, + child: const CircularProgressIndicator.adaptive(), + ), + ), + ); + } + if (snapshot.data == null) { + return SliverToBoxAdapter( + child: Text( + snapshot.error?.toString() ?? + appLocalizations.loading_dialog_default_error_message, + ), + ); + } + final FetchedProduct fetchedProduct = snapshot.data!; + if (fetchedProduct.product != null) { + rawImages = getRawProductImages( + fetchedProduct.product!, + ImageSize.DISPLAY, + ); + } + if (rawImages.isNotEmpty) { + widget.onPhotosAvailable(true); + return _RawGridGallery( + fetchedProduct.product ?? product, + rawImages, + ); + } - widget.onPhotosAvailable(false); - return const SliverToBoxAdapter(child: EMPTY_WIDGET); - }, + widget.onPhotosAvailable(false); + return const SliverToBoxAdapter(child: EMPTY_WIDGET); + }, ); } } @@ -116,8 +117,8 @@ class _RawGridGallery extends StatelessWidget { Widget build(BuildContext context) { final double squareSize = _getSquareSize(context); final ImageSize? imageSize = _computeImageSize(squareSize); - final OpenFoodFactsLanguage language = - context.read(); + final OpenFoodFactsLanguage language = context + .read(); return SliverGrid( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( @@ -168,8 +169,9 @@ class _RawGridGallery extends StatelessWidget { top: 0.0, end: 0.0, child: Tooltip( - message: AppLocalizations.of(context) - .photo_viewer_use_picture_as_tooltip, + message: AppLocalizations.of( + context, + ).photo_viewer_use_picture_as_tooltip, child: Material( type: MaterialType.transparency, child: InkWell( @@ -200,10 +202,11 @@ class _RawGridGallery extends StatelessWidget { ); } - ImageSize? _computeImageSize(double squareSize) => [ + ImageSize? _computeImageSize(double squareSize) => + [ ImageSize.THUMB, ImageSize.SMALL, - ImageSize.DISPLAY + ImageSize.DISPLAY, ].firstWhereOrNull( (ImageSize element) => squareSize <= int.parse(element.number), ); @@ -239,11 +242,10 @@ class _RawGridGallery extends StatelessWidget { required final ProductImage productImage, required final String heroTag, required final OpenFoodFactsLanguage language, - }) => - ProductImageOtherPage.usePhotoAs( - context: context, - product: product, - language: language, - productImage: productImage, - ); + }) => ProductImageOtherPage.usePhotoAs( + context: context, + product: product, + language: language, + productImage: productImage, + ); } diff --git a/packages/smooth_app/lib/pages/image/product_image_other_page.dart b/packages/smooth_app/lib/pages/image/product_image_other_page.dart index f60e70adee..b24fac9ef0 100644 --- a/packages/smooth_app/lib/pages/image/product_image_other_page.dart +++ b/packages/smooth_app/lib/pages/image/product_image_other_page.dart @@ -45,13 +45,13 @@ class ProductImageOtherPage extends StatefulWidget { required final ProductImage productImage, }) async { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final List imageFields = ImageFieldSmoothieExtension.getOrderedMainImageFields( - product.productType, - ); + product.productType, + ); final Widget existingPictureIcon = icons.Picture.check( color: extension.success, @@ -62,56 +62,60 @@ class ProductImageOtherPage extends StatefulWidget { semanticLabel: appLocalizations.photo_missing, ); - final ImageField? selectedImageField = - await showSmoothListOfChoicesModalSheet( + final ImageField? + selectedImageField = await showSmoothListOfChoicesModalSheet( context: context, title: appLocalizations.photo_viewer_use_picture_as_title( Languages().getNameInLanguage(language), ), - padding: const EdgeInsetsDirectional.only( - start: 15.0, - end: 19.0, - ), - labels: imageFields.map((final ImageField imageField) { - return switch (imageField) { - ImageField.FRONT => appLocalizations.photo_field_front, - ImageField.INGREDIENTS => appLocalizations.photo_field_ingredients, - ImageField.NUTRITION => appLocalizations.photo_field_nutrition, - ImageField.PACKAGING => appLocalizations.photo_field_packaging, - ImageField.OTHER => throw UnimplementedError(), - }; - }).toList(growable: false), + padding: const EdgeInsetsDirectional.only(start: 15.0, end: 19.0), + labels: imageFields + .map((final ImageField imageField) { + return switch (imageField) { + ImageField.FRONT => appLocalizations.photo_field_front, + ImageField.INGREDIENTS => + appLocalizations.photo_field_ingredients, + ImageField.NUTRITION => appLocalizations.photo_field_nutrition, + ImageField.PACKAGING => appLocalizations.photo_field_packaging, + ImageField.OTHER => throw UnimplementedError(), + }; + }) + .toList(growable: false), values: imageFields, - prefixIcons: imageFields.map((final ImageField imageField) { - return switch (imageField) { - ImageField.FRONT => const icons.Milk.happy(), - ImageField.INGREDIENTS => const icons.Ingredients.alt(), - ImageField.NUTRITION => const icons.NutritionFacts(), - ImageField.PACKAGING => const icons.Recycling(), - ImageField.OTHER => throw UnimplementedError(), - }; - }).toList(growable: false), - suffixIcons: imageFields.map((final ImageField imageField) { - final bool exists = TransientFile.fromProduct( - product, - imageField, - language, - ).isImageAvailable(); - return exists ? existingPictureIcon : missingPictureIcon; - }).toList(growable: false), + prefixIcons: imageFields + .map((final ImageField imageField) { + return switch (imageField) { + ImageField.FRONT => const icons.Milk.happy(), + ImageField.INGREDIENTS => const icons.Ingredients.alt(), + ImageField.NUTRITION => const icons.NutritionFacts(), + ImageField.PACKAGING => const icons.Recycling(), + ImageField.OTHER => throw UnimplementedError(), + }; + }) + .toList(growable: false), + suffixIcons: imageFields + .map((final ImageField imageField) { + final bool exists = TransientFile.fromProduct( + product, + imageField, + language, + ).isImageAvailable(); + return exists ? existingPictureIcon : missingPictureIcon; + }) + .toList(growable: false), ); if (context.mounted && selectedImageField != null) { final CropParameters? cropParameters = await UploadedImageGallery.useExistingPhotoFor( - context: context, - rawImage: productImage, - barcode: product.barcode!, - imageField: selectedImageField, - isLoggedInMandatory: true, - productType: product.productType, - language: language, - ); + context: context, + rawImage: productImage, + barcode: product.barcode!, + imageField: selectedImageField, + isLoggedInMandatory: true, + productType: product.productType, + language: language, + ); if (cropParameters != null) { return ProductImagePageResult( @@ -161,25 +165,24 @@ class _ProductImageOtherPageState extends State { Positioned.fill( child: PageView( controller: _pageController, - children: widget.images.map( - (final ProductImage image) { - return _ProductImageViewer( - image: image, - barcode: widget.product.barcode!, - language: widget.language, - heroTag: - widget.currentImage == image ? widget.heroTag : null, - productType: widget.product.productType, - ); - }, - ).toList(growable: false), + children: widget.images + .map((final ProductImage image) { + return _ProductImageViewer( + image: image, + barcode: widget.product.barcode!, + language: widget.language, + heroTag: widget.currentImage == image + ? widget.heroTag + : null, + productType: widget.product.productType, + ); + }) + .toList(growable: false), ), ), Positioned( top: SMALL_SPACE, - child: _ProductImagePageIndicator( - items: widget.images.length, - ), + child: _ProductImagePageIndicator(items: widget.images.length), ), ], ), @@ -218,8 +221,9 @@ class _ProductImageViewer extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; return Stack( children: [ @@ -238,26 +242,24 @@ class _ProductImageViewer extends StatelessWidget { ), ), fit: BoxFit.contain, - loadingBuilder: ( - _, - final Widget child, - final ImageChunkEvent? loadingProgress, - ) { - if (loadingProgress != null) { - return const Center( - child: CircularProgressIndicator.adaptive(), - ); - } else { - return child; - } - }, + loadingBuilder: + ( + _, + final Widget child, + final ImageChunkEvent? loadingProgress, + ) { + if (loadingProgress != null) { + return const Center( + child: CircularProgressIndicator.adaptive(), + ); + } else { + return child; + } + }, errorBuilder: (_, __, ___) => Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const icons.Warning( - size: 48.0, - color: Colors.red, - ), + const icons.Warning(size: 48.0, color: Colors.red), const SizedBox(height: SMALL_SPACE), Text(AppLocalizations.of(context).error_loading_photo), ], @@ -290,9 +292,7 @@ class _ProductImageViewer extends StatelessWidget { } class _ProductImageOutdatedLabel extends StatelessWidget { - const _ProductImageOutdatedLabel({ - required this.colors, - }); + const _ProductImageOutdatedLabel({required this.colors}); final SmoothColorsThemeExtension colors; @@ -310,17 +310,11 @@ class _ProductImageOutdatedLabel extends StatelessWidget { padding: const EdgeInsets.all(SMALL_SPACE), child: Row( children: [ - const icons.Outdated( - size: 18.0, - color: Colors.white, - ), + const icons.Outdated(size: 18.0, color: Colors.white), const SizedBox(width: SMALL_SPACE), Text( AppLocalizations.of(context).product_image_outdated, - style: const TextStyle( - fontSize: 13.0, - color: Colors.white, - ), + style: const TextStyle(fontSize: 13.0, color: Colors.white), ), ], ), @@ -345,12 +339,11 @@ class _ProductImageDetailsButton extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final String url = image.url ?? + final String url = + image.url ?? image.getUrl( barcode, - uriHelper: ProductQuery.getUriProductHelper( - productType: productType, - ), + uriHelper: ProductQuery.getUriProductHelper(productType: productType), ); return DecoratedBox( @@ -364,61 +357,67 @@ class _ProductImageDetailsButton extends StatelessWidget { borderRadius: CIRCULAR_BORDER_RADIUS, onTap: () { showSmoothModalSheet( - context: context, - builder: (BuildContext lContext) { - return SmoothModalSheet( - title: appLocalizations.photo_viewer_details_title, - bodyPadding: EdgeInsets.zero, - body: Column( - children: [ - ListTile( - title: Text( - appLocalizations - .photo_viewer_details_contributor_title, - ), - subtitle: Text(image.contributor ?? '-'), + context: context, + builder: (BuildContext lContext) { + return SmoothModalSheet( + title: appLocalizations.photo_viewer_details_title, + bodyPadding: EdgeInsets.zero, + body: Column( + children: [ + ListTile( + title: Text( + appLocalizations + .photo_viewer_details_contributor_title, ), - const Divider(), - ListTile( - title: Text( - appLocalizations.photo_viewer_details_date_title), - subtitle: Text(image.uploaded != null + subtitle: Text(image.contributor ?? '-'), + ), + const Divider(), + ListTile( + title: Text( + appLocalizations.photo_viewer_details_date_title, + ), + subtitle: Text( + image.uploaded != null ? DateFormat.yMMMMEEEEd().format(image.uploaded!) - : '-'), + : '-', ), + ), + const Divider(), + ListTile( + title: Text( + appLocalizations.photo_viewer_details_size_title, + ), + subtitle: Text( + image.width != null && image.height != null + ? appLocalizations + .photo_viewer_details_size_value( + image.width!, + image.height!, + ) + : '-', + ), + ), + if (url.isNotEmpty) ...[ const Divider(), ListTile( title: Text( - appLocalizations.photo_viewer_details_size_title), - subtitle: Text( - image.width != null && image.height != null - ? appLocalizations - .photo_viewer_details_size_value( - image.width!, - image.height!, - ) - : '-', + appLocalizations.photo_viewer_details_url_title, ), - ), - if (url.isNotEmpty) ...[ - const Divider(), - ListTile( - title: Text(appLocalizations - .photo_viewer_details_url_title), - subtitle: Text(url), - trailing: const Icon(Icons.open_in_new_rounded), - onTap: () { - LaunchUrlHelper.launchURL(url); - }, - ) - ], - SizedBox( - height: MediaQuery.viewPaddingOf(context).bottom, + subtitle: Text(url), + trailing: const Icon(Icons.open_in_new_rounded), + onTap: () { + LaunchUrlHelper.launchURL(url); + }, ), ], - ), - ); - }); + SizedBox( + height: MediaQuery.viewPaddingOf(context).bottom, + ), + ], + ), + ); + }, + ); }, child: Padding( padding: const EdgeInsetsDirectional.only( @@ -434,16 +433,11 @@ class _ProductImageDetailsButton extends StatelessWidget { excludeSemantics: true, child: Row( children: [ - const icons.Info( - size: 15.0, - color: Colors.white, - ), + const icons.Info(size: 15.0, color: Colors.white), const SizedBox(width: SMALL_SPACE), Text( appLocalizations.photo_viewer_details_button, - style: const TextStyle( - color: Colors.white, - ), + style: const TextStyle(color: Colors.white), ), ], ), @@ -475,8 +469,8 @@ class _ProductImagePageIndicator extends StatelessWidget { return 0; } - final int page = - (value.offset / value.position.viewportDimension).round(); + final int page = (value.offset / value.position.viewportDimension) + .round(); if (page < 0) { return 0; } else if (page > items - 1) { diff --git a/packages/smooth_app/lib/pages/image/product_image_widget.dart b/packages/smooth_app/lib/pages/image/product_image_widget.dart index 01fdf4a8d4..ec92aade52 100644 --- a/packages/smooth_app/lib/pages/image/product_image_widget.dart +++ b/packages/smooth_app/lib/pages/image/product_image_widget.dart @@ -34,23 +34,22 @@ class ProductImageWidget extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - context.extension(); + final SmoothColorsThemeExtension colors = context + .extension(); final AppLocalizations appLocalizations = AppLocalizations.of(context); - final DateFormat dateFormat = - DateFormat.yMd(ProductQuery.getLanguage().offTag); + final DateFormat dateFormat = DateFormat.yMd( + ProductQuery.getLanguage().offTag, + ); final Widget image = SmoothImage( - cacheHeight: - (squareSize * MediaQuery.devicePixelRatioOf(context)).toInt(), + cacheHeight: (squareSize * MediaQuery.devicePixelRatioOf(context)) + .toInt(), width: squareSize, height: squareSize, imageProvider: NetworkImage( productImage.getUrl( barcode, - uriHelper: ProductQuery.getUriProductHelper( - productType: productType, - ), + uriHelper: ProductQuery.getUriProductHelper(productType: productType), imageSize: imageSize, ), ), @@ -79,9 +78,7 @@ class ProductImageWidget extends StatelessWidget { borderRadius: ANGULAR_BORDER_RADIUS, child: Column( children: [ - Expanded( - child: image, - ), + Expanded(child: image), SizedBox( width: double.infinity, child: Padding( @@ -112,7 +109,7 @@ class ProductImageWidget extends StatelessWidget { ], ), ), - ) + ), ], ), ), diff --git a/packages/smooth_app/lib/pages/image/uploaded_image_gallery.dart b/packages/smooth_app/lib/pages/image/uploaded_image_gallery.dart index 8950fd0225..16c381ec25 100644 --- a/packages/smooth_app/lib/pages/image/uploaded_image_gallery.dart +++ b/packages/smooth_app/lib/pages/image/uploaded_image_gallery.dart @@ -47,14 +47,13 @@ class UploadedImageGallery extends StatelessWidget { brightness: Brightness.light, appBar: SmoothAppBar( title: Text(appLocalizations.edit_photo_select_existing_all_label), - subTitle: - Text(appLocalizations.edit_photo_select_existing_all_subtitle), + subTitle: Text( + appLocalizations.edit_photo_select_existing_all_subtitle, + ), backgroundColor: Colors.black, foregroundColor: WHITE_COLOR, elevation: 0, - leading: const SmoothBackButton( - iconColor: Colors.white, - ), + leading: const SmoothBackButton(iconColor: Colors.white), ), body: GridView.builder( itemCount: rawImages.length, @@ -93,16 +92,16 @@ class UploadedImageGallery extends StatelessWidget { borderRadius: ANGULAR_BORDER_RADIUS, onTap: () async => Navigator.of(context).pop( - await useExistingPhotoFor( - context: context, - rawImage: rawImage, - barcode: barcode, - imageField: imageField, - isLoggedInMandatory: isLoggedInMandatory, - productType: productType, - language: language, - ), - ), + await useExistingPhotoFor( + context: context, + rawImage: rawImage, + barcode: barcode, + imageField: imageField, + isLoggedInMandatory: isLoggedInMandatory, + productType: productType, + language: language, + ), + ), ), ), ), @@ -130,9 +129,7 @@ class UploadedImageGallery extends StatelessWidget { rawImage.getUrl( barcode, imageSize: ImageSize.ORIGINAL, - uriHelper: ProductQuery.getUriProductHelper( - productType: productType, - ), + uriHelper: ProductQuery.getUriProductHelper(productType: productType), ), DaoInt(localDatabase), ); diff --git a/packages/smooth_app/lib/pages/image_crop_page.dart b/packages/smooth_app/lib/pages/image_crop_page.dart index 47d48c3270..b2dc30b434 100644 --- a/packages/smooth_app/lib/pages/image_crop_page.dart +++ b/packages/smooth_app/lib/pages/image_crop_page.dart @@ -78,10 +78,7 @@ Future pickImageFile( if (!context.mounted) { return null; } - return innerPickImageFile( - context, - ignorePlatformException: true, - ); + return innerPickImageFile(context, ignorePlatformException: true); } } @@ -99,23 +96,24 @@ Future _getUserPictureSource( } return showSmoothModalSheet( - context: context, - builder: (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); + context: context, + builder: (BuildContext context) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); - return SmoothModalSheet( - title: appLocalizations.choose_image_source_title, - closeButton: true, - closeButtonSemanticsOrder: 5.0, - body: const _ImageSourcePicker(), - bodyPadding: const EdgeInsetsDirectional.only( - start: BALANCED_SPACE, - end: MEDIUM_SPACE, - top: LARGE_SPACE, - bottom: MEDIUM_SPACE, - ), - ); - }); + return SmoothModalSheet( + title: appLocalizations.choose_image_source_title, + closeButton: true, + closeButtonSemanticsOrder: 5.0, + body: const _ImageSourcePicker(), + bodyPadding: const EdgeInsetsDirectional.only( + start: BALANCED_SPACE, + end: MEDIUM_SPACE, + top: LARGE_SPACE, + bottom: MEDIUM_SPACE, + ), + ); + }, + ); } class _ImageSourcePicker extends StatefulWidget { @@ -192,14 +190,13 @@ class _ImageSourcePickerState extends State<_ImageSourcePicker> { activeColor: Theme.of(context).primaryColor, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, value: rememberChoice, - onChanged: (final bool? value) => setState( - () => rememberChoice = value ?? false, - ), + onChanged: (final bool? value) => + setState(() => rememberChoice = value ?? false), ), ), Expanded( child: Text(appLocalizations.user_picture_source_remember), - ) + ), ], ), ), @@ -244,8 +241,8 @@ class _ImageSourceButton extends StatelessWidget { color: context.lightTheme() ? primaryColor : context - .extension() - .primaryLight, + .extension() + .primaryLight, ), ), padding: const WidgetStatePropertyAll( @@ -281,18 +278,17 @@ Future confirmAndUploadNewPicture( required final OpenFoodFactsLanguage language, required final bool isLoggedInMandatory, final UserPictureSource? forcedSource, -}) async => - confirmAndUploadNewImage( - context, - cropHelper: ProductCropNewHelper( - imageField: imageField, - language: language, - barcode: barcode, - productType: productType, - ), - isLoggedInMandatory: isLoggedInMandatory, - forcedSource: forcedSource, - ); +}) async => confirmAndUploadNewImage( + context, + cropHelper: ProductCropNewHelper( + imageField: imageField, + language: language, + barcode: barcode, + productType: productType, + ), + isLoggedInMandatory: isLoggedInMandatory, + forcedSource: forcedSource, +); /// Lets the user pick a picture, crop it, and save it. Future confirmAndUploadNewImage( @@ -330,31 +326,32 @@ Future confirmAndUploadNewImage( Future _onGalleryAccessDenied(final BuildContext context) { return showDialog( - context: context, - builder: (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); - return SmoothSimpleErrorAlertDialog( - title: appLocalizations.gallery_source_access_denied_dialog_title, - message: - appLocalizations.gallery_source_access_denied_dialog_message_ios, - positiveAction: SmoothActionButton( - text: appLocalizations.gallery_source_access_denied_dialog_button, - onPressed: () async { - await AppSettings.openAppSettings(); - if (context.mounted) { - Navigator.of(context).maybePop(true); - } - }, - ), - negativeAction: SmoothActionButton( - text: appLocalizations.close, - onPressed: () { - Navigator.of(context).maybePop(false); - }, - ), - actionsAxis: Axis.vertical, - ); - }); + context: context, + builder: (BuildContext context) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + return SmoothSimpleErrorAlertDialog( + title: appLocalizations.gallery_source_access_denied_dialog_title, + message: + appLocalizations.gallery_source_access_denied_dialog_message_ios, + positiveAction: SmoothActionButton( + text: appLocalizations.gallery_source_access_denied_dialog_button, + onPressed: () async { + await AppSettings.openAppSettings(); + if (context.mounted) { + Navigator.of(context).maybePop(true); + } + }, + ), + negativeAction: SmoothActionButton( + text: appLocalizations.close, + onPressed: () { + Navigator.of(context).maybePop(false); + }, + ), + actionsAxis: Axis.vertical, + ); + }, + ); } /// Downloads an image URL into a file, with a dialog. @@ -401,8 +398,10 @@ Future _downloadImageFile(DaoInt daoInt, String url) async { const String CROP_IMAGE_SEQUENCE_KEY = 'crop_image_sequence'; - final int sequenceNumber = - await getNextSequenceNumber(daoInt, CROP_IMAGE_SEQUENCE_KEY); + final int sequenceNumber = await getNextSequenceNumber( + daoInt, + CROP_IMAGE_SEQUENCE_KEY, + ); final File file = File('${tempDirectory.path}/editing_image_$sequenceNumber'); diff --git a/packages/smooth_app/lib/pages/input/debounced_text_editing_controller.dart b/packages/smooth_app/lib/pages/input/debounced_text_editing_controller.dart index 6cd6a6ba86..ae525642fd 100644 --- a/packages/smooth_app/lib/pages/input/debounced_text_editing_controller.dart +++ b/packages/smooth_app/lib/pages/input/debounced_text_editing_controller.dart @@ -26,10 +26,7 @@ class DebouncedTextEditingController extends TextEditingController { _debounce!.cancel(); } - _debounce = Timer( - debounceTime, - () => super.notifyListeners(), - ); + _debounce = Timer(debounceTime, () => super.notifyListeners()); } @override diff --git a/packages/smooth_app/lib/pages/input/smooth_autocomplete_text_field.dart b/packages/smooth_app/lib/pages/input/smooth_autocomplete_text_field.dart index 03833f8531..d507f62563 100644 --- a/packages/smooth_app/lib/pages/input/smooth_autocomplete_text_field.dart +++ b/packages/smooth_app/lib/pages/input/smooth_autocomplete_text_field.dart @@ -88,96 +88,103 @@ class _SmoothAutocompleteTextFieldState optionsBuilder: (final TextEditingValue value) { return _getSuggestions(value.text); }, - fieldViewBuilder: (BuildContext context, - TextEditingController textEditingController, - FocusNode focusNode, - VoidCallback onFieldSubmitted) => - TextField( - maxLines: 1, - controller: widget.controller, - onChanged: (_) { - if (mounted) { - setState(() => _selectedSearch = null); - } - }, - inputFormatters: [ - if (!widget.allowEmojis) - FilteringTextInputFormatter.deny(TextHelper.emojiRegex), - ], - textCapitalization: - widget.textCapitalization ?? TextCapitalization.none, - style: widget.textStyle ?? - DefaultTextStyle.of(context).style.copyWith(fontSize: 15.0), - decoration: InputDecoration( - contentPadding: widget.padding ?? - const EdgeInsets.symmetric( - horizontal: SMALL_SPACE, - vertical: SMALL_SPACE, + fieldViewBuilder: + ( + BuildContext context, + TextEditingController textEditingController, + FocusNode focusNode, + VoidCallback onFieldSubmitted, + ) => TextField( + maxLines: 1, + controller: widget.controller, + onChanged: (_) { + if (mounted) { + setState(() => _selectedSearch = null); + } + }, + inputFormatters: [ + if (!widget.allowEmojis) + FilteringTextInputFormatter.deny(TextHelper.emojiRegex), + ], + textCapitalization: + widget.textCapitalization ?? TextCapitalization.none, + style: + widget.textStyle ?? + DefaultTextStyle.of(context).style.copyWith(fontSize: 15.0), + decoration: InputDecoration( + contentPadding: + widget.padding ?? + const EdgeInsets.symmetric( + horizontal: SMALL_SPACE, + vertical: SMALL_SPACE, + ), + isDense: widget.padding != null, + suffixIcon: widget.suffixIcon, + filled: true, + hintStyle: SmoothTextFormField.defaultHintTextStyle(context), + hintText: widget.hintText, + border: OutlineInputBorder( + borderRadius: widget.borderRadius ?? ANGULAR_BORDER_RADIUS, ), - isDense: widget.padding != null, - suffixIcon: widget.suffixIcon, - filled: true, - hintStyle: SmoothTextFormField.defaultHintTextStyle(context), - hintText: widget.hintText, - border: OutlineInputBorder( - borderRadius: widget.borderRadius ?? ANGULAR_BORDER_RADIUS, - ), - enabledBorder: OutlineInputBorder( - borderRadius: widget.borderRadius ?? CIRCULAR_BORDER_RADIUS, - borderSide: const BorderSide( - color: Colors.transparent, - width: 5.0, - ), - ), - suffix: Offstage( - offstage: !_loading, - child: SizedBox( - width: Theme.of(context).textTheme.titleMedium?.fontSize ?? 15, - height: Theme.of(context).textTheme.titleMedium?.fontSize ?? 15, - child: const CircularProgressIndicator.adaptive( - strokeWidth: 1.0, + enabledBorder: OutlineInputBorder( + borderRadius: widget.borderRadius ?? CIRCULAR_BORDER_RADIUS, + borderSide: const BorderSide( + color: Colors.transparent, + width: 5.0, + ), + ), + suffix: Offstage( + offstage: !_loading, + child: SizedBox( + width: + Theme.of(context).textTheme.titleMedium?.fontSize ?? 15, + height: + Theme.of(context).textTheme.titleMedium?.fontSize ?? 15, + child: const CircularProgressIndicator.adaptive( + strokeWidth: 1.0, + ), + ), ), ), + // a lot of confusion if set to `true` + autofocus: false, + focusNode: focusNode, ), - ), - // a lot of confusion if set to `true` - autofocus: false, - focusNode: focusNode, - ), onSelected: (String search) { _selectedSearch = search; _setLoading(false); widget.onSelected?.call(search); }, - optionsViewBuilder: ( - BuildContext lContext, - AutocompleteOnSelected onSelected, - Iterable options, - ) { - final double screenHeight = MediaQuery.sizeOf(context).height; - String input = ''; + optionsViewBuilder: + ( + BuildContext lContext, + AutocompleteOnSelected onSelected, + Iterable options, + ) { + final double screenHeight = MediaQuery.sizeOf(context).height; + String input = ''; - for (final String key in _suggestions.keys) { - if (_suggestions[key].hashCode == options.hashCode) { - input = key; - break; - } - } + for (final String key in _suggestions.keys) { + if (_suggestions[key].hashCode == options.hashCode) { + input = key; + break; + } + } - if (input == _searchInput) { - _setLoading(false); - } + if (input == _searchInput) { + _setLoading(false); + } - return AutocompleteOptions( - displayStringForOption: RawAutocomplete.defaultStringForOption, - onSelected: onSelected, - options: options, - // Width = Row width - horizontal padding - maxOptionsWidth: widget.constraints.maxWidth - (LARGE_SPACE * 2), - maxOptionsHeight: screenHeight / 3, - search: input, - ); - }, + return AutocompleteOptions( + displayStringForOption: RawAutocomplete.defaultStringForOption, + onSelected: onSelected, + options: options, + // Width = Row width - horizontal padding + maxOptionsWidth: widget.constraints.maxWidth - (LARGE_SPACE * 2), + maxOptionsHeight: screenHeight / 3, + search: input, + ); + }, ); } @@ -185,13 +192,11 @@ class _SmoothAutocompleteTextFieldState void _setLoading(bool loading) { if (_loading != loading) { - WidgetsBinding.instance.addPostFrameCallback( - (_) { - if (mounted) { - setState(() => _loading = loading); - } - }, - ); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + setState(() => _loading = loading); + } + }); } } @@ -213,8 +218,9 @@ class _SmoothAutocompleteTextFieldState _setLoading(true); try { - _suggestions[search] = - _SearchResults(await widget.manager!.getSuggestions(search)); + _suggestions[search] = _SearchResults( + await widget.manager!.getSuggestions(search), + ); } catch (_) {} if (_suggestions[search]?.isEmpty ?? true && search == _searchInput) { diff --git a/packages/smooth_app/lib/pages/input/unfocus_field_when_tap_outside.dart b/packages/smooth_app/lib/pages/input/unfocus_field_when_tap_outside.dart index 298c58df20..f42610b125 100644 --- a/packages/smooth_app/lib/pages/input/unfocus_field_when_tap_outside.dart +++ b/packages/smooth_app/lib/pages/input/unfocus_field_when_tap_outside.dart @@ -9,12 +9,12 @@ class UnfocusFieldWhenTapOutside extends StatelessWidget { @override Widget build(BuildContext context) => GestureDetector( - onTap: () { - final FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus) { - currentFocus.unfocus(); - } - }, - child: child, - ); + onTap: () { + final FocusScopeNode currentFocus = FocusScope.of(context); + if (!currentFocus.hasPrimaryFocus) { + currentFocus.unfocus(); + } + }, + child: child, + ); } diff --git a/packages/smooth_app/lib/pages/locations/favorite_location_helper.dart b/packages/smooth_app/lib/pages/locations/favorite_location_helper.dart index b50728d174..7b71f68e4e 100644 --- a/packages/smooth_app/lib/pages/locations/favorite_location_helper.dart +++ b/packages/smooth_app/lib/pages/locations/favorite_location_helper.dart @@ -39,10 +39,7 @@ class FavoriteLocationHelper { } /// Returns true if a store was flagged as favorite, from stored keys. - bool _isFavorite( - final List favorites, - final OsmLocation location, - ) { + bool _isFavorite(final List favorites, final OsmLocation location) { for (final String favorite in favorites) { if (favorite == _locationToString(location)) { return true; diff --git a/packages/smooth_app/lib/pages/locations/location_map_page.dart b/packages/smooth_app/lib/pages/locations/location_map_page.dart index c37d923c84..e14de74284 100644 --- a/packages/smooth_app/lib/pages/locations/location_map_page.dart +++ b/packages/smooth_app/lib/pages/locations/location_map_page.dart @@ -10,10 +10,7 @@ import 'package:smooth_app/widgets/smooth_scaffold.dart'; /// Page that displays a map centered on a location. class LocationMapPage extends StatelessWidget { - const LocationMapPage( - this.osmLocation, { - required this.popFirst, - }); + const LocationMapPage(this.osmLocation, {required this.popFirst}); final OsmLocation osmLocation; final bool popFirst; @@ -29,11 +26,7 @@ class LocationMapPage extends StatelessWidget { title: title == null ? null : Text(title), subTitle: subtitle == null ? null - : Text( - subtitle, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), + : Text(subtitle, maxLines: 1, overflow: TextOverflow.ellipsis), actions: [ IconButton( icon: const Icon(Icons.info), @@ -81,10 +74,7 @@ class LocationMapPage extends StatelessWidget { ], ), body: FlutterMap( - options: MapOptions( - initialCenter: latLng, - initialZoom: 17, - ), + options: MapOptions(initialCenter: latLng, initialZoom: 17), children: [ TileLayer( urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', @@ -126,9 +116,8 @@ class LocationMapPage extends StatelessWidget { final BuildContext context, final String value, final String label, - ) => - CupertinoActionSheetAction( - onPressed: () => Navigator.of(context).pop(), - child: Text('$label: $value'), - ); + ) => CupertinoActionSheetAction( + onPressed: () => Navigator.of(context).pop(), + child: Text('$label: $value'), + ); } diff --git a/packages/smooth_app/lib/pages/locations/location_query_page.dart b/packages/smooth_app/lib/pages/locations/location_query_page.dart index 04ff53a49c..6ab410b96d 100644 --- a/packages/smooth_app/lib/pages/locations/location_query_page.dart +++ b/packages/smooth_app/lib/pages/locations/location_query_page.dart @@ -66,9 +66,7 @@ class _LocationQueryPageState extends State ); case LoadingStatus.LOADING: if (_model.isEmpty()) { - return SearchLoadingScreen( - title: widget.query, - ); + return SearchLoadingScreen(title: widget.query); } break; case LoadingStatus.LOADED: @@ -86,11 +84,7 @@ class _LocationQueryPageState extends State // Now used in two cases. // 1. we have data downloaded and we display it (normal mode) // 2. we are downloading extra data, and display what we already knew - return _getNotEmptyScreen( - screenSize, - themeData, - appLocalizations, - ); + return _getNotEmptyScreen(screenSize, themeData, appLocalizations); }, ); } @@ -99,62 +93,60 @@ class _LocationQueryPageState extends State final Size screenSize, final ThemeData themeData, final AppLocalizations appLocalizations, - ) => - SmoothScaffold( - appBar: SmoothAppBar( - backgroundColor: themeData.scaffoldBackgroundColor, - elevation: 2, - automaticallyImplyLeading: false, - leading: const SmoothBackButton(), - title: SearchAppBarTitle( - title: widget.query, - editableAppBarTitle: widget.editableAppBarTitle, - ), - ), - body: ListTileTheme( - data: ListTileThemeData( - titleTextStyle: const TextStyle(fontSize: 20.0), - minLeadingWidth: 18.0, - iconColor: Theme.of(context).colorScheme.onSurface, - textColor: Theme.of(context).colorScheme.onSurface, - ), - child: ListView.builder( - itemBuilder: (BuildContext context, int index) { - if (index >= _model.displayedResults.length) { - final LocationListSupplier? supplier = _model.alternateSupplier; - if (supplier != null) { - return SmoothCard( - child: SmoothLargeButtonWithIcon( - text: appLocalizations.prices_location_search_broader, - leadingIcon: const Icon(Icons.search), - onPressed: () => unawaited(_model.loadMore(supplier)), - ), - ); - } - return const Padding( - padding: EdgeInsets.only(top: SMALL_SPACE), - child: Center( - child: CircularProgressIndicator.adaptive(), - ), - ); - } - return KeyedSubtree( - key: ValueKey(_model.displayedResults[index].osmId), - child: SearchLocationPreloadedItem( - _model.displayedResults[index], - popFirst: true, - ).getWidget(context), + ) => SmoothScaffold( + appBar: SmoothAppBar( + backgroundColor: themeData.scaffoldBackgroundColor, + elevation: 2, + automaticallyImplyLeading: false, + leading: const SmoothBackButton(), + title: SearchAppBarTitle( + title: widget.query, + editableAppBarTitle: widget.editableAppBarTitle, + ), + ), + body: ListTileTheme( + data: ListTileThemeData( + titleTextStyle: const TextStyle(fontSize: 20.0), + minLeadingWidth: 18.0, + iconColor: Theme.of(context).colorScheme.onSurface, + textColor: Theme.of(context).colorScheme.onSurface, + ), + child: ListView.builder( + itemBuilder: (BuildContext context, int index) { + if (index >= _model.displayedResults.length) { + final LocationListSupplier? supplier = _model.alternateSupplier; + if (supplier != null) { + return SmoothCard( + child: SmoothLargeButtonWithIcon( + text: appLocalizations.prices_location_search_broader, + leadingIcon: const Icon(Icons.search), + onPressed: () => unawaited(_model.loadMore(supplier)), + ), ); - }, - itemCount: _model.displayedResults.length + - (_model.alternateSupplier != null - ? 1 - : _model.loadingStatus == LoadingStatus.LOADING - ? 1 - : 0), - ), - ), - ); + } + return const Padding( + padding: EdgeInsets.only(top: SMALL_SPACE), + child: Center(child: CircularProgressIndicator.adaptive()), + ); + } + return KeyedSubtree( + key: ValueKey(_model.displayedResults[index].osmId), + child: SearchLocationPreloadedItem( + _model.displayedResults[index], + popFirst: true, + ).getWidget(context), + ); + }, + itemCount: + _model.displayedResults.length + + (_model.alternateSupplier != null + ? 1 + : _model.loadingStatus == LoadingStatus.LOADING + ? 1 + : 0), + ), + ), + ); Widget _getErrorWidget( final Size screenSize, @@ -173,10 +165,7 @@ class _LocationQueryPageState extends State ); } - Widget _getEmptyText( - final ThemeData themeData, - final String message, - ) => + Widget _getEmptyText(final ThemeData themeData, final String message) => Padding( padding: const EdgeInsets.all(SMALL_SPACE), child: Column( @@ -187,8 +176,9 @@ class _LocationQueryPageState extends State child: Text( message, textAlign: TextAlign.center, - style: - themeData.textTheme.titleMedium!.copyWith(fontSize: 18.0), + style: themeData.textTheme.titleMedium!.copyWith( + fontSize: 18.0, + ), ), ), ], diff --git a/packages/smooth_app/lib/pages/locations/osm_location.dart b/packages/smooth_app/lib/pages/locations/osm_location.dart index a17e8cb5ae..bd391a5ab3 100644 --- a/packages/smooth_app/lib/pages/locations/osm_location.dart +++ b/packages/smooth_app/lib/pages/locations/osm_location.dart @@ -19,18 +19,18 @@ class OsmLocation { }); OsmLocation.fromPrice(final Location location) - : osmId = location.osmId!, - osmType = location.type!, - longitude = location.longitude ?? 0, - latitude = location.latitude ?? 0, - name = location.name, - street = null, - city = location.city, - postcode = location.postcode, - country = location.country, - countryCode = location.countryCode, - osmKey = location.osmKey, - osmValue = location.osmValue; + : osmId = location.osmId!, + osmType = location.type!, + longitude = location.longitude ?? 0, + latitude = location.latitude ?? 0, + name = location.name, + street = null, + city = location.city, + postcode = location.postcode, + country = location.country, + countryCode = location.countryCode, + osmKey = location.osmKey, + osmValue = location.osmValue; final int osmId; final LocationOSMType osmType; diff --git a/packages/smooth_app/lib/pages/locations/search_location_helper.dart b/packages/smooth_app/lib/pages/locations/search_location_helper.dart index 1cf3afb4d2..a108c7cdbe 100644 --- a/packages/smooth_app/lib/pages/locations/search_location_helper.dart +++ b/packages/smooth_app/lib/pages/locations/search_location_helper.dart @@ -35,10 +35,8 @@ class SearchLocationHelper extends SearchHelper { Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => LocationQueryPage( - query: query, - editableAppBarTitle: true, - ), + builder: (BuildContext context) => + LocationQueryPage(query: query, editableAppBarTitle: true), ), ); } diff --git a/packages/smooth_app/lib/pages/locations/search_location_preloaded_item.dart b/packages/smooth_app/lib/pages/locations/search_location_preloaded_item.dart index 45ad143b51..4ec8a2f152 100644 --- a/packages/smooth_app/lib/pages/locations/search_location_preloaded_item.dart +++ b/packages/smooth_app/lib/pages/locations/search_location_preloaded_item.dart @@ -33,9 +33,7 @@ class SearchLocationPreloadedItem extends SearchPreloadedItem { ); return IconButton( - icon: Icon( - isFavorite ? Icons.favorite : Icons.favorite_border, - ), + icon: Icon(isFavorite ? Icons.favorite : Icons.favorite_border), onPressed: () async => FavoriteLocationHelper().setFavorite( localDatabase, osmLocation, @@ -58,10 +56,8 @@ class SearchLocationPreloadedItem extends SearchPreloadedItem { onPressed: () async => Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => LocationMapPage( - osmLocation, - popFirst: popFirst, - ), + builder: (BuildContext context) => + LocationMapPage(osmLocation, popFirst: popFirst), ), ), icon: const Icon(Icons.map), @@ -79,10 +75,7 @@ class SearchLocationPreloadedItem extends SearchPreloadedItem { color: RED_COLOR, alignment: AlignmentDirectional.centerEnd, padding: const EdgeInsetsDirectional.only(end: LARGE_SPACE * 2), - child: const Icon( - Icons.delete, - color: Colors.white, - ), + child: const Icon(Icons.delete, color: Colors.white), ), child: child, ); diff --git a/packages/smooth_app/lib/pages/navigator/app_navigator.dart b/packages/smooth_app/lib/pages/navigator/app_navigator.dart index 03d4b33b6d..2041422e51 100644 --- a/packages/smooth_app/lib/pages/navigator/app_navigator.dart +++ b/packages/smooth_app/lib/pages/navigator/app_navigator.dart @@ -45,16 +45,14 @@ class AppNavigator extends InheritedWidget { super.key, List? observers, required super.child, - }) : _router = _SmoothGoRouter( - observers: observers, - ); + }) : _router = _SmoothGoRouter(observers: observers); // GoRouter is never accessible directly final _SmoothGoRouter _router; static AppNavigator of(BuildContext context) { - final AppNavigator? result = - context.dependOnInheritedWidgetOfExactType(); + final AppNavigator? result = context + .dependOnInheritedWidgetOfExactType(); assert(result != null, 'No AppNavigator found in context'); return result!; } @@ -112,19 +110,13 @@ class AppNavigator extends InheritedWidget { /// One drawback of the implementation is that we never know the base URL of the /// deep link (eg: es.openfoodfacts.org) class _SmoothGoRouter { - factory _SmoothGoRouter({ - List? observers, - }) { - _singleton ??= _SmoothGoRouter._internal( - observers: observers, - ); + factory _SmoothGoRouter({List? observers}) { + _singleton ??= _SmoothGoRouter._internal(observers: observers); return _singleton!; } - _SmoothGoRouter._internal({ - List? observers, - }) { + _SmoothGoRouter._internal({List? observers}) { router = GoRouter( observers: observers, routes: [ @@ -171,11 +163,12 @@ class _SmoothGoRouter { } return switch (ProductPageTransition.byName( - state.uri.queryParameters['transition'])) { + state.uri.queryParameters['transition'], + )) { ProductPageTransition.standard => MaterialPage( - key: state.pageKey, - child: widget, - ), + key: state.pageKey, + child: widget, + ), ProductPageTransition.slideUp => OpenUpwardsPage.getTransition( key: state.pageKey, @@ -229,9 +222,7 @@ class _SmoothGoRouter { throw Exception('Unsupported preference page type: $type'); } - return UserPreferencesPage( - type: pageType, - ); + return UserPreferencesPage(type: pageType); }, ), GoRoute( @@ -264,7 +255,7 @@ class _SmoothGoRouter { GoRoute( path: _InternalAppRoutes.SIGNUP_PAGE, builder: (_, __) => const SignUpPage(), - ) + ), ], ), GoRoute( @@ -352,9 +343,8 @@ class _SmoothGoRouter { return state.uri.toString(); } }, - errorBuilder: (_, GoRouterState state) => ErrorPage( - url: state.uri.toString(), - ), + errorBuilder: (_, GoRouterState state) => + ErrorPage(url: state.uri.toString()), ); } @@ -370,14 +360,10 @@ class _SmoothGoRouter { } String _openExternalLink(String path) { - AnalyticsHelper.trackEvent( - AnalyticsEvent.genericDeepLink, - ); + AnalyticsHelper.trackEvent(AnalyticsEvent.genericDeepLink); // Unsupported link -> open the browser - return AppRoutes.EXTERNAL( - path[0] == '/' ? path.substring(1) : path, - ); + return AppRoutes.EXTERNAL(path[0] == '/' ? path.substring(1) : path); } static _SmoothGoRouter? _singleton; @@ -433,7 +419,7 @@ class _SmoothGoRouter { return lastVisitedOnboardingPage; } -//endregion Onboarding + //endregion Onboarding } /// Internal routes diff --git a/packages/smooth_app/lib/pages/navigator/error_page.dart b/packages/smooth_app/lib/pages/navigator/error_page.dart index e275f215a2..de75449281 100644 --- a/packages/smooth_app/lib/pages/navigator/error_page.dart +++ b/packages/smooth_app/lib/pages/navigator/error_page.dart @@ -7,10 +7,7 @@ import 'package:smooth_app/pages/navigator/app_navigator.dart'; /// Similar to a 404 page class ErrorPage extends StatelessWidget { - const ErrorPage({ - required this.url, - super.key, - }); + const ErrorPage({required this.url, super.key}); final String url; @@ -33,10 +30,7 @@ class ErrorPage extends StatelessWidget { style: Theme.of(context).textTheme.displayMedium, ), const SizedBox(height: LARGE_SPACE), - Text( - url, - textAlign: TextAlign.center, - ), + Text(url, textAlign: TextAlign.center), const SizedBox(height: VERY_LARGE_SPACE * 2), SmoothLargeButtonWithIcon( text: localizations.page_not_found_button, @@ -45,7 +39,7 @@ class ErrorPage extends StatelessWidget { onPressed: () { AppNavigator.of(context).pop(); }, - ) + ), ], ), ), diff --git a/packages/smooth_app/lib/pages/navigator/external_page.dart b/packages/smooth_app/lib/pages/navigator/external_page.dart index a662051b31..176148f87d 100644 --- a/packages/smooth_app/lib/pages/navigator/external_page.dart +++ b/packages/smooth_app/lib/pages/navigator/external_page.dart @@ -24,10 +24,7 @@ import 'package:url_launcher/url_launcher.dart'; /// (eg: de.openfoodfacts.org), that's why we try to guess it with the country /// and the locale of the user class ExternalPage extends StatefulWidget { - const ExternalPage({ - required this.path, - super.key, - }) : assert(path != ''); + const ExternalPage({required this.path, super.key}) : assert(path != ''); final String path; @@ -54,10 +51,7 @@ class ExternalPage extends StatefulWidget { if (url == null) { final OpenFoodFactsLanguage language = ProductQuery.getLanguage(); - url = path_lib.join( - 'https://world.openfoodfacts.org', - pathUrl, - ); + url = path_lib.join('https://world.openfoodfacts.org', pathUrl); url = '$url?lc=${language.offTag}'; } @@ -88,8 +82,9 @@ class _ExternalPageState extends State { await tabs.launchUrl( Uri.parse(url), customTabsOptions: const tabs.CustomTabsOptions( - showTitle: true, - browser: tabs.CustomTabsBrowserConfiguration()), + showTitle: true, + browser: tabs.CustomTabsBrowserConfiguration(), + ), ); } else { /// The default browser @@ -102,8 +97,9 @@ class _ExternalPageState extends State { Logs.e('Unable to open an external link', ex: e); if (mounted) { SmoothFloatingMessage( - message: - AppLocalizations.of(context).url_not_supported(widget.path), + message: AppLocalizations.of( + context, + ).url_not_supported(widget.path), type: SmoothFloatingMessageType.error, ).show( context, @@ -127,9 +123,7 @@ class _ExternalPageState extends State { @override Widget build(BuildContext context) { return const Scaffold( - body: Center( - child: CircularProgressIndicator.adaptive(), - ), + body: Center(child: CircularProgressIndicator.adaptive()), ); } } diff --git a/packages/smooth_app/lib/pages/navigator/external_page_webview.dart b/packages/smooth_app/lib/pages/navigator/external_page_webview.dart index 663020ae67..676a555214 100644 --- a/packages/smooth_app/lib/pages/navigator/external_page_webview.dart +++ b/packages/smooth_app/lib/pages/navigator/external_page_webview.dart @@ -97,9 +97,7 @@ class _ExternalPageInAWebViewState extends State { title: Text(widget.pageName ?? AppLocalizations.of(context).loading), leading: const CloseButton(), ), - body: const Center( - child: CircularProgressIndicator.adaptive(), - ), + body: const Center(child: CircularProgressIndicator.adaptive()), ); } else { return SmoothScaffold( @@ -113,18 +111,14 @@ class _ExternalPageInAWebViewState extends State { bottom: _progress < 100 ? PreferredSize( preferredSize: const Size(double.infinity, 5.0), - child: LinearProgressIndicator( - value: _progress / 100, - ), + child: LinearProgressIndicator(value: _progress / 100), ) : null, ), bottomNavigationBar: _WebViewBottomBar(controller: _controller), body: RefreshIndicator( onRefresh: () => _controller.reload(), - child: WebViewWidget( - controller: _controller, - ), + child: WebViewWidget(controller: _controller), ), ); } @@ -138,9 +132,7 @@ class _ExternalPageInAWebViewState extends State { } class _WebViewBottomBar extends StatelessWidget { - const _WebViewBottomBar({ - required this.controller, - }); + const _WebViewBottomBar({required this.controller}); final WebViewController controller; diff --git a/packages/smooth_app/lib/pages/navigator/slide_up_transition.dart b/packages/smooth_app/lib/pages/navigator/slide_up_transition.dart index 6f3b22856b..c7a6bb9061 100644 --- a/packages/smooth_app/lib/pages/navigator/slide_up_transition.dart +++ b/packages/smooth_app/lib/pages/navigator/slide_up_transition.dart @@ -11,18 +11,19 @@ class OpenUpwardsPage { return CustomTransitionPage( key: key, child: child, - transitionsBuilder: ( - BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child, - ) { - return _OpenUpwardsPageTransition( - animation: animation, - secondaryAnimation: secondaryAnimation, - child: child, - ); - }, + transitionsBuilder: + ( + BuildContext context, + Animation animation, + Animation secondaryAnimation, + Widget child, + ) { + return _OpenUpwardsPageTransition( + animation: animation, + secondaryAnimation: secondaryAnimation, + child: child, + ); + }, ); } } @@ -127,13 +128,14 @@ class _OpenUpwardsPageTransitionState ._scrimOpacityTween .animate(_primaryAnimation); final Animation primaryTranslationAnimation = - _OpenUpwardsPageTransition._primaryTranslationTween - .animate(_primaryAnimation); + _OpenUpwardsPageTransition._primaryTranslationTween.animate( + _primaryAnimation, + ); final Animation secondaryTranslationAnimation = _OpenUpwardsPageTransition._secondaryTranslationTween.animate( - _secondaryTranslationCurvedAnimation, - ); + _secondaryTranslationCurvedAnimation, + ); return AnimatedBuilder( animation: widget.animation, diff --git a/packages/smooth_app/lib/pages/offline_data_page.dart b/packages/smooth_app/lib/pages/offline_data_page.dart index 5a952b5027..c30ec5c5f9 100644 --- a/packages/smooth_app/lib/pages/offline_data_page.dart +++ b/packages/smooth_app/lib/pages/offline_data_page.dart @@ -38,13 +38,12 @@ class _OfflineDataPageState extends State { final double backgroundHeight = MediaQuery.sizeOf(context).height * .20; final LocalDatabase localDatabase = context.watch(); final DaoProduct daoProduct = DaoProduct(localDatabase); - final DaoProductLastAccess daoProductLastAccess = - DaoProductLastAccess(localDatabase); + final DaoProductLastAccess daoProductLastAccess = DaoProductLastAccess( + localDatabase, + ); final AppLocalizations appLocalizations = AppLocalizations.of(context); return SmoothScaffold( - appBar: SmoothAppBar( - title: Text(appLocalizations.offline_data), - ), + appBar: SmoothAppBar(title: Text(appLocalizations.offline_data)), body: RefreshIndicator( onRefresh: () async { setState(() {}); @@ -60,9 +59,7 @@ class _OfflineDataPageState extends State { package: AppHelper.APP_PACKAGE, ), ), - _StatsWidget( - daoProduct: daoProduct, - ), + _StatsWidget(daoProduct: daoProduct), for (final ProductType productType in ProductType.values) _OfflinePageListTile( title: @@ -122,9 +119,7 @@ class _OfflineDataPageState extends State { // Widget to display the stats of the local databas, ie. the number of products // in the database and the size of the database class _StatsWidget extends StatelessWidget { - const _StatsWidget({ - required this.daoProduct, - }); + const _StatsWidget({required this.daoProduct}); final DaoProduct daoProduct; @@ -137,25 +132,27 @@ class _StatsWidget extends StatelessWidget { title: Text(applocalizations.offline_product_data_title), subtitle: FutureBuilder>( future: daoProduct.getTotalNoOfProducts(), - builder: ( - BuildContext context, - AsyncSnapshot> snapshot, - ) { - if (!snapshot.hasData) { - return Text(applocalizations.loading); - } - int count = 0; - final List list = []; - for (final MapEntry item - in snapshot.data!.entries) { - count += item.value; - list.add( - '${item.value} (${item.key.getLabel(applocalizations)})'); - } - return Text( - '${applocalizations.available_for_download(count)} ${list.join(', ')}', - ); - }, + builder: + ( + BuildContext context, + AsyncSnapshot> snapshot, + ) { + if (!snapshot.hasData) { + return Text(applocalizations.loading); + } + int count = 0; + final List list = []; + for (final MapEntry item + in snapshot.data!.entries) { + count += item.value; + list.add( + '${item.value} (${item.key.getLabel(applocalizations)})', + ); + } + return Text( + '${applocalizations.available_for_download(count)} ${list.join(', ')}', + ); + }, ), trailing: FutureBuilder( future: daoProduct.getEstimatedTotalSizeInMB(), diff --git a/packages/smooth_app/lib/pages/offline_tasks_page.dart b/packages/smooth_app/lib/pages/offline_tasks_page.dart index e0d880c469..857455d9d9 100644 --- a/packages/smooth_app/lib/pages/offline_tasks_page.dart +++ b/packages/smooth_app/lib/pages/offline_tasks_page.dart @@ -29,9 +29,7 @@ class _OfflineTaskState extends State { {}; final List taskIds = []; for (final BackgroundTaskQueue queue in BackgroundTaskQueue.values) { - final List list = localDatabase.getAllTaskIds( - queue.tagTaskQueue, - ); + final List list = localDatabase.getAllTaskIds(queue.tagTaskQueue); taskIds.addAll(list); for (final String taskId in list) { queues[taskId] = queue; @@ -39,10 +37,7 @@ class _OfflineTaskState extends State { } return Scaffold( appBar: SmoothAppBar( - title: Text( - appLocalizations.background_task_title, - maxLines: 2, - ), + title: Text(appLocalizations.background_task_title, maxLines: 2), actions: [ IconButton( onPressed: () => BackgroundTaskManager.runAgain( @@ -54,9 +49,7 @@ class _OfflineTaskState extends State { ], ), body: taskIds.isEmpty - ? Center( - child: Text(appLocalizations.background_task_list_empty), - ) + ? Center(child: Text(appLocalizations.background_task_list_empty)) : ListView.builder( itemCount: taskIds.length, itemBuilder: (final BuildContext context, final int index) { @@ -80,8 +73,9 @@ class _OfflineTaskState extends State { info = ''; } final BackgroundTaskQueue queue = queues[taskId]!; - final String? productType = - OperationType.getProductType(taskId); + final String? productType = OperationType.getProductType( + taskId, + ); return ListTile( leading: Icon(queue.iconData), onTap: () async { @@ -89,17 +83,18 @@ class _OfflineTaskState extends State { context: context, builder: (final BuildContext context) => SmoothAlertDialog( - body: Text( - appLocalizations.background_task_question_stop), - negativeAction: SmoothActionButton( - text: appLocalizations.no, - onPressed: () => Navigator.of(context).pop(false), - ), - positiveAction: SmoothActionButton( - text: appLocalizations.yes, - onPressed: () => Navigator.of(context).pop(true), - ), - ), + body: Text( + appLocalizations.background_task_question_stop, + ), + negativeAction: SmoothActionButton( + text: appLocalizations.no, + onPressed: () => Navigator.of(context).pop(false), + ), + positiveAction: SmoothActionButton( + text: appLocalizations.yes, + onPressed: () => Navigator.of(context).pop(true), + ), + ), ); if (stopTask == true) { await BackgroundTaskManager.getInstance( @@ -110,9 +105,7 @@ class _OfflineTaskState extends State { }, title: Text( '$info' - '(${OperationType.getOperationType(taskId)?.getLabel( - appLocalizations, - ) ?? appLocalizations.background_task_operation_unknown})' + '(${OperationType.getOperationType(taskId)?.getLabel(appLocalizations) ?? appLocalizations.background_task_operation_unknown})' '${productType == null ? '' : ' ($productType)'}', ), subtitle: Text(_getMessage(status, appLocalizations)), @@ -139,7 +132,8 @@ class _OfflineTaskState extends State { } // "startsWith" because there's some kind of "chr(13)" at the end. if (status.startsWith( - 'Exception: JSON expected, html found: 504 Gateway Time-out')) { + 'Exception: JSON expected, html found: 504 Gateway Time-out', + )) { return appLocalizations.background_task_error_server_time_out; } return status; @@ -150,8 +144,9 @@ class _OfflineTaskState extends State { if (work == null || work.isEmpty) { return null; } - final (WorkType workType, ProductType productType)? item = - WorkType.extract(work); + final (WorkType workType, ProductType productType)? item = WorkType.extract( + work, + ); if (item != null) { return '${item.$1.englishLabel} (${item.$2.offTag})'; } diff --git a/packages/smooth_app/lib/pages/onboarding/common/tooltip_shape_border.dart b/packages/smooth_app/lib/pages/onboarding/common/tooltip_shape_border.dart index 100e689d9c..24ed39f8d5 100644 --- a/packages/smooth_app/lib/pages/onboarding/common/tooltip_shape_border.dart +++ b/packages/smooth_app/lib/pages/onboarding/common/tooltip_shape_border.dart @@ -14,9 +14,8 @@ class TooltipShapeBorder extends ShapeBorder { final double radius; @override - EdgeInsetsGeometry get dimensions => EdgeInsetsDirectional.only( - top: arrowHeight, - ); + EdgeInsetsGeometry get dimensions => + EdgeInsetsDirectional.only(top: arrowHeight); @override Path getOuterPath(Rect rect, {TextDirection? textDirection}) { diff --git a/packages/smooth_app/lib/pages/onboarding/currency_selector.dart b/packages/smooth_app/lib/pages/onboarding/currency_selector.dart index 84de4dadf1..d9b584d93a 100644 --- a/packages/smooth_app/lib/pages/onboarding/currency_selector.dart +++ b/packages/smooth_app/lib/pages/onboarding/currency_selector.dart @@ -8,11 +8,7 @@ import 'package:smooth_app/pages/prices/currency_extension.dart'; /// A selector for selecting user's currency. class CurrencySelector extends StatelessWidget { - CurrencySelector({ - this.textStyle, - this.padding, - this.icon, - }); + CurrencySelector({this.textStyle, this.padding, this.icon}); final TextStyle? textStyle; final EdgeInsetsGeometry? padding; @@ -59,10 +55,9 @@ class CurrencySelector extends StatelessWidget { padding: const EdgeInsets.symmetric(horizontal: LARGE_SPACE), child: Text( selected.getFullName(), - style: Theme.of(context) - .textTheme - .displaySmall - ?.merge(textStyle), + style: Theme.of( + context, + ).textTheme.displaySmall?.merge(textStyle), ), ), ), diff --git a/packages/smooth_app/lib/pages/onboarding/currency_selector_helper.dart b/packages/smooth_app/lib/pages/onboarding/currency_selector_helper.dart index 6e7ee0d33c..ad1beaf94a 100644 --- a/packages/smooth_app/lib/pages/onboarding/currency_selector_helper.dart +++ b/packages/smooth_app/lib/pages/onboarding/currency_selector_helper.dart @@ -38,72 +38,66 @@ class CurrencySelectorHelper { return StatefulBuilder( builder: (BuildContext context, void Function(VoidCallback fn) setState) { - const double horizontalPadding = 16.0 + SMALL_SPACE; + const double horizontalPadding = 16.0 + SMALL_SPACE; - return SmoothListAlertDialog( - title: appLocalizations.currency_selector_title, - header: SmoothTextFormField( - type: TextFieldTypes.PLAIN_TEXT, - prefixIcon: const Icon(Icons.search), - controller: currencyController, - onChanged: (String? query) { - query = query!.trim().getComparisonSafeString(); + return SmoothListAlertDialog( + title: appLocalizations.currency_selector_title, + header: SmoothTextFormField( + type: TextFieldTypes.PLAIN_TEXT, + prefixIcon: const Icon(Icons.search), + controller: currencyController, + onChanged: (String? query) { + query = query!.trim().getComparisonSafeString(); - setState( - () { - filteredList = _currencyList - .where( - (Currency item) => item - .getFullName() - .getComparisonSafeString() - .contains( - query!, - ), - ) - .toList(growable: false); + setState(() { + filteredList = _currencyList + .where( + (Currency item) => item + .getFullName() + .getComparisonSafeString() + .contains(query!), + ) + .toList(growable: false); + }); }, - ); - }, - hintText: appLocalizations.search, - ), - scrollController: scrollController, - list: ListView.separated( - controller: scrollController, - itemBuilder: (BuildContext context, int index) { - final Currency currency = filteredList[index]; - final bool isSelected = currency == selected; - return ListTile( - dense: true, - contentPadding: const EdgeInsets.symmetric( - horizontal: horizontalPadding, - ), - trailing: isSelected ? const Icon(Icons.check) : null, - title: TextHighlighter( - text: currency.getFullName(), - filter: currencyController.text, - selected: isSelected, - ), - onTap: () { - Navigator.of(context).pop(currency); + hintText: appLocalizations.search, + ), + scrollController: scrollController, + list: ListView.separated( + controller: scrollController, + itemBuilder: (BuildContext context, int index) { + final Currency currency = filteredList[index]; + final bool isSelected = currency == selected; + return ListTile( + dense: true, + contentPadding: const EdgeInsets.symmetric( + horizontal: horizontalPadding, + ), + trailing: isSelected ? const Icon(Icons.check) : null, + title: TextHighlighter( + text: currency.getFullName(), + filter: currencyController.text, + selected: isSelected, + ), + onTap: () { + Navigator.of(context).pop(currency); + currencyController.clear(); + }, + ); + }, + separatorBuilder: (_, __) => const Divider(height: 1.0), + itemCount: filteredList.length, + shrinkWrap: true, + ), + positiveAction: SmoothActionButton( + onPressed: () { + Navigator.pop(context); currencyController.clear(); }, - ); - }, - separatorBuilder: (_, __) => const Divider( - height: 1.0, - ), - itemCount: filteredList.length, - shrinkWrap: true, - ), - positiveAction: SmoothActionButton( - onPressed: () { - Navigator.pop(context); - currencyController.clear(); - }, - text: appLocalizations.cancel, - ), - ); - }, + text: appLocalizations.cancel, + ), + ); + }, ); }, ); @@ -122,16 +116,14 @@ class CurrencySelectorHelper { /// Reorder currencies alphabetically, bring user's selected one to top. void _reorderCurrencies(final Currency selected) { - _currencyList.sort( - (final Currency a, final Currency b) { - if (a == selected) { - return -1; - } - if (b == selected) { - return 1; - } - return a.name.compareTo(b.name); - }, - ); + _currencyList.sort((final Currency a, final Currency b) { + if (a == selected) { + return -1; + } + if (b == selected) { + return 1; + } + return a.name.compareTo(b.name); + }); } } diff --git a/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart b/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart index becbb71ff9..0ea288822a 100644 --- a/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart +++ b/packages/smooth_app/lib/pages/onboarding/knowledge_panel_page_template.dart @@ -60,96 +60,91 @@ class _KnowledgePanelPageTemplateState } Future _init() async { - _product = await OnboardingDataProduct.forProduct(widget.localDatabase) - .getData(rootBundle); + _product = await OnboardingDataProduct.forProduct( + widget.localDatabase, + ).getData(rootBundle); } @override Widget build(BuildContext context) => FutureBuilder( - future: _initFuture, - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasError) { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); - return Text( - appLocalizations - .knowledge_panel_page_loading_error(snapshot.error), - ); - } - if (snapshot.connectionState != ConnectionState.done) { - return const Center(child: CircularProgressIndicator.adaptive()); - } + future: _initFuture, + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.hasError) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + return Text( + appLocalizations.knowledge_panel_page_loading_error(snapshot.error), + ); + } + if (snapshot.connectionState != ConnectionState.done) { + return const Center(child: CircularProgressIndicator.adaptive()); + } - final List children = KnowledgePanelsBuilder.getChildren( - context, - panelElement: KnowledgePanelsBuilder.getRootPanelElement( - _product, - widget.panelId, - )!, - product: _product, - onboardingMode: true, - ); - return ColoredBox( - color: widget.backgroundColor, - child: SafeArea( - bottom: Platform.isAndroid, - child: Stack( - fit: StackFit.expand, + final List children = KnowledgePanelsBuilder.getChildren( + context, + panelElement: KnowledgePanelsBuilder.getRootPanelElement( + _product, + widget.panelId, + )!, + product: _product, + onboardingMode: true, + ); + return ColoredBox( + color: widget.backgroundColor, + child: SafeArea( + bottom: Platform.isAndroid, + child: Stack( + fit: StackFit.expand, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Flexible( - flex: 1, - child: Scrollbar( - child: ListView( - children: [ - SvgPicture.asset( - widget.svgAsset, - height: MediaQuery.sizeOf(context).height * .25, - package: AppHelper.APP_PACKAGE, - ), - Padding( - padding: const EdgeInsets.symmetric( - horizontal: LARGE_SPACE, - ), - child: Text( - widget.headerTitle, - style: Theme.of(context) - .textTheme - .displayMedium - ?.wellSpaced, - ), - ), - if (children.isNotEmpty) - KnowledgePanelProductCards( - [ - Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: children, - ), - ], - ), - ], + Flexible( + flex: 1, + child: Scrollbar( + child: ListView( + children: [ + SvgPicture.asset( + widget.svgAsset, + height: MediaQuery.sizeOf(context).height * .25, + package: AppHelper.APP_PACKAGE, ), - ), + Padding( + padding: const EdgeInsets.symmetric( + horizontal: LARGE_SPACE, + ), + child: Text( + widget.headerTitle, + style: Theme.of( + context, + ).textTheme.displayMedium?.wellSpaced, + ), + ), + if (children.isNotEmpty) + KnowledgePanelProductCards([ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: children, + ), + ]), + ], ), - NextButton( - widget.page, - backgroundColor: widget.backgroundColor, - nextKey: widget.nextKey, - ), - ], + ), + ), + NextButton( + widget.page, + backgroundColor: widget.backgroundColor, + nextKey: widget.nextKey, ), - ..._buildHintPopup(), ], ), - ), - ); - }, + ..._buildHintPopup(), + ], + ), + ), ); + }, + ); List _buildHintPopup() { final Widget hintPopup = InkWell( @@ -175,10 +170,7 @@ class _KnowledgePanelPageTemplateState ), ), const SizedBox(width: VERY_LARGE_SPACE), - Icon( - Icons.close, - color: Theme.of(context).cardColor, - ), + Icon(Icons.close, color: Theme.of(context).cardColor), ], ), ), @@ -192,9 +184,11 @@ class _KnowledgePanelPageTemplateState final List hitPopup = []; if (!_isHintDismissed && !OnboardingFlowNavigator.isOnboardingPagedInHistory( - OnboardingPage.HEALTH_CARD_EXAMPLE) && + OnboardingPage.HEALTH_CARD_EXAMPLE, + ) && !OnboardingFlowNavigator.isOnboardingPagedInHistory( - OnboardingPage.ECO_CARD_EXAMPLE)) { + OnboardingPage.ECO_CARD_EXAMPLE, + )) { hitPopup.add( Positioned( child: Align( @@ -202,7 +196,8 @@ class _KnowledgePanelPageTemplateState child: Padding( padding: const EdgeInsets.only( // slightly lower than bottom bar top - bottom: 2 * VERY_LARGE_SPACE + + bottom: + 2 * VERY_LARGE_SPACE + MINIMUM_TOUCH_SIZE - .5 * VERY_LARGE_SPACE, ), diff --git a/packages/smooth_app/lib/pages/onboarding/next_button.dart b/packages/smooth_app/lib/pages/onboarding/next_button.dart index 33cfebf8c2..0a95b425b4 100644 --- a/packages/smooth_app/lib/pages/onboarding/next_button.dart +++ b/packages/smooth_app/lib/pages/onboarding/next_button.dart @@ -30,17 +30,16 @@ class NextButton extends StatelessWidget { final AppLocalizations appLocalizations = AppLocalizations.of(context); final UserPreferences userPreferences = context.watch(); final LocalDatabase localDatabase = context.watch(); - final OnboardingFlowNavigator navigator = - OnboardingFlowNavigator(userPreferences); + final OnboardingFlowNavigator navigator = OnboardingFlowNavigator( + userPreferences, + ); final OnboardingPage previousPage = currentPage.getPrevPage(); return OnboardingBottomBar( leftButton: previousPage.isOnboardingNotStarted() ? null : OnboardingBottomIcon( - onPressed: () async => navigator.navigateToPage( - context, - previousPage, - ), + onPressed: () async => + navigator.navigateToPage(context, previousPage), backgroundColor: Colors.white, foregroundColor: Colors.black, icon: Directionality.of(context) == TextDirection.ltr @@ -50,13 +49,11 @@ class NextButton extends StatelessWidget { ), rightButton: OnboardingBottomButton( onPressed: () async { - await OnboardingLoader(localDatabase) - .runAtNextTime(currentPage, context); + await OnboardingLoader( + localDatabase, + ).runAtNextTime(currentPage, context); if (context.mounted) { - await navigator.navigateToPage( - context, - currentPage.getNextPage(), - ); + await navigator.navigateToPage(context, currentPage.getNextPage()); } }, backgroundColor: Colors.black, diff --git a/packages/smooth_app/lib/pages/onboarding/onboarding_bottom_bar.dart b/packages/smooth_app/lib/pages/onboarding/onboarding_bottom_bar.dart index 9c3406b15f..e32cce9bbd 100644 --- a/packages/smooth_app/lib/pages/onboarding/onboarding_bottom_bar.dart +++ b/packages/smooth_app/lib/pages/onboarding/onboarding_bottom_bar.dart @@ -85,28 +85,29 @@ class OnboardingBottomButton extends StatelessWidget { @override Widget build(BuildContext context) => ConstrainedBox( - constraints: const BoxConstraints.tightFor(height: MINIMUM_TOUCH_SIZE), - child: ElevatedButton( - key: nextKey, - onPressed: onPressed, - style: ButtonStyle( - backgroundColor: WidgetStateProperty.all(backgroundColor), - overlayColor: backgroundColor == Colors.white - ? WidgetStateProperty.all(Theme.of(context).splashColor) - : null, - shape: WidgetStateProperty.all( - const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(40))), - ), - ), - child: Text( - label, - style: Theme.of(context).textTheme.displaySmall?.copyWith( - color: foregroundColor, - ), + constraints: const BoxConstraints.tightFor(height: MINIMUM_TOUCH_SIZE), + child: ElevatedButton( + key: nextKey, + onPressed: onPressed, + style: ButtonStyle( + backgroundColor: WidgetStateProperty.all(backgroundColor), + overlayColor: backgroundColor == Colors.white + ? WidgetStateProperty.all(Theme.of(context).splashColor) + : null, + shape: WidgetStateProperty.all( + const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(40)), ), ), - ); + ), + child: Text( + label, + style: Theme.of( + context, + ).textTheme.displaySmall?.copyWith(color: foregroundColor), + ), + ), + ); } /// Onboarding Bottom Icon, e.g. arrow for "next" or "previous". @@ -127,17 +128,14 @@ class OnboardingBottomIcon extends StatelessWidget { @override Widget build(BuildContext context) => ElevatedButton( - style: ElevatedButton.styleFrom( - shape: const CircleBorder(), - padding: const EdgeInsets.all(MEDIUM_SPACE), - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - iconColor: foregroundColor, - ), - onPressed: onPressed, - child: Padding( - padding: iconPadding ?? EdgeInsets.zero, - child: icon, - ), - ); + style: ElevatedButton.styleFrom( + shape: const CircleBorder(), + padding: const EdgeInsets.all(MEDIUM_SPACE), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + iconColor: foregroundColor, + ), + onPressed: onPressed, + child: Padding(padding: iconPadding ?? EdgeInsets.zero, child: icon), + ); } diff --git a/packages/smooth_app/lib/pages/onboarding/onboarding_flow_navigator.dart b/packages/smooth_app/lib/pages/onboarding/onboarding_flow_navigator.dart index f1c3752bf1..14c4175c4b 100644 --- a/packages/smooth_app/lib/pages/onboarding/onboarding_flow_navigator.dart +++ b/packages/smooth_app/lib/pages/onboarding/onboarding_flow_navigator.dart @@ -103,17 +103,14 @@ enum OnboardingPage { Widget _wrapWidgetInCustomBackNavigator( BuildContext context, Widget widget, - ) => - WillPopScope2( - onWillPop: () async => (false, null), - // wrap the widget in [Builder] to allow navigation on the [context]. - child: Builder( - builder: (BuildContext context) => SmoothScaffold( - body: widget, - brightness: Brightness.dark, - ), - ), - ); + ) => WillPopScope2( + onWillPop: () async => (false, null), + // wrap the widget in [Builder] to allow navigation on the [context]. + child: Builder( + builder: (BuildContext context) => + SmoothScaffold(body: widget, brightness: Brightness.dark), + ), + ); } /// Decide which page to take the user to. @@ -140,9 +137,7 @@ class OnboardingFlowNavigator { if (page.isOnboardingComplete()) { AppNavigator.of(context) ..clearStack() - ..pushReplacement( - AppRoutes.HOME(redraw: true), - ); + ..pushReplacement(AppRoutes.HOME(redraw: true)); } else { final MaterialPageRoute route = MaterialPageRoute( builder: (BuildContext context) => page.getPageWidget(context), diff --git a/packages/smooth_app/lib/pages/onboarding/permissions_page.dart b/packages/smooth_app/lib/pages/onboarding/permissions_page.dart index 22acfe7174..98f014427d 100644 --- a/packages/smooth_app/lib/pages/onboarding/permissions_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/permissions_page.dart @@ -17,10 +17,7 @@ import 'package:smooth_app/themes/theme_provider.dart'; import 'package:smooth_app/widgets/smooth_text.dart'; class PermissionsPage extends StatefulWidget { - const PermissionsPage( - this.backgroundColor, { - super.key, - }); + const PermissionsPage(this.backgroundColor, {super.key}); final Color backgroundColor; @@ -37,11 +34,7 @@ class _PermissionsPageState extends State { final AppLocalizations appLocalizations = AppLocalizations.of(context); return Listener( - listener: ( - BuildContext context, - _, - PermissionListener newValue, - ) { + listener: (BuildContext context, _, PermissionListener newValue) { if (newValue.value.isGranted && !_eventConsumed) { _endOnboarding(context); _eventConsumed = true; @@ -60,25 +53,29 @@ class _PermissionsPageState extends State { child: Column( mainAxisSize: MainAxisSize.min, children: [ - LayoutBuilder(builder: - (BuildContext context, BoxConstraints constraints) { - return SizedBox.square( - dimension: constraints.maxWidth * 0.5, - child: Transform.rotate( - angle: -0.2, - child: const animations.BarcodeAnimation(), - ), - ); - }), + LayoutBuilder( + builder: + ( + BuildContext context, + BoxConstraints constraints, + ) { + return SizedBox.square( + dimension: constraints.maxWidth * 0.5, + child: Transform.rotate( + angle: -0.2, + child: const animations.BarcodeAnimation(), + ), + ); + }, + ), const SizedBox(height: LARGE_SPACE), AutoSizeText( appLocalizations.permissions_page_title, maxLines: 2, - style: Theme.of(context) - .textTheme - .displayLarge! + style: Theme.of(context).textTheme.displayLarge! .apply( - color: const Color.fromARGB(255, 51, 51, 51)), + color: const Color.fromARGB(255, 51, 51, 51), + ), textAlign: TextAlign.center, ), const SizedBox(height: SMALL_SPACE), @@ -113,7 +110,7 @@ class _PermissionsPageState extends State { ), backgroundColor: widget.backgroundColor, semanticsHorizontalOrder: false, - ) + ), ], ), ), @@ -129,26 +126,21 @@ class _PermissionsPageState extends State { if (!context.mounted) { return; } - await OnboardingLoader(context.read()).runAtNextTime( - _onboardingPage, - context, - ); + await OnboardingLoader( + context.read(), + ).runAtNextTime(_onboardingPage, context); if (!context.mounted) { return; } - await OnboardingFlowNavigator(context.read()) - .navigateToPage( - context, - _onboardingPage.getNextPage(), - ); + await OnboardingFlowNavigator( + context.read(), + ).navigateToPage(context, _onboardingPage.getNextPage()); } } class _AskPermissionButton extends StatelessWidget { - const _AskPermissionButton({ - required this.onPermissionIgnored, - }); + const _AskPermissionButton({required this.onPermissionIgnored}); final VoidCallback onPermissionIgnored; @@ -159,11 +151,12 @@ class _AskPermissionButton extends StatelessWidget { return OnboardingBottomButton( onPressed: () async { context.read().askPermission( - onRationaleNotAvailable: () async { - // Don't open settings and continue the navigation - onPermissionIgnored.call(); - return false; - }); + onRationaleNotAvailable: () async { + // Don't open settings and continue the navigation + onPermissionIgnored.call(); + return false; + }, + ); }, backgroundColor: Colors.white, foregroundColor: Colors.black, @@ -175,9 +168,7 @@ class _AskPermissionButton extends StatelessWidget { } class _IgnoreButton extends StatelessWidget { - const _IgnoreButton({ - required this.onPermissionIgnored, - }); + const _IgnoreButton({required this.onPermissionIgnored}); final VoidCallback onPermissionIgnored; diff --git a/packages/smooth_app/lib/pages/onboarding/preferences_page.dart b/packages/smooth_app/lib/pages/onboarding/preferences_page.dart index 998a9bbfdf..52222e9701 100644 --- a/packages/smooth_app/lib/pages/onboarding/preferences_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/preferences_page.dart @@ -39,26 +39,26 @@ class _PreferencesPageState extends State { } Future _init() async => - _product = await OnboardingDataProduct.forProduct(widget._localDatabase) - .getData(rootBundle); + _product = await OnboardingDataProduct.forProduct( + widget._localDatabase, + ).getData(rootBundle); @override Widget build(BuildContext context) => FutureBuilder( - future: _initFuture, - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.hasError) { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); - return Text( - appLocalizations.preferences_page_loading_error(snapshot.error), - ); - } - if (snapshot.connectionState != ConnectionState.done) { - return const Center(child: CircularProgressIndicator.adaptive()); - } - return _Helper(_product, widget.backgroundColor); - }, - ); + future: _initFuture, + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.hasError) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + return Text( + appLocalizations.preferences_page_loading_error(snapshot.error), + ); + } + if (snapshot.connectionState != ConnectionState.done) { + return const Center(child: CircularProgressIndicator.adaptive()); + } + return _Helper(_product, widget.backgroundColor); + }, + ); } // In order to avoid to reload the product when refreshing the preferences. @@ -75,8 +75,8 @@ class _Helper extends StatefulWidget { class _HelperState extends State<_Helper> { @override Widget build(BuildContext context) { - final ProductPreferences productPreferences = - context.watch(); + final ProductPreferences productPreferences = context + .watch(); final UserPreferences userPreferences = context.watch(); final AppLocalizations appLocalizations = AppLocalizations.of(context); final List pageData = [ diff --git a/packages/smooth_app/lib/pages/onboarding/reinvention_page.dart b/packages/smooth_app/lib/pages/onboarding/reinvention_page.dart index f73352f9d4..a64a1f5442 100644 --- a/packages/smooth_app/lib/pages/onboarding/reinvention_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/reinvention_page.dart @@ -28,10 +28,10 @@ class OnboardingHomePage extends StatelessWidget { const _OnboardingWelcomePageContent(), OnboardingBottomHills( onTap: () async { - final UserPreferences userPreferences = - context.read(); - final LocalDatabase localDatabase = - context.read(); + final UserPreferences userPreferences = context + .read(); + final LocalDatabase localDatabase = context + .read(); /// Enable crash reports and user tracking by default /// (Can be disabled by the user later in the settings) @@ -39,8 +39,9 @@ class OnboardingHomePage extends StatelessWidget { await userPreferences.setUserTracking(true); if (context.mounted) { - await OnboardingLoader(localDatabase) - .runAtNextTime(OnboardingPage.HOME_PAGE, context); + await OnboardingLoader( + localDatabase, + ).runAtNextTime(OnboardingPage.HOME_PAGE, context); } if (context.mounted) { @@ -86,10 +87,7 @@ class _OnboardingWelcomePageContent extends StatelessWidget { textAlign: TextAlign.center, ), ), - const Expanded( - flex: 37, - child: _SunAndCloud(), - ), + const Expanded(flex: 37, child: _SunAndCloud()), Expanded( flex: 45, child: FractionallySizedBox( @@ -145,13 +143,11 @@ class _SunAndCloudState extends State<_SunAndCloud> @override void initState() { super.initState(); - _controller = - AnimationController(vsync: this, duration: const Duration(seconds: 2)) - ..addListener(() => setState(() {})); - _animation = Tween( - begin: -1.0, - end: 1.0, - ).animate(_controller); + _controller = AnimationController( + vsync: this, + duration: const Duration(seconds: 2), + )..addListener(() => setState(() {})); + _animation = Tween(begin: -1.0, end: 1.0).animate(_controller); _controller.repeat(reverse: true); } @@ -160,33 +156,32 @@ class _SunAndCloudState extends State<_SunAndCloud> final TextDirection textDirection = Directionality.of(context); return RepaintBoundary( - child: LayoutBuilder(builder: ( - BuildContext context, - BoxConstraints constraints, - ) { - return Stack( - children: [ - Positioned.directional( - top: constraints.maxHeight * 0.3, - bottom: constraints.maxHeight * 0.2, - start: (_animation.value * 161.0) * 0.3, - textDirection: textDirection, - child: SvgPicture.asset('assets/onboarding/cloud.svg'), - ), - const Align( - alignment: Alignment.center, - child: SunAnimation(type: SunAnimationType.loop), - ), - Positioned.directional( - top: constraints.maxHeight * 0.22, - bottom: constraints.maxHeight * 0.35, - end: (_animation.value * 40.0) - 31, - textDirection: textDirection, - child: SvgPicture.asset('assets/onboarding/cloud.svg'), - ), - ], - ); - }), + child: LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + return Stack( + children: [ + Positioned.directional( + top: constraints.maxHeight * 0.3, + bottom: constraints.maxHeight * 0.2, + start: (_animation.value * 161.0) * 0.3, + textDirection: textDirection, + child: SvgPicture.asset('assets/onboarding/cloud.svg'), + ), + const Align( + alignment: Alignment.center, + child: SunAnimation(type: SunAnimationType.loop), + ), + Positioned.directional( + top: constraints.maxHeight * 0.22, + bottom: constraints.maxHeight * 0.35, + end: (_animation.value * 40.0) - 31, + textDirection: textDirection, + child: SvgPicture.asset('assets/onboarding/cloud.svg'), + ), + ], + ); + }, + ), ); } @@ -200,7 +195,7 @@ class _SunAndCloudState extends State<_SunAndCloud> // TODO(g123k): Move elsewhere when the onboarding will be redesigned class OnboardingConfig { OnboardingConfig._(Size screenSize) - : fontMultiplier = computeFontMultiplier(screenSize); + : fontMultiplier = computeFontMultiplier(screenSize); final double fontMultiplier; static double computeFontMultiplier(Size screenSize) => diff --git a/packages/smooth_app/lib/pages/onboarding/sample_eco_card_page.dart b/packages/smooth_app/lib/pages/onboarding/sample_eco_card_page.dart index ccc41e27d0..166cce64d8 100644 --- a/packages/smooth_app/lib/pages/onboarding/sample_eco_card_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/sample_eco_card_page.dart @@ -12,12 +12,12 @@ class SampleEcoCardPage extends StatelessWidget { @override Widget build(BuildContext context) => KnowledgePanelPageTemplate( - headerTitle: AppLocalizations.of(context).ecoCardUtility, - page: OnboardingPage.ECO_CARD_EXAMPLE, - panelId: 'environment_card', - localDatabase: _localDatabase, - backgroundColor: backgroundColor, - svgAsset: 'assets/onboarding/eco.svg', - nextKey: const Key('nextAfterEco'), - ); + headerTitle: AppLocalizations.of(context).ecoCardUtility, + page: OnboardingPage.ECO_CARD_EXAMPLE, + panelId: 'environment_card', + localDatabase: _localDatabase, + backgroundColor: backgroundColor, + svgAsset: 'assets/onboarding/eco.svg', + nextKey: const Key('nextAfterEco'), + ); } diff --git a/packages/smooth_app/lib/pages/onboarding/sample_health_card_page.dart b/packages/smooth_app/lib/pages/onboarding/sample_health_card_page.dart index 824831e795..bd4bbd1c31 100644 --- a/packages/smooth_app/lib/pages/onboarding/sample_health_card_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/sample_health_card_page.dart @@ -13,15 +13,15 @@ class SampleHealthCardPage extends StatelessWidget { @override Widget build(BuildContext context) => SmoothBrightnessOverride( - brightness: Brightness.dark, - child: KnowledgePanelPageTemplate( - headerTitle: AppLocalizations.of(context).healthCardUtility, - page: OnboardingPage.HEALTH_CARD_EXAMPLE, - panelId: 'health_card', - localDatabase: _localDatabase, - backgroundColor: backgroundColor, - svgAsset: 'assets/onboarding/health.svg', - nextKey: const Key('nextAfterHealth'), - ), - ); + brightness: Brightness.dark, + child: KnowledgePanelPageTemplate( + headerTitle: AppLocalizations.of(context).healthCardUtility, + page: OnboardingPage.HEALTH_CARD_EXAMPLE, + panelId: 'health_card', + localDatabase: _localDatabase, + backgroundColor: backgroundColor, + svgAsset: 'assets/onboarding/health.svg', + nextKey: const Key('nextAfterHealth'), + ), + ); } diff --git a/packages/smooth_app/lib/pages/onboarding/v2/onboarding_bottom_hills.dart b/packages/smooth_app/lib/pages/onboarding/v2/onboarding_bottom_hills.dart index 86611b0e32..befa7b81f6 100644 --- a/packages/smooth_app/lib/pages/onboarding/v2/onboarding_bottom_hills.dart +++ b/packages/smooth_app/lib/pages/onboarding/v2/onboarding_bottom_hills.dart @@ -8,10 +8,7 @@ import 'package:smooth_app/resources/app_icons.dart' as icons; import 'package:smooth_app/themes/smooth_theme_colors.dart'; class OnboardingBottomHills extends StatelessWidget { - const OnboardingBottomHills({ - required this.onTap, - super.key, - }); + const OnboardingBottomHills({required this.onTap, super.key}); final VoidCallback onTap; @@ -32,8 +29,9 @@ class OnboardingBottomHills extends StatelessWidget { } final double maxHeight = OnboardingBottomHills.height(context); - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; return Positioned( top: null, @@ -68,9 +66,7 @@ class OnboardingBottomHills extends StatelessWidget { end: 15.0, child: TextButton( style: ButtonStyle( - backgroundColor: WidgetStateProperty.all( - Colors.white, - ), + backgroundColor: WidgetStateProperty.all(Colors.white), padding: WidgetStateProperty.all( const EdgeInsetsDirectional.only( start: LARGE_SPACE + 1.0, diff --git a/packages/smooth_app/lib/pages/onboarding/welcome_page.dart b/packages/smooth_app/lib/pages/onboarding/welcome_page.dart index 2b6e343dbc..602a4523b0 100644 --- a/packages/smooth_app/lib/pages/onboarding/welcome_page.dart +++ b/packages/smooth_app/lib/pages/onboarding/welcome_page.dart @@ -60,7 +60,8 @@ class WelcomePage extends StatelessWidget { ), Padding( padding: const EdgeInsetsDirectional.only( - top: SMALL_SPACE), + top: SMALL_SPACE, + ), child: SizedBox( height: screenSize.height * .15, child: AutoSizeText( @@ -83,7 +84,8 @@ class WelcomePage extends StatelessWidget { ), Padding( padding: const EdgeInsets.symmetric( - vertical: MEDIUM_SPACE), + vertical: MEDIUM_SPACE, + ), child: Container( decoration: BoxDecoration( border: Border.fromBorderSide( @@ -124,8 +126,9 @@ class WelcomePage extends StatelessWidget { ), ), ), - textStyle: - TextStyle(color: theme.primaryColor), + textStyle: TextStyle( + color: theme.primaryColor, + ), ), ), ), diff --git a/packages/smooth_app/lib/pages/page_manager.dart b/packages/smooth_app/lib/pages/page_manager.dart index 06732ff31e..7fdae4f050 100644 --- a/packages/smooth_app/lib/pages/page_manager.dart +++ b/packages/smooth_app/lib/pages/page_manager.dart @@ -9,11 +9,7 @@ import 'package:smooth_app/widgets/smooth_navigation_bar.dart'; import 'package:smooth_app/widgets/tab_navigator.dart'; import 'package:smooth_app/widgets/will_pop_scope.dart'; -enum BottomNavigationTab { - Profile, - Scan, - List, -} +enum BottomNavigationTab { Profile, Scan, List } /// Here the different tabs in the bottom navigation bar are taken care of, /// so that they are stateful, that is not only things like the scroll position @@ -35,10 +31,10 @@ class PageManagerState extends State { final Map> _navigatorKeys = >{ - BottomNavigationTab.Profile: GlobalKey(), - BottomNavigationTab.Scan: GlobalKey(), - BottomNavigationTab.List: GlobalKey(), - }; + BottomNavigationTab.Profile: GlobalKey(), + BottomNavigationTab.Scan: GlobalKey(), + BottomNavigationTab.List: GlobalKey(), + }; BottomNavigationTab _currentPage = BottomNavigationTab.Scan; @@ -51,9 +47,9 @@ class PageManagerState extends State { void _selectTab(BottomNavigationTab tabItem, int index) { if (tabItem == _currentPage) { - _navigatorKeys[tabItem]! - .currentState! - .popUntil((Route route) => route.isFirst); + _navigatorKeys[tabItem]!.currentState!.popUntil( + (Route route) => route.isFirst, + ); } else { setState(() { _currentPage = _pageKeys[index]; @@ -78,8 +74,10 @@ class PageManagerState extends State { ]; final UserPreferences userPreferences = context.watch(); - final bool isProd = userPreferences - .getFlag(UserPreferencesDevMode.userPreferencesFlagProd) ?? + final bool isProd = + userPreferences.getFlag( + UserPreferencesDevMode.userPreferencesFlagProd, + ) ?? true; final Widget bar = DecoratedBox( decoration: BoxDecoration( diff --git a/packages/smooth_app/lib/pages/personalized_ranking_page.dart b/packages/smooth_app/lib/pages/personalized_ranking_page.dart index 939274501b..84c61f2fae 100644 --- a/packages/smooth_app/lib/pages/personalized_ranking_page.dart +++ b/packages/smooth_app/lib/pages/personalized_ranking_page.dart @@ -22,10 +22,7 @@ import 'package:smooth_app/widgets/smooth_menu_button.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; class PersonalizedRankingPage extends StatefulWidget { - const PersonalizedRankingPage({ - required this.barcodes, - required this.title, - }); + const PersonalizedRankingPage({required this.barcodes, required this.title}); final List barcodes; final String title; @@ -59,20 +56,16 @@ class _PersonalizedRankingPageState extends State final AppLocalizations appLocalizations = AppLocalizations.of(context); final LocalDatabase localDatabase = context.read(); final DaoProductList daoProductList = DaoProductList(localDatabase); - final bool? added = await ProductListUserDialogHelper(daoProductList) - .showUserAddProductsDialog( - context, - widget.barcodes.toSet(), - ); + final bool? added = await ProductListUserDialogHelper( + daoProductList, + ).showUserAddProductsDialog(context, widget.barcodes.toSet()); if (!context.mounted) { return; } if (added != null && added) { ScaffoldMessenger.of(context).showSnackBar( SmoothFloatingSnackbar( - content: Text( - appLocalizations.added_to_list_msg, - ), + content: Text(appLocalizations.added_to_list_msg), duration: SnackBarDuration.medium, ), ); @@ -91,8 +84,8 @@ class _PersonalizedRankingPageState extends State @override Widget build(BuildContext context) { - final ProductPreferences productPreferences = - context.watch(); + final ProductPreferences productPreferences = context + .watch(); context.watch(); final AppLocalizations appLocalizations = AppLocalizations.of(context); @@ -118,8 +111,8 @@ class _PersonalizedRankingPageState extends State create: (final BuildContext context) => _model, builder: (final BuildContext context, final Widget? wtf) { context.watch(); - final List compactPreferences = - productPreferences.getCompactView(); + final List compactPreferences = productPreferences + .getCompactView(); if (_compactPreferences == null) { _compactPreferences = compactPreferences; _model.refresh(productPreferences); @@ -167,11 +160,8 @@ class _PersonalizedRankingPageState extends State final bool darkMode = Theme.of(context).brightness == Brightness.dark; return ListView.builder( itemCount: list.length, - itemBuilder: (BuildContext context, int index) => _buildItem( - list[index], - appLocalizations, - darkMode, - ), + itemBuilder: (BuildContext context, int index) => + _buildItem(list[index], appLocalizations, darkMode), ); }, ), @@ -182,26 +172,18 @@ class _PersonalizedRankingPageState extends State final _VirtualItem item, final AppLocalizations appLocalizations, final bool darkMode, - ) => - item.status != null - ? _buildHeader( - item.status!, - appLocalizations, - darkMode, - ) - : _buildSmoothProductCard( - item.score!, - appLocalizations, - darkMode, - ); + ) => item.status != null + ? _buildHeader(item.status!, appLocalizations, darkMode) + : _buildSmoothProductCard(item.score!, appLocalizations, darkMode); Widget _buildHeader( final MatchedProductStatusV2 status, final AppLocalizations appLocalizations, final bool darkMode, ) { - final ProductCompatibilityHelper helper = - ProductCompatibilityHelper.status(status); + final ProductCompatibilityHelper helper = ProductCompatibilityHelper.status( + status, + ); return SizedBox( width: double.infinity, child: ColoredBox( @@ -212,10 +194,10 @@ class _PersonalizedRankingPageState extends State helper.getHeaderText(appLocalizations), textAlign: TextAlign.center, style: Theme.of(context).textTheme.titleMedium?.copyWith( - fontWeight: FontWeight.w600, - fontSize: 15.0, - color: Colors.white, - ), + fontWeight: FontWeight.w600, + fontSize: 15.0, + color: Colors.white, + ), ), ), ), @@ -226,36 +208,31 @@ class _PersonalizedRankingPageState extends State final MatchedScoreV2 matchedProduct, final AppLocalizations appLocalizations, final bool darkMode, - ) => - Dismissible( - direction: DismissDirection.endToStart, - background: Container( - alignment: AlignmentDirectional.centerEnd, - color: RED_COLOR, - padding: const EdgeInsetsDirectional.only(end: 30.0), - child: const Icon( - Icons.delete, - color: Colors.white, - ), - ), - key: Key(matchedProduct.barcode), - onDismissed: (final DismissDirection direction) { - _model.dismiss(matchedProduct.barcode); - ScaffoldMessenger.of(context).showSnackBar( - SmoothFloatingSnackbar( - content: Text(appLocalizations.product_removed_comparison), - duration: SnackBarDuration.medium, - ), - ); - }, - child: ProductListItemSimple( - barcode: matchedProduct.barcode, - backgroundColor: - ProductCompatibilityHelper.status(matchedProduct.status) - .getColor(context) - .withAlpha(_backgroundAlpha), + ) => Dismissible( + direction: DismissDirection.endToStart, + background: Container( + alignment: AlignmentDirectional.centerEnd, + color: RED_COLOR, + padding: const EdgeInsetsDirectional.only(end: 30.0), + child: const Icon(Icons.delete, color: Colors.white), + ), + key: Key(matchedProduct.barcode), + onDismissed: (final DismissDirection direction) { + _model.dismiss(matchedProduct.barcode); + ScaffoldMessenger.of(context).showSnackBar( + SmoothFloatingSnackbar( + content: Text(appLocalizations.product_removed_comparison), + duration: SnackBarDuration.medium, ), ); + }, + child: ProductListItemSimple( + barcode: matchedProduct.barcode, + backgroundColor: ProductCompatibilityHelper.status( + matchedProduct.status, + ).getColor(context).withAlpha(_backgroundAlpha), + ), + ); } /// Virtual item in the list: either a product or a status header diff --git a/packages/smooth_app/lib/pages/preferences/abstract_user_preferences.dart b/packages/smooth_app/lib/pages/preferences/abstract_user_preferences.dart index 6693f97bb7..2538024ddd 100644 --- a/packages/smooth_app/lib/pages/preferences/abstract_user_preferences.dart +++ b/packages/smooth_app/lib/pages/preferences/abstract_user_preferences.dart @@ -32,10 +32,8 @@ abstract class AbstractUserPreferences { /// Title of the header, always visible. @protected - Widget getTitle() => Text( - getTitleString(), - style: themeData.textTheme.displayMedium, - ); + Widget getTitle() => + Text(getTitleString(), style: themeData.textTheme.displayMedium); /// Subtitle of the header, always visible. @protected @@ -47,38 +45,38 @@ abstract class AbstractUserPreferences { getSubtitleString() == null ? null : Text(getSubtitleString()!); List getLabels() => [ - getPageTitleString(), - getTitleString(), - if (getSubtitleString() != null) getSubtitleString()!, - ]; + getPageTitleString(), + getTitleString(), + if (getSubtitleString() != null) getSubtitleString()!, + ]; Widget getOnlyHeader() => InkWell( - onTap: () async => runHeaderAction(), - child: getHeaderHelper(false), - ); + onTap: () async => runHeaderAction(), + child: getHeaderHelper(false), + ); @protected - Icon? getForwardIcon() => UserPreferencesListTile.getTintedIcon( - ConstantIcons.forwardIcon, - context, - ); + Icon? getForwardIcon() => + UserPreferencesListTile.getTintedIcon(ConstantIcons.forwardIcon, context); /// Returns the tappable header. @protected Widget getHeader() => InkWell( - onTap: () async => runHeaderAction(), - child: getHeaderHelper(true), - ); + onTap: () async => runHeaderAction(), + child: getHeaderHelper(true), + ); /// Returns the header (helper) (no padding, no tapping). @protected Widget getHeaderHelper(final bool? collapsed) => UserPreferencesListTile( - title: getTitle(), - subtitle: getSubtitle(), - trailing: collapsed != null ? getForwardIcon() : null, - leading: UserPreferencesListTile.getTintedIcon( - getLeadingIconData(), context), - ); + title: getTitle(), + subtitle: getSubtitle(), + trailing: collapsed != null ? getForwardIcon() : null, + leading: UserPreferencesListTile.getTintedIcon( + getLeadingIconData(), + context, + ), + ); @protected IconData getLeadingIconData(); @@ -89,13 +87,12 @@ abstract class AbstractUserPreferences { /// Returns the action when we tap on the header. @protected Future runHeaderAction() async => Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => UserPreferencesPage( - type: getPreferencePageType(), - ), - ), - ); + context, + MaterialPageRoute( + builder: (BuildContext context) => + UserPreferencesPage(type: getPreferencePageType()), + ), + ); /// Svg asset for the header. /// diff --git a/packages/smooth_app/lib/pages/preferences/account_deletion_webview.dart b/packages/smooth_app/lib/pages/preferences/account_deletion_webview.dart index b9e472154e..77191abb15 100644 --- a/packages/smooth_app/lib/pages/preferences/account_deletion_webview.dart +++ b/packages/smooth_app/lib/pages/preferences/account_deletion_webview.dart @@ -21,11 +21,15 @@ class _AccountDeletionWebviewState extends State { const PlatformWebViewControllerCreationParams(); if (WebViewPlatform.instance is WebKitWebViewPlatform) { - params = WebKitWebViewControllerCreationParams - .fromPlatformWebViewControllerCreationParams(params); + params = + WebKitWebViewControllerCreationParams.fromPlatformWebViewControllerCreationParams( + params, + ); } else if (WebViewPlatform.instance is AndroidWebViewPlatform) { - params = AndroidWebViewControllerCreationParams - .fromPlatformWebViewControllerCreationParams(params); + params = + AndroidWebViewControllerCreationParams.fromPlatformWebViewControllerCreationParams( + params, + ); } _controller = WebViewController.fromPlatformCreationParams(params) @@ -33,21 +37,16 @@ class _AccountDeletionWebviewState extends State { } Uri _getUri() => Uri( - scheme: 'https', - host: 'blog.openfoodfacts.org', - pathSegments: [ - 'en', - 'account-deletion', - ], - ); + scheme: 'https', + host: 'blog.openfoodfacts.org', + pathSegments: ['en', 'account-deletion'], + ); @override Widget build(BuildContext context) { return SmoothScaffold( appBar: SmoothAppBar(), - body: WebViewWidget( - controller: _controller, - ), + body: WebViewWidget(controller: _controller), ); } } diff --git a/packages/smooth_app/lib/pages/preferences/attribute_group_list_tile.dart b/packages/smooth_app/lib/pages/preferences/attribute_group_list_tile.dart index 9231124c85..081f69cb81 100644 --- a/packages/smooth_app/lib/pages/preferences/attribute_group_list_tile.dart +++ b/packages/smooth_app/lib/pages/preferences/attribute_group_list_tile.dart @@ -3,27 +3,24 @@ import 'package:smooth_app/generic_lib/design_constants.dart'; /// Custom [ListTile] for attribute groups in preferences. class AttributeGroupListTile extends StatelessWidget { - const AttributeGroupListTile({ - required this.title, - required this.icon, - }); + const AttributeGroupListTile({required this.title, required this.icon}); final Widget title; final Widget icon; @override Widget build(BuildContext context) => Padding( - padding: const EdgeInsets.symmetric( - horizontal: LARGE_SPACE, - vertical: LARGE_SPACE, - ), - child: DefaultTextStyle.merge( - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.center, - children: [title, icon], - ), - style: Theme.of(context).textTheme.headlineMedium, - ), - ); + padding: const EdgeInsets.symmetric( + horizontal: LARGE_SPACE, + vertical: LARGE_SPACE, + ), + child: DefaultTextStyle.merge( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + children: [title, icon], + ), + style: Theme.of(context).textTheme.headlineMedium, + ), + ); } diff --git a/packages/smooth_app/lib/pages/preferences/country_selector/country.dart b/packages/smooth_app/lib/pages/preferences/country_selector/country.dart index a16e37bf68..31d77359e8 100644 --- a/packages/smooth_app/lib/pages/preferences/country_selector/country.dart +++ b/packages/smooth_app/lib/pages/preferences/country_selector/country.dart @@ -17,13 +17,14 @@ extension OpenFoodFactsCountryLocalization on OpenFoodFactsCountry { String get name { final String? result = _getMapper().map[_latestLanguageCode]?.map[iso3Code] ?? - _getMapper().map[_englishLanguageCode]?.map[iso3Code]; + _getMapper().map[_englishLanguageCode]?.map[iso3Code]; if (result != null) { return result; } // lousy fallback version in English - final String countryName = - toString().replaceAll('OpenFoodFactsCountry.', '').replaceAll('_', ' '); + final String countryName = toString() + .replaceAll('OpenFoodFactsCountry.', '') + .replaceAll('_', ' '); return '${countryName[0].toUpperCase()}' '${countryName.substring(1).toLowerCase()}'; } diff --git a/packages/smooth_app/lib/pages/preferences/country_selector/country_selector.dart b/packages/smooth_app/lib/pages/preferences/country_selector/country_selector.dart index 390376a318..6a9a1d2623 100644 --- a/packages/smooth_app/lib/pages/preferences/country_selector/country_selector.dart +++ b/packages/smooth_app/lib/pages/preferences/country_selector/country_selector.dart @@ -49,19 +49,17 @@ class CountrySelector extends StatelessWidget { builder: (BuildContext context, _CountrySelectorProvider provider, _) { return switch (provider.value) { PreferencesSelectorLoadingState _ => SizedBox( - height: loadingHeight, - child: const Center( - child: CircularProgressIndicator.adaptive(), - ), - ), + height: loadingHeight, + child: const Center(child: CircularProgressIndicator.adaptive()), + ), PreferencesSelectorLoadedState _ => _CountrySelectorButton( - icon: icon, - innerPadding: padding ?? EdgeInsets.zero, - textStyle: textStyle, - inkWellBorderRadius: inkWellBorderRadius, - forceCurrencyChange: forceCurrencyChange, - autoValidate: autoValidate, - ), + icon: icon, + innerPadding: padding ?? EdgeInsets.zero, + textStyle: textStyle, + inkWellBorderRadius: inkWellBorderRadius, + forceCurrencyChange: forceCurrencyChange, + autoValidate: autoValidate, + ), }; }, ), @@ -97,88 +95,100 @@ class _CountrySelectorButton extends StatelessWidget { ), child: ConstrainedBox( constraints: const BoxConstraints(minHeight: 40.0), - child: ConsumerValueNotifierFilter<_CountrySelectorProvider, - PreferencesSelectorState>( - buildWhen: (PreferencesSelectorState? previousValue, - PreferencesSelectorState currentValue) => - previousValue != null && - currentValue is! PreferencesSelectorEditingState && - (currentValue as PreferencesSelectorLoadedState) - .selectedItem != - (previousValue as PreferencesSelectorLoadedState) - .selectedItem, - builder: (_, PreferencesSelectorState value, __) { - final Country? country = - (value as PreferencesSelectorLoadedState) - .selectedItem; + child: + ConsumerValueNotifierFilter< + _CountrySelectorProvider, + PreferencesSelectorState + >( + buildWhen: + ( + PreferencesSelectorState? previousValue, + PreferencesSelectorState currentValue, + ) => + previousValue != null && + currentValue is! PreferencesSelectorEditingState && + (currentValue + as PreferencesSelectorLoadedState) + .selectedItem != + (previousValue + as PreferencesSelectorLoadedState) + .selectedItem, + builder: (_, PreferencesSelectorState value, __) { + final Country? country = + (value as PreferencesSelectorLoadedState) + .selectedItem; - return Padding( - padding: innerPadding, - child: Row( - children: [ - if (country != null) - SizedBox( - width: IconTheme.of(context).size! + LARGE_SPACE, - child: AutoSizeText( - EmojiHelper.getCountryEmoji(country)!, - textAlign: TextAlign.center, - style: - TextStyle(fontSize: IconTheme.of(context).size), + return Padding( + padding: innerPadding, + child: Row( + children: [ + if (country != null) + SizedBox( + width: IconTheme.of(context).size! + LARGE_SPACE, + child: AutoSizeText( + EmojiHelper.getCountryEmoji(country)!, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: IconTheme.of(context).size, + ), + ), + ) + else + const Icon(Icons.public), + const SizedBox(width: SMALL_SPACE), + Expanded( + child: Text( + country?.name ?? + AppLocalizations.of(context).loading, + style: Theme.of( + context, + ).textTheme.displaySmall?.merge(textStyle), + ), ), - ) - else - const Icon(Icons.public), - const SizedBox(width: SMALL_SPACE), - Expanded( - child: Text( - country?.name ?? AppLocalizations.of(context).loading, - style: Theme.of(context) - .textTheme - .displaySmall - ?.merge(textStyle), - ), + icon ?? const Icon(Icons.arrow_drop_down), + ], ), - icon ?? const Icon(Icons.arrow_drop_down), - ], - ), - ); - }, - ), + ); + }, + ), ), ), ); } Future _openCountrySelector(BuildContext context) async { - final dynamic newCountry = - await Navigator.of(context, rootNavigator: true).push( - PageRouteBuilder( - pageBuilder: (_, __, ___) => _CountrySelectorScreen( - provider: context.read<_CountrySelectorProvider>(), - ), - transitionsBuilder: (BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child) { - final Tween tween = Tween( - begin: const Offset(0.0, 1.0), - end: Offset.zero, - ); - final CurvedAnimation curvedAnimation = CurvedAnimation( - parent: animation, - curve: Curves.easeInOut, - ); - final Animation position = tween.animate(curvedAnimation); + final dynamic newCountry = await Navigator.of(context, rootNavigator: true) + .push( + PageRouteBuilder( + pageBuilder: (_, __, ___) => _CountrySelectorScreen( + provider: context.read<_CountrySelectorProvider>(), + ), + transitionsBuilder: + ( + BuildContext context, + Animation animation, + Animation secondaryAnimation, + Widget child, + ) { + final Tween tween = Tween( + begin: const Offset(0.0, 1.0), + end: Offset.zero, + ); + final CurvedAnimation curvedAnimation = CurvedAnimation( + parent: animation, + curve: Curves.easeInOut, + ); + final Animation position = tween.animate( + curvedAnimation, + ); - return SlideTransition( - position: position, - child: FadeTransition( - opacity: animation, - child: child, - ), - ); - }), - ); + return SlideTransition( + position: position, + child: FadeTransition(opacity: animation, child: child), + ); + }, + ), + ); if (!context.mounted) { return; @@ -193,7 +203,7 @@ class _CountrySelectorButton extends StatelessWidget { } } -// TODO(g123k): move this to a dedicated Provider + // TODO(g123k): move this to a dedicated Provider Future _changeCurrencyIfRelevant( final BuildContext context, final Country country, @@ -220,10 +230,7 @@ class _CountrySelectorButton extends StatelessWidget { body: Text( '${appLocalizations.country_change_message}' '\n' - '${appLocalizations.currency_auto_change_message( - currentCurrencyCode, - possibleCurrencyCode, - )}', + '${appLocalizations.currency_auto_change_message(currentCurrencyCode, possibleCurrencyCode)}', ), negativeAction: SmoothActionButton( onPressed: () => Navigator.of(context, rootNavigator: true).pop(), @@ -244,9 +251,7 @@ class _CountrySelectorButton extends StatelessWidget { } class _CountrySelectorScreen extends StatelessWidget { - const _CountrySelectorScreen({ - required this.provider, - }); + const _CountrySelectorScreen({required this.provider}); final _CountrySelectorProvider provider; @@ -257,51 +262,54 @@ class _CountrySelectorScreen extends StatelessWidget { return SmoothSelectorScreen( provider: provider, title: appLocalizations.country_selector_title, - itemBuilder: ( - BuildContext context, - Country country, - bool selected, - String filter, - ) { - return Row( - children: [ - Expanded( - flex: 1, - child: Text( - EmojiHelper.getCountryEmoji(country)!, - style: const TextStyle(fontSize: 25.0), - ), - ), - Expanded( - flex: 2, - child: Text( - country.offTag.toUpperCase(), - textAlign: TextAlign.center, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), - Expanded( - flex: 7, - child: TextHighlighter( - text: country.name, - filter: filter, - textStyle: const TextStyle( - fontWeight: FontWeight.w600, + itemBuilder: + ( + BuildContext context, + Country country, + bool selected, + String filter, + ) { + return Row( + children: [ + Expanded( + flex: 1, + child: Text( + EmojiHelper.getCountryEmoji(country)!, + style: const TextStyle(fontSize: 25.0), + ), ), - ), - ) - ], - ); - }, - itemsFilter: (List list, Country? selectedItem, - Country? selectedItemOverride, String filter) => - _filterCountries( - list, - selectedItem, - selectedItemOverride, - filter, - ), + Expanded( + flex: 2, + child: Text( + country.offTag.toUpperCase(), + textAlign: TextAlign.center, + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + Expanded( + flex: 7, + child: TextHighlighter( + text: country.name, + filter: filter, + textStyle: const TextStyle(fontWeight: FontWeight.w600), + ), + ), + ], + ); + }, + itemsFilter: + ( + List list, + Country? selectedItem, + Country? selectedItemOverride, + String filter, + ) => _filterCountries( + list, + selectedItem, + selectedItemOverride, + filter, + ), ); } @@ -319,12 +327,8 @@ class _CountrySelectorScreen extends StatelessWidget { (Country country) => country == userCountry || country == selectedCountry || - country.name.toLowerCase().contains( - filter.toLowerCase(), - ) || - country.offTag.toLowerCase().contains( - filter.toLowerCase(), - ), + country.name.toLowerCase().contains(filter.toLowerCase()) || + country.offTag.toLowerCase().contains(filter.toLowerCase()), ); } } diff --git a/packages/smooth_app/lib/pages/preferences/country_selector/country_selector_provider.dart b/packages/smooth_app/lib/pages/preferences/country_selector/country_selector_provider.dart index 53c4be09df..f3469eaaa7 100644 --- a/packages/smooth_app/lib/pages/preferences/country_selector/country_selector_provider.dart +++ b/packages/smooth_app/lib/pages/preferences/country_selector/country_selector_provider.dart @@ -48,27 +48,24 @@ class _CountrySelectorProvider extends PreferencesSelectorProvider { @override Future> onLoadValues() async { - final List countries = - OpenFoodFactsCountry.values.toList(growable: false); + final List countries = OpenFoodFactsCountry.values.toList( + growable: false, + ); _reorderCountries(countries); return countries; } /// Reorder countries alphabetically, bring user's locale country to top. - void _reorderCountries( - List countries, - ) { - countries.sort( - (final Country a, final Country b) { - if (a.offTag == userCountryCode) { - return -1; - } - if (b.offTag == userCountryCode) { - return 1; - } - return a.name.compareTo(b.name); - }, - ); + void _reorderCountries(List countries) { + countries.sort((final Country a, final Country b) { + if (a.offTag == userCountryCode) { + return -1; + } + if (b.offTag == userCountryCode) { + return 1; + } + return a.name.compareTo(b.name); + }); } @override diff --git a/packages/smooth_app/lib/pages/preferences/language_selector/language_selector.dart b/packages/smooth_app/lib/pages/preferences/language_selector/language_selector.dart index 5738d1ecd6..80ee855f4d 100644 --- a/packages/smooth_app/lib/pages/preferences/language_selector/language_selector.dart +++ b/packages/smooth_app/lib/pages/preferences/language_selector/language_selector.dart @@ -102,81 +102,100 @@ class _LanguageSelectorButton extends StatelessWidget { decoration: const BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(10)), ), - child: ConsumerValueNotifierFilter<_LanguageSelectorProvider, - PreferencesSelectorState>( - buildWhen: - (PreferencesSelectorState? previousValue, - PreferencesSelectorState - currentValue) => - previousValue != null && - currentValue is! PreferencesSelectorEditingState && - (currentValue as PreferencesSelectorLoadedState< - OpenFoodFactsLanguage>) - .selectedItem != - (previousValue as PreferencesSelectorLoadedState< - OpenFoodFactsLanguage>) - .selectedItem, - builder: - (_, PreferencesSelectorState value, __) { - final OpenFoodFactsLanguage? language = - (value as PreferencesSelectorLoadedState) - .selectedItem; + child: + ConsumerValueNotifierFilter< + _LanguageSelectorProvider, + PreferencesSelectorState + >( + buildWhen: + ( + PreferencesSelectorState? + previousValue, + PreferencesSelectorState + currentValue, + ) => + previousValue != null && + currentValue is! PreferencesSelectorEditingState && + (currentValue + as PreferencesSelectorLoadedState< + OpenFoodFactsLanguage + >) + .selectedItem != + (previousValue + as PreferencesSelectorLoadedState< + OpenFoodFactsLanguage + >) + .selectedItem, + builder: + ( + _, + PreferencesSelectorState value, + __, + ) { + final OpenFoodFactsLanguage? language = + (value + as PreferencesSelectorLoadedState< + OpenFoodFactsLanguage + >) + .selectedItem; - return Padding( - padding: innerPadding, - child: Row( - children: [ - const Icon(Icons.language), - const SizedBox(width: LARGE_SPACE), - Expanded( - child: Text( - LanguageSelector._getCompleteName(language!), - style: Theme.of(context) - .textTheme - .displaySmall - ?.merge(textStyle), - ), - ), - icon ?? const Icon(Icons.arrow_drop_down), - ], - ), - ); - }, - ), + return Padding( + padding: innerPadding, + child: Row( + children: [ + const Icon(Icons.language), + const SizedBox(width: LARGE_SPACE), + Expanded( + child: Text( + LanguageSelector._getCompleteName(language!), + style: Theme.of( + context, + ).textTheme.displaySmall?.merge(textStyle), + ), + ), + icon ?? const Icon(Icons.arrow_drop_down), + ], + ), + ); + }, + ), ), ); } Future _openLanguageSelector(BuildContext context) async { - final dynamic newLanguage = - await Navigator.of(context, rootNavigator: true).push( - PageRouteBuilder( - pageBuilder: (_, __, ___) => _LanguageSelectorScreen( - provider: context.read<_LanguageSelectorProvider>(), - ), - transitionsBuilder: (BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child) { - final Tween tween = Tween( - begin: const Offset(0.0, 1.0), - end: Offset.zero, - ); - final CurvedAnimation curvedAnimation = CurvedAnimation( - parent: animation, - curve: Curves.easeInOut, - ); - final Animation position = tween.animate(curvedAnimation); + final dynamic newLanguage = await Navigator.of(context, rootNavigator: true) + .push( + PageRouteBuilder( + pageBuilder: (_, __, ___) => _LanguageSelectorScreen( + provider: context.read<_LanguageSelectorProvider>(), + ), + transitionsBuilder: + ( + BuildContext context, + Animation animation, + Animation secondaryAnimation, + Widget child, + ) { + final Tween tween = Tween( + begin: const Offset(0.0, 1.0), + end: Offset.zero, + ); + final CurvedAnimation curvedAnimation = CurvedAnimation( + parent: animation, + curve: Curves.easeInOut, + ); + final Animation position = tween.animate( + curvedAnimation, + ); - return SlideTransition( - position: position, - child: FadeTransition( - opacity: animation, - child: child, - ), - ); - }), - ); + return SlideTransition( + position: position, + child: FadeTransition(opacity: animation, child: child), + ); + }, + ), + ); if (!context.mounted) { return; @@ -196,11 +215,9 @@ class _LanguageSelectorButton extends StatelessWidget { context.read(), languageCode: newLanguage.code, ); - final ProductPreferences productPreferences = - context.read(); - await BackgroundTaskLanguageRefresh.addTask( - context.read(), - ); + final ProductPreferences productPreferences = context + .read(); + await BackgroundTaskLanguageRefresh.addTask(context.read()); // Refresh the news feed if (context.mounted) { @@ -213,9 +230,7 @@ class _LanguageSelectorButton extends StatelessWidget { } class _LanguageSelectorScreen extends StatelessWidget { - const _LanguageSelectorScreen({ - required this.provider, - }); + const _LanguageSelectorScreen({required this.provider}); final _LanguageSelectorProvider provider; @@ -226,44 +241,45 @@ class _LanguageSelectorScreen extends StatelessWidget { return SmoothSelectorScreen( provider: provider, title: appLocalizations.language_selector_title, - itemBuilder: ( - BuildContext context, - OpenFoodFactsLanguage language, - bool selected, - String filter, - ) { - return Row( - children: [ - const Icon(Icons.language), - const SizedBox(width: LARGE_SPACE), - Align( - alignment: AlignmentDirectional.centerStart, - child: Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: SMALL_SPACE, - ), - child: TextHighlighter( - text: LanguageSelector._getCompleteName(language), - filter: filter, - textStyle: const TextStyle( - fontWeight: FontWeight.w600, + itemBuilder: + ( + BuildContext context, + OpenFoodFactsLanguage language, + bool selected, + String filter, + ) { + return Row( + children: [ + const Icon(Icons.language), + const SizedBox(width: LARGE_SPACE), + Align( + alignment: AlignmentDirectional.centerStart, + child: Padding( + padding: const EdgeInsetsDirectional.symmetric( + horizontal: SMALL_SPACE, + ), + child: TextHighlighter( + text: LanguageSelector._getCompleteName(language), + filter: filter, + textStyle: const TextStyle(fontWeight: FontWeight.w600), + ), ), ), - ), - ), - ], - ); - }, - itemsFilter: (List list, - OpenFoodFactsLanguage? selectedItem, - OpenFoodFactsLanguage? selectedItemOverride, - String filter) => - _filterCountries( - list, - selectedItem, - selectedItemOverride, - filter, - ), + ], + ); + }, + itemsFilter: + ( + List list, + OpenFoodFactsLanguage? selectedItem, + OpenFoodFactsLanguage? selectedItemOverride, + String filter, + ) => _filterCountries( + list, + selectedItem, + selectedItemOverride, + filter, + ), ); } @@ -281,12 +297,14 @@ class _LanguageSelectorScreen extends StatelessWidget { (OpenFoodFactsLanguage language) => language == userLanguage || language == selectedLanguage || - Languages().getNameInLanguage(language).toLowerCase().contains( - filter.toLowerCase(), - ) || - Languages().getNameInEnglish(language).toLowerCase().contains( - filter.toLowerCase(), - ), + Languages() + .getNameInLanguage(language) + .toLowerCase() + .contains(filter.toLowerCase()) || + Languages() + .getNameInEnglish(language) + .toLowerCase() + .contains(filter.toLowerCase()), ); } } diff --git a/packages/smooth_app/lib/pages/preferences/language_selector/language_selector_provider.dart b/packages/smooth_app/lib/pages/preferences/language_selector/language_selector_provider.dart index a5462bafc7..d4ebf5f5fa 100644 --- a/packages/smooth_app/lib/pages/preferences/language_selector/language_selector_provider.dart +++ b/packages/smooth_app/lib/pages/preferences/language_selector/language_selector_provider.dart @@ -55,10 +55,8 @@ class _LanguageSelectorProvider } static Future> _reformatLanguages( - ( - List languages, - String userAppLanguageCode, - ) val) async { + (List languages, String userAppLanguageCode) val, + ) async { _reorderLanguages(val.$1, val.$2); return val.$1; } @@ -69,22 +67,24 @@ class _LanguageSelectorProvider ) { final Languages languages = Languages(); final String userLanguageName = languages.getNameInEnglish( - OpenFoodFactsLanguage.fromOffTag(userAppLanguageCode)!); - - languagesList.sort( - (final OpenFoodFactsLanguage a, final OpenFoodFactsLanguage b) { - final String aName = languages.getNameInEnglish(a); - final String bName = languages.getNameInEnglish(b); - - if (aName == userLanguageName) { - return -1; - } - if (bName == userLanguageName) { - return 1; - } - return aName.compareTo(bName); - }, + OpenFoodFactsLanguage.fromOffTag(userAppLanguageCode)!, ); + + languagesList.sort(( + final OpenFoodFactsLanguage a, + final OpenFoodFactsLanguage b, + ) { + final String aName = languages.getNameInEnglish(a); + final String bName = languages.getNameInEnglish(b); + + if (aName == userLanguageName) { + return -1; + } + if (bName == userLanguageName) { + return 1; + } + return aName.compareTo(bName); + }); } @override diff --git a/packages/smooth_app/lib/pages/preferences/lazy_counter.dart b/packages/smooth_app/lib/pages/preferences/lazy_counter.dart index 98bc9c778e..6245c00718 100644 --- a/packages/smooth_app/lib/pages/preferences/lazy_counter.dart +++ b/packages/smooth_app/lib/pages/preferences/lazy_counter.dart @@ -19,12 +19,7 @@ abstract class LazyCounter { final int value, final UserPreferences userPreferences, { required final bool notify, - }) => - userPreferences.setLazyCount( - value, - getSuffixTag(), - notify: notify, - ); + }) => userPreferences.setLazyCount(value, getSuffixTag(), notify: notify); /// Returns the suffix tag used to cache the value locally; @protected @@ -47,11 +42,11 @@ class LazyCounterPrices extends LazyCounter { Future getServerCount() async { final MaybeError result = await OpenPricesAPIClient.getPrices( - GetPricesParameters() - ..owner = owner - ..pageSize = 1, - uriHelper: ProductQuery.uriPricesHelper, - ); + GetPricesParameters() + ..owner = owner + ..pageSize = 1, + uriHelper: ProductQuery.uriPricesHelper, + ); if (result.isError) { return null; } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_account.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_account.dart index 4f93b6b6ff..afbba40b26 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_account.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_account.dart @@ -59,9 +59,9 @@ class UserPreferencesAccount extends AbstractUserPreferences { @override List getLabels() => [ - ...super.getLabels(), - if (_getUserId() == null) appLocalizations.sign_in, - ]; + ...super.getLabels(), + if (_getUserId() == null) appLocalizations.sign_in, + ]; @override IconData getLeadingIconData() => Icons.face; @@ -112,10 +112,8 @@ class UserPreferencesAccount extends AbstractUserPreferences { ); } - Future _goToLoginPage() async => Navigator.of( - context, - rootNavigator: true, - ).push( + Future _goToLoginPage() async => + Navigator.of(context, rootNavigator: true).push( MaterialPageRoute( builder: (BuildContext context) => const LoginPage(), ), @@ -207,8 +205,9 @@ class UserPreferencesAccount extends AbstractUserPreferences { iconData: Icons.more_horiz, context: context, localDatabase: localDatabase, - lazyCounter: - const LazyCounterUserSearch(UserSearchType.TO_BE_COMPLETED), + lazyCounter: const LazyCounterUserSearch( + UserSearchType.TO_BE_COMPLETED, + ), ), _buildProductQueryTile( productQuery: PagedToBeCompletedProductQuery( @@ -245,43 +244,37 @@ class UserPreferencesAccount extends AbstractUserPreferences { ), Icons.delete, ), - _getListTile( - appLocalizations.sign_out, - () async { - if (await _confirmLogout() == true) { + _getListTile(appLocalizations.sign_out, () async { + if (await _confirmLogout() == true) { + if (context.mounted) { + await context.read().logout(); + AnalyticsHelper.trackEvent(AnalyticsEvent.logoutAction); if (context.mounted) { - await context.read().logout(); - AnalyticsHelper.trackEvent(AnalyticsEvent.logoutAction); - if (context.mounted) { - Navigator.pop(context); - } + Navigator.pop(context); } } - }, - Icons.clear, - ), + } + }, Icons.clear), ]; } Future _confirmLogout() async => showDialog( - context: context, - builder: (BuildContext context) { - return SmoothAlertDialog( - title: appLocalizations.sign_out, - body: Text( - appLocalizations.sign_out_confirmation, - ), - positiveAction: SmoothActionButton( - text: appLocalizations.yes, - onPressed: () async => Navigator.pop(context, true), - ), - negativeAction: SmoothActionButton( - text: appLocalizations.no, - onPressed: () => Navigator.pop(context, false), - ), - ); - }, + context: context, + builder: (BuildContext context) { + return SmoothAlertDialog( + title: appLocalizations.sign_out, + body: Text(appLocalizations.sign_out_confirmation), + positiveAction: SmoothActionButton( + text: appLocalizations.yes, + onPressed: () async => Navigator.pop(context, true), + ), + negativeAction: SmoothActionButton( + text: appLocalizations.no, + onPressed: () => Navigator.pop(context, false), + ), ); + }, + ); UserPreferencesItem _buildProductQueryTile({ required final PagedProductQuery productQuery, @@ -290,44 +283,37 @@ class UserPreferencesAccount extends AbstractUserPreferences { required final BuildContext context, required final LocalDatabase localDatabase, final LazyCounter? lazyCounter, - }) => - _getListTile( - title, - () async => ProductQueryPageHelper.openBestChoice( - name: title, - localDatabase: localDatabase, - productQuery: productQuery, - context: context, - editableAppBarTitle: true, - ), - iconData, - lazyCounter: lazyCounter, - ); + }) => _getListTile( + title, + () async => ProductQueryPageHelper.openBestChoice( + name: title, + localDatabase: localDatabase, + productQuery: productQuery, + context: context, + editableAppBarTitle: true, + ), + iconData, + lazyCounter: lazyCounter, + ); UserPreferencesItem _getListTile( final String title, final VoidCallback onTap, final IconData leading, { final LazyCounter? lazyCounter, - }) => - UserPreferencesItemSimple( - labels: [title], - builder: (_) => Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15), - ), - elevation: 5, - color: Theme.of(context).cardColor, - child: UserPreferencesListTile( - title: Text(title), - onTap: onTap, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15), - ), - leading: UserPreferencesListTile.getTintedIcon(leading, context), - trailing: - lazyCounter == null ? null : LazyCounterWidget(lazyCounter), - ), - ), - ); + }) => UserPreferencesItemSimple( + labels: [title], + builder: (_) => Card( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), + elevation: 5, + color: Theme.of(context).cardColor, + child: UserPreferencesListTile( + title: Text(title), + onTap: onTap, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), + leading: UserPreferencesListTile.getTintedIcon(leading, context), + trailing: lazyCounter == null ? null : LazyCounterWidget(lazyCounter), + ), + ), + ); } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_attribute_group.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_attribute_group.dart index b10c2c2870..498e6051a3 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_attribute_group.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_attribute_group.dart @@ -40,8 +40,8 @@ class UserPreferencesAttributeGroup { } List getItems({bool? collapsed}) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); collapsed ??= _isCollapsed; final List result = []; result.add( @@ -76,13 +76,19 @@ class UserPreferencesAttributeGroup { title: Text( group.name ?? appLocalizations.unknown, style: themeData.textTheme.titleLarge!.copyWith( - color: Colors.white, fontWeight: FontWeight.bold), + color: Colors.white, + fontWeight: FontWeight.bold, + ), ), trailing: collapsed! - ? const Icon(Icons.keyboard_arrow_right, - color: Colors.white) - : const Icon(Icons.keyboard_arrow_down, - color: Colors.white), + ? const Icon( + Icons.keyboard_arrow_right, + color: Colors.white, + ) + : const Icon( + Icons.keyboard_arrow_down, + color: Colors.white, + ), ), ), ), @@ -105,17 +111,15 @@ class UserPreferencesAttributeGroup { margin: const EdgeInsetsDirectional.all(LARGE_SPACE), child: Text( group.warning!, - style: TextStyle( - color: colorScheme.onError, - ), + style: TextStyle(color: colorScheme.onError), ), ); }, ), ); } - final List excludedAttributeIds = - userPreferences.getExcludedAttributeIds(); + final List excludedAttributeIds = userPreferences + .getExcludedAttributeIds(); for (final Attribute attribute in group.attributes!) { if (excludedAttributeIds.contains(attribute.id)) { continue; @@ -129,8 +133,9 @@ class UserPreferencesAttributeGroup { if (attribute.name != null) attribute.name!, ], builder: (_) => Padding( - padding: - const EdgeInsetsDirectional.symmetric(horizontal: LARGE_SPACE), + padding: const EdgeInsetsDirectional.symmetric( + horizontal: LARGE_SPACE, + ), child: SmoothCard( elevation: 8, padding: EdgeInsetsDirectional.zero, @@ -142,7 +147,8 @@ class UserPreferencesAttributeGroup { child: AttributeButton( attribute, productPreferences, - isFirst: attribute == group.attributes!.first && + isFirst: + attribute == group.attributes!.first && group.warning == null, isLast: attribute == group.attributes!.last, ), diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_choose_accent_color.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_choose_accent_color.dart index 72cb23611b..141b613b09 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_choose_accent_color.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_choose_accent_color.dart @@ -16,10 +16,7 @@ class UserPreferencesChooseAccentColor extends StatelessWidget { final AppLocalizations appLocalizations = AppLocalizations.of(context); final Map labels = _localizedNames(appLocalizations); return UserPreferencesItemSimple( - labels: [ - appLocalizations.select_accent_color, - ...labels.values, - ], + labels: [appLocalizations.select_accent_color, ...labels.values], builder: (_) => const UserPreferencesChooseAccentColor(), ); } @@ -33,7 +30,8 @@ class UserPreferencesChooseAccentColor extends StatelessWidget { return UserPreferencesMultipleChoicesItem( title: appLocalizations.select_accent_color, leadingBuilder: labels.keys.map( - (String key) => (_) => CircleAvatar( + (String key) => + (_) => CircleAvatar( backgroundColor: getColorValue(key), radius: SMALL_SPACE, ), @@ -47,17 +45,16 @@ class UserPreferencesChooseAccentColor extends StatelessWidget { static Map _localizedNames( AppLocalizations appLocalizations, - ) => - { - 'Blue': appLocalizations.color_blue, - 'Cyan': appLocalizations.color_cyan, - 'Green': appLocalizations.color_green, - 'Default': appLocalizations.color_light_brown, - 'Magenta': appLocalizations.color_magenta, - 'Orange': appLocalizations.color_orange, - 'Pink': appLocalizations.color_pink, - 'Red': appLocalizations.color_red, - 'Rust': appLocalizations.color_rust, - 'Teal': appLocalizations.color_teal, - }; + ) => { + 'Blue': appLocalizations.color_blue, + 'Cyan': appLocalizations.color_cyan, + 'Green': appLocalizations.color_green, + 'Default': appLocalizations.color_light_brown, + 'Magenta': appLocalizations.color_magenta, + 'Orange': appLocalizations.color_orange, + 'Pink': appLocalizations.color_pink, + 'Red': appLocalizations.color_red, + 'Rust': appLocalizations.color_rust, + 'Teal': appLocalizations.color_teal, + }; } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_choose_text_color_contrast.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_choose_text_color_contrast.dart index 67e6a97f2e..1dc92f10fa 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_choose_text_color_contrast.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_choose_text_color_contrast.dart @@ -27,16 +27,12 @@ class UserPreferencesChooseTextColorContrast extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final TextContrastProvider textContrastProvider = - context.watch(); + final TextContrastProvider textContrastProvider = context + .watch(); return UserPreferencesMultipleChoicesItem( title: appLocalizations.text_contrast_mode, - values: const [ - CONTRAST_HIGH, - CONTRAST_MEDIUM, - CONTRAST_LOW, - ], + values: const [CONTRAST_HIGH, CONTRAST_MEDIUM, CONTRAST_LOW], labels: [ appLocalizations.contrast_high, appLocalizations.contrast_medium, diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_connect.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_connect.dart index 7156754a69..9a227af80a 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_connect.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_connect.dart @@ -45,156 +45,156 @@ class UserPreferencesConnect extends AbstractUserPreferences { @override List getChildren() => [ - _getListTile( - title: appLocalizations.contact_title_newsletter, - url: 'https://link.openfoodfacts.org/newsletter-en', - leadingIconData: CupertinoIcons.news_solid, - ), - _getListTile( - title: appLocalizations.contact_title_calendar, - url: 'https://wiki.openfoodfacts.org/Events', - leadingIconData: Icons.calendar_month, - ), - _getListTile( - title: appLocalizations.support_via_email, - leadingIconData: Icons.drafts, - onTap: () async { - final bool? includeLogs = await showDialog( - context: context, - builder: (BuildContext context) { - return SmoothAlertDialog( - title: appLocalizations - .support_via_email_include_logs_dialog_title, - body: Text( - appLocalizations - .support_via_email_include_logs_dialog_body, - ), - close: true, - positiveAction: SmoothActionButton( - text: appLocalizations.yes, - onPressed: () => Navigator.of(context).pop(true)), - negativeAction: SmoothActionButton( - text: appLocalizations.no, - onPressed: () => Navigator.of(context).pop(false)), - ); - }); - - if (includeLogs == null) { - return; - } - - await _sendEmail( - body: await _emailBody, - subject: - '${appLocalizations.help_with_openfoodfacts} (Help with Open Food Facts)', - recipient: 'mobile@openfoodfacts.org', - attachmentPaths: includeLogs == true ? Logs.logFilesPaths : null, + _getListTile( + title: appLocalizations.contact_title_newsletter, + url: 'https://link.openfoodfacts.org/newsletter-en', + leadingIconData: CupertinoIcons.news_solid, + ), + _getListTile( + title: appLocalizations.contact_title_calendar, + url: 'https://wiki.openfoodfacts.org/Events', + leadingIconData: Icons.calendar_month, + ), + _getListTile( + title: appLocalizations.support_via_email, + leadingIconData: Icons.drafts, + onTap: () async { + final bool? includeLogs = await showDialog( + context: context, + builder: (BuildContext context) { + return SmoothAlertDialog( + title: + appLocalizations.support_via_email_include_logs_dialog_title, + body: Text( + appLocalizations.support_via_email_include_logs_dialog_body, + ), + close: true, + positiveAction: SmoothActionButton( + text: appLocalizations.yes, + onPressed: () => Navigator.of(context).pop(true), + ), + negativeAction: SmoothActionButton( + text: appLocalizations.no, + onPressed: () => Navigator.of(context).pop(false), + ), ); }, + ); + + if (includeLogs == null) { + return; + } + + await _sendEmail( + body: await _emailBody, + subject: + '${appLocalizations.help_with_openfoodfacts} (Help with Open Food Facts)', + recipient: 'mobile@openfoodfacts.org', + attachmentPaths: includeLogs == true ? Logs.logFilesPaths : null, + ); + }, + ), + _getDivider(), + _getListTile( + title: appLocalizations.tiktok, + url: appLocalizations.tiktok_link, + leadingWidget: SvgPicture.asset( + 'assets/preferences/tiktok-logo.svg', + width: DEFAULT_ICON_SIZE, + package: AppHelper.APP_PACKAGE, + ), + ), + _getListTile( + title: appLocalizations.instagram, + url: appLocalizations.instagram_link, + leadingWidget: SvgPicture.asset( + 'assets/preferences/instagram-camera.svg', + width: DEFAULT_ICON_SIZE, + package: AppHelper.APP_PACKAGE, + ), + ), + _getListTile( + title: appLocalizations.twitter, + url: appLocalizations.twitter_link, + leadingWidget: SvgPicture.asset( + 'assets/preferences/x-logo.svg', + width: DEFAULT_ICON_SIZE, + colorFilter: ui.ColorFilter.mode( + Theme.of(context).colorScheme.onSurface, + ui.BlendMode.srcIn, ), - _getDivider(), - _getListTile( - title: appLocalizations.tiktok, - url: appLocalizations.tiktok_link, - leadingWidget: SvgPicture.asset( - 'assets/preferences/tiktok-logo.svg', - width: DEFAULT_ICON_SIZE, - package: AppHelper.APP_PACKAGE, - ), - ), - _getListTile( - title: appLocalizations.instagram, - url: appLocalizations.instagram_link, - leadingWidget: SvgPicture.asset( - 'assets/preferences/instagram-camera.svg', - width: DEFAULT_ICON_SIZE, - package: AppHelper.APP_PACKAGE, - ), - ), - _getListTile( - title: appLocalizations.twitter, - url: appLocalizations.twitter_link, - leadingWidget: SvgPicture.asset( - 'assets/preferences/x-logo.svg', - width: DEFAULT_ICON_SIZE, - colorFilter: ui.ColorFilter.mode( - Theme.of(context).colorScheme.onSurface, - ui.BlendMode.srcIn, - ), - package: AppHelper.APP_PACKAGE, - ), - ), - _getListTile( - title: appLocalizations.mastodon, - url: appLocalizations.mastodon_link, - leadingWidget: SvgPicture.asset( - 'assets/preferences/mastodon-logo.svg', - width: DEFAULT_ICON_SIZE, - package: AppHelper.APP_PACKAGE, - ), - ), - _getListTile( - title: appLocalizations.bsky, - url: appLocalizations.bsky_link, - leadingWidget: SvgPicture.asset( - 'assets/preferences/bluesky-logo.svg', - width: DEFAULT_ICON_SIZE, - package: AppHelper.APP_PACKAGE, - ), - ), - _getListTile( - title: appLocalizations.blog, - url: 'https://blog.openfoodfacts.org', - leadingIconData: Icons.newspaper, - ), - _getDivider(), - _getListTile( - title: appLocalizations.support_via_forum, - url: 'https://forum.openfoodfacts.org/', - leadingIconData: Icons.forum, - ), - _getListTile( - title: appLocalizations.support_join_slack, - url: 'https://slack.openfoodfacts.org/', - leadingIconData: Icons.chat, - ), - _getDivider(), - _getListTile( - title: appLocalizations.contact_title_pro_page, - url: ProductQuery.replaceSubdomain( - 'https://world.pro.openfoodfacts.org/', - ), - leadingIconData: Icons.factory_outlined, - ), - _getListTile( - title: appLocalizations.contact_title_pro_email, - leadingIconData: Icons.drafts, - onTap: () async => _sendEmail( - recipient: - ProductQuery.getLanguage() == OpenFoodFactsLanguage.FRENCH - ? 'producteurs@openfoodfacts.org' - : 'producers@openfoodfacts.org', - ), - ), - _getDivider(), - _getListTile( - title: appLocalizations.contact_title_press_page, - url: ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/press', - ), - leadingIconData: CupertinoIcons.news_solid, - ), - _getListTile( - title: appLocalizations.contact_title_press_email, - leadingIconData: Icons.drafts, - onTap: () async => _sendEmail( - recipient: - ProductQuery.getLanguage() == OpenFoodFactsLanguage.FRENCH - ? 'presse@openfoodfacts.org' - : 'press@openfoodfacts.org', - ), - ), - ]; + package: AppHelper.APP_PACKAGE, + ), + ), + _getListTile( + title: appLocalizations.mastodon, + url: appLocalizations.mastodon_link, + leadingWidget: SvgPicture.asset( + 'assets/preferences/mastodon-logo.svg', + width: DEFAULT_ICON_SIZE, + package: AppHelper.APP_PACKAGE, + ), + ), + _getListTile( + title: appLocalizations.bsky, + url: appLocalizations.bsky_link, + leadingWidget: SvgPicture.asset( + 'assets/preferences/bluesky-logo.svg', + width: DEFAULT_ICON_SIZE, + package: AppHelper.APP_PACKAGE, + ), + ), + _getListTile( + title: appLocalizations.blog, + url: 'https://blog.openfoodfacts.org', + leadingIconData: Icons.newspaper, + ), + _getDivider(), + _getListTile( + title: appLocalizations.support_via_forum, + url: 'https://forum.openfoodfacts.org/', + leadingIconData: Icons.forum, + ), + _getListTile( + title: appLocalizations.support_join_slack, + url: 'https://slack.openfoodfacts.org/', + leadingIconData: Icons.chat, + ), + _getDivider(), + _getListTile( + title: appLocalizations.contact_title_pro_page, + url: ProductQuery.replaceSubdomain( + 'https://world.pro.openfoodfacts.org/', + ), + leadingIconData: Icons.factory_outlined, + ), + _getListTile( + title: appLocalizations.contact_title_pro_email, + leadingIconData: Icons.drafts, + onTap: () async => _sendEmail( + recipient: ProductQuery.getLanguage() == OpenFoodFactsLanguage.FRENCH + ? 'producteurs@openfoodfacts.org' + : 'producers@openfoodfacts.org', + ), + ), + _getDivider(), + _getListTile( + title: appLocalizations.contact_title_press_page, + url: ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/press', + ), + leadingIconData: CupertinoIcons.news_solid, + ), + _getListTile( + title: appLocalizations.contact_title_press_email, + leadingIconData: Icons.drafts, + onTap: () async => _sendEmail( + recipient: ProductQuery.getLanguage() == OpenFoodFactsLanguage.FRENCH + ? 'presse@openfoodfacts.org' + : 'press@openfoodfacts.org', + ), + ), + ]; Future get _emailBody async { final StringBuffer buffer = StringBuffer('\n\n----\n'); @@ -223,8 +223,12 @@ class UserPreferencesConnect extends AbstractUserPreferences { final PackageInfo packageInfo = await PackageInfo.fromPlatform(); buffer.writeln( - appLocalizations.contact_form_body(deviceText, packageInfo.version, - packageInfo.buildNumber, packageInfo.packageName), + appLocalizations.contact_form_body( + deviceText, + packageInfo.version, + packageInfo.buildNumber, + packageInfo.packageName, + ), ); return buffer.toString(); @@ -236,20 +240,21 @@ class UserPreferencesConnect extends AbstractUserPreferences { final Widget? leadingWidget, final String? url, final VoidCallback? onTap, - }) => - UserPreferencesItemSimple( - labels: [title], - builder: (_) => UserPreferencesListTile( - title: Text(title), - onTap: onTap ?? () async => LaunchUrlHelper.launchURL(url!), - trailing: - UserPreferencesListTile.getTintedIcon(Icons.open_in_new, context), - leading: leadingIconData != null - ? UserPreferencesListTile.getTintedIcon(leadingIconData, context) - : leadingWidget, - externalLink: true, - ), - ); + }) => UserPreferencesItemSimple( + labels: [title], + builder: (_) => UserPreferencesListTile( + title: Text(title), + onTap: onTap ?? () async => LaunchUrlHelper.launchURL(url!), + trailing: UserPreferencesListTile.getTintedIcon( + Icons.open_in_new, + context, + ), + leading: leadingIconData != null + ? UserPreferencesListTile.getTintedIcon(leadingIconData, context) + : leadingWidget, + externalLink: true, + ), + ); Future _sendEmail({ final String body = '', @@ -313,9 +318,9 @@ class UserPreferencesConnect extends AbstractUserPreferences { ); } }, - ) + ), ], - ) + ), ], ), positiveAction: SmoothActionButton( @@ -332,7 +337,7 @@ class UserPreferencesConnect extends AbstractUserPreferences { } UserPreferencesItem _getDivider() => UserPreferencesItemSimple( - labels: [], - builder: (_) => const Divider(), - ); + labels: [], + builder: (_) => const Divider(), + ); } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart index 8c9b1a3e22..e65734d68a 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart @@ -54,11 +54,7 @@ class UserPreferencesContribute extends AbstractUserPreferences { final OpenFoodFactsCountry country = ProductQuery.getCountry(); return [ - _getListTile( - 'Hunger Games', - () async => _hungerGames(), - Icons.games, - ), + _getListTile('Hunger Games', () async => _hungerGames(), Icons.games), _getListTile( appLocalizations.contribute_improve_header, () async => _contribute(), @@ -160,154 +156,137 @@ class UserPreferencesContribute extends AbstractUserPreferences { } Future _contribute() => showDialog( - context: context, - builder: (BuildContext context) { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); - return SmoothAlertDialog( - title: appLocalizations.contribute_improve_header, - body: Column( - children: [ - Text( - appLocalizations.contribute_improve_text, - ), - const SizedBox( - height: 10, - ), - ], - ), - positiveAction: SmoothActionButton( - text: AppLocalizations.of(context) - .contribute_improve_ProductsToBeCompleted, - onPressed: () async { - final LocalDatabase localDatabase = - context.read(); - Navigator.of(context).pop(); - ProductQueryPageHelper.openBestChoice( - name: appLocalizations.all_search_to_be_completed_title, - localDatabase: localDatabase, - productQuery: PagedToBeCompletedProductQuery( - // TODO(monsieurtanuki): only food? - productType: ProductType.food, - ), - // the other "context"s being popped - context: this.context, - editableAppBarTitle: false, - ); - }, - ), - negativeAction: SmoothActionButton( - onPressed: () { - Navigator.of(context, rootNavigator: true).pop('dialog'); - }, - text: appLocalizations.close, - minWidth: 100, - ), - actionsAxis: Axis.vertical, - actionsOrder: SmoothButtonsBarOrder.auto, - ); - }, + context: context, + builder: (BuildContext context) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + return SmoothAlertDialog( + title: appLocalizations.contribute_improve_header, + body: Column( + children: [ + Text(appLocalizations.contribute_improve_text), + const SizedBox(height: 10), + ], + ), + positiveAction: SmoothActionButton( + text: AppLocalizations.of( + context, + ).contribute_improve_ProductsToBeCompleted, + onPressed: () async { + final LocalDatabase localDatabase = context.read(); + Navigator.of(context).pop(); + ProductQueryPageHelper.openBestChoice( + name: appLocalizations.all_search_to_be_completed_title, + localDatabase: localDatabase, + productQuery: PagedToBeCompletedProductQuery( + // TODO(monsieurtanuki): only food? + productType: ProductType.food, + ), + // the other "context"s being popped + context: this.context, + editableAppBarTitle: false, + ); + }, + ), + negativeAction: SmoothActionButton( + onPressed: () { + Navigator.of(context, rootNavigator: true).pop('dialog'); + }, + text: appLocalizations.close, + minWidth: 100, + ), + actionsAxis: Axis.vertical, + actionsOrder: SmoothButtonsBarOrder.auto, ); + }, + ); Future _develop() => showDialog( - context: context, - builder: (BuildContext context) { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); - context.watch(); - return SmoothAlertDialog( - title: appLocalizations.contribute_sw_development, - body: Column( - children: [ - Text(appLocalizations.contribute_develop_text), - const SizedBox(height: VERY_LARGE_SPACE), - Text(appLocalizations.contribute_develop_text_2), - const SizedBox(height: 10), - SmoothAlertContentButton( - label: 'Slack', - icon: Icons.open_in_new, - onPressed: () async => LaunchUrlHelper.launchURL( - 'https://slack.openfoodfacts.org/', - ), - ), - const SizedBox(height: SMALL_SPACE), - SmoothAlertContentButton( - label: 'GitHub', - icon: Icons.open_in_new, - onPressed: () async => LaunchUrlHelper.launchURL( - 'https://github.com/openfoodfacts', - ), - ), - const SizedBox(height: 10), - UserPreferencesSwitchWidget( - title: appLocalizations.contribute_develop_dev_mode_title, - subtitle: - appLocalizations.contribute_develop_dev_mode_subtitle, - value: userPreferences.devMode != 0, - onChanged: (final bool devMode) async => - userPreferences.setDevMode(devMode ? 1 : 0), - ), - ], + context: context, + builder: (BuildContext context) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + context.watch(); + return SmoothAlertDialog( + title: appLocalizations.contribute_sw_development, + body: Column( + children: [ + Text(appLocalizations.contribute_develop_text), + const SizedBox(height: VERY_LARGE_SPACE), + Text(appLocalizations.contribute_develop_text_2), + const SizedBox(height: 10), + SmoothAlertContentButton( + label: 'Slack', + icon: Icons.open_in_new, + onPressed: () async => + LaunchUrlHelper.launchURL('https://slack.openfoodfacts.org/'), ), - negativeAction: SmoothActionButton( - onPressed: () { - Navigator.of(context, rootNavigator: true).pop('dialog'); - }, - text: appLocalizations.close, - minWidth: 100, + const SizedBox(height: SMALL_SPACE), + SmoothAlertContentButton( + label: 'GitHub', + icon: Icons.open_in_new, + onPressed: () async => + LaunchUrlHelper.launchURL('https://github.com/openfoodfacts'), ), - ); - }, + const SizedBox(height: 10), + UserPreferencesSwitchWidget( + title: appLocalizations.contribute_develop_dev_mode_title, + subtitle: appLocalizations.contribute_develop_dev_mode_subtitle, + value: userPreferences.devMode != 0, + onChanged: (final bool devMode) async => + userPreferences.setDevMode(devMode ? 1 : 0), + ), + ], + ), + negativeAction: SmoothActionButton( + onPressed: () { + Navigator.of(context, rootNavigator: true).pop('dialog'); + }, + text: appLocalizations.close, + minWidth: 100, + ), ); + }, + ); Future _translate() => showDialog( - context: context, - builder: (BuildContext context) { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); - return SmoothAlertDialog( - title: appLocalizations.contribute_translate_header, - body: Column( - children: [ - Text( - appLocalizations.contribute_translate_text, - ), - Text( - appLocalizations.contribute_translate_text_2, - ), - ], - ), - positiveAction: SmoothActionButton( - onPressed: () async => LaunchUrlHelper.launchURL( - 'https://translate.openfoodfacts.org/', - ), - text: appLocalizations.contribute_translate_link_text, - ), - negativeAction: SmoothActionButton( - onPressed: () { - Navigator.of(context, rootNavigator: true).pop('dialog'); - }, - text: appLocalizations.close, - minWidth: 100, - ), - actionsAxis: Axis.vertical, - actionsOrder: SmoothButtonsBarOrder.auto, - ); - }, + context: context, + builder: (BuildContext context) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + return SmoothAlertDialog( + title: appLocalizations.contribute_translate_header, + body: Column( + children: [ + Text(appLocalizations.contribute_translate_text), + Text(appLocalizations.contribute_translate_text_2), + ], + ), + positiveAction: SmoothActionButton( + onPressed: () async => + LaunchUrlHelper.launchURL('https://translate.openfoodfacts.org/'), + text: appLocalizations.contribute_translate_link_text, + ), + negativeAction: SmoothActionButton( + onPressed: () { + Navigator.of(context, rootNavigator: true).pop('dialog'); + }, + text: appLocalizations.close, + minWidth: 100, + ), + actionsAxis: Axis.vertical, + actionsOrder: SmoothButtonsBarOrder.auto, ); + }, + ); Future _share(String content) async => Share.share(content); Future _contributors() => showDialog( - context: context, - builder: (BuildContext context) => _ContributorsDialog(), - ); + context: context, + builder: (BuildContext context) => _ContributorsDialog(), + ); Future _hungerGames() async { // Track the hunger game analytics event - AnalyticsHelper.trackEvent( - AnalyticsEvent.hungerGameOpened, - ); + AnalyticsHelper.trackEvent(AnalyticsEvent.hungerGameOpened); await Navigator.push( context, @@ -380,44 +359,48 @@ class _ContributorsDialog extends StatelessWidget { controller: _scrollController, child: Wrap( crossAxisAlignment: WrapCrossAlignment.center, - children: contributors.map((dynamic contributorsData) { - final ContributorsModel contributor = - ContributorsModel.fromJson( - contributorsData as Map); - return Padding( - padding: const EdgeInsets.all(5.0), - child: Semantics( - value: appLocalizations - .contributors_dialog_entry_description( - contributor.login, - ), - excludeSemantics: true, - child: Tooltip( - message: contributor.login, - child: InkWell( - customBorder: const CircleBorder(), - onTap: () async => LaunchUrlHelper.launchURL( - contributor.profilePath, - ), - child: Ink( - decoration: BoxDecoration( - borderRadius: - const BorderRadius.all(Radius.circular(20)), - image: DecorationImage( - image: NetworkImage( - contributor.avatarUrl, + children: contributors + .map((dynamic contributorsData) { + final ContributorsModel contributor = + ContributorsModel.fromJson( + contributorsData as Map, + ); + return Padding( + padding: const EdgeInsets.all(5.0), + child: Semantics( + value: appLocalizations + .contributors_dialog_entry_description( + contributor.login, + ), + excludeSemantics: true, + child: Tooltip( + message: contributor.login, + child: InkWell( + customBorder: const CircleBorder(), + onTap: () async => LaunchUrlHelper.launchURL( + contributor.profilePath, + ), + child: Ink( + decoration: BoxDecoration( + borderRadius: const BorderRadius.all( + Radius.circular(20), + ), + image: DecorationImage( + image: NetworkImage( + contributor.avatarUrl, + ), + fit: BoxFit.cover, + ), ), - fit: BoxFit.cover, + width: 40.0, + height: 40.0, ), ), - width: 40.0, - height: 40.0, ), ), - ), - ), - ); - }).toList(growable: false), + ); + }) + .toList(growable: false), ), ), ); diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_currency_selector.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_currency_selector.dart index 1b7d94eccd..6e4c3473b0 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_currency_selector.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_currency_selector.dart @@ -38,9 +38,7 @@ class UserPreferencesCurrencySelector extends StatelessWidget { child: CurrencySelector( textStyle: themeData.textTheme.bodyMedium, icon: const Icon(Icons.edit), - padding: const EdgeInsetsDirectional.only( - start: SMALL_SPACE, - ), + padding: const EdgeInsetsDirectional.only(start: SMALL_SPACE), ), ), minVerticalPadding: MEDIUM_SPACE, diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_dev_debug_info.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_dev_debug_info.dart index 056402387d..d8cac80244 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_dev_debug_info.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_dev_debug_info.dart @@ -10,9 +10,7 @@ import 'package:smooth_app/widgets/smooth_app_bar.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; class UserPreferencesDebugInfo extends StatefulWidget { - const UserPreferencesDebugInfo({ - super.key, - }); + const UserPreferencesDebugInfo({super.key}); @override State createState() => @@ -27,12 +25,15 @@ class _UserPreferencesDebugInfoState extends State { 'IsLoggedIn': ProductQuery.isLoggedIn().toString(), 'UUID': OpenFoodAPIConfiguration.uuid.toString(), 'Matomo Visitor ID': AnalyticsHelper.matomoVisitorId, - 'QueryType': ProductQuery.getUriProductHelper(productType: ProductType.food) - .isTestMode + 'QueryType': + ProductQuery.getUriProductHelper( + productType: ProductType.food, + ).isTestMode ? 'QueryType.TEST' : 'QueryType.PROD', - 'Domain': - ProductQuery.getUriProductHelper(productType: ProductType.food).domain, + 'Domain': ProductQuery.getUriProductHelper( + productType: ProductType.food, + ).domain, 'UserAgent-name': '${OpenFoodAPIConfiguration.userAgent?.name}', 'UserAgent-system': '${OpenFoodAPIConfiguration.userAgent?.system}', }; @@ -69,40 +70,38 @@ class _UserPreferencesDebugInfoState extends State { title: const Text('Debugging information'), actions: [ IconButton( - onPressed: () async { - final StringBuffer buffer = StringBuffer(); + onPressed: () async { + final StringBuffer buffer = StringBuffer(); - for (final MapEntry e in infos.entries) { - buffer.writeln('${e.key}: ${e.value}'); - } + for (final MapEntry e in infos.entries) { + buffer.writeln('${e.key}: ${e.value}'); + } - await Clipboard.setData( - ClipboardData(text: buffer.toString()), - ); - }, - icon: const Icon(Icons.copy)) + await Clipboard.setData(ClipboardData(text: buffer.toString())); + }, + icon: const Icon(Icons.copy), + ), ], ), body: FutureBuilder( - future: loadAsyncData(), - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.connectionState != ConnectionState.done) { - return const Center( - child: CircularProgressIndicator(), - ); - } + future: loadAsyncData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState != ConnectionState.done) { + return const Center(child: CircularProgressIndicator()); + } - return ListView.builder( - itemCount: infos.length, - itemBuilder: (BuildContext context, int index) { - return ListTile( - title: Text( - '${infos.keys.elementAt(index)}: ${infos.values.elementAt(index)}', - ), - ); - }, - ); - }), + return ListView.builder( + itemCount: infos.length, + itemBuilder: (BuildContext context, int index) { + return ListTile( + title: Text( + '${infos.keys.elementAt(index)}: ${infos.values.elementAt(index)}', + ), + ); + }, + ); + }, + ), ); } } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_dev_mode.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_dev_mode.dart index 8bdf3e3b9b..3b1c2576af 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_dev_mode.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_dev_mode.dart @@ -77,492 +77,455 @@ class UserPreferencesDevMode extends AbstractUserPreferences { @override Widget getTitle() => Container( - color: Colors.red, - child: Text( - getTitleString(), - style: - themeData.textTheme.displayMedium!.copyWith(color: Colors.white), - ), - ); + color: Colors.red, + child: Text( + getTitleString(), + style: themeData.textTheme.displayMedium!.copyWith(color: Colors.white), + ), + ); @override IconData getLeadingIconData() => Icons.settings; @override List getChildren() => [ - UserPreferencesItemSwitch( - title: appLocalizations.contribute_develop_dev_mode_title, - onChanged: (bool value) async { - final NavigatorState navigator = Navigator.of(context); - // resetting back to "no dev mode" - await userPreferences.setDevMode(0); - // resetting back to PROD - await userPreferences.setFlag(userPreferencesFlagProd, true); - ProductQuery.setQueryType(userPreferences); - navigator.pop(); - }, - value: userPreferences.devMode == 1, + UserPreferencesItemSwitch( + title: appLocalizations.contribute_develop_dev_mode_title, + onChanged: (bool value) async { + final NavigatorState navigator = Navigator.of(context); + // resetting back to "no dev mode" + await userPreferences.setDevMode(0); + // resetting back to PROD + await userPreferences.setFlag(userPreferencesFlagProd, true); + ProductQuery.setQueryType(userPreferences); + navigator.pop(); + }, + value: userPreferences.devMode == 1, + ), + UserPreferencesItemTile( + title: 'Debugging information', + onTap: () async => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => const UserPreferencesDebugInfo(), ), - UserPreferencesItemTile( - title: 'Debugging information', - onTap: () async => Navigator.of(context).push(MaterialPageRoute( - builder: (BuildContext context) => - const UserPreferencesDebugInfo())), + ), + ), + UserPreferencesItemSection(label: appLocalizations.dev_mode_section_data), + UserPreferencesItemTile( + title: appLocalizations.background_task_title, + subtitle: appLocalizations.background_task_subtitle, + trailing: const BackgroundTaskBadge( + child: Icon(Icons.edit_notifications_outlined), + ), + onTap: () async => Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => const OfflineTaskPage(), ), - UserPreferencesItemSection( - label: appLocalizations.dev_mode_section_data, + ), + ), + UserPreferencesItemTile( + title: appLocalizations.offline_data, + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => const OfflineDataPage(), ), - UserPreferencesItemTile( - title: appLocalizations.background_task_title, - subtitle: appLocalizations.background_task_subtitle, - trailing: const BackgroundTaskBadge( - child: Icon(Icons.edit_notifications_outlined), - ), - onTap: () async => Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => const OfflineTaskPage(), - ), - ), - ), - UserPreferencesItemTile( - title: appLocalizations.offline_data, - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => const OfflineDataPage(), - ), - ), - ), - UserPreferencesItemTile( - title: appLocalizations.dev_preferences_export_history_title, - subtitle: appLocalizations.clipboard_barcode_copy, - onTap: () async { - final LocalDatabase localDatabase = context.read(); - final Map export = - await DaoProductList(localDatabase).export( - ProductList.history(), - ); - final List children = []; - for (final String barcode in export.keys) { - final bool? exists = export[barcode] as bool?; - children.add( - ListTile( - leading: Icon(exists == null - ? Icons.error - : exists - ? Icons.check - : Icons.help_outline), - title: Text(barcode), - subtitle: Text(exists == null - ? appLocalizations + ), + ), + UserPreferencesItemTile( + title: appLocalizations.dev_preferences_export_history_title, + subtitle: appLocalizations.clipboard_barcode_copy, + onTap: () async { + final LocalDatabase localDatabase = context.read(); + final Map export = await DaoProductList( + localDatabase, + ).export(ProductList.history()); + final List children = []; + for (final String barcode in export.keys) { + final bool? exists = export[barcode] as bool?; + children.add( + ListTile( + leading: Icon( + exists == null + ? Icons.error + : exists + ? Icons.check + : Icons.help_outline, + ), + title: Text(barcode), + subtitle: Text( + exists == null + ? appLocalizations .dev_preferences_export_history_progress_error - : exists - ? appLocalizations - .dev_preferences_export_history_progress_found - : appLocalizations - .dev_preferences_export_history_progress_not_found), - ), - ); - } - - if (!context.mounted) { - return; - } - await showDialog( - context: context, - builder: (BuildContext context) => SmoothAlertDialog( - title: appLocalizations - .dev_preferences_export_history_dialog_title, - body: SizedBox( - height: 400, - width: 300, - child: ListView(children: children), - ), - negativeAction: SmoothActionButton( - text: appLocalizations.copy_to_clipboard, - onPressed: () async { - final StringBuffer data = StringBuffer(); - - for (final String key in export.keys) { - data.write('$key, '); - } - - await Clipboard.setData( - ClipboardData(text: data.toString()), - ); - }, - ), - positiveAction: SmoothActionButton( - text: appLocalizations.okay, - onPressed: () => Navigator.pop(context), - ), + : exists + ? appLocalizations + .dev_preferences_export_history_progress_found + : appLocalizations + .dev_preferences_export_history_progress_not_found, ), - ); - }, - ), - UserPreferencesItemTile( - title: 'Refresh all products from server (cf. Nutriscore v2)', - trailing: const Icon(Icons.refresh), - onTap: () async { - final LocalDatabase localDatabase = context.read(); - final DaoProduct daoProduct = DaoProduct(localDatabase); - await daoProduct.clearAllLanguages(); - await BackgroundTaskLanguageRefresh.addTask(localDatabase); - _showSuccessMessage(); - }, - ), - UserPreferencesItemTile( - // Do not translate - title: 'Reset app language', - onTap: () async { - userPreferences.setAppLanguageCode(null); - ProductQuery.setLanguage(context, userPreferences); - }, - ), - UserPreferencesItemTile( - title: 'Add cards to scanner', - subtitle: 'Adds 3 sample products to the scanner', - onTap: () async { - final ContinuousScanModel model = - context.read(); - - const List barcodes = [ - '5449000000996', - '3017620425035', - '3175680011480', - ]; - for (int i = 0; i < barcodes.length; i++) { - await model.onScan(barcodes[i]); - } - }, - ), - UserPreferencesItemSection( - label: appLocalizations.dev_mode_section_server, - ), - UserPreferencesItemTile( - title: appLocalizations.dev_preferences_environment_switch_title, - trailing: DropdownButton( - value: userPreferences.getFlag(userPreferencesFlagProd) ?? true, - elevation: 16, - onChanged: (bool? newValue) async { - await userPreferences.setFlag(userPreferencesFlagProd, newValue); - ProductQuery.setQueryType(userPreferences); - }, - items: const >[ - DropdownMenuItem( - value: true, - child: Text('PROD'), - ), - DropdownMenuItem( - value: false, - child: Text('TEST'), - ), - ], - ), - ), - UserPreferencesItemTile( - title: appLocalizations.dev_preferences_test_environment_title, - subtitle: appLocalizations.dev_preferences_test_environment_subtitle( - ProductQuery.getTestUriProductHelper(userPreferences) - .getPostUri(path: '') - .toString(), - ), - visibleWhen: (BuildContext context) { - return userPreferences.getFlag(userPreferencesFlagProd) == false; - }, - onTap: () async => _changeTestEnvDomain(), - ), - const UserPreferencesItemSection( - label: 'Prices Server configuration', - ), - UserPreferencesItemTile( - title: 'Switch between prices.openfoodfacts.org (PROD) and test env', - trailing: DropdownButton( - value: - userPreferences.getFlag(userPreferencesFlagPriceProd) ?? true, - elevation: 16, - onChanged: (bool? newValue) async { - await userPreferences.setFlag( - userPreferencesFlagPriceProd, - newValue, - ); - ProductQuery.setQueryType(userPreferences); - }, - items: const >[ - DropdownMenuItem( - value: true, - child: Text('PROD'), - ), - DropdownMenuItem( - value: false, - child: Text('TEST'), - ), - ], - ), - ), - const UserPreferencesItemSection( - label: 'Folksonomy Server configuration', - ), - UserPreferencesItemTile( - title: 'Folksonomy host', - subtitle: ProductQuery.uriFolksonomyHelper.host, - onTap: () async => _changeFolksonomyHost(), - ), - UserPreferencesItemSection( - label: appLocalizations.dev_mode_section_news, - ), - UserPreferencesEditableItemTile( - title: appLocalizations.dev_preferences_news_custom_url_title, - subtitleWithEmptyValue: - appLocalizations.dev_preferences_news_custom_url_empty_value, - dialogAction: - appLocalizations.dev_preferences_news_custom_url_subtitle, - value: userPreferences - .getDevModeString(userPreferencesCustomNewsJSONURI), - onNewValue: (String newUrl) => userPreferences.setDevModeString( - userPreferencesCustomNewsJSONURI, - newUrl, - ), - validator: (String value) => - value.isEmpty || Uri.tryParse(value) != null, - ), - UserPreferencesItemTileBuilder( - title: appLocalizations.dev_preferences_news_provider_status_title, - subtitleBuilder: (BuildContext context) { - return Consumer( - builder: (_, AppNewsProvider provider, __) { - return Text(switch (provider.state) { - AppNewsStateLoading() => 'Loading…', - AppNewsStateLoaded(lastUpdate: final DateTime date) => - appLocalizations - .dev_preferences_news_provider_status_subtitle( - DateFormat.yMd().format(date), - ), - AppNewsStateError(exception: final dynamic e) => 'Error $e', - }); - }); - }, - trailingBuilder: (BuildContext context) { - return IconButton( - icon: const Icon(Icons.refresh), - onPressed: () => context - .read() - .loadLatestNews(forceUpdate: true), - ); - }, - ), - UserPreferencesItemSection( - label: appLocalizations.dev_mode_section_product_page, - ), - UserPreferencesItemSwitch( - title: appLocalizations.dev_preferences_edit_ingredients_title, - value: userPreferences.getFlag(userPreferencesFlagEditIngredients) ?? - false, - onChanged: (bool value) async { - await userPreferences.setFlag( - userPreferencesFlagEditIngredients, value); - _showSuccessMessage(); - }, - ), - UserPreferencesItemSwitch( - title: appLocalizations.dev_mode_hide_environmental_score_title, - value: userPreferences - .getExcludedAttributeIds() - .contains(Attribute.ATTRIBUTE_ECOSCORE), - onChanged: (bool value) async { - const String tag = Attribute.ATTRIBUTE_ECOSCORE; - final List list = userPreferences.getExcludedAttributeIds(); - list.removeWhere((final String element) => element == tag); - if (value) { - list.add(tag); - } - await userPreferences.setExcludedAttributeIds(list); - }, - ), - UserPreferencesItemSwitch( - title: appLocalizations.dev_preferences_show_folksonomy_title, - value: userPreferences.getFlag(userPreferencesFlagHideFolksonomy) ?? - true, - onChanged: (bool value) async { - await userPreferences.setFlag( - userPreferencesFlagHideFolksonomy, - value, - ); - _showSuccessMessage(); - }, - ), - UserPreferencesItemSection( - label: appLocalizations.dev_mode_section_ui, - ), - UserPreferencesItemTile( - title: appLocalizations.dev_preferences_reset_onboarding_title, - subtitle: appLocalizations.dev_preferences_reset_onboarding_subtitle, - onTap: () async { - await userPreferences.resetOnboarding(); - _showSuccessMessage(); - }, - ), - UserPreferencesItemSwitch( - title: 'Accessibility: remove colors', - value: userPreferences - .getFlag(userPreferencesFlagAccessibilityNoColor) ?? - false, - onChanged: (bool value) async { - await userPreferences.setFlag( - userPreferencesFlagAccessibilityNoColor, value); - _showSuccessMessage(); - }, - ), - UserPreferencesItemSwitch( - title: 'Accessibility: show emoji', - value: - userPreferences.getFlag(userPreferencesFlagAccessibilityEmoji) ?? - false, - onChanged: (bool value) async { - await userPreferences.setFlag( - userPreferencesFlagAccessibilityEmoji, value); - _showSuccessMessage(); - }, - ), - UserPreferencesItemSwitch( - title: appLocalizations.dev_mode_spellchecker_for_ocr_title, - subtitle: appLocalizations.dev_mode_spellchecker_for_ocr_subtitle, - value: - userPreferences.getFlag(userPreferencesFlagSpellCheckerOnOcr) ?? - false, - onChanged: (bool value) async => userPreferences.setFlag( - userPreferencesFlagSpellCheckerOnOcr, - value, - ), - ), - UserPreferencesItemSection( - label: appLocalizations.dev_mode_section_experimental_features, - ), - UserPreferencesItemSwitch( - title: appLocalizations.prices_bulk_proof_upload_title, - value: userPreferences.getFlag(userPreferencesFlagBulkProofUpload) ?? - false, - onChanged: (bool value) async => userPreferences.setFlag( - userPreferencesFlagBulkProofUpload, - value, - ), - ), - UserPreferencesItemSwitch( - title: 'Multi-products selection for prices', - value: userPreferences - .getFlag(userPreferencesFlagPricesReceiptMultiSelection) ?? - false, - onChanged: (bool value) async { - await userPreferences.setFlag( - userPreferencesFlagPricesReceiptMultiSelection, - value, - ); - _showSuccessMessage(); - }, - ), - UserPreferencesItemSwitch( - title: 'User ordered knowledge panels', - value: userPreferences.getFlag(userPreferencesFlagUserOrderedKP) ?? - false, - onChanged: (bool value) async { - await userPreferences.setFlag( - userPreferencesFlagUserOrderedKP, value); - _showSuccessMessage(); - }, - ), - UserPreferencesItemTile( - title: 'Temporary access to location search', - onTap: () async { - final LocalDatabase localDatabase = context.read(); - final DaoOsmLocation daoOsmLocation = DaoOsmLocation(localDatabase); - final List osmLocations = - await daoOsmLocation.getAll(); - if (!context.mounted) { - return; - } - final List preloadedList = - []; - for (final OsmLocation osmLocation in osmLocations) { - preloadedList.add( - SearchLocationPreloadedItem( - osmLocation, - popFirst: false, - ), - ); - } - final OsmLocation? osmLocation = await Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => SearchPage( - SearchLocationHelper(), - preloadedList: preloadedList, - autofocus: false, - ), - ), - ); - if (osmLocation == null) { - return; - } - await daoOsmLocation.put(osmLocation); - if (!context.mounted) { - return; - } - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - osmLocation.getTitle() ?? - osmLocation.getSubtitle() ?? - osmLocation.getLatLng().toString(), - ), - ), - ); - }, - ), - UserPreferencesItemTile( - title: 'Preference Search...', - onTap: () async => Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => - const UserPreferencesSearchPage(), - ), - ), - ), - UserPreferencesItemSwitch( - title: 'Side by side comparison for 2 or 3 products', - value: - userPreferences.getFlag(userPreferencesFlagBoostedComparison) ?? - false, - onChanged: (bool value) async { - await userPreferences.setFlag( - userPreferencesFlagBoostedComparison, value); - _showSuccessMessage(); - }, - ), - UserPreferencesItemSwitch( - title: 'Product list import', - value: - userPreferences.getFlag(userPreferencesFlagProductListImport) ?? - false, - onChanged: (bool value) async { - await userPreferences.setFlag( - userPreferencesFlagProductListImport, value); - _showSuccessMessage(); - }, - ), - ]; - - ScaffoldFeatureController - _showSuccessMessage() => ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(appLocalizations.dev_preferences_button_positive), ), ); + } + + if (!context.mounted) { + return; + } + await showDialog( + context: context, + builder: (BuildContext context) => SmoothAlertDialog( + title: appLocalizations.dev_preferences_export_history_dialog_title, + body: SizedBox( + height: 400, + width: 300, + child: ListView(children: children), + ), + negativeAction: SmoothActionButton( + text: appLocalizations.copy_to_clipboard, + onPressed: () async { + final StringBuffer data = StringBuffer(); + + for (final String key in export.keys) { + data.write('$key, '); + } + + await Clipboard.setData(ClipboardData(text: data.toString())); + }, + ), + positiveAction: SmoothActionButton( + text: appLocalizations.okay, + onPressed: () => Navigator.pop(context), + ), + ), + ); + }, + ), + UserPreferencesItemTile( + title: 'Refresh all products from server (cf. Nutriscore v2)', + trailing: const Icon(Icons.refresh), + onTap: () async { + final LocalDatabase localDatabase = context.read(); + final DaoProduct daoProduct = DaoProduct(localDatabase); + await daoProduct.clearAllLanguages(); + await BackgroundTaskLanguageRefresh.addTask(localDatabase); + _showSuccessMessage(); + }, + ), + UserPreferencesItemTile( + // Do not translate + title: 'Reset app language', + onTap: () async { + userPreferences.setAppLanguageCode(null); + ProductQuery.setLanguage(context, userPreferences); + }, + ), + UserPreferencesItemTile( + title: 'Add cards to scanner', + subtitle: 'Adds 3 sample products to the scanner', + onTap: () async { + final ContinuousScanModel model = context.read(); + + const List barcodes = [ + '5449000000996', + '3017620425035', + '3175680011480', + ]; + for (int i = 0; i < barcodes.length; i++) { + await model.onScan(barcodes[i]); + } + }, + ), + UserPreferencesItemSection(label: appLocalizations.dev_mode_section_server), + UserPreferencesItemTile( + title: appLocalizations.dev_preferences_environment_switch_title, + trailing: DropdownButton( + value: userPreferences.getFlag(userPreferencesFlagProd) ?? true, + elevation: 16, + onChanged: (bool? newValue) async { + await userPreferences.setFlag(userPreferencesFlagProd, newValue); + ProductQuery.setQueryType(userPreferences); + }, + items: const >[ + DropdownMenuItem(value: true, child: Text('PROD')), + DropdownMenuItem(value: false, child: Text('TEST')), + ], + ), + ), + UserPreferencesItemTile( + title: appLocalizations.dev_preferences_test_environment_title, + subtitle: appLocalizations.dev_preferences_test_environment_subtitle( + ProductQuery.getTestUriProductHelper( + userPreferences, + ).getPostUri(path: '').toString(), + ), + visibleWhen: (BuildContext context) { + return userPreferences.getFlag(userPreferencesFlagProd) == false; + }, + onTap: () async => _changeTestEnvDomain(), + ), + const UserPreferencesItemSection(label: 'Prices Server configuration'), + UserPreferencesItemTile( + title: 'Switch between prices.openfoodfacts.org (PROD) and test env', + trailing: DropdownButton( + value: userPreferences.getFlag(userPreferencesFlagPriceProd) ?? true, + elevation: 16, + onChanged: (bool? newValue) async { + await userPreferences.setFlag(userPreferencesFlagPriceProd, newValue); + ProductQuery.setQueryType(userPreferences); + }, + items: const >[ + DropdownMenuItem(value: true, child: Text('PROD')), + DropdownMenuItem(value: false, child: Text('TEST')), + ], + ), + ), + const UserPreferencesItemSection(label: 'Folksonomy Server configuration'), + UserPreferencesItemTile( + title: 'Folksonomy host', + subtitle: ProductQuery.uriFolksonomyHelper.host, + onTap: () async => _changeFolksonomyHost(), + ), + UserPreferencesItemSection(label: appLocalizations.dev_mode_section_news), + UserPreferencesEditableItemTile( + title: appLocalizations.dev_preferences_news_custom_url_title, + subtitleWithEmptyValue: + appLocalizations.dev_preferences_news_custom_url_empty_value, + dialogAction: appLocalizations.dev_preferences_news_custom_url_subtitle, + value: userPreferences.getDevModeString(userPreferencesCustomNewsJSONURI), + onNewValue: (String newUrl) => userPreferences.setDevModeString( + userPreferencesCustomNewsJSONURI, + newUrl, + ), + validator: (String value) => value.isEmpty || Uri.tryParse(value) != null, + ), + UserPreferencesItemTileBuilder( + title: appLocalizations.dev_preferences_news_provider_status_title, + subtitleBuilder: (BuildContext context) { + return Consumer( + builder: (_, AppNewsProvider provider, __) { + return Text(switch (provider.state) { + AppNewsStateLoading() => 'Loading…', + AppNewsStateLoaded(lastUpdate: final DateTime date) => + appLocalizations.dev_preferences_news_provider_status_subtitle( + DateFormat.yMd().format(date), + ), + AppNewsStateError(exception: final dynamic e) => 'Error $e', + }); + }, + ); + }, + trailingBuilder: (BuildContext context) { + return IconButton( + icon: const Icon(Icons.refresh), + onPressed: () => + context.read().loadLatestNews(forceUpdate: true), + ); + }, + ), + UserPreferencesItemSection( + label: appLocalizations.dev_mode_section_product_page, + ), + UserPreferencesItemSwitch( + title: appLocalizations.dev_preferences_edit_ingredients_title, + value: + userPreferences.getFlag(userPreferencesFlagEditIngredients) ?? false, + onChanged: (bool value) async { + await userPreferences.setFlag( + userPreferencesFlagEditIngredients, + value, + ); + _showSuccessMessage(); + }, + ), + UserPreferencesItemSwitch( + title: appLocalizations.dev_mode_hide_environmental_score_title, + value: userPreferences.getExcludedAttributeIds().contains( + Attribute.ATTRIBUTE_ECOSCORE, + ), + onChanged: (bool value) async { + const String tag = Attribute.ATTRIBUTE_ECOSCORE; + final List list = userPreferences.getExcludedAttributeIds(); + list.removeWhere((final String element) => element == tag); + if (value) { + list.add(tag); + } + await userPreferences.setExcludedAttributeIds(list); + }, + ), + UserPreferencesItemSwitch( + title: appLocalizations.dev_preferences_show_folksonomy_title, + value: userPreferences.getFlag(userPreferencesFlagHideFolksonomy) ?? true, + onChanged: (bool value) async { + await userPreferences.setFlag(userPreferencesFlagHideFolksonomy, value); + _showSuccessMessage(); + }, + ), + UserPreferencesItemSection(label: appLocalizations.dev_mode_section_ui), + UserPreferencesItemTile( + title: appLocalizations.dev_preferences_reset_onboarding_title, + subtitle: appLocalizations.dev_preferences_reset_onboarding_subtitle, + onTap: () async { + await userPreferences.resetOnboarding(); + _showSuccessMessage(); + }, + ), + UserPreferencesItemSwitch( + title: 'Accessibility: remove colors', + value: + userPreferences.getFlag(userPreferencesFlagAccessibilityNoColor) ?? + false, + onChanged: (bool value) async { + await userPreferences.setFlag( + userPreferencesFlagAccessibilityNoColor, + value, + ); + _showSuccessMessage(); + }, + ), + UserPreferencesItemSwitch( + title: 'Accessibility: show emoji', + value: + userPreferences.getFlag(userPreferencesFlagAccessibilityEmoji) ?? + false, + onChanged: (bool value) async { + await userPreferences.setFlag( + userPreferencesFlagAccessibilityEmoji, + value, + ); + _showSuccessMessage(); + }, + ), + UserPreferencesItemSwitch( + title: appLocalizations.dev_mode_spellchecker_for_ocr_title, + subtitle: appLocalizations.dev_mode_spellchecker_for_ocr_subtitle, + value: + userPreferences.getFlag(userPreferencesFlagSpellCheckerOnOcr) ?? + false, + onChanged: (bool value) async => + userPreferences.setFlag(userPreferencesFlagSpellCheckerOnOcr, value), + ), + UserPreferencesItemSection( + label: appLocalizations.dev_mode_section_experimental_features, + ), + UserPreferencesItemSwitch( + title: appLocalizations.prices_bulk_proof_upload_title, + value: + userPreferences.getFlag(userPreferencesFlagBulkProofUpload) ?? false, + onChanged: (bool value) async => + userPreferences.setFlag(userPreferencesFlagBulkProofUpload, value), + ), + UserPreferencesItemSwitch( + title: 'Multi-products selection for prices', + value: + userPreferences.getFlag( + userPreferencesFlagPricesReceiptMultiSelection, + ) ?? + false, + onChanged: (bool value) async { + await userPreferences.setFlag( + userPreferencesFlagPricesReceiptMultiSelection, + value, + ); + _showSuccessMessage(); + }, + ), + UserPreferencesItemSwitch( + title: 'User ordered knowledge panels', + value: userPreferences.getFlag(userPreferencesFlagUserOrderedKP) ?? false, + onChanged: (bool value) async { + await userPreferences.setFlag(userPreferencesFlagUserOrderedKP, value); + _showSuccessMessage(); + }, + ), + UserPreferencesItemTile( + title: 'Temporary access to location search', + onTap: () async { + final LocalDatabase localDatabase = context.read(); + final DaoOsmLocation daoOsmLocation = DaoOsmLocation(localDatabase); + final List osmLocations = await daoOsmLocation.getAll(); + if (!context.mounted) { + return; + } + final List preloadedList = + []; + for (final OsmLocation osmLocation in osmLocations) { + preloadedList.add( + SearchLocationPreloadedItem(osmLocation, popFirst: false), + ); + } + final OsmLocation? osmLocation = await Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => SearchPage( + SearchLocationHelper(), + preloadedList: preloadedList, + autofocus: false, + ), + ), + ); + if (osmLocation == null) { + return; + } + await daoOsmLocation.put(osmLocation); + if (!context.mounted) { + return; + } + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + osmLocation.getTitle() ?? + osmLocation.getSubtitle() ?? + osmLocation.getLatLng().toString(), + ), + ), + ); + }, + ), + UserPreferencesItemTile( + title: 'Preference Search...', + onTap: () async => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => const UserPreferencesSearchPage(), + ), + ), + ), + UserPreferencesItemSwitch( + title: 'Side by side comparison for 2 or 3 products', + value: + userPreferences.getFlag(userPreferencesFlagBoostedComparison) ?? + false, + onChanged: (bool value) async { + await userPreferences.setFlag( + userPreferencesFlagBoostedComparison, + value, + ); + _showSuccessMessage(); + }, + ), + UserPreferencesItemSwitch( + title: 'Product list import', + value: + userPreferences.getFlag(userPreferencesFlagProductListImport) ?? + false, + onChanged: (bool value) async { + await userPreferences.setFlag( + userPreferencesFlagProductListImport, + value, + ); + _showSuccessMessage(); + }, + ), + ]; + + ScaffoldFeatureController + _showSuccessMessage() => ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(appLocalizations.dev_preferences_button_positive)), + ); Future _changeTestEnvDomain() async { _textFieldController.text = userPreferences.getDevModeString(userPreferencesTestEnvDomain) ?? - uriHelperFoodTest.domain; + uriHelperFoodTest.domain; final bool? result = await showDialog( context: context, builder: (final BuildContext context) => SmoothAlertDialog( @@ -580,7 +543,9 @@ class UserPreferencesDevMode extends AbstractUserPreferences { ); if (result == true) { await userPreferences.setDevModeString( - userPreferencesTestEnvDomain, _textFieldController.text); + userPreferencesTestEnvDomain, + _textFieldController.text, + ); ProductQuery.setQueryType(userPreferences); } } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_donation.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_donation.dart index 92d580480f..09e09ebefc 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_donation.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_donation.dart @@ -27,15 +27,12 @@ class UserPreferencesDonation extends AbstractUserPreferences { IconData getLeadingIconData() => Icons.volunteer_activism; @override - Icon? getForwardIcon() => UserPreferencesListTile.getTintedIcon( - Icons.open_in_new, - context, - ); + Icon? getForwardIcon() => + UserPreferencesListTile.getTintedIcon(Icons.open_in_new, context); @override - Future runHeaderAction() async => LaunchUrlHelper.launchURL( - appLocalizations.donate_url, - ); + Future runHeaderAction() async => + LaunchUrlHelper.launchURL(appLocalizations.donate_url); @override List getChildren() => []; diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_faq.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_faq.dart index ff4a06c65a..6b2e40ca53 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_faq.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_faq.dart @@ -42,87 +42,78 @@ class UserPreferencesFaq extends AbstractUserPreferences { @override List getChildren() => [ - _getListTile( - title: appLocalizations.faq, - leadingIconData: Icons.question_mark, - url: _getFAQUrl(), + _getListTile( + title: appLocalizations.faq, + leadingIconData: Icons.question_mark, + url: _getFAQUrl(), + ), + _getNutriListTile( + title: appLocalizations.nutriscore_generic, + url: 'https://world.openfoodfacts.org/nutriscore', + svg: SvgCache.getAssetsCacheForNutriscore(NutriScoreValue.b, false), + ), + _getListTile( + title: appLocalizations.faq_nutriscore_nutriscore, + leadingSvg: SvgCache.getAssetsCacheForNutriscore(NutriScoreValue.b, true), + onTap: () => Navigator.of(context, rootNavigator: true).push( + MaterialPageRoute( + builder: (BuildContext context) => const GuideNutriscoreV2(), ), - _getNutriListTile( - title: appLocalizations.nutriscore_generic, - url: 'https://world.openfoodfacts.org/nutriscore', - svg: SvgCache.getAssetsCacheForNutriscore( - NutriScoreValue.b, - false, - ), - ), - _getListTile( - title: appLocalizations.faq_nutriscore_nutriscore, - leadingSvg: SvgCache.getAssetsCacheForNutriscore( - NutriScoreValue.b, - true, - ), - onTap: () => Navigator.of(context, rootNavigator: true).push( - MaterialPageRoute( - builder: (BuildContext context) => const GuideNutriscoreV2(), - ), - ), + ), - /// Hide the icon - icon: const Icon( - Icons.info, - size: 0.0, - ), - ), - _getNutriListTile( - title: appLocalizations.environmental_score_generic, - url: 'https://world.openfoodfacts.org/ecoscore', - svg: 'assets/cache/green-score-b.svg', - ), - _getNutriListTile( - title: appLocalizations.nova_group_generic, - url: 'https://world.openfoodfacts.org/nova', - svg: 'assets/cache/nova-group-4.svg', - ), - _getNutriListTile( - title: appLocalizations.nutrition_facts, - url: 'https://world.openfoodfacts.org/traffic-lights', - svg: 'assets/cache/low.svg', - leadingSvgWidth: 1.5 * DEFAULT_ICON_SIZE, - ), - _getListTile( - title: appLocalizations.discover, - leadingIconData: Icons.travel_explore, - url: ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/discover', - ), - ), - _getListTile( - title: appLocalizations.how_to_contribute, - leadingIconData: Icons.volunteer_activism, - url: ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/contribute', - ), - ), - _getListTile( - title: appLocalizations.feed_back, - leadingIconData: Icons.add_comment, - url: UserFeedbackHelper.getFeedbackFormLink(), - ), - _getListTile( - title: appLocalizations.faq_title_partners, - leadingIconData: Icons.handshake_outlined, - url: ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/partners', - ), - ), - _getListTile( - title: appLocalizations.faq_title_vision, - leadingIconData: Icons.remove_red_eye_outlined, - url: ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/open-food-facts-vision-mission-values-and-programs', - ), - ), - /* + /// Hide the icon + icon: const Icon(Icons.info, size: 0.0), + ), + _getNutriListTile( + title: appLocalizations.environmental_score_generic, + url: 'https://world.openfoodfacts.org/ecoscore', + svg: 'assets/cache/green-score-b.svg', + ), + _getNutriListTile( + title: appLocalizations.nova_group_generic, + url: 'https://world.openfoodfacts.org/nova', + svg: 'assets/cache/nova-group-4.svg', + ), + _getNutriListTile( + title: appLocalizations.nutrition_facts, + url: 'https://world.openfoodfacts.org/traffic-lights', + svg: 'assets/cache/low.svg', + leadingSvgWidth: 1.5 * DEFAULT_ICON_SIZE, + ), + _getListTile( + title: appLocalizations.discover, + leadingIconData: Icons.travel_explore, + url: ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/discover', + ), + ), + _getListTile( + title: appLocalizations.how_to_contribute, + leadingIconData: Icons.volunteer_activism, + url: ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/contribute', + ), + ), + _getListTile( + title: appLocalizations.feed_back, + leadingIconData: Icons.add_comment, + url: UserFeedbackHelper.getFeedbackFormLink(), + ), + _getListTile( + title: appLocalizations.faq_title_partners, + leadingIconData: Icons.handshake_outlined, + url: ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/partners', + ), + ), + _getListTile( + title: appLocalizations.faq_title_vision, + leadingIconData: Icons.remove_red_eye_outlined, + url: ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/open-food-facts-vision-mission-values-and-programs', + ), + ), + /* // temporarily (?) hiding "install OxF" links // cf. https://github.com/openfoodfacts/smooth-app/issues/6413 if (Platform.isAndroid || Platform.isIOS) @@ -158,13 +149,13 @@ class UserPreferencesFaq extends AbstractUserPreferences { 'https://play.google.com/store/apps/details?id=org.openproductsfacts.scanner&hl=${ProductQuery.getLanguage().offTag}', ), */ - _getListTile( - title: appLocalizations.about_this_app, - leadingIconData: Icons.info, - onTap: () async => _about(), - icon: getForwardIcon(), - ), - ]; + _getListTile( + title: appLocalizations.about_this_app, + leadingIconData: Icons.info, + onTap: () async => _about(), + icon: getForwardIcon(), + ), + ]; UserPreferencesItem _getListTile({ required final String title, @@ -174,50 +165,47 @@ class UserPreferencesFaq extends AbstractUserPreferences { final String? url, final VoidCallback? onTap, final Icon? icon, - }) => - UserPreferencesItemSimple( - labels: [title], - builder: (_) => UserPreferencesListTile( - title: Text(title), - onTap: onTap ?? - () async => LaunchUrlHelper.launchURLInWebViewOrBrowser( - context, - url!, - ), - trailing: icon ?? - UserPreferencesListTile.getTintedIcon(Icons.open_in_new, context), - leading: SizedBox( - width: 2 * DEFAULT_ICON_SIZE, - height: 2 * DEFAULT_ICON_SIZE, - child: Center( - child: leadingIconData != null - ? UserPreferencesListTile.getTintedIcon( - leadingIconData, context) - : leadingSvg == null - ? null - : SvgPicture.asset( - leadingSvg, - width: leadingSvgWidth ?? 2 * DEFAULT_ICON_SIZE, - package: AppHelper.APP_PACKAGE, - ), - ), - ), - externalLink: url != null, + }) => UserPreferencesItemSimple( + labels: [title], + builder: (_) => UserPreferencesListTile( + title: Text(title), + onTap: + onTap ?? + () async => + LaunchUrlHelper.launchURLInWebViewOrBrowser(context, url!), + trailing: + icon ?? + UserPreferencesListTile.getTintedIcon(Icons.open_in_new, context), + leading: SizedBox( + width: 2 * DEFAULT_ICON_SIZE, + height: 2 * DEFAULT_ICON_SIZE, + child: Center( + child: leadingIconData != null + ? UserPreferencesListTile.getTintedIcon(leadingIconData, context) + : leadingSvg == null + ? null + : SvgPicture.asset( + leadingSvg, + width: leadingSvgWidth ?? 2 * DEFAULT_ICON_SIZE, + package: AppHelper.APP_PACKAGE, + ), ), - ); + ), + externalLink: url != null, + ), + ); UserPreferencesItem _getNutriListTile({ required final String title, required final String url, required final String svg, final double? leadingSvgWidth, - }) => - _getListTile( - title: title, - leadingSvg: svg, - leadingSvgWidth: leadingSvgWidth, - url: ProductQuery.replaceSubdomain(url), - ); + }) => _getListTile( + title: title, + leadingSvg: svg, + leadingSvgWidth: leadingSvgWidth, + url: ProductQuery.replaceSubdomain(url), + ); static const String _iconLightAssetPath = 'assets/app/release_icon_light_transparent_no_border.svg'; @@ -260,7 +248,7 @@ class UserPreferencesFaq extends AbstractUserPreferences { Text( '${packageInfo.version}+${packageInfo.buildNumber}-${GlobalVars.scannerLabel.name}-${GlobalVars.storeLabel.name}', style: themeData.textTheme.titleSmall, - ) + ), ], ), ), @@ -280,11 +268,11 @@ class UserPreferencesFaq extends AbstractUserPreferences { SmoothAlertContentButton( onPressed: () async => LaunchUrlHelper.launchURLInWebViewOrBrowser( - context, - ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/who-we-are', - ), - ), + context, + ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/who-we-are', + ), + ), label: appLocalizations.learnMore, icon: Icons.open_in_new, ), @@ -292,11 +280,11 @@ class UserPreferencesFaq extends AbstractUserPreferences { SmoothAlertContentButton( onPressed: () async => LaunchUrlHelper.launchURLInWebViewOrBrowser( - context, - ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/terms-of-use', - ), - ), + context, + ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/terms-of-use', + ), + ), label: appLocalizations.termsOfUse, icon: Icons.open_in_new, ), @@ -304,11 +292,11 @@ class UserPreferencesFaq extends AbstractUserPreferences { SmoothAlertContentButton( onPressed: () async => LaunchUrlHelper.launchURLInWebViewOrBrowser( - context, - ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/legal', - ), - ), + context, + ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/legal', + ), + ), label: appLocalizations.legalNotices, icon: Icons.open_in_new, ), @@ -316,11 +304,11 @@ class UserPreferencesFaq extends AbstractUserPreferences { SmoothAlertContentButton( onPressed: () => LaunchUrlHelper.launchURLInWebViewOrBrowser( - context, - ProductQuery.replaceSubdomain( - 'https://world.openfoodfacts.org/privacy', - ), - ), + context, + ProductQuery.replaceSubdomain( + 'https://world.openfoodfacts.org/privacy', + ), + ), label: appLocalizations.privacy_policy, icon: Icons.open_in_new, ), diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_food.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_food.dart index b17ac2bd2d..b324450b2c 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_food.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_food.dart @@ -54,25 +54,28 @@ class UserPreferencesFood extends AbstractUserPreferences { @override List getChildren() => [ - // we don't want this on the onboarding - UserPreferencesItemTile( - leading: UserPreferencesListTile.getTintedIcon( - Icons.rotate_left, - context, - ), - title: appLocalizations.reset_food_prefs, - onTap: () async => _confirmReset(), - ), - ..._getOnboardingBody(collapsed: false) - ]; + // we don't want this on the onboarding + UserPreferencesItemTile( + leading: UserPreferencesListTile.getTintedIcon( + Icons.rotate_left, + context, + ), + title: appLocalizations.reset_food_prefs, + onTap: () async => _confirmReset(), + ), + ..._getOnboardingBody(collapsed: false), + ]; List _reorderGroups(List groups) { final List result = []; for (final String id in _ORDERED_ATTRIBUTE_GROUP_IDS) { result.addAll(groups.where((AttributeGroup g) => g.id == id)); } - result.addAll(groups.where( - (AttributeGroup g) => !_ORDERED_ATTRIBUTE_GROUP_IDS.contains(g.id))); + result.addAll( + groups.where( + (AttributeGroup g) => !_ORDERED_ATTRIBUTE_GROUP_IDS.contains(g.id), + ), + ); return result; } @@ -103,29 +106,27 @@ class UserPreferencesFood extends AbstractUserPreferences { List getOnboardingContent() { final List result = [ Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: LARGE_SPACE, - ), - child: Text( - getTitleString(), - style: themeData.textTheme.displayMedium, - ), + padding: const EdgeInsetsDirectional.symmetric(horizontal: LARGE_SPACE), + child: Text(getTitleString(), style: themeData.textTheme.displayMedium), ), ]; for (final UserPreferencesItem item in _getOnboardingBody()) { - result.add(Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: SMALL_SPACE, + result.add( + Padding( + padding: const EdgeInsetsDirectional.symmetric( + horizontal: SMALL_SPACE, + ), + child: item.builder(context), ), - child: item.builder(context), - )); + ); } return result; } List _getOnboardingBody({final bool? collapsed}) { - final List groups = - _reorderGroups(productPreferences.attributeGroups!); + final List groups = _reorderGroups( + productPreferences.attributeGroups!, + ); final List result = [ UserPreferencesItemSimple( labels: [appLocalizations.myPreferences_food_comment], diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_language_selector.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_language_selector.dart index e8012f6fef..5f017f569d 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_language_selector.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_language_selector.dart @@ -12,9 +12,7 @@ class UserPreferencesLanguageSelector extends StatelessWidget { ) { final AppLocalizations appLocalizations = AppLocalizations.of(context); return UserPreferencesItemSimple( - labels: [ - appLocalizations.language_picker_label, - ], + labels: [appLocalizations.language_picker_label], builder: (_) => const UserPreferencesLanguageSelector(), ); } @@ -38,9 +36,7 @@ class UserPreferencesLanguageSelector extends StatelessWidget { autoValidate: false, textStyle: themeData.textTheme.bodyMedium, icon: const Icon(Icons.edit), - padding: const EdgeInsetsDirectional.only( - start: SMALL_SPACE, - ), + padding: const EdgeInsetsDirectional.only(start: SMALL_SPACE), loadingHeight: 40.0, ), ), diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_languages_list.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_languages_list.dart index 392e9d5fcd..92c3dd5fc7 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_languages_list.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_languages_list.dart @@ -17,190 +17,190 @@ class Languages { static const Map _namesInLanguage = { - OpenFoodFactsLanguage.AFAR: 'Afar', - OpenFoodFactsLanguage.AFRIKAANS: 'Afrikaans', - OpenFoodFactsLanguage.AKAN: 'Akan', - OpenFoodFactsLanguage.AMHARIC: 'አማርኛ', - OpenFoodFactsLanguage.ARABIC: 'عربى', - OpenFoodFactsLanguage.ARAGONESE: 'Aragonés', - OpenFoodFactsLanguage.ASSAMESE: 'অসমীয়া', - OpenFoodFactsLanguage.AVAR: 'Авар', - OpenFoodFactsLanguage.AVESTAN: 'Avesta', - OpenFoodFactsLanguage.AYMARA: 'Aymar aru', - OpenFoodFactsLanguage.AZERBAIJANI: 'Azərbaycan', - OpenFoodFactsLanguage.BELARUSIAN: 'беларускi', - OpenFoodFactsLanguage.BULGARIAN: 'български', - OpenFoodFactsLanguage.BAMBARA: 'Bamanankan', - OpenFoodFactsLanguage.BASHKIR: 'башҡорт тілі', - OpenFoodFactsLanguage.BENGALI: 'বাংলা', - OpenFoodFactsLanguage.BIHARI_LANGUAGES: 'Bihari Languages', - OpenFoodFactsLanguage.BISLAMA: 'Bislama', - OpenFoodFactsLanguage.TIBETAN_LANGUAGE: 'Tibetan', - OpenFoodFactsLanguage.BRETON: 'Breton', - OpenFoodFactsLanguage.BOSNIAN: 'bosanski', - OpenFoodFactsLanguage.CATALAN: 'català', - OpenFoodFactsLanguage.CHECHEN: 'Chechen', - OpenFoodFactsLanguage.CHEWA: 'Chewa', - OpenFoodFactsLanguage.CHAMORRO: 'Chamoru', - OpenFoodFactsLanguage.CHURCH_SLAVONIC: 'Church Slavonic', - OpenFoodFactsLanguage.CORSICAN: 'Corsu', - OpenFoodFactsLanguage.CREE: 'ᐃᓄᒃᑎᑐᑦ', - OpenFoodFactsLanguage.CZECH: 'čeština', - OpenFoodFactsLanguage.CHUVASH: 'Chuvash', - OpenFoodFactsLanguage.WELSH: 'Cymraeg', - OpenFoodFactsLanguage.DANISH: 'dansk', - OpenFoodFactsLanguage.DZONGKHA_LANGUAGE: 'Dzongkha', - OpenFoodFactsLanguage.GERMAN: 'Deutsch', - OpenFoodFactsLanguage.MODERN_GREEK: 'Ελληνικά', - OpenFoodFactsLanguage.ENGLISH: 'English', - OpenFoodFactsLanguage.ESPERANTO: 'Esperanto', - OpenFoodFactsLanguage.SPANISH: 'Español', - OpenFoodFactsLanguage.ESTONIAN: 'eestikeel', - OpenFoodFactsLanguage.EWE: 'Eʋegbe', - OpenFoodFactsLanguage.BASQUE: 'euskara', - OpenFoodFactsLanguage.PERSIAN: 'فارسی', - OpenFoodFactsLanguage.FINNISH: 'Suomi', - OpenFoodFactsLanguage.FAROESE: 'Faroese', - OpenFoodFactsLanguage.FRENCH: 'Français', - OpenFoodFactsLanguage.FIJIAN_LANGUAGE: 'Fijian', - OpenFoodFactsLanguage.FULA_LANGUAGE: 'Fula', - OpenFoodFactsLanguage.IRISH: 'Gaeilge', - OpenFoodFactsLanguage.SCOTTISH_GAELIC: 'ScottishGaelic', - OpenFoodFactsLanguage.GALICIAN: 'galego', - OpenFoodFactsLanguage.GREENLANDIC: 'Greenlandic', - OpenFoodFactsLanguage.GIKUYU: 'Gikuyu', - OpenFoodFactsLanguage.GUARANI: 'Guaraní', - OpenFoodFactsLanguage.GUJARATI: 'ગુજરાતી', - OpenFoodFactsLanguage.HAUSA: 'હૌસા', - OpenFoodFactsLanguage.HEBREW: 'עִברִית', - OpenFoodFactsLanguage.HERERO: 'Herero', - OpenFoodFactsLanguage.HINDI: 'हिन्दी', - OpenFoodFactsLanguage.HIRI_MOTU: 'HiriMotu', - OpenFoodFactsLanguage.CROATIAN: 'Hrvatski', - OpenFoodFactsLanguage.HAITIAN_CREOLE: 'ayisyen', - OpenFoodFactsLanguage.HUNGARIAN: 'Magyar', - OpenFoodFactsLanguage.ARMENIAN: 'հայերեն', - OpenFoodFactsLanguage.INDONESIAN: 'bahasaIndonesia', - OpenFoodFactsLanguage.NUOSU_LANGUAGE: 'SichuanYi', - OpenFoodFactsLanguage.ICELANDIC: 'íslenskur', - OpenFoodFactsLanguage.IDO: 'Ido', - OpenFoodFactsLanguage.ITALIAN: 'Italiano', - OpenFoodFactsLanguage.INUKTITUT: 'Inuktitut', - OpenFoodFactsLanguage.INTERLINGUA: 'Interlingua', - OpenFoodFactsLanguage.INUPIAT_LANGUAGE: 'Inupiaq', - OpenFoodFactsLanguage.INTERLINGUE: 'Interlingue', - OpenFoodFactsLanguage.IGBO_LANGUAGE: 'Igbo', - OpenFoodFactsLanguage.JAPANESE: '日本語', - OpenFoodFactsLanguage.JAVANESE: 'basajawa', - OpenFoodFactsLanguage.GEORGIAN: 'ქართული', - OpenFoodFactsLanguage.KANURI: 'Kanuri', - OpenFoodFactsLanguage.KASHMIRI: 'कश्मीरी', - OpenFoodFactsLanguage.KAZAKH: 'қазақ', - OpenFoodFactsLanguage.KANNADA: 'ಕನ್ನಡ', - OpenFoodFactsLanguage.KINYARWANDA: 'Kinyarwanda', - OpenFoodFactsLanguage.KOREAN: '한국인', - OpenFoodFactsLanguage.KOMI: 'коми кыв', - OpenFoodFactsLanguage.KONGO_LANGUAGE: 'Kongo', - OpenFoodFactsLanguage.KURDISH: 'Kurdî', - OpenFoodFactsLanguage.KWANYAMA: 'Kwanyama', - OpenFoodFactsLanguage.CORNISH: 'Cornish', - OpenFoodFactsLanguage.KIRUNDI: 'Kirundi', - OpenFoodFactsLanguage.KYRGYZ: 'Кыргызча', - OpenFoodFactsLanguage.LATIN: 'latīnum', - OpenFoodFactsLanguage.LUXEMBOURGISH: 'lëtzebuergesch', - OpenFoodFactsLanguage.LAO: 'ພາສາລາວ', - OpenFoodFactsLanguage.LATVIAN: 'latviski', - OpenFoodFactsLanguage.LITHUANIAN: 'lietuvių', - OpenFoodFactsLanguage.LINGALA_LANGUAGE: 'Lingala', - OpenFoodFactsLanguage.LIMBURGISH_LANGUAGE: 'Limburgish', - OpenFoodFactsLanguage.LUBA_KATANGA_LANGUAGE: 'Luba Katanga', - OpenFoodFactsLanguage.LUGANDA: 'Luganda', - OpenFoodFactsLanguage.MALAGASY: 'Malagasy', - OpenFoodFactsLanguage.MACEDONIAN: 'македонски', - OpenFoodFactsLanguage.MAORI: 'മലയാളം', - OpenFoodFactsLanguage.MARSHALLESE: 'Ebon', - OpenFoodFactsLanguage.MONGOLIAN: 'Монгол', - OpenFoodFactsLanguage.MANX: 'Gaelg', - OpenFoodFactsLanguage.MARATHI: 'मराठी', - OpenFoodFactsLanguage.MALAY: 'Melayu', - OpenFoodFactsLanguage.MALAYALAM: 'മലയാളം', - OpenFoodFactsLanguage.MALDIVIAN_LANGUAGE: 'Maldivian', - OpenFoodFactsLanguage.MALTESE: 'Malti', - OpenFoodFactsLanguage.MOLDOVAN: 'Moldovenească', - OpenFoodFactsLanguage.BURMESE: 'မြန်မာဘာသာ', - OpenFoodFactsLanguage.BOKMAL: 'Norskbokmål', - OpenFoodFactsLanguage.NAVAJO: 'Diné bizaad', - OpenFoodFactsLanguage.NEPALI: 'नेपाली', - OpenFoodFactsLanguage.NAURUAN: 'Nauru', - OpenFoodFactsLanguage.NDONGA_DIALECT: 'Ndonga', - OpenFoodFactsLanguage.DUTCH: 'Nederlands', - OpenFoodFactsLanguage.NYNORSK: 'Norsknynorsk', - OpenFoodFactsLanguage.NORWEGIAN: 'norsk', - OpenFoodFactsLanguage.NORTHERN_NDEBELE_LANGUAGE: 'Northern Ndebele', - OpenFoodFactsLanguage.NORTHERN_SAMI: 'Sámegiella', - OpenFoodFactsLanguage.SAMOAN: 'Gagana Sāmoa', - OpenFoodFactsLanguage.SOUTHERN_NDEBELE: 'SouthNdebele', - OpenFoodFactsLanguage.OCCITAN: 'Occitan', - OpenFoodFactsLanguage.OLD_CHURCH_SLAVONIC: 'Old Church Slavonic', - OpenFoodFactsLanguage.OSSETIAN: 'Ossetian', - OpenFoodFactsLanguage.OROMO: 'Oromoo', - OpenFoodFactsLanguage.ODIA: 'ଓଡ଼ିଆ', - OpenFoodFactsLanguage.OJIBWE: 'ᐊᓂᔑᓈᐯᒧᐎᓐ', - OpenFoodFactsLanguage.PALI: 'Pali', - OpenFoodFactsLanguage.PASHTO: 'پښتو', - OpenFoodFactsLanguage.PUNJABI: 'Panjabi', - OpenFoodFactsLanguage.POLISH: 'Polski', - OpenFoodFactsLanguage.PORTUGUESE: 'Português', - OpenFoodFactsLanguage.QUECHUA_LANGUAGES: 'Runasimi', - OpenFoodFactsLanguage.ROMANSH: 'Romansh', - OpenFoodFactsLanguage.ROMANIAN: 'Română', - OpenFoodFactsLanguage.RUSSIAN: 'Русский', - OpenFoodFactsLanguage.SANSKRIT: 'संस्कृत', - OpenFoodFactsLanguage.SARDINIAN_LANGUAGE: 'Sardinian', - OpenFoodFactsLanguage.SINDHI: 'سنڌي', - OpenFoodFactsLanguage.SANGO: 'Sango', - OpenFoodFactsLanguage.SINHALA: 'සිංහල', - OpenFoodFactsLanguage.SLOVAK: 'Slovenčina', - OpenFoodFactsLanguage.SLOVENE: 'Slovenščina', - OpenFoodFactsLanguage.SHONA: 'Shona', - OpenFoodFactsLanguage.SOMALI: 'Soomaali', - OpenFoodFactsLanguage.ALBANIAN: 'shqiptare', - OpenFoodFactsLanguage.SERBIAN: 'Српски', - OpenFoodFactsLanguage.SWAZI: 'Swati', - OpenFoodFactsLanguage.SOTHO: 'SouthernSotho', - OpenFoodFactsLanguage.SUNDANESE_LANGUAGE: 'Basa Sunda', - OpenFoodFactsLanguage.SWEDISH: 'svenska', - OpenFoodFactsLanguage.SWAHILI: 'kiswahili', - OpenFoodFactsLanguage.TAMIL: 'தமிழ்', - OpenFoodFactsLanguage.TELUGU: 'తెలుగు', - OpenFoodFactsLanguage.TAJIK: 'тоҷикӣ', - OpenFoodFactsLanguage.THAI: 'ไทย', - OpenFoodFactsLanguage.TIGRINYA: 'ትግሪኛ', - OpenFoodFactsLanguage.TAGALOG: 'Tagalog', - OpenFoodFactsLanguage.TSWANA: 'Setswana', - OpenFoodFactsLanguage.TURKISH: 'Türk', - OpenFoodFactsLanguage.TURKMEN: 'Türkmen', - OpenFoodFactsLanguage.TSONGA: 'Tsonga', - OpenFoodFactsLanguage.TATAR: 'Татар', - OpenFoodFactsLanguage.TONGAN_LANGUAGE: 'Tongan', - OpenFoodFactsLanguage.TWI: 'Twi', - OpenFoodFactsLanguage.TAHITIAN: 'Tahitian', - OpenFoodFactsLanguage.UYGHUR: 'ئۇيغۇر', - OpenFoodFactsLanguage.UKRAINIAN: 'Українська', - OpenFoodFactsLanguage.URDU: 'اردو', - OpenFoodFactsLanguage.UZBEK: '"ozbek"', - OpenFoodFactsLanguage.VENDA: 'Venda', - OpenFoodFactsLanguage.VIETNAMESE: 'TiếngViệt', - OpenFoodFactsLanguage.VOLAPUK: 'Volapuk', - OpenFoodFactsLanguage.WEST_FRISIAN: 'West Frisian', - OpenFoodFactsLanguage.WOLOF: 'Wolof', - OpenFoodFactsLanguage.XHOSA: 'isiXhosa', - OpenFoodFactsLanguage.YIDDISH: 'יידיש', - OpenFoodFactsLanguage.YORUBA: 'Yoruba', - OpenFoodFactsLanguage.CHINESE: '中文', - OpenFoodFactsLanguage.ZHUANG_LANGUAGES: 'Zhuang', - OpenFoodFactsLanguage.ZULU: 'ខ្មែរ', - }; + OpenFoodFactsLanguage.AFAR: 'Afar', + OpenFoodFactsLanguage.AFRIKAANS: 'Afrikaans', + OpenFoodFactsLanguage.AKAN: 'Akan', + OpenFoodFactsLanguage.AMHARIC: 'አማርኛ', + OpenFoodFactsLanguage.ARABIC: 'عربى', + OpenFoodFactsLanguage.ARAGONESE: 'Aragonés', + OpenFoodFactsLanguage.ASSAMESE: 'অসমীয়া', + OpenFoodFactsLanguage.AVAR: 'Авар', + OpenFoodFactsLanguage.AVESTAN: 'Avesta', + OpenFoodFactsLanguage.AYMARA: 'Aymar aru', + OpenFoodFactsLanguage.AZERBAIJANI: 'Azərbaycan', + OpenFoodFactsLanguage.BELARUSIAN: 'беларускi', + OpenFoodFactsLanguage.BULGARIAN: 'български', + OpenFoodFactsLanguage.BAMBARA: 'Bamanankan', + OpenFoodFactsLanguage.BASHKIR: 'башҡорт тілі', + OpenFoodFactsLanguage.BENGALI: 'বাংলা', + OpenFoodFactsLanguage.BIHARI_LANGUAGES: 'Bihari Languages', + OpenFoodFactsLanguage.BISLAMA: 'Bislama', + OpenFoodFactsLanguage.TIBETAN_LANGUAGE: 'Tibetan', + OpenFoodFactsLanguage.BRETON: 'Breton', + OpenFoodFactsLanguage.BOSNIAN: 'bosanski', + OpenFoodFactsLanguage.CATALAN: 'català', + OpenFoodFactsLanguage.CHECHEN: 'Chechen', + OpenFoodFactsLanguage.CHEWA: 'Chewa', + OpenFoodFactsLanguage.CHAMORRO: 'Chamoru', + OpenFoodFactsLanguage.CHURCH_SLAVONIC: 'Church Slavonic', + OpenFoodFactsLanguage.CORSICAN: 'Corsu', + OpenFoodFactsLanguage.CREE: 'ᐃᓄᒃᑎᑐᑦ', + OpenFoodFactsLanguage.CZECH: 'čeština', + OpenFoodFactsLanguage.CHUVASH: 'Chuvash', + OpenFoodFactsLanguage.WELSH: 'Cymraeg', + OpenFoodFactsLanguage.DANISH: 'dansk', + OpenFoodFactsLanguage.DZONGKHA_LANGUAGE: 'Dzongkha', + OpenFoodFactsLanguage.GERMAN: 'Deutsch', + OpenFoodFactsLanguage.MODERN_GREEK: 'Ελληνικά', + OpenFoodFactsLanguage.ENGLISH: 'English', + OpenFoodFactsLanguage.ESPERANTO: 'Esperanto', + OpenFoodFactsLanguage.SPANISH: 'Español', + OpenFoodFactsLanguage.ESTONIAN: 'eestikeel', + OpenFoodFactsLanguage.EWE: 'Eʋegbe', + OpenFoodFactsLanguage.BASQUE: 'euskara', + OpenFoodFactsLanguage.PERSIAN: 'فارسی', + OpenFoodFactsLanguage.FINNISH: 'Suomi', + OpenFoodFactsLanguage.FAROESE: 'Faroese', + OpenFoodFactsLanguage.FRENCH: 'Français', + OpenFoodFactsLanguage.FIJIAN_LANGUAGE: 'Fijian', + OpenFoodFactsLanguage.FULA_LANGUAGE: 'Fula', + OpenFoodFactsLanguage.IRISH: 'Gaeilge', + OpenFoodFactsLanguage.SCOTTISH_GAELIC: 'ScottishGaelic', + OpenFoodFactsLanguage.GALICIAN: 'galego', + OpenFoodFactsLanguage.GREENLANDIC: 'Greenlandic', + OpenFoodFactsLanguage.GIKUYU: 'Gikuyu', + OpenFoodFactsLanguage.GUARANI: 'Guaraní', + OpenFoodFactsLanguage.GUJARATI: 'ગુજરાતી', + OpenFoodFactsLanguage.HAUSA: 'હૌસા', + OpenFoodFactsLanguage.HEBREW: 'עִברִית', + OpenFoodFactsLanguage.HERERO: 'Herero', + OpenFoodFactsLanguage.HINDI: 'हिन्दी', + OpenFoodFactsLanguage.HIRI_MOTU: 'HiriMotu', + OpenFoodFactsLanguage.CROATIAN: 'Hrvatski', + OpenFoodFactsLanguage.HAITIAN_CREOLE: 'ayisyen', + OpenFoodFactsLanguage.HUNGARIAN: 'Magyar', + OpenFoodFactsLanguage.ARMENIAN: 'հայերեն', + OpenFoodFactsLanguage.INDONESIAN: 'bahasaIndonesia', + OpenFoodFactsLanguage.NUOSU_LANGUAGE: 'SichuanYi', + OpenFoodFactsLanguage.ICELANDIC: 'íslenskur', + OpenFoodFactsLanguage.IDO: 'Ido', + OpenFoodFactsLanguage.ITALIAN: 'Italiano', + OpenFoodFactsLanguage.INUKTITUT: 'Inuktitut', + OpenFoodFactsLanguage.INTERLINGUA: 'Interlingua', + OpenFoodFactsLanguage.INUPIAT_LANGUAGE: 'Inupiaq', + OpenFoodFactsLanguage.INTERLINGUE: 'Interlingue', + OpenFoodFactsLanguage.IGBO_LANGUAGE: 'Igbo', + OpenFoodFactsLanguage.JAPANESE: '日本語', + OpenFoodFactsLanguage.JAVANESE: 'basajawa', + OpenFoodFactsLanguage.GEORGIAN: 'ქართული', + OpenFoodFactsLanguage.KANURI: 'Kanuri', + OpenFoodFactsLanguage.KASHMIRI: 'कश्मीरी', + OpenFoodFactsLanguage.KAZAKH: 'қазақ', + OpenFoodFactsLanguage.KANNADA: 'ಕನ್ನಡ', + OpenFoodFactsLanguage.KINYARWANDA: 'Kinyarwanda', + OpenFoodFactsLanguage.KOREAN: '한국인', + OpenFoodFactsLanguage.KOMI: 'коми кыв', + OpenFoodFactsLanguage.KONGO_LANGUAGE: 'Kongo', + OpenFoodFactsLanguage.KURDISH: 'Kurdî', + OpenFoodFactsLanguage.KWANYAMA: 'Kwanyama', + OpenFoodFactsLanguage.CORNISH: 'Cornish', + OpenFoodFactsLanguage.KIRUNDI: 'Kirundi', + OpenFoodFactsLanguage.KYRGYZ: 'Кыргызча', + OpenFoodFactsLanguage.LATIN: 'latīnum', + OpenFoodFactsLanguage.LUXEMBOURGISH: 'lëtzebuergesch', + OpenFoodFactsLanguage.LAO: 'ພາສາລາວ', + OpenFoodFactsLanguage.LATVIAN: 'latviski', + OpenFoodFactsLanguage.LITHUANIAN: 'lietuvių', + OpenFoodFactsLanguage.LINGALA_LANGUAGE: 'Lingala', + OpenFoodFactsLanguage.LIMBURGISH_LANGUAGE: 'Limburgish', + OpenFoodFactsLanguage.LUBA_KATANGA_LANGUAGE: 'Luba Katanga', + OpenFoodFactsLanguage.LUGANDA: 'Luganda', + OpenFoodFactsLanguage.MALAGASY: 'Malagasy', + OpenFoodFactsLanguage.MACEDONIAN: 'македонски', + OpenFoodFactsLanguage.MAORI: 'മലയാളം', + OpenFoodFactsLanguage.MARSHALLESE: 'Ebon', + OpenFoodFactsLanguage.MONGOLIAN: 'Монгол', + OpenFoodFactsLanguage.MANX: 'Gaelg', + OpenFoodFactsLanguage.MARATHI: 'मराठी', + OpenFoodFactsLanguage.MALAY: 'Melayu', + OpenFoodFactsLanguage.MALAYALAM: 'മലയാളം', + OpenFoodFactsLanguage.MALDIVIAN_LANGUAGE: 'Maldivian', + OpenFoodFactsLanguage.MALTESE: 'Malti', + OpenFoodFactsLanguage.MOLDOVAN: 'Moldovenească', + OpenFoodFactsLanguage.BURMESE: 'မြန်မာဘာသာ', + OpenFoodFactsLanguage.BOKMAL: 'Norskbokmål', + OpenFoodFactsLanguage.NAVAJO: 'Diné bizaad', + OpenFoodFactsLanguage.NEPALI: 'नेपाली', + OpenFoodFactsLanguage.NAURUAN: 'Nauru', + OpenFoodFactsLanguage.NDONGA_DIALECT: 'Ndonga', + OpenFoodFactsLanguage.DUTCH: 'Nederlands', + OpenFoodFactsLanguage.NYNORSK: 'Norsknynorsk', + OpenFoodFactsLanguage.NORWEGIAN: 'norsk', + OpenFoodFactsLanguage.NORTHERN_NDEBELE_LANGUAGE: 'Northern Ndebele', + OpenFoodFactsLanguage.NORTHERN_SAMI: 'Sámegiella', + OpenFoodFactsLanguage.SAMOAN: 'Gagana Sāmoa', + OpenFoodFactsLanguage.SOUTHERN_NDEBELE: 'SouthNdebele', + OpenFoodFactsLanguage.OCCITAN: 'Occitan', + OpenFoodFactsLanguage.OLD_CHURCH_SLAVONIC: 'Old Church Slavonic', + OpenFoodFactsLanguage.OSSETIAN: 'Ossetian', + OpenFoodFactsLanguage.OROMO: 'Oromoo', + OpenFoodFactsLanguage.ODIA: 'ଓଡ଼ିଆ', + OpenFoodFactsLanguage.OJIBWE: 'ᐊᓂᔑᓈᐯᒧᐎᓐ', + OpenFoodFactsLanguage.PALI: 'Pali', + OpenFoodFactsLanguage.PASHTO: 'پښتو', + OpenFoodFactsLanguage.PUNJABI: 'Panjabi', + OpenFoodFactsLanguage.POLISH: 'Polski', + OpenFoodFactsLanguage.PORTUGUESE: 'Português', + OpenFoodFactsLanguage.QUECHUA_LANGUAGES: 'Runasimi', + OpenFoodFactsLanguage.ROMANSH: 'Romansh', + OpenFoodFactsLanguage.ROMANIAN: 'Română', + OpenFoodFactsLanguage.RUSSIAN: 'Русский', + OpenFoodFactsLanguage.SANSKRIT: 'संस्कृत', + OpenFoodFactsLanguage.SARDINIAN_LANGUAGE: 'Sardinian', + OpenFoodFactsLanguage.SINDHI: 'سنڌي', + OpenFoodFactsLanguage.SANGO: 'Sango', + OpenFoodFactsLanguage.SINHALA: 'සිංහල', + OpenFoodFactsLanguage.SLOVAK: 'Slovenčina', + OpenFoodFactsLanguage.SLOVENE: 'Slovenščina', + OpenFoodFactsLanguage.SHONA: 'Shona', + OpenFoodFactsLanguage.SOMALI: 'Soomaali', + OpenFoodFactsLanguage.ALBANIAN: 'shqiptare', + OpenFoodFactsLanguage.SERBIAN: 'Српски', + OpenFoodFactsLanguage.SWAZI: 'Swati', + OpenFoodFactsLanguage.SOTHO: 'SouthernSotho', + OpenFoodFactsLanguage.SUNDANESE_LANGUAGE: 'Basa Sunda', + OpenFoodFactsLanguage.SWEDISH: 'svenska', + OpenFoodFactsLanguage.SWAHILI: 'kiswahili', + OpenFoodFactsLanguage.TAMIL: 'தமிழ்', + OpenFoodFactsLanguage.TELUGU: 'తెలుగు', + OpenFoodFactsLanguage.TAJIK: 'тоҷикӣ', + OpenFoodFactsLanguage.THAI: 'ไทย', + OpenFoodFactsLanguage.TIGRINYA: 'ትግሪኛ', + OpenFoodFactsLanguage.TAGALOG: 'Tagalog', + OpenFoodFactsLanguage.TSWANA: 'Setswana', + OpenFoodFactsLanguage.TURKISH: 'Türk', + OpenFoodFactsLanguage.TURKMEN: 'Türkmen', + OpenFoodFactsLanguage.TSONGA: 'Tsonga', + OpenFoodFactsLanguage.TATAR: 'Татар', + OpenFoodFactsLanguage.TONGAN_LANGUAGE: 'Tongan', + OpenFoodFactsLanguage.TWI: 'Twi', + OpenFoodFactsLanguage.TAHITIAN: 'Tahitian', + OpenFoodFactsLanguage.UYGHUR: 'ئۇيغۇر', + OpenFoodFactsLanguage.UKRAINIAN: 'Українська', + OpenFoodFactsLanguage.URDU: 'اردو', + OpenFoodFactsLanguage.UZBEK: '"ozbek"', + OpenFoodFactsLanguage.VENDA: 'Venda', + OpenFoodFactsLanguage.VIETNAMESE: 'TiếngViệt', + OpenFoodFactsLanguage.VOLAPUK: 'Volapuk', + OpenFoodFactsLanguage.WEST_FRISIAN: 'West Frisian', + OpenFoodFactsLanguage.WOLOF: 'Wolof', + OpenFoodFactsLanguage.XHOSA: 'isiXhosa', + OpenFoodFactsLanguage.YIDDISH: 'יידיש', + OpenFoodFactsLanguage.YORUBA: 'Yoruba', + OpenFoodFactsLanguage.CHINESE: '中文', + OpenFoodFactsLanguage.ZHUANG_LANGUAGES: 'Zhuang', + OpenFoodFactsLanguage.ZULU: 'ខ្មែរ', + }; List getSupportedLanguagesNameInEnglish() { final List languages = []; diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_list_tile.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_list_tile.dart index 494f766905..2d23821536 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_list_tile.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_list_tile.dart @@ -34,11 +34,7 @@ class UserPreferencesListTile extends StatelessWidget { static Icon getTintedIcon( final IconData iconData, final BuildContext context, - ) => - Icon( - iconData, - color: Theme.of(context).iconTheme.color, - ); + ) => Icon(iconData, color: Theme.of(context).iconTheme.color); @override Widget build(BuildContext context) { @@ -52,7 +48,8 @@ class UserPreferencesListTile extends StatelessWidget { ), selected: selected ?? false, selectedTileColor: selectedColor, - contentPadding: contentPadding ?? + contentPadding: + contentPadding ?? EdgeInsets.symmetric( horizontal: LARGE_SPACE, vertical: subtitle != null ? VERY_SMALL_SPACE : 2.0, @@ -68,8 +65,9 @@ class UserPreferencesListTile extends StatelessWidget { return Semantics( label: titleAsText, hint: externalLink == true - ? AppLocalizations.of(context) - .user_preferences_item_accessibility_hint + ? AppLocalizations.of( + context, + ).user_preferences_item_accessibility_hint : null, button: true, excludeSemantics: true, diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart index 47b1d45521..7e56969e35 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_page.dart @@ -53,8 +53,8 @@ enum PreferencePageType { final AppLocalizations appLocalizations = AppLocalizations.of(context); final ThemeProvider themeProvider = context.read(); final ThemeData themeData = Theme.of(context); - final ProductPreferences productPreferences = - context.read(); + final ProductPreferences productPreferences = context + .read(); // TODO(monsieurtanuki): the following line is probably useless - get rid of it if possible context.read(); @@ -129,18 +129,17 @@ enum PreferencePageType { static List getPreferencePageTypes( final UserPreferences userPreferences, - ) => - [ - PreferencePageType.ACCOUNT, - PreferencePageType.FOOD, - PreferencePageType.PRICES, - PreferencePageType.DONATION, - PreferencePageType.SETTINGS, - PreferencePageType.CONTRIBUTE, - PreferencePageType.FAQ, - PreferencePageType.CONNECT, - if (userPreferences.devMode > 0) PreferencePageType.DEV_MODE, - ]; + ) => [ + PreferencePageType.ACCOUNT, + PreferencePageType.FOOD, + PreferencePageType.PRICES, + PreferencePageType.DONATION, + PreferencePageType.SETTINGS, + PreferencePageType.CONTRIBUTE, + PreferencePageType.FAQ, + PreferencePageType.CONNECT, + if (userPreferences.devMode > 0) PreferencePageType.DEV_MODE, + ]; } /// Preferences page: main or detailed. @@ -177,14 +176,14 @@ class _UserPreferencesPageState extends State final List items = PreferencePageType.getPreferencePageTypes(userPreferences); for (final PreferencePageType type in items) { - final AbstractUserPreferences abstractUserPreferences = - type.getUserPreferences( - userPreferences: userPreferences, - context: context, - ); + final AbstractUserPreferences abstractUserPreferences = type + .getUserPreferences( + userPreferences: userPreferences, + context: context, + ); children.add(abstractUserPreferences.getOnlyHeader()); - final Widget? additionalSubtitle = - abstractUserPreferences.getAdditionalSubtitle(); + final Widget? additionalSubtitle = abstractUserPreferences + .getAdditionalSubtitle(); if (additionalSubtitle != null) { children.add(additionalSubtitle); } @@ -196,11 +195,11 @@ class _UserPreferencesPageState extends State appBarTitle = appLocalizations.myPreferences; addDividers = true; } else { - final AbstractUserPreferences abstractUserPreferences = - widget.type!.getUserPreferences( - userPreferences: userPreferences, - context: context, - ); + final AbstractUserPreferences abstractUserPreferences = widget.type! + .getUserPreferences( + userPreferences: userPreferences, + context: context, + ); for (final UserPreferencesItem item in abstractUserPreferences.getChildren()) { @@ -239,16 +238,10 @@ class _UserPreferencesPageState extends State if (headerAsset == null) { return SmoothScaffold( appBar: SmoothAppBar( - title: Text( - appBarTitle, - maxLines: 2, - ), + title: Text(appBarTitle, maxLines: 2), leading: const SmoothBackButton(), ), - body: Scrollbar( - controller: _controller, - child: list, - ), + body: Scrollbar(controller: _controller, child: list), ); } final bool dark = Theme.of(context).brightness == Brightness.dark; @@ -272,16 +265,8 @@ class _UserPreferencesPageState extends State : Brightness.light, contentBehindStatusBar: false, spaceBehindStatusBar: false, - appBar: SmoothAppBar( - title: Text( - appBarTitle, - maxLines: 2, - ), - ), - body: ListView( - controller: _controller, - children: children, - ), + appBar: SmoothAppBar(title: Text(appBarTitle, maxLines: 2)), + body: ListView(controller: _controller, children: children), ); } } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_prices.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_prices.dart index 80258632f8..e7e9ca89bc 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_prices.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_prices.dart @@ -48,14 +48,9 @@ class UserPreferencesPrices extends AbstractUserPreferences { return [ if (isConnected) _getListTile( - PriceUserButton.showUserTitle( - user: userId, - context: context, - ), - () async => PriceUserButton.showUserPrices( - user: userId, - context: context, - ), + PriceUserButton.showUserTitle(user: userId, context: context), + () async => + PriceUserButton.showUserPrices(user: userId, context: context), CupertinoIcons.money_dollar_circle, lazyCounter: LazyCounterPrices(userId), ), @@ -64,9 +59,8 @@ class UserPreferencesPrices extends AbstractUserPreferences { appLocalizations.user_search_proofs_title, () async => Navigator.of(context).push( MaterialPageRoute( - builder: (BuildContext context) => const PricesProofsPage( - selectProof: false, - ), + builder: (BuildContext context) => + const PricesProofsPage(selectProof: false), ), ), Icons.receipt, @@ -144,13 +138,12 @@ class UserPreferencesPrices extends AbstractUserPreferences { Icons.bar_chart, ), if (userPreferences.getFlag( - UserPreferencesDevMode.userPreferencesFlagBulkProofUpload) ?? + UserPreferencesDevMode.userPreferencesFlagBulkProofUpload, + ) ?? false) _getListTile( appLocalizations.prices_bulk_proof_upload_title, - () async => ProofBulkAddPage.showPage( - context: context, - ), + () async => ProofBulkAddPage.showPage(context: context), Icons.upload_file, ), _getListTile( @@ -184,7 +177,8 @@ class UserPreferencesPrices extends AbstractUserPreferences { _getListTile( appLocalizations.contribute_prices_gdpr, () async => LaunchUrlHelper.launchURL( - 'https://wiki.openfoodfacts.org/GDPR_request'), + 'https://wiki.openfoodfacts.org/GDPR_request', + ), Icons.open_in_new, ), ]; @@ -192,34 +186,28 @@ class UserPreferencesPrices extends AbstractUserPreferences { // we need the [AppNavigator] for a better back-gesture management. @override - Future runHeaderAction() async => AppNavigator.of(context).push( - AppRoutes.PREFERENCES(PreferencePageType.PRICES), - ); + Future runHeaderAction() async => AppNavigator.of( + context, + ).push(AppRoutes.PREFERENCES(PreferencePageType.PRICES)); UserPreferencesItem _getListTile( final String title, final VoidCallback onTap, final IconData leading, { final LazyCounter? lazyCounter, - }) => - UserPreferencesItemSimple( - labels: [title], - builder: (_) => Card( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15), - ), - elevation: 5, - color: Theme.of(context).cardColor, - child: UserPreferencesListTile( - title: Text(title), - onTap: onTap, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15), - ), - leading: UserPreferencesListTile.getTintedIcon(leading, context), - trailing: - lazyCounter == null ? null : LazyCounterWidget(lazyCounter), - ), - ), - ); + }) => UserPreferencesItemSimple( + labels: [title], + builder: (_) => Card( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), + elevation: 5, + color: Theme.of(context).cardColor, + child: UserPreferencesListTile( + title: Text(title), + onTap: onTap, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), + leading: UserPreferencesListTile.getTintedIcon(leading, context), + trailing: lazyCounter == null ? null : LazyCounterWidget(lazyCounter), + ), + ), + ); } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_search_page.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_search_page.dart index 82e908eb51..4615a1ef6e 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_search_page.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_search_page.dart @@ -24,9 +24,7 @@ class _UserPreferencesSearchPageState extends State { final UserPreferences userPreferences = context.watch(); final List items = _getItems(_controller.text, userPreferences); return Scaffold( - appBar: AppBar( - title: const Text('Preferences Search'), - ), + appBar: AppBar(title: const Text('Preferences Search')), body: SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.start, @@ -75,11 +73,11 @@ class _UserPreferencesSearchPageState extends State { final List types = PreferencePageType.getPreferencePageTypes(userPreferences); for (final PreferencePageType type in types) { - final AbstractUserPreferences abstractUserPreferences = - type.getUserPreferences( - userPreferences: userPreferences, - context: context, - ); + final AbstractUserPreferences abstractUserPreferences = type + .getUserPreferences( + userPreferences: userPreferences, + context: context, + ); // we find the label in the page description: we add all the page items. if (_findLabels(needle, abstractUserPreferences.getLabels())) { for (final UserPreferencesItem item diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart index 7c1c3a868a..365af45081 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart @@ -66,9 +66,7 @@ class UserPreferencesSettings extends AbstractUserPreferences { _getDivider(), UserPreferencesImageSource.getUserPreferencesItem(context), if (CameraHelper.hasACamera) - _getTitle( - label: appLocalizations.settings_app_camera, - ), + _getTitle(label: appLocalizations.settings_app_camera), if (CameraHelper.hasACamera) UserPreferencesItemSwitch( title: appLocalizations.camera_play_sound_title, @@ -77,9 +75,7 @@ class UserPreferencesSettings extends AbstractUserPreferences { onChanged: (final bool value) async => userPreferences.setPlayCameraSound(value), ), - _getTitle( - label: appLocalizations.settings_app_products, - ), + _getTitle(label: appLocalizations.settings_app_products), _getExpandPanel( title: appLocalizations.expand_nutrition_facts, subtitle: appLocalizations.expand_nutrition_facts_body, @@ -100,9 +96,7 @@ class UserPreferencesSettings extends AbstractUserPreferences { userPreferences.setSearchProductTypeFilter(visible), ), if (CameraHelper.hasACamera) - _getTitle( - label: appLocalizations.settings_app_miscellaneous, - ), + _getTitle(label: appLocalizations.settings_app_miscellaneous), if (CameraHelper.hasACamera) UserPreferencesItemSwitch( title: appLocalizations.app_haptic_feedback_title, @@ -137,38 +131,34 @@ class UserPreferencesSettings extends AbstractUserPreferences { UserPreferencesItem _getTitle({ required final String label, final bool addExtraPadding = true, - }) => - UserPreferencesItemSimple( - labels: [label], - builder: (_) => _UserPreferencesTitle( - label: label, - addExtraPadding: addExtraPadding, - ), - ); + }) => UserPreferencesItemSimple( + labels: [label], + builder: (_) => + _UserPreferencesTitle(label: label, addExtraPadding: addExtraPadding), + ); UserPreferencesItem _getDivider() => UserPreferencesItemSimple( - labels: [], - builder: (_) => const UserPreferencesListItemDivider(), - ); + labels: [], + builder: (_) => const UserPreferencesListItemDivider(), + ); UserPreferencesItem _getExpandPanel({ required String title, required String subtitle, required String panelId, - }) => - UserPreferencesItemSimple( - labels: [title, subtitle], - builder: (_) { - final String flagTag = KnowledgePanelCard.getExpandFlagTag(panelId); - return UserPreferencesSwitchWidget( - title: title, - subtitle: subtitle, - value: userPreferences.getFlag(flagTag) ?? false, - onChanged: (final bool value) async => - userPreferences.setFlag(flagTag, value), - ); - }, + }) => UserPreferencesItemSimple( + labels: [title, subtitle], + builder: (_) { + final String flagTag = KnowledgePanelCard.getExpandFlagTag(panelId); + return UserPreferencesSwitchWidget( + title: title, + subtitle: subtitle, + value: userPreferences.getFlag(flagTag) ?? false, + onChanged: (final bool value) async => + userPreferences.setFlag(flagTag, value), ); + }, + ); } class _UserPreferencesTitle extends StatelessWidget { @@ -182,19 +172,16 @@ class _UserPreferencesTitle extends StatelessWidget { @override Widget build(BuildContext context) => SizedBox( - width: double.infinity, - child: Padding( - padding: EdgeInsetsDirectional.only( - top: addExtraPadding ? LARGE_SPACE : LARGE_SPACE, - bottom: SMALL_SPACE, - // Horizontal = same as ListTile - start: LARGE_SPACE, - end: LARGE_SPACE, - ), - child: Text( - label, - style: Theme.of(context).textTheme.displayLarge, - ), - ), - ); + width: double.infinity, + child: Padding( + padding: EdgeInsetsDirectional.only( + top: addExtraPadding ? LARGE_SPACE : LARGE_SPACE, + bottom: SMALL_SPACE, + // Horizontal = same as ListTile + start: LARGE_SPACE, + end: LARGE_SPACE, + ), + child: Text(label, style: Theme.of(context).textTheme.displayLarge), + ), + ); } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_share_with_friends.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_share_with_friends.dart index b95a5d7472..82952385be 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_share_with_friends.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_share_with_friends.dart @@ -13,45 +13,37 @@ class UserPreferencesShareWithFriends extends StatelessWidget { ) { final AppLocalizations appLocalizations = AppLocalizations.of(context); return UserPreferencesItemSimple( - labels: [ - appLocalizations.contribute_share_header, - ], + labels: [appLocalizations.contribute_share_header], builder: (_) => const UserPreferencesShareWithFriends(), ); } @override Widget build(BuildContext context) => UserPreferenceListTile( - title: AppLocalizations.of(context).contribute_share_header, - leading: Icon( - key: const Key('settings.share_app'), - Icons.adaptive.share, - ), - showDivider: false, - onTap: (final BuildContext context) async { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); - final ThemeData themeData = Theme.of(context); - try { - await Share.share(appLocalizations.contribute_share_content); - } on PlatformException { - if (!context.mounted) { - return; - } - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text( - appLocalizations.error, - textAlign: TextAlign.center, - style: TextStyle( - color: themeData.colorScheme.surface, - ), - ), - behavior: SnackBarBehavior.floating, - backgroundColor: themeData.colorScheme.onSurface, - ), - ); - } - }, - ); + title: AppLocalizations.of(context).contribute_share_header, + leading: Icon(key: const Key('settings.share_app'), Icons.adaptive.share), + showDivider: false, + onTap: (final BuildContext context) async { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + final ThemeData themeData = Theme.of(context); + try { + await Share.share(appLocalizations.contribute_share_content); + } on PlatformException { + if (!context.mounted) { + return; + } + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + appLocalizations.error, + textAlign: TextAlign.center, + style: TextStyle(color: themeData.colorScheme.surface), + ), + behavior: SnackBarBehavior.floating, + backgroundColor: themeData.colorScheme.onSurface, + ), + ); + } + }, + ); } diff --git a/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart b/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart index cae613c73b..1a2ccfdaa3 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart @@ -11,28 +11,17 @@ import 'package:smooth_app/themes/theme_provider.dart'; /// A dashed line class UserPreferencesListItemDivider extends StatelessWidget { - const UserPreferencesListItemDivider({ - this.margin, - super.key, - }); + const UserPreferencesListItemDivider({this.margin, super.key}); final EdgeInsetsGeometry? margin; @override Widget build(BuildContext context) { return Padding( - padding: margin ?? - const EdgeInsets.symmetric( - horizontal: LARGE_SPACE, - ), + padding: margin ?? const EdgeInsets.symmetric(horizontal: LARGE_SPACE), child: CustomPaint( - size: const Size( - double.infinity, - 1.0, - ), - painter: DashedLinePainter( - color: Theme.of(context).dividerColor, - ), + size: const Size(double.infinity, 1.0), + painter: DashedLinePainter(color: Theme.of(context).dividerColor), ), ); } @@ -53,29 +42,24 @@ class UserPreferencesSwitchWidget extends StatelessWidget { @override Widget build(BuildContext context) => SwitchListTile.adaptive( - title: Padding( - padding: const EdgeInsetsDirectional.only( - top: SMALL_SPACE, - bottom: SMALL_SPACE, + title: Padding( + padding: const EdgeInsetsDirectional.only( + top: SMALL_SPACE, + bottom: SMALL_SPACE, + ), + child: Text(title, style: Theme.of(context).textTheme.headlineMedium), + ), + subtitle: subtitle == null + ? null + : Padding( + padding: const EdgeInsetsDirectional.only(bottom: SMALL_SPACE), + child: Text(subtitle!, style: const TextStyle(height: 1.5)), ), - child: Text(title, style: Theme.of(context).textTheme.headlineMedium), - ), - subtitle: subtitle == null - ? null - : Padding( - padding: const EdgeInsetsDirectional.only( - bottom: SMALL_SPACE, - ), - child: Text( - subtitle!, - style: const TextStyle(height: 1.5), - ), - ), - activeColor: Theme.of(context).primaryColor, - value: value, - onChanged: onChanged, - isThreeLine: subtitle != null, - ); + activeColor: Theme.of(context).primaryColor, + value: value, + onChanged: onChanged, + isThreeLine: subtitle != null, + ); } class UserPreferencesItemSwitch implements UserPreferencesItem { @@ -92,19 +76,16 @@ class UserPreferencesItemSwitch implements UserPreferencesItem { final ValueChanged onChanged; @override - List get labels => [ - title, - if (subtitle != null) subtitle!, - ]; + List get labels => [title, if (subtitle != null) subtitle!]; @override WidgetBuilder get builder => (final BuildContext context) => UserPreferencesSwitchWidget( - title: title, - subtitle: subtitle, - value: value, - onChanged: onChanged, - ); + title: title, + subtitle: subtitle, + value: value, + onChanged: onChanged, + ); } class UserPreferencesItemTile implements UserPreferencesItem { @@ -125,25 +106,22 @@ class UserPreferencesItemTile implements UserPreferencesItem { final bool Function(BuildContext context)? visibleWhen; @override - List get labels => [ - title, - if (subtitle != null) subtitle!, - ]; + List get labels => [title, if (subtitle != null) subtitle!]; @override WidgetBuilder get builder => (final BuildContext context) { - if (visibleWhen?.call(context) == false) { - return EMPTY_WIDGET; - } + if (visibleWhen?.call(context) == false) { + return EMPTY_WIDGET; + } - return ListTile( - title: Text(title), - subtitle: subtitle == null ? null : Text(subtitle!), - onTap: onTap, - leading: leading, - trailing: trailing, - ); - }; + return ListTile( + title: Text(title), + subtitle: subtitle == null ? null : Text(subtitle!), + onTap: onTap, + leading: leading, + trailing: trailing, + ); + }; } /// Same as [UserPreferencesItemTile] but with [WidgetBuilder]. @@ -166,7 +144,8 @@ class UserPreferencesItemTileBuilder implements UserPreferencesItem { List get labels => [title]; @override - WidgetBuilder get builder => (final BuildContext context) => ListTile( + WidgetBuilder get builder => + (final BuildContext context) => ListTile( title: Text(title), subtitle: subtitleBuilder.call(context), onTap: onTap, @@ -176,46 +155,45 @@ class UserPreferencesItemTileBuilder implements UserPreferencesItem { } class UserPreferencesItemSection implements UserPreferencesItem { - const UserPreferencesItemSection({ - required this.label, - this.icon, - }) : assert(label.length > 0); + const UserPreferencesItemSection({required this.label, this.icon}) + : assert(label.length > 0); final String label; final Widget? icon; @override WidgetBuilder get builder => (BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; - return Container( - color: colors.primaryDark, - padding: const EdgeInsets.symmetric( - horizontal: LARGE_SPACE, - vertical: SMALL_SPACE, - ), - child: Row( - children: [ - Expanded( - child: Text( - label, - style: TextStyle( - color: colors.primaryLight, - fontSize: 18, - fontWeight: FontWeight.bold, - ), - ), + return Container( + color: colors.primaryDark, + padding: const EdgeInsets.symmetric( + horizontal: LARGE_SPACE, + vertical: SMALL_SPACE, + ), + child: Row( + children: [ + Expanded( + child: Text( + label, + style: TextStyle( + color: colors.primaryLight, + fontSize: 18, + fontWeight: FontWeight.bold, ), - if (icon != null) - IconTheme( - data: IconThemeData(color: colors.primaryLight), - child: icon!, - ), - ], + ), ), - ); - }; + if (icon != null) + IconTheme( + data: IconThemeData(color: colors.primaryLight), + child: icon!, + ), + ], + ), + ); + }; @override Iterable get labels => [label]; @@ -241,10 +219,10 @@ class UserPreferencesMultipleChoicesItem extends StatelessWidget { this.descriptions, this.dialogHeight, super.key, - }) : assert(labels.length > 0), - assert(values.length == labels.length), - assert(descriptions == null || descriptions.length == labels.length), - assert(dialogHeight == null || dialogHeight > 0.0); + }) : assert(labels.length > 0), + assert(values.length == labels.length), + assert(descriptions == null || descriptions.length == labels.length), + assert(dialogHeight == null || dialogHeight > 0.0); final String title; final IconData? leading; @@ -267,10 +245,7 @@ class UserPreferencesMultipleChoicesItem extends StatelessWidget { top: SMALL_SPACE, bottom: SMALL_SPACE, ), - child: Text( - title, - style: theme.textTheme.headlineMedium, - ), + child: Text(title, style: theme.textTheme.headlineMedium), ), subtitle: Padding( padding: const EdgeInsetsDirectional.only( @@ -300,18 +275,20 @@ class UserPreferencesMultipleChoicesItem extends StatelessWidget { ), ), ), - const Icon(Icons.edit) + const Icon(Icons.edit), ], ), ), onTap: () async { - final double itemHeight = (descriptions != null ? 15.0 : 0.0) + + final double itemHeight = + (descriptions != null ? 15.0 : 0.0) + (5.0 * 2) + 1.0 + (56.0 + Theme.of(context).visualDensity.baseSizeAdjustment.dy); final MediaQueryData queryData = MediaQueryData.fromView( - WidgetsBinding.instance.platformDispatcher.implicitView!); + WidgetsBinding.instance.platformDispatcher.implicitView!, + ); // If there is not enough space, we use the scrolling sheet final T? res; @@ -323,31 +300,33 @@ class UserPreferencesMultipleChoicesItem extends StatelessWidget { if ((itemHeight * labels.length + header.computeHeight(context)) > (queryData.size.height * 0.9) - queryData.viewPadding.top) { res = await showSmoothDraggableModalSheet( - context: context, - header: header, - bodyBuilder: (BuildContext context) { - return SliverList( - delegate: SliverChildBuilderDelegate( - childCount: labels.length, - (BuildContext context, int position) { - final bool selected = - currentValue == values.elementAt(position); + context: context, + header: header, + bodyBuilder: (BuildContext context) { + return SliverList( + delegate: SliverChildBuilderDelegate( + childCount: labels.length, + (BuildContext context, int position) { + final bool selected = + currentValue == values.elementAt(position); - return _ChoiceItem( - selected: selected, - label: labels.elementAt(position), - value: values.elementAt(position), - description: descriptions?.elementAt(position), - leading: leadingBuilder != null - ? Builder( - builder: leadingBuilder!.elementAt(position)) - : null, - hasDivider: position < labels.length - 1, - ); - }, - ), - ); - }); + return _ChoiceItem( + selected: selected, + label: labels.elementAt(position), + value: values.elementAt(position), + description: descriptions?.elementAt(position), + leading: leadingBuilder != null + ? Builder( + builder: leadingBuilder!.elementAt(position), + ) + : null, + hasDivider: position < labels.length - 1, + ); + }, + ), + ); + }, + ); } else { final SmoothModalSheet smoothModalSheet = SmoothModalSheet( title: title, @@ -380,7 +359,8 @@ class UserPreferencesMultipleChoicesItem extends StatelessWidget { res = await showSmoothModalSheet( context: context, - minHeight: smoothModalSheet.computeHeaderHeight(context) + + minHeight: + smoothModalSheet.computeHeaderHeight(context) + itemHeight * labels.length, builder: (BuildContext context) { return smoothModalSheet; @@ -426,15 +406,15 @@ class _ChoiceItem extends StatelessWidget { @override Widget build(BuildContext context) { final ThemeData theme = Theme.of(context); - final SmoothColorsThemeExtension extension = - theme.extension()!; + final SmoothColorsThemeExtension extension = theme + .extension()!; final bool lightTheme = context.lightTheme(); final Color backgroundColor = selected ? (lightTheme ? extension.primaryMedium : extension.primaryTone) : context.lightTheme() - ? Colors.transparent - : extension.primaryUltraBlack; + ? Colors.transparent + : extension.primaryUltraBlack; return Semantics( value: label, @@ -497,15 +477,9 @@ class UserPreferenceListTile extends StatelessWidget { padding: const EdgeInsets.all(VERY_SMALL_SPACE), child: leading, ), - title: Text( - title, - style: textTheme.headlineMedium, - ), + title: Text(title, style: textTheme.headlineMedium), subtitle: subTitle != null - ? Text( - subTitle!, - style: textTheme.bodyMedium, - ) + ? Text(subTitle!, style: textTheme.bodyMedium) : null, onTap: () => onTap(context), contentPadding: const EdgeInsetsDirectional.symmetric( @@ -528,8 +502,8 @@ class UserPreferencesEditableItemTile extends UserPreferencesItemTile { this.validator, this.hint, this.value, - }) : assert(dialogAction.length > 0), - super(subtitle: dialogAction); + }) : assert(dialogAction.length > 0), + super(subtitle: dialogAction); final String? value; final String? hint; @@ -539,18 +513,19 @@ class UserPreferencesEditableItemTile extends UserPreferencesItemTile { @override WidgetBuilder get builder => (BuildContext context) { - return ListTile( - title: Text(title), - subtitle: Text(value?.isNotEmpty == true - ? value! - : (subtitleWithEmptyValue ?? '-')), - onTap: () async => _showInputTextDialog(context), - ); - }; + return ListTile( + title: Text(title), + subtitle: Text( + value?.isNotEmpty == true ? value! : (subtitleWithEmptyValue ?? '-'), + ), + onTap: () async => _showInputTextDialog(context), + ); + }; Future _showInputTextDialog(BuildContext context) async { - final TextEditingController controller = - TextEditingController(text: value ?? ''); + final TextEditingController controller = TextEditingController( + text: value ?? '', + ); final dynamic res = await showDialog( context: context, @@ -563,25 +538,25 @@ class UserPreferencesEditableItemTile extends UserPreferencesItemTile { child: Consumer( builder: (BuildContext context, TextEditingController controller, _) { - return SmoothAlertDialog( - title: title, - close: true, - body: _UserPreferencesEditableDialogContent( - title: subtitle!, - hint: hint, - ), - positiveAction: SmoothActionButton( - text: appLocalizations.okay, - onPressed: validator?.call(controller.text) != false - ? () => Navigator.of(context).pop(controller.text) - : null, - ), - negativeAction: SmoothActionButton( - text: appLocalizations.cancel, - onPressed: () => Navigator.of(context).pop(), - ), - ); - }, + return SmoothAlertDialog( + title: title, + close: true, + body: _UserPreferencesEditableDialogContent( + title: subtitle!, + hint: hint, + ), + positiveAction: SmoothActionButton( + text: appLocalizations.okay, + onPressed: validator?.call(controller.text) != false + ? () => Navigator.of(context).pop(controller.text) + : null, + ), + negativeAction: SmoothActionButton( + text: appLocalizations.cancel, + onPressed: () => Navigator.of(context).pop(), + ), + ); + }, ), ); }, @@ -594,10 +569,7 @@ class UserPreferencesEditableItemTile extends UserPreferencesItemTile { } class _UserPreferencesEditableDialogContent extends StatefulWidget { - const _UserPreferencesEditableDialogContent({ - required this.title, - this.hint, - }); + const _UserPreferencesEditableDialogContent({required this.title, this.hint}); final String title; final String? hint; diff --git a/packages/smooth_app/lib/pages/prices/currency_extension.dart b/packages/smooth_app/lib/pages/prices/currency_extension.dart index 07e76c3ca9..f2d2a2c1cb 100644 --- a/packages/smooth_app/lib/pages/prices/currency_extension.dart +++ b/packages/smooth_app/lib/pages/prices/currency_extension.dart @@ -14,7 +14,7 @@ extension CurrencyExtension on Currency { return '$name ($symbol)'; } -// source: https://www.xe.com/symbols/ + // source: https://www.xe.com/symbols/ static final Map _symbols = { Currency.ALL: 'Lek', Currency.AFN: String.fromCharCode(1547), diff --git a/packages/smooth_app/lib/pages/prices/eraser_model.dart b/packages/smooth_app/lib/pages/prices/eraser_model.dart index 22ecfcac1d..5d5a1f5115 100644 --- a/packages/smooth_app/lib/pages/prices/eraser_model.dart +++ b/packages/smooth_app/lib/pages/prices/eraser_model.dart @@ -4,10 +4,8 @@ import 'package:smooth_app/pages/crop_helper.dart'; /// Model about the eraser tool: coordinate computations. class EraserModel { - EraserModel({ - this.rotation = CropRotation.up, - final List? offsets, - }) : offsets = offsets ?? []; + EraserModel({this.rotation = CropRotation.up, final List? offsets}) + : offsets = offsets ?? []; CropRotation rotation; @@ -49,43 +47,43 @@ class EraserModel { final Rect rect = cropRect ?? CropHelper.fullImageCropRect; return switch (rotation) { CropRotation.down => Offset( - (1 - offset.dx - rect.left) / rect.width * _imageWidth, - (1 - offset.dy - rect.top) / rect.height * _imageHeight, - ), + (1 - offset.dx - rect.left) / rect.width * _imageWidth, + (1 - offset.dy - rect.top) / rect.height * _imageHeight, + ), CropRotation.left => Offset( - (offset.dy - rect.left) / rect.width * _imageWidth, - (1 - offset.dx - rect.top) / rect.height * _imageHeight, - ), + (offset.dy - rect.left) / rect.width * _imageWidth, + (1 - offset.dx - rect.top) / rect.height * _imageHeight, + ), CropRotation.right => Offset( - (1 - offset.dy - rect.left) / rect.width * _imageWidth, - (offset.dx - rect.top) / rect.height * _imageHeight, - ), + (1 - offset.dy - rect.left) / rect.width * _imageWidth, + (offset.dx - rect.top) / rect.height * _imageHeight, + ), CropRotation.up => Offset( - (offset.dx - rect.left) / rect.width * _imageWidth, - (offset.dy - rect.top) / rect.height * _imageHeight, - ), + (offset.dx - rect.left) / rect.width * _imageWidth, + (offset.dy - rect.top) / rect.height * _imageHeight, + ), }; } // From screen offset to full image [0,1] offset Offset _toPct(final Offset offset) => switch (rotation) { - CropRotation.down => Offset( - (_imageWidth - (offset.dx - _deltaX)) / _imageWidth, - (_imageHeight - (offset.dy - _deltaY)) / _imageHeight, - ), - CropRotation.left => Offset( - (_imageHeight - (offset.dy - _deltaY)) / _imageHeight, - (0 + (offset.dx - _deltaX)) / _imageWidth, - ), - CropRotation.right => Offset( - (offset.dy - _deltaY) / _imageHeight, - (_imageWidth - (offset.dx - _deltaX)) / _imageWidth, - ), - _ => Offset( - (offset.dx - _deltaX) / _imageWidth, - (offset.dy - _deltaY) / _imageHeight, - ), - }; + CropRotation.down => Offset( + (_imageWidth - (offset.dx - _deltaX)) / _imageWidth, + (_imageHeight - (offset.dy - _deltaY)) / _imageHeight, + ), + CropRotation.left => Offset( + (_imageHeight - (offset.dy - _deltaY)) / _imageHeight, + (0 + (offset.dx - _deltaX)) / _imageWidth, + ), + CropRotation.right => Offset( + (offset.dy - _deltaY) / _imageHeight, + (_imageWidth - (offset.dx - _deltaX)) / _imageWidth, + ), + _ => Offset( + (offset.dx - _deltaX) / _imageWidth, + (offset.dy - _deltaY) / _imageHeight, + ), + }; Offset getStart(final int index) => _fromPct(offsets[2 * index]); @@ -97,18 +95,12 @@ class EraserModel { Offset? getCurrentEnd() => _latestUpdate == null ? null : _fromPct(_latestUpdate!); - void panStart( - final Offset offset, - final BoxConstraints constraints, - ) { + void panStart(final Offset offset, final BoxConstraints constraints) { _boxConstraints = constraints; _latestStart = _latestUpdate = _toPct(offset); } - void panUpdate( - final Offset offset, - final BoxConstraints constraints, - ) { + void panUpdate(final Offset offset, final BoxConstraints constraints) { _boxConstraints = constraints; _latestUpdate = _toPct(offset); } diff --git a/packages/smooth_app/lib/pages/prices/eraser_painter.dart b/packages/smooth_app/lib/pages/prices/eraser_painter.dart index 86e2715fb1..8eecb1cdcb 100644 --- a/packages/smooth_app/lib/pages/prices/eraser_painter.dart +++ b/packages/smooth_app/lib/pages/prices/eraser_painter.dart @@ -5,10 +5,7 @@ import 'package:smooth_app/pages/prices/eraser_model.dart'; /// Painter of the eraser tool: displaying thick lines. class EraserPainter extends CustomPainter { - EraserPainter({ - required this.eraserModel, - this.cropRect, - }); + EraserPainter({required this.eraserModel, this.cropRect}); final EraserModel eraserModel; final Rect? cropRect; @@ -38,7 +35,8 @@ class EraserPainter extends CustomPainter { if (cropRect == null) { _paint.strokeWidth = _strokeWidthFactor * sqrt(size.width * size.height); } else { - _paint.strokeWidth = _strokeWidthFactor * + _paint.strokeWidth = + _strokeWidthFactor * sqrt(size.width * size.height / cropRect!.width / cropRect!.height); } diff --git a/packages/smooth_app/lib/pages/prices/get_prices_model.dart b/packages/smooth_app/lib/pages/prices/get_prices_model.dart index 06476e90f0..addf3aeeae 100644 --- a/packages/smooth_app/lib/pages/prices/get_prices_model.dart +++ b/packages/smooth_app/lib/pages/prices/get_prices_model.dart @@ -25,24 +25,22 @@ class GetPricesModel { factory GetPricesModel.product({ required final PriceMetaProduct product, required final BuildContext context, - }) => - GetPricesModel( - parameters: getStandardPricesParameters() - ..productCode = product.barcode, - displayEachProduct: false, - uri: OpenPricesAPIClient.getUri( - path: 'products/${product.barcode}', - uriHelper: ProductQuery.uriPricesHelper, - ), - title: product.getName(AppLocalizations.of(context)), - subtitle: product.barcode, - addButton: () async => ProductPriceAddPage.showProductPage( - context: context, - product: product, - proofType: ProofType.priceTag, - ), - enableCountButton: false, - ); + }) => GetPricesModel( + parameters: getStandardPricesParameters()..productCode = product.barcode, + displayEachProduct: false, + uri: OpenPricesAPIClient.getUri( + path: 'products/${product.barcode}', + uriHelper: ProductQuery.uriPricesHelper, + ), + title: product.getName(AppLocalizations.of(context)), + subtitle: product.barcode, + addButton: () async => ProductPriceAddPage.showProductPage( + context: context, + product: product, + proofType: ProofType.priceTag, + ), + enableCountButton: false, + ); static GetPricesParameters getStandardPricesParameters() => GetPricesParameters() diff --git a/packages/smooth_app/lib/pages/prices/infinite_scroll_list.dart b/packages/smooth_app/lib/pages/prices/infinite_scroll_list.dart index 9052027233..604e050a2d 100644 --- a/packages/smooth_app/lib/pages/prices/infinite_scroll_list.dart +++ b/packages/smooth_app/lib/pages/prices/infinite_scroll_list.dart @@ -9,9 +9,7 @@ import 'package:smooth_app/pages/prices/infinite_scroll_manager.dart'; /// A generic stateful widget for infinite scrolling lists that works with InfiniteScrollManager. class InfiniteScrollList extends StatefulWidget { - const InfiniteScrollList({ - required this.manager, - }); + const InfiniteScrollList({required this.manager}); /// Manager for handling the infinite scroll behavior final InfiniteScrollManager manager; @@ -85,9 +83,7 @@ class _InfiniteScrollListState extends State> { } setState(() {}); ScaffoldMessenger.of(context).showSnackBar( - SmoothFloatingSnackbar( - content: Text(_getItemCount(context)), - ), + SmoothFloatingSnackbar(content: Text(_getItemCount(context))), ); } @@ -117,13 +113,8 @@ class _InfiniteScrollListState extends State> { return const SizedBox(height: MINIMUM_TOUCH_SIZE * 2); } - Widget _buildHeader(BuildContext context) => SmoothCard( - child: ListTile( - title: Text( - _getItemCount(context), - ), - ), - ); + Widget _buildHeader(BuildContext context) => + SmoothCard(child: ListTile(title: Text(_getItemCount(context)))); @override Widget build(BuildContext context) { @@ -144,10 +135,7 @@ class _InfiniteScrollListState extends State> { children.add(_buildHeader(context)); for (final T item in widget.manager.items) { - children.add(widget.manager.getItemWidget( - context: context, - item: item, - )); + children.add(widget.manager.getItemWidget(context: context, item: item)); } if (widget.manager.isLoading) { @@ -156,9 +144,6 @@ class _InfiniteScrollListState extends State> { children.add(_buildFooter(context)); - return ListView( - controller: _scrollController, - children: children, - ); + return ListView(controller: _scrollController, children: children); } } diff --git a/packages/smooth_app/lib/pages/prices/infinite_scroll_manager.dart b/packages/smooth_app/lib/pages/prices/infinite_scroll_manager.dart index f2649d4ad4..96d96d7883 100644 --- a/packages/smooth_app/lib/pages/prices/infinite_scroll_manager.dart +++ b/packages/smooth_app/lib/pages/prices/infinite_scroll_manager.dart @@ -5,11 +5,11 @@ import 'package:smooth_app/l10n/app_localizations.dart'; /// [T] is the type of items being displayed. abstract class InfiniteScrollManager { /// Creates an instance of [InfiniteScrollManager] with optional initial items. - InfiniteScrollManager({ - List? initialItems, - }) : _items = initialItems ?? [], - _currentPage = - initialItems != null && initialItems.isNotEmpty ? _initialPage : 0; + InfiniteScrollManager({List? initialItems}) + : _items = initialItems ?? [], + _currentPage = initialItems != null && initialItems.isNotEmpty + ? _initialPage + : 0; static const int _initialPage = 1; @@ -50,10 +50,7 @@ abstract class InfiniteScrollManager { /// Displays an item. @protected - Widget buildItem({ - required BuildContext context, - required T item, - }); + Widget buildItem({required BuildContext context, required T item}); Widget getItemWidget({required BuildContext context, required T item}) { return buildItem(context: context, item: item); diff --git a/packages/smooth_app/lib/pages/prices/price_add_helper.dart b/packages/smooth_app/lib/pages/prices/price_add_helper.dart index 80ed26412e..95f95f8449 100644 --- a/packages/smooth_app/lib/pages/prices/price_add_helper.dart +++ b/packages/smooth_app/lib/pages/prices/price_add_helper.dart @@ -87,23 +87,26 @@ class PriceAddHelper { if (location.countryCode == null) { return; } - final Currency? newCurrency = - OpenFoodFactsCountry.fromOffTag(location.countryCode)?.currency; + final Currency? newCurrency = OpenFoodFactsCountry.fromOffTag( + location.countryCode, + )?.currency; if (newCurrency != null && model.currency != newCurrency) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final Currency? currency = await showSmoothAlertModalSheet( context: context, title: appLocalizations.prices_currency_change_proposal_title, message: TextWithBoldParts( text: appLocalizations.prices_currency_change_proposal_message( - model.currency.name, newCurrency.name), - textStyle: Theme.of(context).textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.w500, - ), + model.currency.name, + newCurrency.name, + ), + textStyle: Theme.of( + context, + ).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w500), ), actionLabels: [ appLocalizations.prices_currency_change_proposal_action_approve( @@ -129,8 +132,8 @@ class PriceAddHelper { Future doesAcceptWarning({required final bool justInfo}) async { final AppLocalizations appLocalizations = AppLocalizations.of(context); const Color color = Color(0xFFB81D1D); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return showSmoothListOfChoicesModalSheet( safeArea: true, context: context, @@ -145,9 +148,9 @@ class PriceAddHelper { children: [ TextWithBoldParts( text: appLocalizations.prices_privacy_warning_main_message, - textStyle: Theme.of(context).textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.w600, - ), + textStyle: Theme.of( + context, + ).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600), ), _buildBulletPoint( appLocalizations.prices_privacy_warning_message_bullet_1, @@ -161,21 +164,15 @@ class PriceAddHelper { const SizedBox(height: MEDIUM_SPACE), Text( appLocalizations.prices_privacy_warning_sub_message, - style: Theme.of(context).textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.w600, - ), + style: Theme.of( + context, + ).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600), ), ], ), ), - labels: [ - appLocalizations.i_accept, - appLocalizations.i_refuse, - ], - values: [ - true, - false, - ], + labels: [appLocalizations.i_accept, appLocalizations.i_refuse], + values: [true, false], prefixIcons: [ Icon(Icons.check_circle_rounded, color: extension.success), Icon(Icons.cancel_rounded, color: extension.error), @@ -187,8 +184,8 @@ class PriceAddHelper { Widget _buildBulletPoint(String text, BuildContext context) { const double defaultIconSize = 7.0; const double radius = 10.0; - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -205,9 +202,9 @@ class PriceAddHelper { Expanded( child: Text( text, - style: Theme.of(context).textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.w600, - ), + style: Theme.of( + context, + ).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600), ), ), ], diff --git a/packages/smooth_app/lib/pages/prices/price_add_product_card.dart b/packages/smooth_app/lib/pages/prices/price_add_product_card.dart index aba76af87e..1519002672 100644 --- a/packages/smooth_app/lib/pages/prices/price_add_product_card.dart +++ b/packages/smooth_app/lib/pages/prices/price_add_product_card.dart @@ -56,14 +56,15 @@ class _PriceAddProductCardState extends State { text: appLocalizations.prices_barcode_reader_action, leadingIcon: const Icon(Icons.barcode_reader), onPressed: () async { - final UserPreferences userPreferences = - context.read(); - final List? barcodes = - await Navigator.of(context).push>( + final UserPreferences userPreferences = context + .read(); + final List? + barcodes = await Navigator.of(context).push>( MaterialPageRoute>( builder: (BuildContext context) => PriceScanPage( latestScannedBarcode: _latestScannedBarcode, - isMultiProducts: userPreferences.getFlag( + isMultiProducts: + userPreferences.getFlag( UserPreferencesDevMode .userPreferencesFlagPricesReceiptMultiSelection, ) ?? @@ -102,12 +103,12 @@ class _PriceAddProductCardState extends State { onPressed: () async { final PriceMetaProduct? priceMetaProduct = await Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => - const PriceCategoryInputPage(), - ), - ); + context, + MaterialPageRoute( + builder: (BuildContext context) => + const PriceCategoryInputPage(), + ), + ); if (priceMetaProduct == null) { return; } @@ -164,11 +165,7 @@ class _PriceAddProductCardState extends State { for (final String barcode in notThere) { _addProductToList( priceModel, - PriceMetaProduct.unknown( - barcode, - localDatabase, - priceModel, - ), + PriceMetaProduct.unknown(barcode, localDatabase, priceModel), context, ); } @@ -200,11 +197,7 @@ class _PriceAddProductCardState extends State { context, listen: false, ); - _addProductToList( - priceModel, - priceMetaProduct, - context, - ); + _addProductToList(priceModel, priceMetaProduct, context); priceModel.notifyListeners(); } @@ -228,38 +221,38 @@ class _PriceAddProductCardState extends State { return showDialog( context: context, builder: (final BuildContext context) => StatefulBuilder( - builder: ( - final BuildContext context, - void Function(VoidCallback fn) setState, - ) => - SmoothAlertDialog( - title: appLocalizations.prices_add_an_item, - body: SmoothTextFormField( - autofocus: true, - type: TextFieldTypes.PLAIN_TEXT, - controller: controller, - hintText: appLocalizations.barcode, - textInputType: _textInputType, - onChanged: (_) { - final String barcode = controller.text; - final String cleanBarcode = _getCleanBarcode(barcode); - setState(() => controller.text = cleanBarcode); - }, - onFieldSubmitted: (_) => !_isValidBarcode(controller.text) - ? null - : Navigator.of(context).pop(controller.text), - ), - positiveAction: SmoothActionButton( - text: appLocalizations.validate, - onPressed: !_isValidBarcode(controller.text) - ? null - : () => Navigator.of(context).pop(controller.text), - ), - negativeAction: SmoothActionButton( - text: appLocalizations.cancel, - onPressed: () => Navigator.of(context).pop(), - ), - ), + builder: + ( + final BuildContext context, + void Function(VoidCallback fn) setState, + ) => SmoothAlertDialog( + title: appLocalizations.prices_add_an_item, + body: SmoothTextFormField( + autofocus: true, + type: TextFieldTypes.PLAIN_TEXT, + controller: controller, + hintText: appLocalizations.barcode, + textInputType: _textInputType, + onChanged: (_) { + final String barcode = controller.text; + final String cleanBarcode = _getCleanBarcode(barcode); + setState(() => controller.text = cleanBarcode); + }, + onFieldSubmitted: (_) => !_isValidBarcode(controller.text) + ? null + : Navigator.of(context).pop(controller.text), + ), + positiveAction: SmoothActionButton( + text: appLocalizations.validate, + onPressed: !_isValidBarcode(controller.text) + ? null + : () => Navigator.of(context).pop(controller.text), + ), + negativeAction: SmoothActionButton( + text: appLocalizations.cancel, + onPressed: () => Navigator.of(context).pop(), + ), + ), ), ); } diff --git a/packages/smooth_app/lib/pages/prices/price_amount_card.dart b/packages/smooth_app/lib/pages/prices/price_amount_card.dart index 41c3a15fff..0b513aedc3 100644 --- a/packages/smooth_app/lib/pages/prices/price_amount_card.dart +++ b/packages/smooth_app/lib/pages/prices/price_amount_card.dart @@ -13,10 +13,7 @@ import 'package:smooth_app/widgets/smooth_dropdown.dart'; /// Card that displays the amounts (discounted or not) for price adding. class PriceAmountCard extends StatefulWidget { - const PriceAmountCard({ - required this.index, - required super.key, - }); + const PriceAmountCard({required this.index, required super.key}); final int index; @@ -36,8 +33,9 @@ class _PriceAmountCardState extends State { listen: false, ).elementAt(widget.index); _controllerPaid = TextEditingController(text: model.paidPrice); - _controllerWithoutDiscount = - TextEditingController(text: model.priceWithoutDiscount); + _controllerWithoutDiscount = TextEditingController( + text: model.priceWithoutDiscount, + ); } @override @@ -55,7 +53,8 @@ class _PriceAmountCardState extends State { final int total = priceModel.length; return SmoothCardWithRoundedHeader( - title: '${appLocalizations.prices_amount_subtitle}' + title: + '${appLocalizations.prices_amount_subtitle}' '${total == 1 ? '' : ' (${widget.index + 1}/$total)'}', leading: const Icon(Icons.calculate_rounded), contentPadding: const EdgeInsetsDirectional.symmetric( @@ -96,9 +95,8 @@ class _PriceAmountCardState extends State { ), SwitchListTile( value: model.promo, - onChanged: (final bool value) => setState( - () => model.promo = !model.promo, - ), + onChanged: (final bool value) => + setState(() => model.promo = !model.promo), title: Text(appLocalizations.prices_amount_is_discounted), controlAffinity: ListTileControlAffinity.leading, ), diff --git a/packages/smooth_app/lib/pages/prices/price_amount_field.dart b/packages/smooth_app/lib/pages/prices/price_amount_field.dart index 842a0c7b93..871da0b908 100644 --- a/packages/smooth_app/lib/pages/prices/price_amount_field.dart +++ b/packages/smooth_app/lib/pages/prices/price_amount_field.dart @@ -17,10 +17,7 @@ class PriceAmountField extends StatelessWidget { // TODO(monsieurtanuki): TextInputAction + focus static const TextInputType _priceTextInputType = - TextInputType.numberWithOptions( - signed: false, - decimal: true, - ); + TextInputType.numberWithOptions(signed: false, decimal: true); @override Widget build(BuildContext context) { @@ -31,8 +28,8 @@ class PriceAmountField extends StatelessWidget { hintText: !isPaidPrice ? appLocalizations.prices_amount_price_not_discounted : model.promo - ? appLocalizations.prices_amount_price_discounted - : appLocalizations.prices_amount_price_normal, + ? appLocalizations.prices_amount_price_discounted + : appLocalizations.prices_amount_price_normal, textInputType: _priceTextInputType, onChanged: (final String? value) { if (isPaidPrice) { diff --git a/packages/smooth_app/lib/pages/prices/price_amount_model.dart b/packages/smooth_app/lib/pages/prices/price_amount_model.dart index 6bf9527bfe..07c0e8da3e 100644 --- a/packages/smooth_app/lib/pages/prices/price_amount_model.dart +++ b/packages/smooth_app/lib/pages/prices/price_amount_model.dart @@ -4,9 +4,7 @@ import 'package:smooth_app/pages/prices/price_meta_product.dart'; /// Model for the price of a single product. class PriceAmountModel { - PriceAmountModel({ - required this.product, - }); + PriceAmountModel({required this.product}); final PriceMetaProduct product; diff --git a/packages/smooth_app/lib/pages/prices/price_bulk_proof_card.dart b/packages/smooth_app/lib/pages/prices/price_bulk_proof_card.dart index 660b199898..cf27b6ad25 100644 --- a/packages/smooth_app/lib/pages/prices/price_bulk_proof_card.dart +++ b/packages/smooth_app/lib/pages/prices/price_bulk_proof_card.dart @@ -45,9 +45,7 @@ class _PriceBulkProofCardState extends State { children: [ ListTile( trailing: const Icon(Icons.warning), - title: Text( - appLocalizations.prices_bulk_proof_upload_warning, - ), + title: Text(appLocalizations.prices_bulk_proof_upload_warning), ), SmoothLargeButtonWithIcon( text: appLocalizations.prices_bulk_proof_upload_select, @@ -62,9 +60,7 @@ class _PriceBulkProofCardState extends State { ); } - Future _selectAndUpload({ - required PriceModel model, - }) async { + Future _selectAndUpload({required PriceModel model}) async { final PriceAddHelper priceAddHelper = PriceAddHelper(context); final LocalDatabase localDatabase = context.read(); const int imageQuality = 80; @@ -106,9 +102,7 @@ class _PriceBulkProofCardState extends State { final File toBeUploadedFile = File( '${directory.path}/bulk_proof_${sequenceNumber}_$filename', ); - setState( - () => _text = 'Locally copying file #$index/$count', - ); + setState(() => _text = 'Locally copying file #$index/$count'); await temporaryFile.copy(toBeUploadedFile.path); await temporaryFile.delete(); diff --git a/packages/smooth_app/lib/pages/prices/price_button.dart b/packages/smooth_app/lib/pages/prices/price_button.dart index 85e9e6c36c..7e7a8540b9 100644 --- a/packages/smooth_app/lib/pages/prices/price_button.dart +++ b/packages/smooth_app/lib/pages/prices/price_button.dart @@ -61,10 +61,7 @@ class PriceButton extends StatelessWidget { value: tooltip, button: true, excludeSemantics: true, - child: Tooltip( - message: tooltip, - child: widget, - ), + child: Tooltip(message: tooltip, child: widget), ); } return widget; diff --git a/packages/smooth_app/lib/pages/prices/price_category_input_page.dart b/packages/smooth_app/lib/pages/prices/price_category_input_page.dart index f82a9da867..407f7350f6 100644 --- a/packages/smooth_app/lib/pages/prices/price_category_input_page.dart +++ b/packages/smooth_app/lib/pages/prices/price_category_input_page.dart @@ -63,9 +63,7 @@ class _PriceCategoryInputPageState extends State { onWillPop: () async => _mayExitPage(saving: false), child: SmoothScaffold( fixKeyboard: true, - appBar: AppBar( - title: Text(appLocalizations.prices_category_enter), - ), + appBar: AppBar(title: Text(appLocalizations.prices_category_enter)), body: Padding( padding: const EdgeInsets.all(SMALL_SPACE), child: Column( @@ -77,9 +75,8 @@ class _PriceCategoryInputPageState extends State { _MyAutocomplete( helper: SimpleInputPageCategoryHelper(), controller: _categoryController, - onSelected: (final String selected) => setState( - () => _categoryName = selected, - ), + onSelected: (final String selected) => + setState(() => _categoryName = selected), ) else _ReadOnlyTextField(_categoryName!), @@ -89,12 +86,10 @@ class _PriceCategoryInputPageState extends State { _MyAutocomplete( helper: SimpleInputPageOriginHelper(), controller: _originController, - onSelected: (final String selected) => setState( - () { - _originController.text = ''; - _originNames.add(selected); - }, - ), + onSelected: (final String selected) => setState(() { + _originController.text = ''; + _originNames.add(selected); + }), ), ], ), @@ -105,8 +100,9 @@ class _PriceCategoryInputPageState extends State { onPressed: _categoryName == null ? null : () async { - final (bool, PriceMetaProduct?) result = - await _mayExitPage(saving: true); + final (bool, PriceMetaProduct?) result = await _mayExitPage( + saving: true, + ); if (result.$1) { if (context.mounted) { Navigator.of(context).pop(result.$2); @@ -134,11 +130,11 @@ class _PriceCategoryInputPageState extends State { } if (!saving) { - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog( - context, - title: appLocalizations.prices_category_enter, - ); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog( + context, + title: appLocalizations.prices_category_enter, + ); if (pleaseSave == null) { return (false, null); } @@ -202,37 +198,33 @@ class _MyAutocompleteState extends State<_MyAutocomplete> { @override Widget build(BuildContext context) => LayoutBuilder( - builder: ( - _, - BoxConstraints constraints, - ) => - SmoothAutocompleteTextField( - autocompleteKey: _autocompleteKey, - focusNode: _focusNode, - constraints: constraints, - onSelected: widget.onSelected, - manager: AutocompleteManager( - TagTypeAutocompleter( - tagType: widget.helper.getTagType()!, - language: ProductQuery.getLanguage(), - country: ProductQuery.getCountry(), - categories: null, - shape: null, - user: ProductQuery.getReadUser(), - limit: 15, - uriHelper: ProductQuery.getUriProductHelper( - productType: ProductType.food, - ), - ), + builder: (_, BoxConstraints constraints) => SmoothAutocompleteTextField( + autocompleteKey: _autocompleteKey, + focusNode: _focusNode, + constraints: constraints, + onSelected: widget.onSelected, + manager: AutocompleteManager( + TagTypeAutocompleter( + tagType: widget.helper.getTagType()!, + language: ProductQuery.getLanguage(), + country: ProductQuery.getCountry(), + categories: null, + shape: null, + user: ProductQuery.getReadUser(), + limit: 15, + uriHelper: ProductQuery.getUriProductHelper( + productType: ProductType.food, ), - textCapitalization: widget.helper.getTextCapitalization(), - allowEmojis: widget.helper.getAllowEmojis(), - hintText: widget.helper.getAddHint(AppLocalizations.of(context)), - controller: widget.controller, - padding: _fieldPadding, - borderRadius: _borderRadius, ), - ); + ), + textCapitalization: widget.helper.getTextCapitalization(), + allowEmojis: widget.helper.getAllowEmojis(), + hintText: widget.helper.getAddHint(AppLocalizations.of(context)), + controller: widget.controller, + padding: _fieldPadding, + borderRadius: _borderRadius, + ), + ); } class _ReadOnlyTextField extends StatefulWidget { @@ -269,15 +261,10 @@ class _ReadOnlyTextFieldState extends State<_ReadOnlyTextField> { contentPadding: _fieldPadding, isDense: true, filled: true, - border: OutlineInputBorder( - borderRadius: _borderRadius, - ), + border: OutlineInputBorder(borderRadius: _borderRadius), enabledBorder: OutlineInputBorder( borderRadius: _borderRadius, - borderSide: BorderSide( - color: Colors.transparent, - width: 5.0, - ), + borderSide: BorderSide(color: Colors.transparent, width: 5.0), ), ), ); diff --git a/packages/smooth_app/lib/pages/prices/price_count_widget.dart b/packages/smooth_app/lib/pages/prices/price_count_widget.dart index 6817a2ab97..ddf93c8e3c 100644 --- a/packages/smooth_app/lib/pages/prices/price_count_widget.dart +++ b/packages/smooth_app/lib/pages/prices/price_count_widget.dart @@ -4,43 +4,38 @@ import 'package:smooth_app/pages/prices/price_button.dart'; /// Price Count display. class PriceCountWidget extends StatelessWidget { - const PriceCountWidget({ - required this.count, - required this.onPressed, - }); + const PriceCountWidget({required this.count, required this.onPressed}); final int count; final VoidCallback? onPressed; @override Widget build(BuildContext context) => PriceButton( - onPressed: onPressed, - iconData: PriceButton.priceIconData, - title: '$count', - buttonStyle: ElevatedButton.styleFrom( - disabledForegroundColor: - onPressed != null ? null : _getForegroundColor(count), - disabledBackgroundColor: - onPressed != null ? null : _getBackgroundColor(count), - foregroundColor: - onPressed == null ? null : _getForegroundColor(count), - backgroundColor: - onPressed == null ? null : _getBackgroundColor(count), - ), - tooltip: AppLocalizations.of(context).prices_button_count_price( - count, - ), - ); + onPressed: onPressed, + iconData: PriceButton.priceIconData, + title: '$count', + buttonStyle: ElevatedButton.styleFrom( + disabledForegroundColor: onPressed != null + ? null + : _getForegroundColor(count), + disabledBackgroundColor: onPressed != null + ? null + : _getBackgroundColor(count), + foregroundColor: onPressed == null ? null : _getForegroundColor(count), + backgroundColor: onPressed == null ? null : _getBackgroundColor(count), + ), + tooltip: AppLocalizations.of(context).prices_button_count_price(count), + ); static Color? _getForegroundColor(final int count) => switch (count) { - 0 => Colors.red, - 1 => Colors.orange, - _ => Colors.green, - }; + 0 => Colors.red, + 1 => Colors.orange, + _ => Colors.green, + }; static Color? _getBackgroundColor(final int count) => switch (count) { - 0 => Colors.red[100], - 1 => Colors.orange[100], - _ => Colors.green[100], - }; + 0 => Colors.red[100], + 1 => Colors.orange[100], + _ => Colors.green[100], + }; } diff --git a/packages/smooth_app/lib/pages/prices/price_data_widget.dart b/packages/smooth_app/lib/pages/prices/price_data_widget.dart index c31bda0758..9171f49858 100644 --- a/packages/smooth_app/lib/pages/prices/price_data_widget.dart +++ b/packages/smooth_app/lib/pages/prices/price_data_widget.dart @@ -13,10 +13,7 @@ import 'package:smooth_app/query/product_query.dart'; /// Price Data display (no product data here). class PriceDataWidget extends StatelessWidget { - const PriceDataWidget( - this.price, { - required this.model, - }); + const PriceDataWidget(this.price, {required this.model}); final Price price; final GetPricesModel model; @@ -31,8 +28,9 @@ class PriceDataWidget extends StatelessWidget { locale: locale, name: price.currency.name, ); - final String? locationTitle = - PriceLocationWidget.getLocationTitle(price.location); + final String? locationTitle = PriceLocationWidget.getLocationTitle( + price.location, + ); String? getPricePerKg() { if (price.product == null) { @@ -64,7 +62,8 @@ class PriceDataWidget extends StatelessWidget { final String? notDiscountedPrice = getNotDiscountedPrice(); final bool isDiscounted = price.priceIsDiscounted == true; - final String priceLabel = '${currencyFormat.format(price.price)}' + final String priceLabel = + '${currencyFormat.format(price.price)}' ' ${pricePerKg == null ? '' : ' ($pricePerKg)'}'; return Semantics( container: true, @@ -97,15 +96,16 @@ class PriceDataWidget extends StatelessWidget { onPressed: price.locationId == null ? () {} : () async => PriceLocationWidget.showLocationPrices( - locationId: price.locationId!, - context: context, - ), + locationId: price.locationId!, + context: context, + ), ), ), if (model.displayEachOwner) PriceUserButton(price.owner), ExcludeSemantics( child: Tooltip( - message: '${dateFormat.format(price.created)}' + message: + '${dateFormat.format(price.created)}' ' ' '${timeFormat.format(price.created)}', child: PriceButton( @@ -127,9 +127,8 @@ class PriceDataWidget extends StatelessWidget { onPressed: () async => Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => PriceProofPage( - price.proof!, - ), + builder: (BuildContext context) => + PriceProofPage(price.proof!), ), ), // PriceProofPage ), diff --git a/packages/smooth_app/lib/pages/prices/price_date_card.dart b/packages/smooth_app/lib/pages/prices/price_date_card.dart index 09ba542e60..0a4737788e 100644 --- a/packages/smooth_app/lib/pages/prices/price_date_card.dart +++ b/packages/smooth_app/lib/pages/prices/price_date_card.dart @@ -41,12 +41,9 @@ class PriceDateCard extends StatelessWidget { // cf. https://stackoverflow.com/questions/50321182/how-to-customize-a-date-picker final ThemeData themeData = Theme.of(context).brightness == Brightness.light - ? ThemeData.light() - : ThemeData.dark(); - return Theme( - data: themeData.copyWith(), - child: child!, - ); + ? ThemeData.light() + : ThemeData.dark(); + return Theme(data: themeData.copyWith(), child: child!); }, ); if (newDate == null) { diff --git a/packages/smooth_app/lib/pages/prices/price_existing_amount_card.dart b/packages/smooth_app/lib/pages/prices/price_existing_amount_card.dart index 46049d52e4..6d3928956a 100644 --- a/packages/smooth_app/lib/pages/prices/price_existing_amount_card.dart +++ b/packages/smooth_app/lib/pages/prices/price_existing_amount_card.dart @@ -12,9 +12,7 @@ import 'package:smooth_app/query/product_query.dart'; /// Card that displays an existing amount. class PriceExistingAmountCard extends StatefulWidget { - const PriceExistingAmountCard( - this.price, - ); + const PriceExistingAmountCard(this.price); final Price price; @@ -45,14 +43,14 @@ class _PriceExistingAmountCardState extends State { final OpenFoodFactsLanguage language = ProductQuery.getLanguage(); final Map? map = await OpenFoodAPIClient.getTaxonomyCategories( - TaxonomyCategoryQueryConfiguration( - tags: [_categoryTag!], - country: ProductQuery.getCountry(), - languages: [language], - fields: [TaxonomyCategoryField.NAME], - includeChildren: false, - ), - ); + TaxonomyCategoryQueryConfiguration( + tags: [_categoryTag!], + country: ProductQuery.getCountry(), + languages: [language], + fields: [TaxonomyCategoryField.NAME], + includeChildren: false, + ), + ); if (map == null) { return; } @@ -79,14 +77,14 @@ class _PriceExistingAmountCardState extends State { final OpenFoodFactsLanguage language = ProductQuery.getLanguage(); final Map? map = await OpenFoodAPIClient.getTaxonomyOrigins( - TaxonomyOriginQueryConfiguration( - tags: _originTags!, - country: ProductQuery.getCountry(), - languages: [language], - fields: [TaxonomyOriginField.NAME], - includeChildren: false, - ), - ); + TaxonomyOriginQueryConfiguration( + tags: _originTags!, + country: ProductQuery.getCountry(), + languages: [language], + fields: [TaxonomyOriginField.NAME], + includeChildren: false, + ), + ); if (map == null) { return; } diff --git a/packages/smooth_app/lib/pages/prices/price_existing_amount_field.dart b/packages/smooth_app/lib/pages/prices/price_existing_amount_field.dart index b506485a13..ff55c75d0b 100644 --- a/packages/smooth_app/lib/pages/prices/price_existing_amount_field.dart +++ b/packages/smooth_app/lib/pages/prices/price_existing_amount_field.dart @@ -6,10 +6,7 @@ import 'package:smooth_app/pages/prices/price_per_extension.dart'; /// Text field that displays a read-only amount for an existing price. class PriceExistingAmountField extends StatelessWidget { - const PriceExistingAmountField({ - required this.value, - required this.pricePer, - }); + const PriceExistingAmountField({required this.value, required this.pricePer}); final num? value; final PricePer? pricePer; diff --git a/packages/smooth_app/lib/pages/prices/price_location_card.dart b/packages/smooth_app/lib/pages/prices/price_location_card.dart index 394dbc779e..9def355481 100644 --- a/packages/smooth_app/lib/pages/prices/price_location_card.dart +++ b/packages/smooth_app/lib/pages/prices/price_location_card.dart @@ -15,12 +15,10 @@ import 'package:smooth_app/pages/search/search_page.dart'; /// Card that displays the location for price adding. class PriceLocationCard extends StatelessWidget { - const PriceLocationCard({ - required this.onLocationChanged, - }); + const PriceLocationCard({required this.onLocationChanged}); final Function(OsmLocation? oldLocation, OsmLocation location) - onLocationChanged; + onLocationChanged; @override Widget build(BuildContext context) { @@ -39,45 +37,43 @@ class PriceLocationCard extends StatelessWidget { text: location == null ? appLocalizations.prices_location_find : location.getTitle() ?? - location.getSubtitle() ?? - location.getLatLng().toString(), + location.getSubtitle() ?? + location.getLatLng().toString(), leadingIcon: location == null ? const Icon(Icons.shopping_cart) : const Icon(PriceButton.locationIconData), onPressed: model.proof != null ? null : () async { - final LocalDatabase localDatabase = - context.read(); + final LocalDatabase localDatabase = context + .read(); final List preloadedList = []; for (final OsmLocation osmLocation in model.locations!) { preloadedList.add( - SearchLocationPreloadedItem( - osmLocation, - popFirst: false, - ), + SearchLocationPreloadedItem(osmLocation, popFirst: false), ); } final OsmLocation? osmLocation = await Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => SearchPage( - SearchLocationHelper(), - preloadedList: preloadedList, - autofocus: false, - ), - ), - ); + context, + MaterialPageRoute( + builder: (BuildContext context) => SearchPage( + SearchLocationHelper(), + preloadedList: preloadedList, + autofocus: false, + ), + ), + ); if (osmLocation == null) { return; } - final DaoOsmLocation daoOsmLocation = - DaoOsmLocation(localDatabase); + final DaoOsmLocation daoOsmLocation = DaoOsmLocation( + localDatabase, + ); await daoOsmLocation.put(osmLocation); - final List newOsmLocations = - await daoOsmLocation.getAll(); + final List newOsmLocations = await daoOsmLocation + .getAll(); model.locations = newOsmLocations; onLocationChanged.call(location, model.location!); diff --git a/packages/smooth_app/lib/pages/prices/price_location_widget.dart b/packages/smooth_app/lib/pages/prices/price_location_widget.dart index 4bfd817dca..d8d5bdd13c 100644 --- a/packages/smooth_app/lib/pages/prices/price_location_widget.dart +++ b/packages/smooth_app/lib/pages/prices/price_location_widget.dart @@ -9,9 +9,7 @@ import 'package:smooth_app/query/product_query.dart'; /// Price Location display (no price data here). class PriceLocationWidget extends StatelessWidget { - const PriceLocationWidget( - this.location, - ); + const PriceLocationWidget(this.location); final Location location; @@ -22,11 +20,7 @@ class PriceLocationWidget extends StatelessWidget { leading: const Icon(PriceButton.locationIconData), title: title == null ? null - : Text( - title, - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), + : Text(title, maxLines: 1, overflow: TextOverflow.ellipsis), subtitle: location.displayName == null ? null : Text( @@ -72,22 +66,22 @@ class PriceLocationWidget extends StatelessWidget { static Future showLocationPrices({ required final int locationId, required final BuildContext context, - }) async => - Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => PricesPage( - GetPricesModel( - parameters: GetPricesModel.getStandardPricesParameters() - ..locationId = locationId, - displayEachLocation: false, - uri: OpenPricesAPIClient.getUri( - path: 'locations/$locationId', - uriHelper: ProductQuery.uriPricesHelper, - ), - title: AppLocalizations.of(context) - .all_search_prices_top_location_single_title, - ), + }) async => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => PricesPage( + GetPricesModel( + parameters: GetPricesModel.getStandardPricesParameters() + ..locationId = locationId, + displayEachLocation: false, + uri: OpenPricesAPIClient.getUri( + path: 'locations/$locationId', + uriHelper: ProductQuery.uriPricesHelper, ), + title: AppLocalizations.of( + context, + ).all_search_prices_top_location_single_title, ), - ); + ), + ), + ); } diff --git a/packages/smooth_app/lib/pages/prices/price_meta_product.dart b/packages/smooth_app/lib/pages/prices/price_meta_product.dart index dead0038ca..560e0711e5 100644 --- a/packages/smooth_app/lib/pages/prices/price_meta_product.dart +++ b/packages/smooth_app/lib/pages/prices/price_meta_product.dart @@ -18,45 +18,44 @@ class PriceMetaProduct { required final String categoryName, required final List originNames, required final OpenFoodFactsLanguage language, - }) : _product = null, - _categoryName = categoryName, - _categoryTag = _getTag(categoryName, language), - _originNames = originNames, - _originTags = _getTags(originNames, language), - _priceProduct = null, - _barcode = null; + }) : _product = null, + _categoryName = categoryName, + _categoryTag = _getTag(categoryName, language), + _originNames = originNames, + _originTags = _getTags(originNames, language), + _priceProduct = null, + _barcode = null; PriceMetaProduct.product(final Product product) - : _product = product, - _categoryTag = null, - _categoryName = null, - _priceProduct = null, - _barcode = null; + : _product = product, + _categoryTag = null, + _categoryName = null, + _priceProduct = null, + _barcode = null; PriceMetaProduct.priceProduct(final PriceProduct priceProduct) - : _product = null, - _categoryTag = null, - _categoryName = null, - _priceProduct = priceProduct, - _barcode = null; + : _product = null, + _categoryTag = null, + _categoryName = null, + _priceProduct = priceProduct, + _barcode = null; PriceMetaProduct.unknown( final String barcode, final LocalDatabase localDatabase, final PriceModel priceModel, - ) : _product = null, - _categoryTag = null, - _categoryName = null, - _priceProduct = null, - _barcode = barcode { + ) : _product = null, + _categoryTag = null, + _categoryName = null, + _priceProduct = null, + _barcode = barcode { unawaited(_search(localDatabase, priceModel)); } static String _getTag( final String name, final OpenFoodFactsLanguage language, - ) => - '${language.offTag}:$name'; + ) => '${language.offTag}:$name'; static List _getTags( final List names, @@ -108,10 +107,7 @@ class PriceMetaProduct { return _categoryName; } if (_product != null) { - return getProductNameAndBrands( - _product!, - appLocalizations, - ); + return getProductNameAndBrands(_product!, appLocalizations); } if (_priceProduct != null) { return _priceProduct.name ?? _priceProduct.code; @@ -141,10 +137,7 @@ class PriceMetaProduct { imageProvider: imageURL == null ? null : NetworkImage(imageURL), ); } - return SmoothImage( - width: size, - height: size, - ); + return SmoothImage(width: size, height: size); } Future _search( @@ -158,11 +151,11 @@ class PriceMetaProduct { _product = product; return; } - final FetchedProduct fetchAndRefreshed = - await ProductRefresher().silentFetchAndRefresh( - localDatabase: localDatabase, - barcode: barcode, - ); + final FetchedProduct fetchAndRefreshed = await ProductRefresher() + .silentFetchAndRefresh( + localDatabase: localDatabase, + barcode: barcode, + ); if (fetchAndRefreshed.product == null) { return; } diff --git a/packages/smooth_app/lib/pages/prices/price_model.dart b/packages/smooth_app/lib/pages/prices/price_model.dart index 3f2c3d666f..9e1ee55f65 100644 --- a/packages/smooth_app/lib/pages/prices/price_model.dart +++ b/packages/smooth_app/lib/pages/prices/price_model.dart @@ -20,21 +20,19 @@ class PriceModel with ChangeNotifier { required final Currency currency, final PriceMetaProduct? initialProduct, required this.multipleProducts, - }) : _proof = null, - existingPrices = null, - _proofType = proofType, - _date = DateTime.now(), - _currency = currency, - _locations = locations, - _priceAmountModels = [ - if (initialProduct != null) PriceAmountModel(product: initialProduct), - ]; + }) : _proof = null, + existingPrices = null, + _proofType = proofType, + _date = DateTime.now(), + _currency = currency, + _locations = locations, + _priceAmountModels = [ + if (initialProduct != null) PriceAmountModel(product: initialProduct), + ]; - PriceModel.proof({ - required Proof proof, - this.existingPrices, - }) : multipleProducts = true, - _priceAmountModels = [] { + PriceModel.proof({required Proof proof, this.existingPrices}) + : multipleProducts = true, + _priceAmountModels = [] { setProof(proof, init: true); } diff --git a/packages/smooth_app/lib/pages/prices/price_per_extension.dart b/packages/smooth_app/lib/pages/prices/price_per_extension.dart index 206031dc5f..2b6d363262 100644 --- a/packages/smooth_app/lib/pages/prices/price_per_extension.dart +++ b/packages/smooth_app/lib/pages/prices/price_per_extension.dart @@ -4,9 +4,9 @@ import 'package:smooth_app/l10n/app_localizations.dart'; /// Extension for PricePer. extension PricePerExtension on PricePer { String getTitle(final AppLocalizations appLocalizations) => switch (this) { - PricePer.kilogram => appLocalizations.prices_per_kilogram, - PricePer.unit => appLocalizations.prices_per_unit, - }; + PricePer.kilogram => appLocalizations.prices_per_kilogram, + PricePer.unit => appLocalizations.prices_per_unit, + }; String getShortTitle(final AppLocalizations appLocalizations) => switch (this) { diff --git a/packages/smooth_app/lib/pages/prices/price_product_list_tile.dart b/packages/smooth_app/lib/pages/prices/price_product_list_tile.dart index 3a75be899b..efeb10200d 100644 --- a/packages/smooth_app/lib/pages/prices/price_product_list_tile.dart +++ b/packages/smooth_app/lib/pages/prices/price_product_list_tile.dart @@ -5,10 +5,7 @@ import 'package:smooth_app/pages/prices/price_meta_product.dart'; /// Displays a meta product with an action button, as a ListTile. class PriceProductListTile extends StatelessWidget { - const PriceProductListTile({ - required this.product, - this.trailing, - }); + const PriceProductListTile({required this.product, this.trailing}); final PriceMetaProduct product; final Widget? trailing; @@ -22,10 +19,7 @@ class PriceProductListTile extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ - SizedBox( - width: size, - child: product.getImageWidget(size), - ), + SizedBox(width: size, child: product.getImageWidget(size)), const SizedBox(width: SMALL_SPACE), Expanded( child: Column( diff --git a/packages/smooth_app/lib/pages/prices/price_product_widget.dart b/packages/smooth_app/lib/pages/prices/price_product_widget.dart index e8e9a26df9..2a689fdc32 100644 --- a/packages/smooth_app/lib/pages/prices/price_product_widget.dart +++ b/packages/smooth_app/lib/pages/prices/price_product_widget.dart @@ -32,8 +32,9 @@ class PriceProductWidget extends StatelessWidget { final bool unknown = priceProduct.name == null; final String? imageURL = priceProduct.imageURL; final int priceCount = priceProduct.priceCount ?? 0; - final List? brands = - priceProduct.brands == '' ? null : priceProduct.brands?.split(','); + final List? brands = priceProduct.brands == '' + ? null + : priceProduct.brands?.split(','); final String? quantity = priceProduct.quantity == null ? null : '${priceProduct.quantity} ${priceProduct.quantityUnit ?? 'g'}'; @@ -80,11 +81,11 @@ class PriceProductWidget extends StatelessWidget { onPressed: !enableCountButton ? null : () async { - final LocalDatabase localDatabase = - context.read(); - final Product? newProduct = - await DaoProduct(localDatabase) - .get(priceProduct.code); + final LocalDatabase localDatabase = context + .read(); + final Product? newProduct = await DaoProduct( + localDatabase, + ).get(priceProduct.code); if (!context.mounted) { return; } @@ -95,7 +96,8 @@ class PriceProductWidget extends StatelessWidget { product: newProduct != null ? PriceMetaProduct.product(newProduct) : PriceMetaProduct.priceProduct( - priceProduct), + priceProduct, + ), context: context, ), ), @@ -105,10 +107,7 @@ class PriceProductWidget extends StatelessWidget { ), if (brands != null) for (final String brand in brands) - PriceButton( - title: brand, - onPressed: () {}, - ), + PriceButton(title: brand, onPressed: () {}), if (quantity != null) Text(quantity), if (unknown) PriceButton( diff --git a/packages/smooth_app/lib/pages/prices/price_proof_card.dart b/packages/smooth_app/lib/pages/prices/price_proof_card.dart index efb9ae00a9..4029435b02 100644 --- a/packages/smooth_app/lib/pages/prices/price_proof_card.dart +++ b/packages/smooth_app/lib/pages/prices/price_proof_card.dart @@ -21,10 +21,7 @@ import 'package:smooth_app/query/product_query.dart'; /// Card that displays the proof for price adding. class PriceProofCard extends StatelessWidget { - const PriceProofCard({ - this.forcedProofType, - this.includeMyProofs = true, - }); + const PriceProofCard({this.forcedProofType, this.includeMyProofs = true}); final ProofType? forcedProofType; final bool includeMyProofs; @@ -60,12 +57,12 @@ class PriceProofCard extends StatelessWidget { LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) => Image( - image: FileImage( - File(model.cropParameters!.smallCroppedFile!.path), - ), - width: constraints.maxWidth, - height: constraints.maxWidth, - ), + image: FileImage( + File(model.cropParameters!.smallCroppedFile!.path), + ), + width: constraints.maxWidth, + height: constraints.maxWidth, + ), ), Padding( padding: const EdgeInsetsDirectional.symmetric( @@ -83,8 +80,8 @@ class PriceProofCard extends StatelessWidget { : () async { final List<_ProofSource> sources = _ProofSource.getPossibleProofSources( - includeMyProofs: includeMyProofs, - ); + includeMyProofs: includeMyProofs, + ); // not very likely if (sources.isEmpty) { return; @@ -110,26 +107,24 @@ class PriceProofCard extends StatelessWidget { ), LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) => Row( - children: (const [ - ProofType.receipt, - ProofType.priceTag, - ]) - .map( - (final ProofType item) => SizedBox( - width: constraints.maxWidth / 2, - child: RadioListTile( - title: Text(item.getTitle(appLocalizations)), - value: item, - groupValue: model.proofType, - onChanged: - model.proof != null || forcedProofType != null + children: + (const [ProofType.receipt, ProofType.priceTag]) + .map( + (final ProofType item) => SizedBox( + width: constraints.maxWidth / 2, + child: RadioListTile( + title: Text(item.getTitle(appLocalizations)), + value: item, + groupValue: model.proofType, + onChanged: + model.proof != null || forcedProofType != null ? null : (final ProofType? proofType) => - model.proofType = proofType!, - ), - ), - ) - .toList(), + model.proofType = proofType!, + ), + ), + ) + .toList(), ), ), ], @@ -144,16 +139,16 @@ enum _ProofSource { history; String getTitle(final AppLocalizations appLocalizations) => switch (this) { - _ProofSource.camera => appLocalizations.settings_app_camera, - _ProofSource.gallery => appLocalizations.gallery_source_label, - _ProofSource.history => appLocalizations.user_search_proofs_title, - }; + _ProofSource.camera => appLocalizations.settings_app_camera, + _ProofSource.gallery => appLocalizations.gallery_source_label, + _ProofSource.history => appLocalizations.user_search_proofs_title, + }; IconData getIconData() => switch (this) { - _ProofSource.camera => Icons.camera_rounded, - _ProofSource.gallery => Icons.perm_media_rounded, - _ProofSource.history => Icons.document_scanner_rounded, - }; + _ProofSource.camera => Icons.camera_rounded, + _ProofSource.gallery => Icons.perm_media_rounded, + _ProofSource.history => Icons.document_scanner_rounded, + }; Future process( final BuildContext context, @@ -163,9 +158,8 @@ enum _ProofSource { case _ProofSource.history: final Proof? proof = await Navigator.of(context).push( MaterialPageRoute( - builder: (BuildContext context) => const PricesProofsPage( - selectProof: true, - ), + builder: (BuildContext context) => + const PricesProofsPage(selectProof: true), ), ); if (proof != null) { @@ -217,9 +211,7 @@ enum _ProofSource { (_ProofSource source) => source.getTitle(appLocalizations), ), prefixIcons: sources - .map( - (_ProofSource source) => Icon(source.getIconData()), - ) + .map((_ProofSource source) => Icon(source.getIconData())) .toList(), addEndArrowToItems: true, values: sources, diff --git a/packages/smooth_app/lib/pages/prices/price_proof_page.dart b/packages/smooth_app/lib/pages/prices/price_proof_page.dart index 8685bb0eb3..d5b60bb5f7 100644 --- a/packages/smooth_app/lib/pages/prices/price_proof_page.dart +++ b/packages/smooth_app/lib/pages/prices/price_proof_page.dart @@ -14,9 +14,7 @@ import 'package:smooth_app/widgets/smooth_scaffold.dart'; /// Full page display of a proof. class PriceProofPage extends StatefulWidget { - const PriceProofPage( - this.proof, - ); + const PriceProofPage(this.proof); final Proof proof; @@ -36,8 +34,9 @@ class _PriceProofPageState extends State { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final DateFormat dateFormat = - DateFormat.yMd(ProductQuery.getLocaleString()).add_Hms(); + final DateFormat dateFormat = DateFormat.yMd( + ProductQuery.getLocaleString(), + ).add_Hms(); return SmoothScaffold( floatingActionButton: _existingPrices == null ? null @@ -58,7 +57,9 @@ class _PriceProofPageState extends State { MaterialPageRoute( builder: (BuildContext context) => ProductPriceAddPage( PriceModel.proof( - proof: widget.proof, existingPrices: _existingPrices), + proof: widget.proof, + existingPrices: _existingPrices, + ), ), ), ); @@ -79,22 +80,23 @@ class _PriceProofPageState extends State { child: Image.network( _getUrl(false), fit: BoxFit.cover, - loadingBuilder: (BuildContext context, Widget child, - ImageChunkEvent? loadingProgress) { - if (loadingProgress == null) { - return child; - } - return Center( - child: SizedBox( - width: double.maxFinite, - height: double.maxFinite, - child: Image.network( - _getUrl(true), - fit: BoxFit.contain, - ), - ), - ); - }, + loadingBuilder: + ( + BuildContext context, + Widget child, + ImageChunkEvent? loadingProgress, + ) { + if (loadingProgress == null) { + return child; + } + return Center( + child: SizedBox( + width: double.maxFinite, + height: double.maxFinite, + child: Image.network(_getUrl(true), fit: BoxFit.contain), + ), + ); + }, ), ), ); @@ -113,9 +115,9 @@ class _PriceProofPageState extends State { } final MaybeError prices = await OpenPricesAPIClient.getPrices( - GetPricesParameters()..proofId = widget.proof.id, - uriHelper: ProductQuery.uriPricesHelper, - ); + GetPricesParameters()..proofId = widget.proof.id, + uriHelper: ProductQuery.uriPricesHelper, + ); if (prices.isError) { return; } diff --git a/packages/smooth_app/lib/pages/prices/price_scan_page.dart b/packages/smooth_app/lib/pages/prices/price_scan_page.dart index b036b3aef6..71fe0b8bef 100644 --- a/packages/smooth_app/lib/pages/prices/price_scan_page.dart +++ b/packages/smooth_app/lib/pages/prices/price_scan_page.dart @@ -51,19 +51,16 @@ class _PriceScanPageState extends State Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); return SmoothScaffold( - appBar: SmoothAppBar( - title: Text(appLocalizations.prices_add_an_item), - ), + appBar: SmoothAppBar(title: Text(appLocalizations.prices_add_an_item)), floatingActionButton: !widget.isMultiProducts ? null : _barcodes.isEmpty - ? null - : FloatingActionButton.extended( - onPressed: () => _pop(context), - label: - Text(appLocalizations.user_list_length(_barcodes.length)), - icon: const Icon(Icons.add), - ), + ? null + : FloatingActionButton.extended( + onPressed: () => _pop(context), + label: Text(appLocalizations.user_list_length(_barcodes.length)), + icon: const Icon(Icons.add), + ), body: GlobalVars.barcodeScanner.getScanner( onScan: (final String barcode) async { // for some reason, the scanner sometimes returns immediately the diff --git a/packages/smooth_app/lib/pages/prices/price_user_button.dart b/packages/smooth_app/lib/pages/prices/price_user_button.dart index 0423d6e0dd..6bb0d03b30 100644 --- a/packages/smooth_app/lib/pages/prices/price_user_button.dart +++ b/packages/smooth_app/lib/pages/prices/price_user_button.dart @@ -16,42 +16,37 @@ class PriceUserButton extends StatelessWidget { static String showUserTitle({ required final String user, required final BuildContext context, - }) => - user == ProductQuery.getWriteUser().userId - ? AppLocalizations.of(context).user_search_prices_title - : AppLocalizations.of(context).user_any_search_prices_title; + }) => user == ProductQuery.getWriteUser().userId + ? AppLocalizations.of(context).user_search_prices_title + : AppLocalizations.of(context).user_any_search_prices_title; static Future showUserPrices({ required final String user, required final BuildContext context, - }) async => - Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => PricesPage( - GetPricesModel( - parameters: GetPricesModel.getStandardPricesParameters() - ..owner = user, - displayEachOwner: false, - uri: OpenPricesAPIClient.getUri( - path: 'users/$user', - uriHelper: ProductQuery.uriPricesHelper, - ), - title: showUserTitle(user: user, context: context), - subtitle: user, - lazyCounterPrices: LazyCounterPrices(user), - ), + }) async => Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => PricesPage( + GetPricesModel( + parameters: GetPricesModel.getStandardPricesParameters() + ..owner = user, + displayEachOwner: false, + uri: OpenPricesAPIClient.getUri( + path: 'users/$user', + uriHelper: ProductQuery.uriPricesHelper, ), + title: showUserTitle(user: user, context: context), + subtitle: user, + lazyCounterPrices: LazyCounterPrices(user), ), - ); + ), + ), + ); @override Widget build(BuildContext context) => PriceButton( - tooltip: AppLocalizations.of(context).prices_open_user_proofs(user), - title: user, - iconData: PriceButton.userIconData, - onPressed: () async => showUserPrices( - user: user, - context: context, - ), - ); + tooltip: AppLocalizations.of(context).prices_open_user_proofs(user), + title: user, + iconData: PriceButton.userIconData, + onPressed: () async => showUserPrices(user: user, context: context), + ); } diff --git a/packages/smooth_app/lib/pages/prices/prices_card.dart b/packages/smooth_app/lib/pages/prices/prices_card.dart index 2a5887840f..2827c6680b 100644 --- a/packages/smooth_app/lib/pages/prices/prices_card.dart +++ b/packages/smooth_app/lib/pages/prices/prices_card.dart @@ -103,8 +103,9 @@ class _PricesCardViewButtonState extends State<_PricesCardViewButton> { return Badge( offset: Offset.zero, isLabelVisible: total != null, - backgroundColor: - context.extension().secondaryNormal, + backgroundColor: context + .extension() + .secondaryNormal, label: Padding( padding: const EdgeInsetsDirectional.only( start: VERY_SMALL_SPACE, diff --git a/packages/smooth_app/lib/pages/prices/prices_locations_page.dart b/packages/smooth_app/lib/pages/prices/prices_locations_page.dart index 3070116555..7ece05cff3 100644 --- a/packages/smooth_app/lib/pages/prices/prices_locations_page.dart +++ b/packages/smooth_app/lib/pages/prices/prices_locations_page.dart @@ -36,9 +36,7 @@ class _PricesLocationsPageState extends State appBar: SmoothAppBar( centerTitle: false, leading: const SmoothBackButton(), - title: Text( - appLocalizations.all_search_prices_top_location_title, - ), + title: Text(appLocalizations.all_search_prices_top_location_title), actions: [ IconButton( tooltip: appLocalizations.prices_app_button, @@ -52,9 +50,7 @@ class _PricesLocationsPageState extends State ), ], ), - body: InfiniteScrollList( - manager: _locationManager, - ), + body: InfiniteScrollList(manager: _locationManager), ); } } @@ -65,21 +61,21 @@ class _InfiniteScrollLocationManager extends InfiniteScrollManager { Future fetchData(final int pageNumber) async { final MaybeError result = await OpenPricesAPIClient.getLocations( - GetLocationsParameters() - ..orderBy = const >[ - OrderBy( - field: GetLocationsOrderField.priceCount, - ascending: false, - ), - OrderBy( - field: GetLocationsOrderField.created, - ascending: false, - ), - ] - ..pageNumber = pageNumber - ..pageSize = 10, - uriHelper: ProductQuery.uriPricesHelper, - ); + GetLocationsParameters() + ..orderBy = const >[ + OrderBy( + field: GetLocationsOrderField.priceCount, + ascending: false, + ), + OrderBy( + field: GetLocationsOrderField.created, + ascending: false, + ), + ] + ..pageNumber = pageNumber + ..pageSize = 10, + uriHelper: ProductQuery.uriPricesHelper, + ); if (result.isError) { throw result.detailError; } @@ -93,10 +89,7 @@ class _InfiniteScrollLocationManager extends InfiniteScrollManager { } @override - Widget buildItem({ - required BuildContext context, - required Location item, - }) { + Widget buildItem({required BuildContext context, required Location item}) { final AppLocalizations appLocalizations = AppLocalizations.of(context); final int priceCount = item.priceCount ?? 0; @@ -118,9 +111,7 @@ class _InfiniteScrollLocationManager extends InfiniteScrollManager { iconData: PriceButton.userIconData, tooltip: item.userCount == null ? null - : appLocalizations.prices_button_count_user( - item.userCount!, - ), + : appLocalizations.prices_button_count_user(item.userCount!), ), PriceButton( onPressed: () {}, @@ -138,9 +129,7 @@ class _InfiniteScrollLocationManager extends InfiniteScrollManager { iconData: PriceButton.proofIconData, tooltip: item.proofCount == null ? null - : appLocalizations.prices_button_count_proof( - item.proofCount!, - ), + : appLocalizations.prices_button_count_proof(item.proofCount!), ), ], ), diff --git a/packages/smooth_app/lib/pages/prices/prices_page.dart b/packages/smooth_app/lib/pages/prices/prices_page.dart index 1341aad0c3..7c297d1d56 100644 --- a/packages/smooth_app/lib/pages/prices/prices_page.dart +++ b/packages/smooth_app/lib/pages/prices/prices_page.dart @@ -17,10 +17,7 @@ import 'package:smooth_app/widgets/smooth_scaffold.dart'; /// Page that displays the latest prices according to a model. class PricesPage extends StatelessWidget { - const PricesPage( - this.model, { - this.pricesResult, - }); + const PricesPage(this.model, {this.pricesResult}); final GetPricesModel model; final GetPricesResult? pricesResult; @@ -32,10 +29,7 @@ class PricesPage extends StatelessWidget { appBar: SmoothAppBar( centerTitle: false, leading: const SmoothBackButton(), - title: Text( - model.title, - maxLines: model.subtitle == null ? 2 : 1, - ), + title: Text(model.title, maxLines: model.subtitle == null ? 2 : 1), subTitle: model.subtitle == null ? null : Text(model.subtitle!), actions: [ Semantics( @@ -45,17 +39,13 @@ class PricesPage extends StatelessWidget { child: IconButton( tooltip: appLocalizations.prices_app_button, icon: const ExcludeSemantics(child: Icon(Icons.open_in_new)), - onPressed: () async => LaunchUrlHelper.launchURL( - model.uri.toString(), - ), + onPressed: () async => + LaunchUrlHelper.launchURL(model.uri.toString()), ), ), ], ), - body: ProductPricesList( - model, - pricesResult: pricesResult, - ), + body: ProductPricesList(model, pricesResult: pricesResult), floatingActionButton: model.addButton == null ? null : FloatingActionButton.extended( @@ -68,17 +58,18 @@ class PricesPage extends StatelessWidget { (UserPreferences? previousValue, UserPreferences currentValue) => previousValue?.shouldShowPricesFeedbackForm != currentValue.shouldShowPricesFeedbackForm, - builder: ( - final BuildContext context, - final UserPreferences userPreferences, - _, - ) { - if (!userPreferences.shouldShowPricesFeedbackForm) { - return EMPTY_WIDGET; - } + builder: + ( + final BuildContext context, + final UserPreferences userPreferences, + _, + ) { + if (!userPreferences.shouldShowPricesFeedbackForm) { + return EMPTY_WIDGET; + } - return const _PricesFeedbackForm(); - }, + return const _PricesFeedbackForm(); + }, ), ); } @@ -90,8 +81,9 @@ class _PricesFeedbackForm extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension? themeExtension = - Theme.of(context).extension(); + final SmoothColorsThemeExtension? themeExtension = Theme.of( + context, + ).extension(); final double bottomPadding = MediaQuery.viewPaddingOf(context).bottom; @@ -104,9 +96,7 @@ class _PricesFeedbackForm extends StatelessWidget { data: const IconThemeData(color: Colors.white), child: InkWell( onTap: () async { - LaunchUrlHelper.launchURL( - 'https://forms.gle/Vmh9SR3HhPpjMnVF7', - ); + LaunchUrlHelper.launchURL('https://forms.gle/Vmh9SR3HhPpjMnVF7'); context.read().markPricesFeedbackFormAsCompleted(); }, child: Padding( @@ -124,10 +114,7 @@ class _PricesFeedbackForm extends StatelessWidget { ), child: const AspectRatio( aspectRatio: 1.0, - child: Lab( - color: Colors.white, - size: 13.0, - ), + child: Lab(color: Colors.white, size: 13.0), ), ), ), @@ -152,7 +139,7 @@ class _PricesFeedbackForm extends StatelessWidget { aspectRatio: 1.0, child: CloseButtonIcon(), ), - ) + ), ], ), ), diff --git a/packages/smooth_app/lib/pages/prices/prices_products_page.dart b/packages/smooth_app/lib/pages/prices/prices_products_page.dart index cc98f2d149..952e020eb5 100644 --- a/packages/smooth_app/lib/pages/prices/prices_products_page.dart +++ b/packages/smooth_app/lib/pages/prices/prices_products_page.dart @@ -33,9 +33,7 @@ class _PricesProductsPageState extends State appBar: SmoothAppBar( centerTitle: false, leading: const SmoothBackButton(), - title: Text( - appLocalizations.all_search_prices_top_product_title, - ), + title: Text(appLocalizations.all_search_prices_top_product_title), actions: [ IconButton( tooltip: appLocalizations.prices_app_button, @@ -49,9 +47,7 @@ class _PricesProductsPageState extends State ), ], ), - body: InfiniteScrollList( - manager: _productManager, - ), + body: InfiniteScrollList(manager: _productManager), ); } } @@ -63,22 +59,22 @@ class _InfiniteScrollProductManager static const List> _orderBy = >[ - OrderBy( - field: GetPriceProductsOrderField.priceCount, - ascending: false, - ), - ]; + OrderBy( + field: GetPriceProductsOrderField.priceCount, + ascending: false, + ), + ]; @override Future fetchData(final int pageNumber) async { final MaybeError result = await OpenPricesAPIClient.getPriceProducts( - GetPriceProductsParameters() - ..pageNumber = pageNumber - ..pageSize = _pageSize - ..orderBy = _orderBy, - uriHelper: ProductQuery.uriPricesHelper, - ); + GetPriceProductsParameters() + ..pageNumber = pageNumber + ..pageSize = _pageSize + ..orderBy = _orderBy, + uriHelper: ProductQuery.uriPricesHelper, + ); if (result.isError) { throw result.detailError; @@ -98,11 +94,6 @@ class _InfiniteScrollProductManager required BuildContext context, required PriceProduct item, }) { - return SmoothCard( - child: PriceProductWidget( - item, - enableCountButton: true, - ), - ); + return SmoothCard(child: PriceProductWidget(item, enableCountButton: true)); } } diff --git a/packages/smooth_app/lib/pages/prices/prices_proofs_page.dart b/packages/smooth_app/lib/pages/prices/prices_proofs_page.dart index 4e1eac6102..904e92fad3 100644 --- a/packages/smooth_app/lib/pages/prices/prices_proofs_page.dart +++ b/packages/smooth_app/lib/pages/prices/prices_proofs_page.dart @@ -17,9 +17,7 @@ import 'package:smooth_app/widgets/smooth_scaffold.dart'; /// Page that displays the latest proofs of the current user. class PricesProofsPage extends StatefulWidget { - const PricesProofsPage({ - required this.selectProof, - }); + const PricesProofsPage({required this.selectProof}); /// Do we want to select a proof (true), or just to see its details (false)? final bool selectProof; @@ -31,9 +29,7 @@ class PricesProofsPage extends StatefulWidget { class _PricesProofsPageState extends State with TraceableClientMixin { late final _InfiniteScrollProofManager _proofManager = - _InfiniteScrollProofManager( - selectProof: widget.selectProof, - ); + _InfiniteScrollProofManager(selectProof: widget.selectProof); @override void dispose() { @@ -48,9 +44,7 @@ class _PricesProofsPageState extends State appBar: SmoothAppBar( centerTitle: false, leading: const SmoothBackButton(), - title: Text( - appLocalizations.user_search_proofs_title, - ), + title: Text(appLocalizations.user_search_proofs_title), actions: [ IconButton( tooltip: appLocalizations.prices_app_button, @@ -64,18 +58,14 @@ class _PricesProofsPageState extends State ), ], ), - body: InfiniteScrollList( - manager: _proofManager, - ), + body: InfiniteScrollList(manager: _proofManager), ); } } /// A manager for handling proof data with infinite scrolling class _InfiniteScrollProofManager extends InfiniteScrollManager { - _InfiniteScrollProofManager({ - required this.selectProof, - }); + _InfiniteScrollProofManager({required this.selectProof}); static const int _pageSize = 10; final bool selectProof; @@ -86,10 +76,10 @@ class _InfiniteScrollProofManager extends InfiniteScrollManager { final User user = ProductQuery.getWriteUser(); final MaybeError token = await OpenPricesAPIClient.getAuthenticationToken( - username: user.userId, - password: user.password, - uriHelper: ProductQuery.uriPricesHelper, - ); + username: user.userId, + password: user.password, + uriHelper: ProductQuery.uriPricesHelper, + ); if (token.isError) { throw Exception(token.error ?? 'Could not authenticate with the server'); @@ -107,19 +97,19 @@ class _InfiniteScrollProofManager extends InfiniteScrollManager { final User user = ProductQuery.getWriteUser(); final MaybeError result = await OpenPricesAPIClient.getProofs( - GetProofsParameters() - ..orderBy = >[ - const OrderBy( - field: GetProofsOrderField.created, - ascending: false, - ), - ] - ..owner = user.userId - ..pageSize = _pageSize - ..pageNumber = pageNumber, - uriHelper: ProductQuery.uriPricesHelper, - bearerToken: _bearerToken!, - ); + GetProofsParameters() + ..orderBy = >[ + const OrderBy( + field: GetProofsOrderField.created, + ascending: false, + ), + ] + ..owner = user.userId + ..pageSize = _pageSize + ..pageNumber = pageNumber, + uriHelper: ProductQuery.uriPricesHelper, + bearerToken: _bearerToken!, + ); if (result.isError) { throw Exception(result.error ?? 'Failed to fetch proofs'); @@ -145,10 +135,7 @@ class _InfiniteScrollProofManager extends InfiniteScrollManager { } @override - Widget buildItem({ - required BuildContext context, - required Proof item, - }) { + Widget buildItem({required BuildContext context, required Proof item}) { if (item.filePath == null) { return const SizedBox.shrink(); } @@ -180,8 +167,9 @@ class _PriceProofListItem extends StatelessWidget { @override Widget build(BuildContext context) { - final DateFormat dateFormat = - DateFormat.yMd(ProductQuery.getLocaleString()); + final DateFormat dateFormat = DateFormat.yMd( + ProductQuery.getLocaleString(), + ); final String date = dateFormat.format(proof.date ?? proof.created); final double screenWidth = MediaQuery.of(context).size.width; @@ -205,15 +193,7 @@ class _PriceProofListItem extends StatelessWidget { rounded: false, ), const SizedBox(width: MEDIUM_SPACE), - Expanded( - child: Column( - children: [ - Text( - date, - ), - ], - ), - ), + Expanded(child: Column(children: [Text(date)])), ], ), ); diff --git a/packages/smooth_app/lib/pages/prices/prices_stats_page.dart b/packages/smooth_app/lib/pages/prices/prices_stats_page.dart index d98473e5e7..7d3d445586 100644 --- a/packages/smooth_app/lib/pages/prices/prices_stats_page.dart +++ b/packages/smooth_app/lib/pages/prices/prices_stats_page.dart @@ -50,13 +50,13 @@ class _PricesStatsPageState extends State { body: _statsData == null ? const Center(child: CircularProgressIndicator()) : _statsData!.isError - ? Center( - child: ListTile( - title: Text(appLocalizations.prices_stats_error), - subtitle: Text(_statsData!.detailError), - ), - ) - : _buildStatsContent(_statsData!.value, appLocalizations), + ? Center( + child: ListTile( + title: Text(appLocalizations.prices_stats_error), + subtitle: Text(_statsData!.detailError), + ), + ) + : _buildStatsContent(_statsData!.value, appLocalizations), ); } @@ -245,20 +245,19 @@ class _PricesStatsPageState extends State { final IconData iconData, final String description, { final String? path, - }) => - ListTile( - leading: Icon(iconData), - title: Text(description), - trailing: path == null ? null : const Icon(Icons.open_in_new), - onTap: path == null - ? null - : () async => LaunchUrlHelper.launchURL( - OpenPricesAPIClient.getUri( - path: path, - uriHelper: ProductQuery.uriPricesHelper, - ).toString(), - ), - ); + }) => ListTile( + leading: Icon(iconData), + title: Text(description), + trailing: path == null ? null : const Icon(Icons.open_in_new), + onTap: path == null + ? null + : () async => LaunchUrlHelper.launchURL( + OpenPricesAPIClient.getUri( + path: path, + uriHelper: ProductQuery.uriPricesHelper, + ).toString(), + ), + ); Widget _getDataTile({ required int? value, @@ -269,18 +268,16 @@ class _PricesStatsPageState extends State { return EMPTY_WIDGET; } - final String displayValue = - denominator == null ? value.toString() : '$value / $denominator'; + final String displayValue = denominator == null + ? value.toString() + : '$value / $denominator'; - return ListTile( - title: Text(displayValue), - subtitle: Text(description), - ); + return ListTile(title: Text(displayValue), subtitle: Text(description)); } static String? _formatDateTime(final DateTime? dateTime) => dateTime == null ? null - : DateFormat.yMd(ProductQuery.getLanguage().offTag) - .add_jms() - .format(dateTime); + : DateFormat.yMd( + ProductQuery.getLanguage().offTag, + ).add_jms().format(dateTime); } diff --git a/packages/smooth_app/lib/pages/prices/prices_users_page.dart b/packages/smooth_app/lib/pages/prices/prices_users_page.dart index a66591f0ec..f2cc69c3ab 100644 --- a/packages/smooth_app/lib/pages/prices/prices_users_page.dart +++ b/packages/smooth_app/lib/pages/prices/prices_users_page.dart @@ -34,9 +34,7 @@ class _PricesUsersPageState extends State appBar: SmoothAppBar( centerTitle: false, leading: const SmoothBackButton(), - title: Text( - appLocalizations.all_search_prices_top_user_title, - ), + title: Text(appLocalizations.all_search_prices_top_user_title), actions: [ IconButton( tooltip: appLocalizations.prices_app_button, @@ -50,9 +48,7 @@ class _PricesUsersPageState extends State ), ], ), - body: InfiniteScrollList( - manager: _userManager, - ), + body: InfiniteScrollList(manager: _userManager), ); } } @@ -75,9 +71,9 @@ class _InfiniteScrollUserManager extends InfiniteScrollManager { final MaybeError result = await OpenPricesAPIClient.getUsers( - parameters, - uriHelper: ProductQuery.uriPricesHelper, - ); + parameters, + uriHelper: ProductQuery.uriPricesHelper, + ); if (result.isError) { throw result.detailError; @@ -93,10 +89,7 @@ class _InfiniteScrollUserManager extends InfiniteScrollManager { } @override - Widget buildItem({ - required BuildContext context, - required PriceUser item, - }) { + Widget buildItem({required BuildContext context, required PriceUser item}) { final int priceCount = item.priceCount ?? 0; return SmoothCard( child: Wrap( diff --git a/packages/smooth_app/lib/pages/prices/product_price_add_page.dart b/packages/smooth_app/lib/pages/prices/product_price_add_page.dart index e03dcef68d..f90c884e0f 100644 --- a/packages/smooth_app/lib/pages/prices/product_price_add_page.dart +++ b/packages/smooth_app/lib/pages/prices/product_price_add_page.dart @@ -29,9 +29,7 @@ import 'package:smooth_app/widgets/will_pop_scope.dart'; /// Single page that displays all the elements of price adding. class ProductPriceAddPage extends StatefulWidget { - const ProductPriceAddPage( - this.model, - ); + const ProductPriceAddPage(this.model); final PriceModel model; @@ -96,10 +94,7 @@ class _ProductPriceAddPageState extends State Widget build(BuildContext context) { return ChangeNotifierProvider.value( value: widget.model, - builder: ( - final BuildContext context, - final Widget? child, - ) { + builder: (final BuildContext context, final Widget? child) { final AppLocalizations appLocalizations = AppLocalizations.of(context); final PriceModel model = Provider.of(context); return ChangeNotifierListener( @@ -108,13 +103,8 @@ class _ProductPriceAddPageState extends State }, child: WillPopScope2( controller: _willPopScope2Controller, - onWillPop: () async => ( - await _mayExitPage( - saving: false, - model: model, - ), - null - ), + onWillPop: () async => + (await _mayExitPage(saving: false, model: model), null), child: Form( key: _formKey, child: SmoothScaffold( @@ -122,22 +112,21 @@ class _ProductPriceAddPageState extends State centerTitle: false, leading: const SmoothBackButton(), title: Text( - appLocalizations.prices_add_n_prices( - model.length, - ), + appLocalizations.prices_add_n_prices(model.length), ), actions: [ IconButton( icon: const Icon(Icons.info), - onPressed: () async => PriceAddHelper(context) - .doesAcceptWarning(justInfo: true), + onPressed: () async => PriceAddHelper( + context, + ).doesAcceptWarning(justInfo: true), ), ], ), backgroundColor: context.lightTheme() ? context - .extension() - .primaryLight + .extension() + .primaryLight : null, body: SingleChildScrollView( controller: _scrollController, @@ -149,15 +138,11 @@ class _ProductPriceAddPageState extends State const PriceDateCard(), const SizedBox(height: LARGE_SPACE), PriceLocationCard( - onLocationChanged: ( - OsmLocation? oldLocation, - OsmLocation location, - ) => - PriceAddHelper(context).updateCurrency( - oldLocation, - location, - model, - ), + onLocationChanged: + (OsmLocation? oldLocation, OsmLocation location) => + PriceAddHelper( + context, + ).updateCurrency(oldLocation, location, model), ), const SizedBox(height: LARGE_SPACE), const PriceCurrencyCard(), @@ -166,10 +151,7 @@ class _ProductPriceAddPageState extends State for (final Price price in model.existingPrices!) PriceExistingAmountCard(price), for (int i = 0; i < model.length; i++) - PriceAmountCard( - key: UniqueKey(), - index: i, - ), + PriceAmountCard(key: UniqueKey(), index: i), const SizedBox(height: LARGE_SPACE), if (model.multipleProducts) const PriceAddProductCard(), // so that the last items don't get hidden by the FAB @@ -179,17 +161,11 @@ class _ProductPriceAddPageState extends State ), floatingActionButton: SmoothExpandableFloatingActionButton( scrollController: _scrollController, - onPressed: () async => _exitPage( - await _mayExitPage( - saving: true, - model: model, - ), - ), + onPressed: () async => + _exitPage(await _mayExitPage(saving: true, model: model)), icon: const Icon(Icons.send), label: Text( - appLocalizations.prices_send_n_prices( - model.length, - ), + appLocalizations.prices_send_n_prices(model.length), style: const TextStyle( fontWeight: FontWeight.w600, fontSize: 15.0, @@ -228,13 +204,13 @@ class _ProductPriceAddPageState extends State } if (!saving) { - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog( - context, - title: AppLocalizations.of(context).prices_add_n_prices( - model.length, - ), - ); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog( + context, + title: AppLocalizations.of( + context, + ).prices_add_n_prices(model.length), + ); if (pleaseSave == null) { return false; } diff --git a/packages/smooth_app/lib/pages/prices/product_prices_list.dart b/packages/smooth_app/lib/pages/prices/product_prices_list.dart index 0650f9c38e..62d07be19b 100644 --- a/packages/smooth_app/lib/pages/prices/product_prices_list.dart +++ b/packages/smooth_app/lib/pages/prices/product_prices_list.dart @@ -15,10 +15,7 @@ import 'package:smooth_app/query/product_query.dart'; /// List of the latest prices for a given model. class ProductPricesList extends StatefulWidget { - const ProductPricesList( - this.model, { - this.pricesResult, - }); + const ProductPricesList(this.model, {this.pricesResult}); final GetPricesModel model; final GetPricesResult? pricesResult; @@ -43,9 +40,7 @@ class _ProductPricesListState extends State @override Widget build(BuildContext context) { context.watch(); - return InfiniteScrollList( - manager: _priceManager, - ); + return InfiniteScrollList(manager: _priceManager); } } @@ -65,8 +60,10 @@ class _InfiniteScrollPriceManager extends InfiniteScrollManager { parameters.pageNumber = pageNumber; final MaybeError result = - await OpenPricesAPIClient.getPrices(parameters, - uriHelper: ProductQuery.uriPricesHelper); + await OpenPricesAPIClient.getPrices( + parameters, + uriHelper: ProductQuery.uriPricesHelper, + ); if (result.isError) { throw result.detailError; @@ -82,10 +79,7 @@ class _InfiniteScrollPriceManager extends InfiniteScrollManager { } @override - Widget buildItem({ - required BuildContext context, - required Price item, - }) { + Widget buildItem({required BuildContext context, required Price item}) { final PriceProduct? priceProduct = item.product; return SmoothCard( child: Column( @@ -97,10 +91,7 @@ class _InfiniteScrollPriceManager extends InfiniteScrollManager { priceProduct, enableCountButton: model.enableCountButton, ), - PriceDataWidget( - item, - model: model, - ), + PriceDataWidget(item, model: model), ], ), ); diff --git a/packages/smooth_app/lib/pages/prices/proof_bulk_add_page.dart b/packages/smooth_app/lib/pages/prices/proof_bulk_add_page.dart index f0ed3c0800..551cc1e382 100644 --- a/packages/smooth_app/lib/pages/prices/proof_bulk_add_page.dart +++ b/packages/smooth_app/lib/pages/prices/proof_bulk_add_page.dart @@ -21,9 +21,7 @@ import 'package:smooth_app/widgets/smooth_scaffold.dart'; /// Single page that displays all the elements of bulk proof adding. class ProofBulkAddPage extends StatefulWidget { - const ProofBulkAddPage( - this.model, - ); + const ProofBulkAddPage(this.model); final PriceModel model; @@ -56,9 +54,7 @@ class ProofBulkAddPage extends StatefulWidget { ); } - static Future showPage({ - required final BuildContext context, - }) async { + static Future showPage({required final BuildContext context}) async { final PriceModel? priceModel = await _getPriceModel(context: context); if (priceModel == null) { return; @@ -86,10 +82,7 @@ class _ProofBulkAddPageState extends State Widget build(BuildContext context) { return ChangeNotifierProvider.value( value: widget.model, - builder: ( - final BuildContext context, - final Widget? child, - ) { + builder: (final BuildContext context, final Widget? child) { final AppLocalizations appLocalizations = AppLocalizations.of(context); final PriceModel model = Provider.of(context); return Form( @@ -98,9 +91,7 @@ class _ProofBulkAddPageState extends State appBar: SmoothAppBar( centerTitle: false, leading: const SmoothBackButton(), - title: Text( - appLocalizations.prices_bulk_proof_upload_title, - ), + title: Text(appLocalizations.prices_bulk_proof_upload_title), actions: [ IconButton( icon: const Icon(Icons.info), @@ -120,15 +111,11 @@ class _ProofBulkAddPageState extends State const PriceDateCard(), const SizedBox(height: LARGE_SPACE), PriceLocationCard( - onLocationChanged: ( - OsmLocation? oldLocation, - OsmLocation location, - ) => - PriceAddHelper(context).updateCurrency( - oldLocation, - location, - model, - ), + onLocationChanged: + (OsmLocation? oldLocation, OsmLocation location) => + PriceAddHelper( + context, + ).updateCurrency(oldLocation, location, model), ), const SizedBox(height: LARGE_SPACE), const PriceCurrencyCard(), diff --git a/packages/smooth_app/lib/pages/prices/proof_type_extensions.dart b/packages/smooth_app/lib/pages/prices/proof_type_extensions.dart index 0b28ddf301..f0eae1683e 100644 --- a/packages/smooth_app/lib/pages/prices/proof_type_extensions.dart +++ b/packages/smooth_app/lib/pages/prices/proof_type_extensions.dart @@ -4,11 +4,11 @@ import 'package:smooth_app/l10n/app_localizations.dart'; /// Extensions on ProofType. extension ProofTypeExtension on ProofType { String getTitle(AppLocalizations appLocalizations) => switch (this) { - ProofType.receipt => appLocalizations.prices_proof_receipt, - ProofType.priceTag => appLocalizations.prices_proof_price_tag, - // not used for the moment - ProofType.gdprRequest => 'GDPR Request', - // not used for the moment - ProofType.shopImport => 'Shop import', - }; + ProofType.receipt => appLocalizations.prices_proof_receipt, + ProofType.priceTag => appLocalizations.prices_proof_price_tag, + // not used for the moment + ProofType.gdprRequest => 'GDPR Request', + // not used for the moment + ProofType.shopImport => 'Shop import', + }; } diff --git a/packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_name.dart b/packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_name.dart index 57378ae2c2..0e44d71bf8 100644 --- a/packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_name.dart +++ b/packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_name.dart @@ -36,10 +36,8 @@ class AddProductNameInputWidget extends StatefulWidget { }); final Product product; - final Function( - ImageField imageField, - OpenFoodFactsLanguage language, - ) onShowImagePreview; + final Function(ImageField imageField, OpenFoodFactsLanguage language) + onShowImagePreview; @override State createState() => @@ -48,7 +46,7 @@ class AddProductNameInputWidget extends StatefulWidget { class _AddProductNameInputWidgetState extends State { final Map - _controllers = {}; + _controllers = {}; static const int MIN_COLLAPSED_COUNT = 3; @@ -73,104 +71,130 @@ class _AddProductNameInputWidgetState extends State { ], ), contentPadding: EdgeInsets.zero, - child: ValueNotifierListener( - listener: ( - final BuildContext context, - _ProductNameEditorProviderState? oldValue, - _ProductNameEditorProviderState value, - ) { - if (oldValue?.productNames.length != value.productNames.length) { - for (final _EditingProductName productName - in value.productNames) { - if (!_controllers.containsKey(productName.language)) { - _controllers[productName.language] = - DebouncedTextEditingController( - controller: TextEditingController(text: productName.name) - ..addListener( - () { - context - .read() - .onNameChanged( - productName.language, - _controllers[productName.language]!.text, - ); + child: + ValueNotifierListener< + ProductNameEditorProvider, + _ProductNameEditorProviderState + >( + listener: + ( + final BuildContext context, + _ProductNameEditorProviderState? oldValue, + _ProductNameEditorProviderState value, + ) { + if (oldValue?.productNames.length != + value.productNames.length) { + for (final _EditingProductName productName + in value.productNames) { + if (!_controllers.containsKey(productName.language)) { + _controllers[productName + .language] = DebouncedTextEditingController( + controller: + TextEditingController(text: productName.name) + ..addListener(() { + context + .read() + .onNameChanged( + productName.language, + _controllers[productName.language]! + .text, + ); + }), + ); + } + } + } + }, + child: + ConsumerValueNotifierFilter< + ProductNameEditorProvider, + _ProductNameEditorProviderState + >( + buildWhen: + ( + _ProductNameEditorProviderState? oldValue, + _ProductNameEditorProviderState value, + ) => + oldValue?.productNames.length != + value.productNames.length || + oldValue?.addedLanguages.length != + value.addedLanguages.length, + builder: + ( + final BuildContext context, + final _ProductNameEditorProviderState value, + _, + ) { + final int count = _collapsed + ? math.min( + value.productNames.length - + value.addedLanguages.length, + MIN_COLLAPSED_COUNT, + ) + : value.productNames.length; + + final bool collapsed = + _collapsed && + value.productNames.length - + value.addedLanguages.length > + MIN_COLLAPSED_COUNT; + + return Column( + children: [ + ...value.productNames + .sublist(0, count) + .map( + ( + _EditingProductName productName, + ) => _ProductNameInputWidget( + productName: productName, + controller: + _controllers[productName.language]!, + onShowImagePreview: () { + widget.onShowImagePreview( + ImageField.FRONT, + productName.language, + ); + }, + ), + ), + if (value.addedLanguages.isNotEmpty && + _collapsed) ...[ + const _ProductNameNewTranslationWarning(), + ...value.productNames + .sublist( + value.productNames.length - + value.addedLanguages.length, + ) + .map( + ( + _EditingProductName productName, + ) => _ProductNameInputWidget( + productName: productName, + controller: + _controllers[productName.language]!, + onShowImagePreview: () { + widget.onShowImagePreview( + ImageField.FRONT, + productName.language, + ); + }, + ), + ), + ], + if (collapsed) + _ProductNameCollapsedSection( + onTap: () => setState(() { + _collapsed = false; + }), + ) + else + const SizedBox(height: BALANCED_SPACE), + ], + ); }, - ), - ); - } - } - } - }, - child: ConsumerValueNotifierFilter( - buildWhen: (_ProductNameEditorProviderState? oldValue, - _ProductNameEditorProviderState value) => - oldValue?.productNames.length != value.productNames.length || - oldValue?.addedLanguages.length != value.addedLanguages.length, - builder: ( - final BuildContext context, - final _ProductNameEditorProviderState value, - _, - ) { - final int count = _collapsed - ? math.min( - value.productNames.length - value.addedLanguages.length, - MIN_COLLAPSED_COUNT) - : value.productNames.length; - - final bool collapsed = _collapsed && - value.productNames.length - value.addedLanguages.length > - MIN_COLLAPSED_COUNT; - - return Column( - children: [ - ...value.productNames.sublist(0, count).map( - (_EditingProductName productName) => - _ProductNameInputWidget( - productName: productName, - controller: _controllers[productName.language]!, - onShowImagePreview: () { - widget.onShowImagePreview( - ImageField.FRONT, - productName.language, - ); - }, - ), - ), - if (value.addedLanguages.isNotEmpty && - _collapsed) ...[ - const _ProductNameNewTranslationWarning(), - ...value.productNames - .sublist(value.productNames.length - - value.addedLanguages.length) - .map( - (_EditingProductName productName) => - _ProductNameInputWidget( - productName: productName, - controller: _controllers[productName.language]!, - onShowImagePreview: () { - widget.onShowImagePreview( - ImageField.FRONT, - productName.language, - ); - }, - ), - ), - ], - if (collapsed) - _ProductNameCollapsedSection( - onTap: () => setState(() { - _collapsed = false; - }), - ) - else - const SizedBox(height: BALANCED_SPACE), - ], - ); - }, - ), - ), + ), + ), ), ); } @@ -201,21 +225,23 @@ class _ProductNameAddNewLanguage extends StatelessWidget { } Future _openLanguagePicker(BuildContext context) async { - final ProductNameEditorProvider provider = - context.read(); + final ProductNameEditorProvider provider = context + .read(); final List selectedLanguages = provider - .value.productNames + .value + .productNames .map((final _EditingProductName productName) => productName.language) .toList(growable: false); final OpenFoodFactsLanguage? language = await LanguagesSelector.openLanguageSelector( - context, - selectedLanguages: selectedLanguages, - title: AppLocalizations.of(context) - .add_basic_details_product_name_add_translation, - ); + context, + selectedLanguages: selectedLanguages, + title: AppLocalizations.of( + context, + ).add_basic_details_product_name_add_translation, + ); if (language != null) { provider.addLanguage(language); @@ -244,8 +270,8 @@ class _ProductNameInputWidgetState extends State<_ProductNameInputWidget> { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); final AppLocalizations appLocalizations = AppLocalizations.of(context); @@ -303,8 +329,9 @@ class _ProductNameInputWidgetState extends State<_ProductNameInputWidget> { textCapitalization: TextCapitalization.sentences, hintText: appLocalizations.add_basic_details_product_name_hint, - hintTextStyle: - SmoothTextFormField.defaultHintTextStyle(context), + hintTextStyle: SmoothTextFormField.defaultHintTextStyle( + context, + ), borderRadius: CIRCULAR_BORDER_RADIUS, contentPadding: const EdgeInsets.symmetric( horizontal: LARGE_SPACE, @@ -317,9 +344,7 @@ class _ProductNameInputWidgetState extends State<_ProductNameInputWidget> { const SizedBox(width: 2.0), if (widget.productName.hasPhoto || _photoTaken) IconButton( - icon: icons.Picture.check( - color: extension.success, - ), + icon: icons.Picture.check(color: extension.success), tooltip: appLocalizations .add_basic_details_product_name_open_photo, onPressed: widget.onShowImagePreview, @@ -334,7 +359,7 @@ class _ProductNameInputWidgetState extends State<_ProductNameInputWidget> { tooltip: appLocalizations .add_basic_details_product_name_take_photo, onPressed: () => _takePicture(context), - ) + ), ], ), ), @@ -359,23 +384,25 @@ class _ProductNameInputWidgetState extends State<_ProductNameInputWidget> { } class _ProductNameCollapsedSection extends StatelessWidget { - const _ProductNameCollapsedSection({ - required this.onTap, - }); + const _ProductNameCollapsedSection({required this.onTap}); final VoidCallback onTap; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); - final _ProductNameEditorProviderState state = - context.watch().value; - final int count = state.productNames.length - - (math.min(state.productNames.length, - _AddProductNameInputWidgetState.MIN_COLLAPSED_COUNT) + + final _ProductNameEditorProviderState state = context + .watch() + .value; + final int count = + state.productNames.length - + (math.min( + state.productNames.length, + _AddProductNameInputWidgetState.MIN_COLLAPSED_COUNT, + ) + state.addedLanguages.length); return Column( @@ -406,9 +433,7 @@ class _ProductNameCollapsedSection extends StatelessWidget { bottomRight: ROUNDED_RADIUS, ), child: Padding( - padding: const EdgeInsets.symmetric( - vertical: SMALL_SPACE, - ), + padding: const EdgeInsets.symmetric(vertical: SMALL_SPACE), child: icons.AppIconTheme( color: lightTheme ? extension.greyMedium @@ -420,8 +445,9 @@ class _ProductNameCollapsedSection extends StatelessWidget { const icons.DoubleChevron.down(), const SizedBox(width: SMALL_SPACE), Text( - AppLocalizations.of(context) - .add_basic_details_product_name_other_translations( + AppLocalizations.of( + context, + ).add_basic_details_product_name_other_translations( count, ), textAlign: TextAlign.center, @@ -520,8 +546,8 @@ class _ProductNameNewTranslationWarningState return EMPTY_WIDGET; } - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); double? height; @@ -574,8 +600,9 @@ class _ProductNameNewTranslationWarningState children: [ Expanded( child: TextWithBoldParts( - text: AppLocalizations.of(context) - .add_basic_details_product_name_warning_translations, + text: AppLocalizations.of( + context, + ).add_basic_details_product_name_warning_translations, textStyle: const TextStyle(height: 1.6), ), ), @@ -590,14 +617,16 @@ class _ProductNameNewTranslationWarningState child: Material( type: MaterialType.transparency, child: Tooltip( - message: MaterialLocalizations.of(context) - .closeButtonTooltip, + message: MaterialLocalizations.of( + context, + ).closeButtonTooltip, child: InkWell( customBorder: const CircleBorder(), onTap: _startAnimation, child: const Padding( - padding: - EdgeInsetsDirectional.all(SMALL_SPACE), + padding: EdgeInsetsDirectional.all( + SMALL_SPACE, + ), child: icons.Close( size: 10.0, color: Colors.white, @@ -624,16 +653,17 @@ class _ProductNameNewTranslationWarningState return; } - _controller = AnimationController( - duration: SmoothAnimationsDuration.medium, - vsync: this, - ) - ..addListener(() => setState(() {})) - ..addStatusListener((final AnimationStatus status) { - if (status == AnimationStatus.completed) { - context.read().hideInputProductNameBanner(); - } - }); + _controller = + AnimationController( + duration: SmoothAnimationsDuration.medium, + vsync: this, + ) + ..addListener(() => setState(() {})) + ..addStatusListener((final AnimationStatus status) { + if (status == AnimationStatus.completed) { + context.read().hideInputProductNameBanner(); + } + }); _animation = Tween(begin: 0.0, end: _size!.height).animate( CurvedAnimation(curve: Curves.easeInOutCubic, parent: _controller!), ); @@ -649,10 +679,7 @@ class _ProductNameNewTranslationWarningState class ProductNameEditorProvider extends ValueNotifier<_ProductNameEditorProviderState> { - ProductNameEditorProvider() - : super( - _ProductNameEditorProviderState.init(), - ); + ProductNameEditorProvider() : super(_ProductNameEditorProviderState.init()); void loadLanguages({ required final Product product, @@ -668,8 +695,9 @@ class ProductNameEditorProvider product.productNameInLanguages; if (multilingualTexts != null) { for (final OpenFoodFactsLanguage language in multilingualTexts.keys) { - final String name = - MultilingualHelper.getCleanText(multilingualTexts[language]); + final String name = MultilingualHelper.getCleanText( + multilingualTexts[language], + ); if (name.isNotEmpty) { localizedNames[language] = name; } @@ -681,8 +709,10 @@ class ProductNameEditorProvider for (final ProductImage image in product.images!) { if (image.field == imageField) { if (image.language != null && - !productNames.any((final _EditingProductName productName) => - productName.language == image.language)) { + !productNames.any( + (final _EditingProductName productName) => + productName.language == image.language, + )) { final OpenFoodFactsLanguage language = image.language!; if (localizedNames.containsKey(language)) { @@ -709,8 +739,10 @@ class ProductNameEditorProvider /// Add existing languages without photo for (final OpenFoodFactsLanguage language in localizedNames.keys) { - if (!productNames.any((final _EditingProductName productName) => - productName.language == language)) { + if (!productNames.any( + (final _EditingProductName productName) => + productName.language == language, + )) { productNames.add( _EditingProductName.initial( language: language, @@ -723,8 +755,10 @@ class ProductNameEditorProvider /// Add user language if (userLanguage != null) { - if (!productNames.any((final _EditingProductName productName) => - productName.language == userLanguage)) { + if (!productNames.any( + (final _EditingProductName productName) => + productName.language == userLanguage, + )) { productNames.add( _EditingProductName.initial( language: userLanguage, @@ -736,26 +770,26 @@ class ProductNameEditorProvider } final OpenFoodFactsLanguage? productLanguage = product.lang; - productNames.sort( - (final _EditingProductName a, final _EditingProductName b) { - // Product language is always first - if (a.language == productLanguage) { - return -1; - } else if (b.language == productLanguage) { - return 1; - } + productNames.sort(( + final _EditingProductName a, + final _EditingProductName b, + ) { + // Product language is always first + if (a.language == productLanguage) { + return -1; + } else if (b.language == productLanguage) { + return 1; + } - // Then user language - if (a.language == userLanguage && b.language != productLanguage) { - return -1; - } else if (b.language == userLanguage && - a.language != productLanguage) { - return 1; - } + // Then user language + if (a.language == userLanguage && b.language != productLanguage) { + return -1; + } else if (b.language == userLanguage && a.language != productLanguage) { + return 1; + } - return a.language.offTag.compareTo(b.language.offTag); - }, - ); + return a.language.offTag.compareTo(b.language.offTag); + }); value = _ProductNameEditorProviderState( productNames: productNames, @@ -781,10 +815,7 @@ class ProductNameEditorProvider ); } - void onNameChanged( - OpenFoodFactsLanguage language, - String name, - ) { + void onNameChanged(OpenFoodFactsLanguage language, String name) { final List<_EditingProductName> productNames = value.productNames; final int index = productNames.indexWhere( (final _EditingProductName productName) => @@ -839,8 +870,8 @@ class _ProductNameEditorProviderState { }); _ProductNameEditorProviderState.init() - : productNames = <_EditingProductName>[], - addedLanguages = []; + : productNames = <_EditingProductName>[], + addedLanguages = []; final List<_EditingProductName> productNames; final List addedLanguages; @@ -859,11 +890,11 @@ class _EditingProductName { required String initialName, required bool hasPhoto, }) : this( - language: language, - initialName: initialName, - name: initialName, - hasPhoto: hasPhoto, - ); + language: language, + initialName: initialName, + name: initialName, + hasPhoto: hasPhoto, + ); final OpenFoodFactsLanguage language; final String initialName; diff --git a/packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_page.dart b/packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_page.dart index b685b9eb51..19b30adfc6 100644 --- a/packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_page.dart +++ b/packages/smooth_app/lib/pages/product/add_basic_details/add_basic_details_page.dart @@ -31,10 +31,7 @@ import 'package:smooth_app/widgets/will_pop_scope.dart'; /// The product name input is either monolingual or multilingual, depending on /// the product data version. class AddBasicDetailsPage extends StatefulWidget { - const AddBasicDetailsPage( - this.product, { - required this.isLoggedInMandatory, - }); + const AddBasicDetailsPage(this.product, {required this.isLoggedInMandatory}); final Product product; final bool isLoggedInMandatory; @@ -107,12 +104,9 @@ class _AddBasicDetailsPageState extends State { ), ), bottomNavigationBar: ProductBottomButtonsBar( - onSave: () async => _exitPage( - await _mayExitPage(saving: true), - ), - onCancel: () async => _exitPage( - await _mayExitPage(saving: false), - ), + onSave: () async => _exitPage(await _mayExitPage(saving: true)), + onCancel: () async => + _exitPage(await _mayExitPage(saving: false)), ), ), ), @@ -155,8 +149,8 @@ class _AddBasicDetailsPageState extends State { product: widget.product, onShowImagePreview: (_, OpenFoodFactsLanguage language) => setState(() { - _imageLanguagePreview = language; - }), + _imageLanguagePreview = language; + }), ), SizedBox(height: _heightSpace), _ProductBrandsInputWidget( @@ -197,8 +191,8 @@ class _AddBasicDetailsPageState extends State { } if (!saving) { - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog(context); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog(context); if (pleaseSave == null) { _brandsHelper.restoreItemsBeforeLastAddition(); return false; @@ -241,9 +235,7 @@ class _AddBasicDetailsPageState extends State { } void _onValueChanged() { - onNextFrame( - () => _willPopScope2Controller.canPop(!_hasProductChanged()), - ); + onNextFrame(() => _willPopScope2Controller.canPop(!_hasProductChanged())); } bool _hasProductChanged() => @@ -272,8 +264,8 @@ class _AddBasicDetailsPageState extends State { if (_productNameEditorProvider.hasChanged()) { hasChanged = true; - result.productNameInLanguages = - _productNameEditorProvider.getChangedProductNames(); + result.productNameInLanguages = _productNameEditorProvider + .getChangedProductNames(); } if (hasChanged) { @@ -286,8 +278,7 @@ class _AddBasicDetailsPageState extends State { bool _isOwnerField( final ProductField productField, { final OpenFoodFactsLanguage? language, - }) => - _product.hasOwnerField(productField, language: language); + }) => _product.hasOwnerField(productField, language: language); } class _ProductBrandsInputWidget extends StatelessWidget { diff --git a/packages/smooth_app/lib/pages/product/add_new_product/add_new_product_page.dart b/packages/smooth_app/lib/pages/product/add_new_product/add_new_product_page.dart index 61234bc525..1a7bb1de54 100644 --- a/packages/smooth_app/lib/pages/product/add_new_product/add_new_product_page.dart +++ b/packages/smooth_app/lib/pages/product/add_new_product/add_new_product_page.dart @@ -39,40 +39,39 @@ import 'package:smooth_app/widgets/will_pop_scope.dart'; /// "Create a product we couldn't find on the server" page. class AddNewProductPage extends StatefulWidget { AddNewProductPage.fromBarcode(final String barcode) - : assert(barcode != ''), - product = Product(barcode: barcode), - events = const { - EditProductAction.openPage: AnalyticsEvent.openNewProductPage, - EditProductAction.leaveEmpty: AnalyticsEvent.closeEmptyNewProductPage, - EditProductAction.ingredients: - AnalyticsEvent.ingredientsNewProductPage, - EditProductAction.category: AnalyticsEvent.categoriesNewProductPage, - EditProductAction.nutritionFacts: - AnalyticsEvent.nutritionNewProductPage, - }, - displayProductType = true, - displayPictures = true, - displayMisc = true, - isLoggedInMandatory = false; + : assert(barcode != ''), + product = Product(barcode: barcode), + events = const { + EditProductAction.openPage: AnalyticsEvent.openNewProductPage, + EditProductAction.leaveEmpty: AnalyticsEvent.closeEmptyNewProductPage, + EditProductAction.ingredients: AnalyticsEvent.ingredientsNewProductPage, + EditProductAction.category: AnalyticsEvent.categoriesNewProductPage, + EditProductAction.nutritionFacts: + AnalyticsEvent.nutritionNewProductPage, + }, + displayProductType = true, + displayPictures = true, + displayMisc = true, + isLoggedInMandatory = false; const AddNewProductPage.fromProduct( this.product, { required this.isLoggedInMandatory, - }) : events = const { - EditProductAction.openPage: - AnalyticsEvent.openFastTrackProductEditPage, - EditProductAction.leaveEmpty: - AnalyticsEvent.closeEmptyFastTrackProductPage, - EditProductAction.ingredients: - AnalyticsEvent.ingredientsFastTrackProductPage, - EditProductAction.category: - AnalyticsEvent.categoriesFastTrackProductPage, - EditProductAction.nutritionFacts: - AnalyticsEvent.nutritionFastTrackProductPage, - }, - displayProductType = false, - displayPictures = false, - displayMisc = false; + }) : events = const { + EditProductAction.openPage: + AnalyticsEvent.openFastTrackProductEditPage, + EditProductAction.leaveEmpty: + AnalyticsEvent.closeEmptyFastTrackProductPage, + EditProductAction.ingredients: + AnalyticsEvent.ingredientsFastTrackProductPage, + EditProductAction.category: + AnalyticsEvent.categoriesFastTrackProductPage, + EditProductAction.nutritionFacts: + AnalyticsEvent.nutritionFastTrackProductPage, + }, + displayProductType = false, + displayPictures = false, + displayMisc = false; final Product product; final bool displayProductType; @@ -116,12 +115,15 @@ class _AddNewProductPageState extends State final ProductFieldEditor _packagingEditor = ProductFieldPackagingEditor(); final ProductFieldEditor _ingredientsEditor = ProductFieldOcrIngredientEditor(); - final ProductFieldEditor _originEditor = - ProductFieldSimpleEditor(SimpleInputPageOriginHelper()); - final ProductFieldEditor _categoryEditor = - ProductFieldSimpleEditor(SimpleInputPageCategoryHelper()); - final ProductFieldEditor _labelEditor = - ProductFieldSimpleEditor(SimpleInputPageLabelHelper()); + final ProductFieldEditor _originEditor = ProductFieldSimpleEditor( + SimpleInputPageOriginHelper(), + ); + final ProductFieldEditor _categoryEditor = ProductFieldSimpleEditor( + SimpleInputPageCategoryHelper(), + ); + final ProductFieldEditor _labelEditor = ProductFieldSimpleEditor( + SimpleInputPageLabelHelper(), + ); final ProductFieldEditor _detailsEditor = ProductFieldDetailsEditor(); final ProductFieldEditor _nutritionEditor = ProductFieldNutritionEditor(); late final List _editors; @@ -246,8 +248,8 @@ class _AddNewProductPageState extends State tracker.track(); } - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return WillPopScope2( @@ -293,8 +295,8 @@ class _AddNewProductPageState extends State controller: _pageController, physics: widget.displayProductType && _inputProductType == null - ? const NeverScrollableScrollPhysics() - : null, + ? const NeverScrollableScrollPhysics() + : null, children: [ if (widget.displayProductType) _buildCard(_getProductTypes(context)), @@ -365,18 +367,15 @@ class _AddNewProductPageState extends State return false; } - Widget _buildCard( - final List children, - ) => - SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(LARGE_SPACE), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: children, - ), - ), - ); + Widget _buildCard(final List children) => SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(LARGE_SPACE), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: children, + ), + ), + ); Attribute? _getAttribute(final String tag) => upToDateProduct.getAttributes([tag])[tag]; @@ -412,8 +411,9 @@ class _AddNewProductPageState extends State }, ), positiveButton: SmoothActionButton2( - text: - _isLastPage ? appLocalizations.finish : appLocalizations.next_label, + text: _isLastPage + ? appLocalizations.finish + : appLocalizations.next_label, onPressed: () async { if (_isLastPage) { Navigator.of(context).pop(); @@ -425,9 +425,7 @@ class _AddNewProductPageState extends State context: context, builder: (final BuildContext context) => SmoothAlertDialog( title: appLocalizations.product_type_selection_title, - body: Text( - appLocalizations.product_type_selection_empty, - ), + body: Text(appLocalizations.product_type_selection_empty), positiveAction: SmoothActionButton( text: appLocalizations.okay, onPressed: () => Navigator.of(context).pop(), @@ -469,16 +467,17 @@ class _AddNewProductPageState extends State !_categoryEditor.isPopulated(upToDateProduct) ? null : () async => NutritionPageLoader.showNutritionPage( - product: upToDateProduct, - isLoggedInMandatory: widget.isLoggedInMandatory, - context: context, - ), + product: upToDateProduct, + isLoggedInMandatory: widget.isLoggedInMandatory, + context: context, + ), done: _nutritionEditor.isPopulated(upToDateProduct), ), _buildIngredientsButton( context, forceIconData: Icons.filter_3, - disabled: (!_categoryEditor.isPopulated(upToDateProduct)) || + disabled: + (!_categoryEditor.isPopulated(upToDateProduct)) || (!_nutritionEditor.isPopulated(upToDateProduct)), ), Center( @@ -492,14 +491,15 @@ class _AddNewProductPageState extends State List _getEnvironmentalScoreRows(final BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final Attribute? attribute = _getAttribute(Attribute.ATTRIBUTE_ECOSCORE); return [ const SizedBox(height: 15.0), AddNewProductSubTitle( - appLocalizations.new_product_subtitle_environmental_score), + appLocalizations.new_product_subtitle_environmental_score, + ), const SizedBox(height: 15.0), _buildCategoriesButton(context), Center( @@ -513,7 +513,8 @@ class _AddNewProductPageState extends State borderRadius: ROUNDED_BORDER_RADIUS, onTap: () { setState( - () => _environmentalScoreExpanded = !_environmentalScoreExpanded); + () => _environmentalScoreExpanded = !_environmentalScoreExpanded, + ); }, child: Ink( padding: const EdgeInsets.symmetric( @@ -528,17 +529,12 @@ class _AddNewProductPageState extends State ), child: Row( children: [ - Icon( - Icons.filter_2, - color: _colorScheme.onPrimary, - ), + Icon(Icons.filter_2, color: _colorScheme.onPrimary), const SizedBox(width: 15.0), Flexible( child: Text( appLocalizations.new_product_additional_environmental_score, - style: TextStyle( - color: _colorScheme.onPrimary, - ), + style: TextStyle(color: _colorScheme.onPrimary), ), ), const SizedBox(width: 5.0), @@ -600,7 +596,7 @@ class _AddNewProductPageState extends State appLocalizations.new_product_desc_nova_unknown, maxLines: 5, ), - ) + ), ], ), ]; @@ -652,7 +648,8 @@ class _AddNewProductPageState extends State rows.add(const SizedBox(height: 15.0)); rows.add( AddNewProductSubTitle( - appLocalizations.new_product_title_pictures_details), + appLocalizations.new_product_title_pictures_details, + ), ); // Main images first. @@ -682,29 +679,27 @@ class _AddNewProductPageState extends State Widget _buildOtherImageButton( final BuildContext context, { required final bool done, - }) => - AddNewProductButton( - ImageField.OTHER.getAddPhotoButtonText(AppLocalizations.of(context)), - done - ? AddNewProductButton.doneIconData - : AddNewProductButton.cameraIconData, - () async { - final CropParameters? cropParameters = - await confirmAndUploadNewPicture( - context, - barcode: barcode, - productType: upToDateProduct.productType, - imageField: ImageField.OTHER, - language: ProductQuery.getLanguage(), - isLoggedInMandatory: widget.isLoggedInMandatory, - ); - if (cropParameters != null) { - setState(() => ++_otherCount); - } - }, - done: done, - showTrailing: false, + }) => AddNewProductButton( + ImageField.OTHER.getAddPhotoButtonText(AppLocalizations.of(context)), + done + ? AddNewProductButton.doneIconData + : AddNewProductButton.cameraIconData, + () async { + final CropParameters? cropParameters = await confirmAndUploadNewPicture( + context, + barcode: barcode, + productType: upToDateProduct.productType, + imageField: ImageField.OTHER, + language: ProductQuery.getLanguage(), + isLoggedInMandatory: widget.isLoggedInMandatory, ); + if (cropParameters != null) { + setState(() => ++_otherCount); + } + }, + done: done, + showTrailing: false, + ); /// Button specific to one of the main 4 images. Widget _buildMainImageButton( @@ -714,8 +709,9 @@ class _AddNewProductPageState extends State ) { final bool done = _helper.isMainImagePopulated(productImageData, product); return AddNewProductButton( - productImageData.imageField - .getAddPhotoButtonText(AppLocalizations.of(context)), + productImageData.imageField.getAddPhotoButtonText( + AppLocalizations.of(context), + ), done ? AddNewProductButton.doneIconData : AddNewProductButton.cameraIconData, @@ -743,11 +739,9 @@ class _AddNewProductPageState extends State ); List _getMiscRows(final BuildContext context) => [ - AddNewProductTitle( - AppLocalizations.of(context).new_product_title_misc, - ), - _buildDetailsButton(context), - ]; + AddNewProductTitle(AppLocalizations.of(context).new_product_title_misc), + _buildDetailsButton(context), + ]; Widget _buildDetailsButton(final BuildContext context) => AddNewProductEditorButton( @@ -760,12 +754,11 @@ class _AddNewProductPageState extends State final BuildContext context, { final IconData? forceIconData, final bool disabled = false, - }) => - AddNewProductEditorButton( - upToDateProduct, - _ingredientsEditor, - forceIconData: forceIconData, - disabled: disabled, - isLoggedInMandatory: widget.isLoggedInMandatory, - ); + }) => AddNewProductEditorButton( + upToDateProduct, + _ingredientsEditor, + forceIconData: forceIconData, + disabled: disabled, + isLoggedInMandatory: widget.isLoggedInMandatory, + ); } diff --git a/packages/smooth_app/lib/pages/product/add_new_product/product_type_radio_list_tile.dart b/packages/smooth_app/lib/pages/product/add_new_product/product_type_radio_list_tile.dart index 365a62166f..9fc2857692 100644 --- a/packages/smooth_app/lib/pages/product/add_new_product/product_type_radio_list_tile.dart +++ b/packages/smooth_app/lib/pages/product/add_new_product/product_type_radio_list_tile.dart @@ -60,8 +60,9 @@ class _ProductTypeRadioListTile extends State final bool lightTheme = context.lightTheme(); _initAnimationsIfNecessary(lightTheme); - final SmoothColorsThemeExtension theme = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension theme = Theme.of( + context, + ).extension()!; return Semantics( label: @@ -121,9 +122,7 @@ class _ProductTypeRadioListTile extends State ), child: Opacity( opacity: _opacityAnimation.value, - child: const icons.Check( - size: 9.0, - ), + child: const icons.Check(size: 9.0), ), ), const SizedBox(width: MEDIUM_SPACE), @@ -157,7 +156,7 @@ class _ProductTypeRadioListTile extends State ], ), ), - ) + ), ], ), ), @@ -182,14 +181,17 @@ class _ProductTypeRadioListTile extends State final ThemeData themeData = Theme.of(context); - _colorAnimation = ColorTween( - begin: themeData.scaffoldBackgroundColor.withValues(alpha: 0.0), - end: lightTheme - ? themeData.extension()!.primaryMedium - : themeData.extension()!.primarySemiDark, - ).animate( - CurvedAnimation(parent: _controller!, curve: Curves.fastOutSlowIn), - ); + _colorAnimation = + ColorTween( + begin: themeData.scaffoldBackgroundColor.withValues(alpha: 0.0), + end: lightTheme + ? themeData.extension()!.primaryMedium + : themeData + .extension()! + .primarySemiDark, + ).animate( + CurvedAnimation(parent: _controller!, curve: Curves.fastOutSlowIn), + ); _opacityAnimation = Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation(parent: _controller!, curve: Curves.fastOutSlowIn), diff --git a/packages/smooth_app/lib/pages/product/add_new_product_helper.dart b/packages/smooth_app/lib/pages/product/add_new_product_helper.dart index 312a2254d5..eb64a89061 100644 --- a/packages/smooth_app/lib/pages/product/add_new_product_helper.dart +++ b/packages/smooth_app/lib/pages/product/add_new_product_helper.dart @@ -42,23 +42,20 @@ class AnalyticsProductTracker { /// Card title for "Add new product" page. class AddNewProductTitle extends StatelessWidget { - const AddNewProductTitle( - this.label, { - this.maxLines, - }); + const AddNewProductTitle(this.label, {this.maxLines}); final String label; final int? maxLines; @override Widget build(BuildContext context) => Text( - label, - style: Theme.of(context).textTheme.displaySmall?.copyWith( - fontSize: 18.0, - fontWeight: FontWeight.bold, - ), - maxLines: maxLines, - ); + label, + style: Theme.of(context).textTheme.displaySmall?.copyWith( + fontSize: 18.0, + fontWeight: FontWeight.bold, + ), + maxLines: maxLines, + ); } /// Card subtitle for "Add new product" page. @@ -107,13 +104,13 @@ class AddNewProductButton extends StatelessWidget { backgroundColor: onPressed == null ? (dark ? darkGrey : lightGrey) : done - ? Colors.green[700] - : themeData.colorScheme.secondary, + ? Colors.green[700] + : themeData.colorScheme.secondary, foregroundColor: onPressed == null ? (dark ? lightGrey : darkGrey) : done - ? Colors.white - : themeData.colorScheme.onSecondary, + ? Colors.white + : themeData.colorScheme.onSecondary, ), ); } @@ -147,10 +144,10 @@ class AddNewProductEditorButton extends StatelessWidget { disabled ? null : () async => editor.edit( - context: context, - product: product, - isLoggedInMandatory: isLoggedInMandatory, - ), + context: context, + product: product, + isLoggedInMandatory: isLoggedInMandatory, + ), done: done, ); } @@ -172,24 +169,16 @@ class AddNewProductScoreIcon extends StatelessWidget { final double height = MediaQuery.sizeOf(context).height * .2; if (fileName.startsWith('nutriscore')) { - return _AddNewProductNutriScoreIcon( - fileName: fileName, - height: height, - ); + return _AddNewProductNutriScoreIcon(fileName: fileName, height: height); } else { - return SvgIconChip( - iconUrl ?? defaultIconUrl, - height: height, - ); + return SvgIconChip(iconUrl ?? defaultIconUrl, height: height); } } } class _AddNewProductNutriScoreIcon extends StatelessWidget { - _AddNewProductNutriScoreIcon({ - required String fileName, - required this.height, - }) : nutriScore = extractValue(fileName); + _AddNewProductNutriScoreIcon({required String fileName, required this.height}) + : nutriScore = extractValue(fileName); final NutriScoreValue nutriScore; final double height; @@ -225,10 +214,7 @@ class AddNewProductHelper { final ProductImageData productImageData, final Product product, ) => - getProductImageLanguages( - product, - productImageData.imageField, - ).isNotEmpty; + getProductImageLanguages(product, productImageData.imageField).isNotEmpty; bool isOneMainImagePopulated(final Product product) { final List productImagesData = getProductMainImagesData( @@ -251,5 +237,5 @@ enum EditProductAction { leaveEmpty, ingredients, category, - nutritionFacts; + nutritionFacts, } diff --git a/packages/smooth_app/lib/pages/product/add_nutrition_button.dart b/packages/smooth_app/lib/pages/product/add_nutrition_button.dart index 206e00ffee..0055920245 100644 --- a/packages/smooth_app/lib/pages/product/add_nutrition_button.dart +++ b/packages/smooth_app/lib/pages/product/add_nutrition_button.dart @@ -16,11 +16,11 @@ class AddNutritionButton extends StatelessWidget { @override Widget build(BuildContext context) => addPanelButton( - AppLocalizations.of(context).score_add_missing_nutrition_facts, - onPressed: () async => NutritionPageLoader.showNutritionPage( - product: product, - isLoggedInMandatory: true, - context: context, - ), - ); + AppLocalizations.of(context).score_add_missing_nutrition_facts, + onPressed: () async => NutritionPageLoader.showNutritionPage( + product: product, + isLoggedInMandatory: true, + context: context, + ), + ); } diff --git a/packages/smooth_app/lib/pages/product/add_ocr_button.dart b/packages/smooth_app/lib/pages/product/add_ocr_button.dart index f4c043e5d9..ce7405b13f 100644 --- a/packages/smooth_app/lib/pages/product/add_ocr_button.dart +++ b/packages/smooth_app/lib/pages/product/add_ocr_button.dart @@ -6,17 +6,14 @@ import 'package:smooth_app/pages/product/product_field_editor.dart'; /// "Add OCR image" button for user contribution. class AddOcrButton extends StatelessWidget { - const AddOcrButton({ - required this.product, - required this.editor, - }); + const AddOcrButton({required this.product, required this.editor}); final Product product; final ProductFieldOcrEditor editor; @override Widget build(BuildContext context) => addPanelButton( - editor.getLabel(AppLocalizations.of(context)), - onPressed: () async => editor.edit(context: context, product: product), - ); + editor.getLabel(AppLocalizations.of(context)), + onPressed: () async => editor.edit(context: context, product: product), + ); } diff --git a/packages/smooth_app/lib/pages/product/add_other_details_page.dart b/packages/smooth_app/lib/pages/product/add_other_details_page.dart index d2638f16be..3997259f82 100644 --- a/packages/smooth_app/lib/pages/product/add_other_details_page.dart +++ b/packages/smooth_app/lib/pages/product/add_other_details_page.dart @@ -17,9 +17,7 @@ import 'package:smooth_app/widgets/will_pop_scope.dart'; /// Input of a product's less significant details, like website. class AddOtherDetailsPage extends StatefulWidget { - const AddOtherDetailsPage( - this.product, - ); + const AddOtherDetailsPage(this.product); final Product product; @@ -67,9 +65,9 @@ class _AddOtherDetailsPageState extends State { product: widget.product, ), backgroundColor: context.lightTheme() - ? Theme.of(context) - .extension()! - .primaryLight + ? Theme.of( + context, + ).extension()!.primaryLight : null, body: Form( key: _formKey, @@ -107,12 +105,8 @@ class _AddOtherDetailsPageState extends State { ), ), bottomNavigationBar: ProductBottomButtonsBar( - onSave: () async => _exitPage( - await _mayExitPage(saving: true), - ), - onCancel: () async => _exitPage( - await _mayExitPage(saving: false), - ), + onSave: () async => _exitPage(await _mayExitPage(saving: true)), + onCancel: () async => _exitPage(await _mayExitPage(saving: false)), ), ), ); @@ -138,8 +132,8 @@ class _AddOtherDetailsPageState extends State { } if (!saving) { - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog(context); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog(context); if (pleaseSave == null) { return false; } diff --git a/packages/smooth_app/lib/pages/product/add_packaging_button.dart b/packages/smooth_app/lib/pages/product/add_packaging_button.dart index 5a742b986d..fc6dedc6aa 100644 --- a/packages/smooth_app/lib/pages/product/add_packaging_button.dart +++ b/packages/smooth_app/lib/pages/product/add_packaging_button.dart @@ -6,9 +6,7 @@ import 'package:smooth_app/pages/product/product_field_editor.dart'; /// "Add (new) packaging" button for user contribution. class AddPackagingButton extends StatelessWidget { - AddPackagingButton({ - required this.product, - }); + AddPackagingButton({required this.product}); final Product product; @@ -16,11 +14,11 @@ class AddPackagingButton extends StatelessWidget { @override Widget build(BuildContext context) => addPanelButton( - _editor.getLabel(AppLocalizations.of(context)), - onPressed: () async => _editor.edit( - context: context, - product: product, - isLoggedInMandatory: true, - ), - ); + _editor.getLabel(AppLocalizations.of(context)), + onPressed: () async => _editor.edit( + context: context, + product: product, + isLoggedInMandatory: true, + ), + ); } diff --git a/packages/smooth_app/lib/pages/product/add_simple_input_button.dart b/packages/smooth_app/lib/pages/product/add_simple_input_button.dart index dfc5d5848a..6284309e35 100644 --- a/packages/smooth_app/lib/pages/product/add_simple_input_button.dart +++ b/packages/smooth_app/lib/pages/product/add_simple_input_button.dart @@ -7,21 +7,16 @@ import 'package:smooth_app/pages/product/simple_input/simple_input_page_helpers. /// "Add simple input" button for user contribution. class AddSimpleInputButton extends StatelessWidget { - const AddSimpleInputButton({ - required this.product, - required this.helper, - }); + const AddSimpleInputButton({required this.product, required this.helper}); final Product product; final AbstractSimpleInputPageHelper helper; @override Widget build(BuildContext context) => addPanelButton( - helper.getAddButtonLabel(AppLocalizations.of(context)), - onPressed: () async => ProductFieldSimpleEditor(helper).edit( - isLoggedInMandatory: true, - context: context, - product: product, - ), - ); + helper.getAddButtonLabel(AppLocalizations.of(context)), + onPressed: () async => ProductFieldSimpleEditor( + helper, + ).edit(isLoggedInMandatory: true, context: context, product: product), + ); } diff --git a/packages/smooth_app/lib/pages/product/attribute_extensions.dart b/packages/smooth_app/lib/pages/product/attribute_extensions.dart index f53090a4e3..3a67affe04 100644 --- a/packages/smooth_app/lib/pages/product/attribute_extensions.dart +++ b/packages/smooth_app/lib/pages/product/attribute_extensions.dart @@ -13,158 +13,158 @@ extension AttributeExtensions on Attribute { }) { return switch (id) { 'additives' => FoodIcons.additives( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_celery' => FoodIcons.celery( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_crustaceans' => FoodIcons.crustaceans( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_eggs' => FoodIcons.eggs( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_fish' => FoodIcons.fish( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_gluten' => FoodIcons.gluten( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_lupin' => FoodIcons.lupin( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_milk' => FoodIcons.milk( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_molluscs' => FoodIcons.molluscs( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_mustard' => FoodIcons.mustard( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_nuts' => FoodIcons.nuts( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_peanuts' => FoodIcons.peanuts( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_sesame_seeds' => FoodIcons.sesameSeeds( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_soybeans' => FoodIcons.soybeans( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'allergens_no_sulphur_dioxide_and_sulphites' => FoodIcons.sulphites( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'ecoscore' => EMPTY_WIDGET, 'forest_footprint' => FoodIcons.forestFootprint( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'labels_fair_trade' => FoodIcons.fairTrade( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'labels_organic' => FoodIcons.organicFarming( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'low_fat' => FoodIcons.fat( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'low_salt' => FoodIcons.salt( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'low_saturated_fat' => FoodIcons.saturatedFat( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'low_sugars' => FoodIcons.sugar( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'nova' => EMPTY_WIDGET, 'nutriscore' => EMPTY_WIDGET, 'palm_oil_free' => FoodIcons.palmOil( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'vegan' => FoodIcons.vegan( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), 'vegetarian' => FoodIcons.vegetarian( - color: color, - size: size, - shadow: shadow, - semanticLabel: semanticLabel, - ), + color: color, + size: size, + shadow: shadow, + semanticLabel: semanticLabel, + ), _ => throw UnimplementedError(), }; } diff --git a/packages/smooth_app/lib/pages/product/attribute_first_row_helper.dart b/packages/smooth_app/lib/pages/product/attribute_first_row_helper.dart index 64bb2792ba..52d400e019 100644 --- a/packages/smooth_app/lib/pages/product/attribute_first_row_helper.dart +++ b/packages/smooth_app/lib/pages/product/attribute_first_row_helper.dart @@ -9,10 +9,7 @@ import 'package:smooth_app/pages/product/product_field_editor.dart'; import 'package:smooth_app/pages/product/simple_input/simple_input_page_helpers.dart'; class StringPair { - const StringPair({ - required this.first, - this.second, - }); + const StringPair({required this.first, this.second}); final String first; final String? second; @@ -25,15 +22,11 @@ abstract class AttributeFirstRowHelper { String getTitle(BuildContext context); - Future onTap({ - required BuildContext context, - }); + Future onTap({required BuildContext context}); } class AttributeFirstRowSimpleHelper extends AttributeFirstRowHelper { - AttributeFirstRowSimpleHelper({ - required this.helper, - }); + AttributeFirstRowSimpleHelper({required this.helper}); final AbstractSimpleInputPageHelper helper; @@ -42,11 +35,7 @@ class AttributeFirstRowSimpleHelper extends AttributeFirstRowHelper { final List allTerms = []; for (final String element in helper.terms) { - allTerms.add( - StringPair( - first: element, - ), - ); + allTerms.add(StringPair(first: element)); } return allTerms; @@ -60,42 +49,33 @@ class AttributeFirstRowSimpleHelper extends AttributeFirstRowHelper { @override String getTitle(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - return helper.getTitle( - appLocalizations, - ); + return helper.getTitle(appLocalizations); } @override - Future onTap({ - required BuildContext context, - }) { - return ProductFieldSimpleEditor(helper).edit( - context: context, - product: helper.product, - ); + Future onTap({required BuildContext context}) { + return ProductFieldSimpleEditor( + helper, + ).edit(context: context, product: helper.product); } } class AttributeFirstRowNutritionHelper extends AttributeFirstRowHelper { - AttributeFirstRowNutritionHelper({ - required this.product, - }); + AttributeFirstRowNutritionHelper({required this.product}); final Product product; @override List getAllTerms() { final List allNutrients = []; - product.nutriments?.toData().forEach( - (String nutrientName, String quantity) { - allNutrients.add( - StringPair( - first: nutrientName.split('_100g')[0], - second: quantity, - ), - ); - }, - ); + product.nutriments?.toData().forEach(( + String nutrientName, + String quantity, + ) { + allNutrients.add( + StringPair(first: nutrientName.split('_100g')[0], second: quantity), + ); + }); return allNutrients; } @@ -115,9 +95,7 @@ class AttributeFirstRowNutritionHelper extends AttributeFirstRowHelper { } @override - Future onTap({ - required BuildContext context, - }) async { + Future onTap({required BuildContext context}) async { if (!await ProductRefresher().checkIfLoggedIn( context, isLoggedInMandatory: true, @@ -143,26 +121,18 @@ class AttributeFirstRowNutritionHelper extends AttributeFirstRowHelper { } class AttributeFirstRowIngredientsHelper extends AttributeFirstRowHelper { - AttributeFirstRowIngredientsHelper({ - required this.product, - }); + AttributeFirstRowIngredientsHelper({required this.product}); final Product product; @override List getAllTerms() { final List allIngredients = []; - product.ingredients?.forEach( - (Ingredient element) { - if (element.text != null) { - allIngredients.add( - StringPair( - first: element.text!, - ), - ); - } - }, - ); + product.ingredients?.forEach((Ingredient element) { + if (element.text != null) { + allIngredients.add(StringPair(first: element.text!)); + } + }); return allIngredients; } @@ -182,9 +152,7 @@ class AttributeFirstRowIngredientsHelper extends AttributeFirstRowHelper { } @override - Future onTap({ - required BuildContext context, - }) { + Future onTap({required BuildContext context}) { return ProductFieldOcrIngredientEditor().edit( context: context, product: product, diff --git a/packages/smooth_app/lib/pages/product/attribute_first_row_widget.dart b/packages/smooth_app/lib/pages/product/attribute_first_row_widget.dart index 5ea7cf9f5a..53c5e85a94 100644 --- a/packages/smooth_app/lib/pages/product/attribute_first_row_widget.dart +++ b/packages/smooth_app/lib/pages/product/attribute_first_row_widget.dart @@ -3,9 +3,7 @@ import 'package:smooth_app/l10n/app_localizations.dart'; import 'package:smooth_app/pages/product/attribute_first_row_helper.dart'; class AttributeFirstRowWidget extends StatefulWidget { - const AttributeFirstRowWidget({ - required this.helper, - }); + const AttributeFirstRowWidget({required this.helper}); final AttributeFirstRowHelper helper; @@ -30,27 +28,17 @@ class _AttributeFirstRowWidgetState extends State { final ThemeData theme = Theme.of(context); const int numberThreshold = 4; final bool hasManyTerms = allTerms.length > numberThreshold; - final List firstTerms = allTerms - .take( - numberThreshold, - ) - .toList(); + final List firstTerms = allTerms.take(numberThreshold).toList(); if (firstTerms.isEmpty) { - firstTerms.add( - StringPair(first: appLocalizations.no_data_available), - ); + firstTerms.add(StringPair(first: appLocalizations.no_data_available)); } return Column( children: [ ListTile( leading: widget.helper.getLeadingIcon(), - title: Text( - widget.helper.getTitle(context), - ), - trailing: const Icon( - Icons.edit, - ), + title: Text(widget.helper.getTitle(context)), + trailing: const Icon(Icons.edit), titleTextStyle: TextStyle( fontWeight: FontWeight.w500, fontSize: 20.0, @@ -73,21 +61,16 @@ class _AttributeFirstRowWidgetState extends State { }), title: const Text( 'Expand', - style: TextStyle( - decoration: TextDecoration.underline, - ), + style: TextStyle(decoration: TextDecoration.underline), ), ), - ) - ] + ), + ], ], ); } - Widget _termsList( - List terms, { - bool borderFlag = false, - }) { + Widget _termsList(List terms, {bool borderFlag = false}) { return ListView.builder( padding: const EdgeInsets.only(left: 100.0), itemCount: terms.length, @@ -100,11 +83,10 @@ class _AttributeFirstRowWidgetState extends State { ), shape: (index == terms.length - 1 && borderFlag) ? null - : const Border( - bottom: BorderSide(), - ), - trailing: - terms[index].second != null ? Text(terms[index].second!) : null, + : const Border(bottom: BorderSide()), + trailing: terms[index].second != null + ? Text(terms[index].second!) + : null, ); }, ); diff --git a/packages/smooth_app/lib/pages/product/attribute_icons.dart b/packages/smooth_app/lib/pages/product/attribute_icons.dart index 1df8781f78..bf53e818a8 100644 --- a/packages/smooth_app/lib/pages/product/attribute_icons.dart +++ b/packages/smooth_app/lib/pages/product/attribute_icons.dart @@ -14,137 +14,137 @@ abstract class AttributeIcon extends StatelessWidget { }) { return switch (attribute.id) { 'additives' => _AttributeAdditivesIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_celery' => _AttributeCeleryIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_crustaceans' => _AttributeCrustaceansIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_eggs' => _AttributeEggsIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_fish' => _AttributeFishIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_gluten' => _AttributeGlutenIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_lupin' => _AttributeLupinIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_milk' => _AttributeMilkIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_molluscs' => _AttributeMolluscsIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_mustard' => _AttributeMustardIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_nuts' => _AttributeNutsIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_peanuts' => _AttributePeanutsIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_sesame_seeds' => _AttributeSesameSeedsIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_soybeans' => _AttributeSoybeansIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'allergens_no_sulphur_dioxide_and_sulphites' => _AttributeSulphitesIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'forest_footprint' => _AttributeForestFootprintIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'labels_fair_trade' => _AttributeFairTradeIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'labels_organic' => _AttributeOrganicFarmingIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'low_fat' => _AttributeFatIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'low_salt' => _AttributeSaltIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'low_saturated_fat' => _AttributeSaturatedFatIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'low_sugars' => _AttributeSugarIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'nova' when attribute.iconUrl?.endsWith('nova-group-1.svg') == true => _AttributeNOVAIcon.group1( backgroundColor: backgroundColor, @@ -174,29 +174,29 @@ abstract class AttributeIcon extends StatelessWidget { semanticsLabel: semanticsLabel, ), 'nova' => _AttributeNOVAIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'palm_oil_free' => _AttributePalmOilIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'vegan' => _AttributeVeganIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), 'vegetarian' => _AttributeVegetarianIcon( - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - size: size, - semanticsLabel: semanticsLabel, - ), + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + size: size, + semanticsLabel: semanticsLabel, + ), /*'nutriscore' => EMPTY_WIDGET, 'ecoscore' => EMPTY_WIDGET,*/ @@ -249,10 +249,7 @@ abstract class AttributeIcon extends StatelessWidget { : EdgeInsets.zero, child: Transform.translate( offset: offsetFactor != null - ? Offset( - size * offsetFactor!.dx, - size * offsetFactor!.dy, - ) + ? Offset(size * offsetFactor!.dx, size * offsetFactor!.dy) : Offset.zero, child: AppIconTheme( color: foregroundColor, @@ -265,22 +262,14 @@ abstract class AttributeIcon extends StatelessWidget { ); if (angle != null) { - child = Transform.rotate( - angle: angle!, - child: child, - ); + child = Transform.rotate(angle: angle!, child: child); } if (clip == true) { - child = ClipOval( - child: child, - ); + child = ClipOval(child: child); } - return SizedBox.square( - dimension: size, - child: child, - ); + return SizedBox.square(dimension: size, child: child); } } @@ -291,10 +280,10 @@ class _AttributeAdditivesIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.additives(), - iconSizeFactor: 0.58, - paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.05), - ); + icon: const FoodIcons.additives(), + iconSizeFactor: 0.58, + paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.05), + ); } class _AttributeCeleryIcon extends AttributeIcon { @@ -304,12 +293,12 @@ class _AttributeCeleryIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.celery(), - iconSizeFactor: 0.95, - offsetFactor: const Offset(-0.1, 0.0), - clip: true, - paddingFactor: const EdgeInsetsDirectional.only(top: 0.15), - ); + icon: const FoodIcons.celery(), + iconSizeFactor: 0.95, + offsetFactor: const Offset(-0.1, 0.0), + clip: true, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.15), + ); } class _AttributeCrustaceansIcon extends AttributeIcon { @@ -319,11 +308,11 @@ class _AttributeCrustaceansIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.crustaceans(), - iconSizeFactor: 0.95, - clip: true, - paddingFactor: const EdgeInsetsDirectional.only(top: 0.18), - ); + icon: const FoodIcons.crustaceans(), + iconSizeFactor: 0.95, + clip: true, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.18), + ); } class _AttributeEggsIcon extends AttributeIcon { @@ -333,10 +322,10 @@ class _AttributeEggsIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.eggs(), - iconSizeFactor: 0.65, - paddingFactor: const EdgeInsetsDirectional.only(top: 0.01), - ); + icon: const FoodIcons.eggs(), + iconSizeFactor: 0.65, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.01), + ); } class _AttributeFishIcon extends AttributeIcon { @@ -346,13 +335,13 @@ class _AttributeFishIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.fish(), - iconSizeFactor: 0.75, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.06, - start: 0.02, - ), - ); + icon: const FoodIcons.fish(), + iconSizeFactor: 0.75, + paddingFactor: const EdgeInsetsDirectional.only( + top: 0.06, + start: 0.02, + ), + ); } class _AttributeGlutenIcon extends AttributeIcon { @@ -362,13 +351,10 @@ class _AttributeGlutenIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.gluten(), - iconSizeFactor: 0.6, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.04, - end: 0.01, - ), - ); + icon: const FoodIcons.gluten(), + iconSizeFactor: 0.6, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.04, end: 0.01), + ); } class _AttributeFairTradeIcon extends AttributeIcon { @@ -378,13 +364,13 @@ class _AttributeFairTradeIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.fairTrade(), - iconSizeFactor: 0.75, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.1, - start: 0.015, - ), - ); + icon: const FoodIcons.fairTrade(), + iconSizeFactor: 0.75, + paddingFactor: const EdgeInsetsDirectional.only( + top: 0.1, + start: 0.015, + ), + ); } class _AttributeFatIcon extends AttributeIcon { @@ -394,12 +380,10 @@ class _AttributeFatIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.fat(), - iconSizeFactor: 0.7, - paddingFactor: const EdgeInsetsDirectional.only( - end: 0.02, - ), - ); + icon: const FoodIcons.fat(), + iconSizeFactor: 0.7, + paddingFactor: const EdgeInsetsDirectional.only(end: 0.02), + ); } class _AttributeForestFootprintIcon extends AttributeIcon { @@ -408,10 +392,7 @@ class _AttributeForestFootprintIcon extends AttributeIcon { required super.size, super.foregroundColor, super.semanticsLabel, - }) : super._( - icon: const FoodIcons.forestFootprint(), - iconSizeFactor: 0.65, - ); + }) : super._(icon: const FoodIcons.forestFootprint(), iconSizeFactor: 0.65); } class _AttributeLupinIcon extends AttributeIcon { @@ -421,13 +402,13 @@ class _AttributeLupinIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.lupin(), - iconSizeFactor: 0.7, - paddingFactor: const EdgeInsetsDirectional.only( - start: 0.05, - top: 0.06, - ), - ); + icon: const FoodIcons.lupin(), + iconSizeFactor: 0.7, + paddingFactor: const EdgeInsetsDirectional.only( + start: 0.05, + top: 0.06, + ), + ); } class _AttributeMilkIcon extends AttributeIcon { @@ -437,13 +418,11 @@ class _AttributeMilkIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.milk(), - iconSizeFactor: 1.0, - clip: true, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.25, - ), - ); + icon: const FoodIcons.milk(), + iconSizeFactor: 1.0, + clip: true, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.25), + ); } class _AttributeMolluscsIcon extends AttributeIcon { @@ -452,10 +431,7 @@ class _AttributeMolluscsIcon extends AttributeIcon { required super.size, super.foregroundColor, super.semanticsLabel, - }) : super._( - icon: const FoodIcons.molluscs(), - iconSizeFactor: 0.65, - ); + }) : super._(icon: const FoodIcons.molluscs(), iconSizeFactor: 0.65); } class _AttributeMustardIcon extends AttributeIcon { @@ -465,16 +441,13 @@ class _AttributeMustardIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.mustard(), - iconSizeFactor: 1.2, - angle: math.pi / 6, - offsetFactor: const Offset(-0.1, 0.0), - clip: true, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.12, - end: 0.1, - ), - ); + icon: const FoodIcons.mustard(), + iconSizeFactor: 1.2, + angle: math.pi / 6, + offsetFactor: const Offset(-0.1, 0.0), + clip: true, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.12, end: 0.1), + ); } class _AttributeNutsIcon extends AttributeIcon { @@ -484,10 +457,10 @@ class _AttributeNutsIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.nuts(), - iconSizeFactor: 0.7, - paddingFactor: const EdgeInsetsDirectional.only(top: 0.005), - ); + icon: const FoodIcons.nuts(), + iconSizeFactor: 0.7, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.005), + ); } class _AttributeNOVAIcon extends AttributeIcon { @@ -496,10 +469,7 @@ class _AttributeNOVAIcon extends AttributeIcon { required super.size, super.foregroundColor, super.semanticsLabel, - }) : super._( - icon: const FoodIcons.nova(), - iconSizeFactor: 0.75, - ); + }) : super._(icon: const FoodIcons.nova(), iconSizeFactor: 0.75); const _AttributeNOVAIcon.group1({ required super.backgroundColor, @@ -507,13 +477,13 @@ class _AttributeNOVAIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.nova1(), - iconSizeFactor: 0.68, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.12, - start: 0.025, - ), - ); + icon: const FoodIcons.nova1(), + iconSizeFactor: 0.68, + paddingFactor: const EdgeInsetsDirectional.only( + top: 0.12, + start: 0.025, + ), + ); const _AttributeNOVAIcon.group2({ required super.backgroundColor, @@ -521,13 +491,13 @@ class _AttributeNOVAIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.nova2(), - iconSizeFactor: 0.64, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.05, - start: 0.025, - ), - ); + icon: const FoodIcons.nova2(), + iconSizeFactor: 0.64, + paddingFactor: const EdgeInsetsDirectional.only( + top: 0.05, + start: 0.025, + ), + ); const _AttributeNOVAIcon.group3({ required super.backgroundColor, @@ -535,13 +505,13 @@ class _AttributeNOVAIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.nova3(), - iconSizeFactor: 0.64, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.07, - start: 0.025, - ), - ); + icon: const FoodIcons.nova3(), + iconSizeFactor: 0.64, + paddingFactor: const EdgeInsetsDirectional.only( + top: 0.07, + start: 0.025, + ), + ); const _AttributeNOVAIcon.group4({ required super.backgroundColor, @@ -549,13 +519,13 @@ class _AttributeNOVAIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.nova4(), - iconSizeFactor: 0.64, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.07, - start: 0.02, - ), - ); + icon: const FoodIcons.nova4(), + iconSizeFactor: 0.64, + paddingFactor: const EdgeInsetsDirectional.only( + top: 0.07, + start: 0.02, + ), + ); } class _AttributeOrganicFarmingIcon extends AttributeIcon { @@ -565,11 +535,11 @@ class _AttributeOrganicFarmingIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.organicFarming(), - iconSizeFactor: 0.8, - clip: true, - paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.1), - ); + icon: const FoodIcons.organicFarming(), + iconSizeFactor: 0.8, + clip: true, + paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.1), + ); } class _AttributePalmOilIcon extends AttributeIcon { @@ -579,10 +549,10 @@ class _AttributePalmOilIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.palmOil(), - iconSizeFactor: 0.7, - paddingFactor: const EdgeInsetsDirectional.only(top: 0.04), - ); + icon: const FoodIcons.palmOil(), + iconSizeFactor: 0.7, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.04), + ); } class _AttributePeanutsIcon extends AttributeIcon { @@ -592,10 +562,10 @@ class _AttributePeanutsIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.peanuts(), - iconSizeFactor: 0.7, - paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.03), - ); + icon: const FoodIcons.peanuts(), + iconSizeFactor: 0.7, + paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.03), + ); } class _AttributeSaltIcon extends AttributeIcon { @@ -605,11 +575,11 @@ class _AttributeSaltIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.salt(), - iconSizeFactor: 1.1, - clip: true, - offsetFactor: const Offset(-0.3, -0.3), - ); + icon: const FoodIcons.salt(), + iconSizeFactor: 1.1, + clip: true, + offsetFactor: const Offset(-0.3, -0.3), + ); } class _AttributeSaturatedFatIcon extends AttributeIcon { @@ -618,10 +588,7 @@ class _AttributeSaturatedFatIcon extends AttributeIcon { required super.size, super.foregroundColor, super.semanticsLabel, - }) : super._( - icon: const FoodIcons.saturatedFat(), - iconSizeFactor: 0.70, - ); + }) : super._(icon: const FoodIcons.saturatedFat(), iconSizeFactor: 0.70); } class _AttributeSesameSeedsIcon extends AttributeIcon { @@ -631,10 +598,10 @@ class _AttributeSesameSeedsIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.sesameSeeds(), - iconSizeFactor: 0.80, - paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.02), - ); + icon: const FoodIcons.sesameSeeds(), + iconSizeFactor: 0.80, + paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.02), + ); } class _AttributeSoybeansIcon extends AttributeIcon { @@ -644,13 +611,10 @@ class _AttributeSoybeansIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.soybeans(), - iconSizeFactor: 0.7, - paddingFactor: const EdgeInsetsDirectional.only( - top: 0.05, - end: 0.07, - ), - ); + icon: const FoodIcons.soybeans(), + iconSizeFactor: 0.7, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.05, end: 0.07), + ); } class _AttributeSugarIcon extends AttributeIcon { @@ -660,10 +624,10 @@ class _AttributeSugarIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.sugar(), - iconSizeFactor: 0.60, - paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.05), - ); + icon: const FoodIcons.sugar(), + iconSizeFactor: 0.60, + paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.05), + ); } class _AttributeSulphitesIcon extends AttributeIcon { @@ -673,11 +637,11 @@ class _AttributeSulphitesIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.sulphites(), - iconSizeFactor: 0.76, - clip: true, - paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.02), - ); + icon: const FoodIcons.sulphites(), + iconSizeFactor: 0.76, + clip: true, + paddingFactor: const EdgeInsetsDirectional.only(bottom: 0.02), + ); } class _AttributeVeganIcon extends AttributeIcon { @@ -687,10 +651,10 @@ class _AttributeVeganIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.vegan(), - iconSizeFactor: 0.62, - paddingFactor: const EdgeInsetsDirectional.only(top: 0.07), - ); + icon: const FoodIcons.vegan(), + iconSizeFactor: 0.62, + paddingFactor: const EdgeInsetsDirectional.only(top: 0.07), + ); } class _AttributeVegetarianIcon extends AttributeIcon { @@ -700,10 +664,8 @@ class _AttributeVegetarianIcon extends AttributeIcon { super.foregroundColor, super.semanticsLabel, }) : super._( - icon: const FoodIcons.vegetarian(), - iconSizeFactor: 0.62, - paddingFactor: const EdgeInsetsDirectional.only( - end: 0.06, - ), - ); + icon: const FoodIcons.vegetarian(), + iconSizeFactor: 0.62, + paddingFactor: const EdgeInsetsDirectional.only(end: 0.06), + ); } diff --git a/packages/smooth_app/lib/pages/product/autocomplete.dart b/packages/smooth_app/lib/pages/product/autocomplete.dart index 6b20995ad6..ccc10ba74b 100644 --- a/packages/smooth_app/lib/pages/product/autocomplete.dart +++ b/packages/smooth_app/lib/pages/product/autocomplete.dart @@ -17,8 +17,8 @@ class AutocompleteOptions extends StatelessWidget { required this.maxOptionsHeight, required this.maxOptionsWidth, this.search, - }) : assert(maxOptionsHeight >= 0), - assert(maxOptionsWidth >= 0); + }) : assert(maxOptionsHeight >= 0), + assert(maxOptionsWidth >= 0); final AutocompleteOptionToString displayStringForOption; final AutocompleteOnSelected onSelected; @@ -59,9 +59,7 @@ class AutocompleteOptions extends StatelessWidget { displayStringForOption: displayStringForOption, ); }, - separatorBuilder: (_, __) => const Divider( - height: 1.0, - ), + separatorBuilder: (_, __) => const Divider(height: 1.0), ), ), ), diff --git a/packages/smooth_app/lib/pages/product/common/loading_status.dart b/packages/smooth_app/lib/pages/product/common/loading_status.dart index f16a9accd9..471a3e6f0b 100644 --- a/packages/smooth_app/lib/pages/product/common/loading_status.dart +++ b/packages/smooth_app/lib/pages/product/common/loading_status.dart @@ -1,6 +1,2 @@ /// Common loading status. -enum LoadingStatus { - LOADING, - LOADED, - ERROR, -} +enum LoadingStatus { LOADING, LOADED, ERROR } diff --git a/packages/smooth_app/lib/pages/product/common/product_dialog_helper.dart b/packages/smooth_app/lib/pages/product/common/product_dialog_helper.dart index 07cc734fa7..fe35114992 100644 --- a/packages/smooth_app/lib/pages/product/common/product_dialog_helper.dart +++ b/packages/smooth_app/lib/pages/product/common/product_dialog_helper.dart @@ -51,13 +51,14 @@ class ProductDialogHelper { Future openUniqueProductSearch() async => await LoadingDialog.run( - context: context, - future: BarcodeProductQuery( - barcode: barcode, - daoProduct: DaoProduct(localDatabase), - isScanned: false, - ).getFetchedProduct(), - title: '${AppLocalizations.of(context).looking_for}: $barcode') ?? + context: context, + future: BarcodeProductQuery( + barcode: barcode, + daoProduct: DaoProduct(localDatabase), + isScanned: false, + ).getFetchedProduct(), + title: '${AppLocalizations.of(context).looking_for}: $barcode', + ) ?? const FetchedProduct.userCancelled(); void _openProductNotFoundDialog() { @@ -65,8 +66,8 @@ class ProductDialogHelper { context: context, builder: (BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); final bool lightTheme = context.lightTheme(); return SmoothModalSheet( @@ -84,9 +85,7 @@ class ProductDialogHelper { start: 5.0, child: Transform.scale( scale: -1.1, - child: const OrangeErrorAnimation( - sizeMultiplier: 1.2, - ), + child: const OrangeErrorAnimation(sizeMultiplier: 1.2), ), ), Column( @@ -97,9 +96,7 @@ class ProductDialogHelper { TextWithBubbleParts( text: appLocalizations.new_product_found_text, backgroundColor: theme.primarySemiDark, - textStyle: const TextStyle( - fontSize: 15.5, - ), + textStyle: const TextStyle(fontSize: 15.5), bubbleTextStyle: const TextStyle( color: Colors.white, fontWeight: FontWeight.w600, @@ -116,8 +113,9 @@ class ProductDialogHelper { DecoratedBox( decoration: BoxDecoration( borderRadius: ANGULAR_BORDER_RADIUS, - color: - lightTheme ? theme.primaryMedium : theme.primaryLight, + color: lightTheme + ? theme.primaryMedium + : theme.primaryLight, ), child: SmoothBarcodeWidget( barcode: barcode, @@ -129,8 +127,9 @@ class ProductDialogHelper { bottom: MEDIUM_SPACE, ), color: Colors.black, - backgroundColor: - lightTheme ? Colors.white : Colors.transparent, + backgroundColor: lightTheme + ? Colors.white + : Colors.transparent, ), ), const SizedBox(height: MEDIUM_SPACE * 2), @@ -139,9 +138,9 @@ class ProductDialogHelper { child: SmoothButtonWithArrow( text: appLocalizations.new_product_found_button, onTap: () async { - await AppNavigator.of(context).push( - AppRoutes.PRODUCT_CREATOR(barcode), - ); + await AppNavigator.of( + context, + ).push(AppRoutes.PRODUCT_CREATOR(barcode)); if (context.mounted) { Navigator.of(context).pop(); } @@ -164,28 +163,28 @@ class ProductDialogHelper { } static Widget getErrorMessage(final String message) => Row( - children: [ - const Icon(Icons.error_outline, color: Colors.red), - const SizedBox(width: SMALL_SPACE), - Expanded(child: Text(message)) - ], - ); + children: [ + const Icon(Icons.error_outline, color: Colors.red), + const SizedBox(width: SMALL_SPACE), + Expanded(child: Text(message)), + ], + ); void _openErrorMessage(final String message) => showDialog( - context: context, - builder: (BuildContext context) { - final AppLocalizations localizations = AppLocalizations.of(context); + context: context, + builder: (BuildContext context) { + final AppLocalizations localizations = AppLocalizations.of(context); - return SmoothAlertDialog( - title: localizations.product_internet_error_modal_title, - body: getErrorMessage(message), - positiveAction: SmoothActionButton( - text: localizations.close, - onPressed: () => Navigator.pop(context), - ), - ); - }, + return SmoothAlertDialog( + title: localizations.product_internet_error_modal_title, + body: getErrorMessage(message), + positiveAction: SmoothActionButton( + text: localizations.close, + onPressed: () => Navigator.pop(context), + ), ); + }, + ); /// Opens an error dialog; to be used only if the status is not ok. void openError(final FetchedProduct fetchedProduct) { @@ -202,7 +201,8 @@ class ProductDialogHelper { case FetchedProductStatus.internetError: _openErrorMessage( appLocalizations.product_internet_error_modal_message( - fetchedProduct.exceptionString ?? '-'), + fetchedProduct.exceptionString ?? '-', + ), ); return; case FetchedProductStatus.internetNotFound: diff --git a/packages/smooth_app/lib/pages/product/common/product_list_helper.dart b/packages/smooth_app/lib/pages/product/common/product_list_helper.dart index 1cbaa30cce..51ad59a7d7 100644 --- a/packages/smooth_app/lib/pages/product/common/product_list_helper.dart +++ b/packages/smooth_app/lib/pages/product/common/product_list_helper.dart @@ -31,22 +31,25 @@ class ProductListHelper { addLine('Barcode', 'Name', 'Brand'); - final List validBarcodes = list.barcodes.where( - (String barcode) { - return isBarcodeValid(barcode); - }, - ).toList(); + final List validBarcodes = list.barcodes.where((String barcode) { + return isBarcodeValid(barcode); + }).toList(); - final Map products = - await DaoProduct(localDatabase).getAll(validBarcodes); + final Map products = await DaoProduct( + localDatabase, + ).getAll(validBarcodes); for (final MapEntry entry in products.entries) { final String barcode = entry.key; final Product product = entry.value; - final String name = - (product.productName ?? '').replaceAll(EXPORT_SEPARATOR, ''); - final String brand = - (product.brands ?? '').replaceAll(EXPORT_SEPARATOR, ''); + final String name = (product.productName ?? '').replaceAll( + EXPORT_SEPARATOR, + '', + ); + final String brand = (product.brands ?? '').replaceAll( + EXPORT_SEPARATOR, + '', + ); addLine(barcode, name, brand); } @@ -62,17 +65,15 @@ class ProductListHelper { // TODOhow should we handle different product types? final List existingBarcodes = await ProductRefresher().silentFetchAndRefreshList( - barcodes: barcodes, - localDatabase: localDatabase, - productType: ProductType.food, - ) ?? - []; + barcodes: barcodes, + localDatabase: localDatabase, + productType: ProductType.food, + ) ?? + []; - await DaoProductList(localDatabase).bulkSet( - list, - existingBarcodes, - include: true, - ); + await DaoProductList( + localDatabase, + ).bulkSet(list, existingBarcodes, include: true); return existingBarcodes; } diff --git a/packages/smooth_app/lib/pages/product/common/product_list_item_popup_items.dart b/packages/smooth_app/lib/pages/product/common/product_list_item_popup_items.dart index b051a5d531..69f370702b 100644 --- a/packages/smooth_app/lib/pages/product/common/product_list_item_popup_items.dart +++ b/packages/smooth_app/lib/pages/product/common/product_list_item_popup_items.dart @@ -14,11 +14,7 @@ import 'package:smooth_app/pages/product/ordered_nutrients_cache.dart'; import 'package:smooth_app/widgets/smooth_menu_button.dart'; /// Popup menu item entries for the product list page, for selected items. -enum ProductListItemPopupMenuEntry { - compareSideBySide, - rank, - delete, -} +enum ProductListItemPopupMenuEntry { compareSideBySide, rank, delete } /// Popup menu items for the product list page, for selected items. abstract class ProductListItemPopupItem { @@ -45,13 +41,12 @@ abstract class ProductListItemPopupItem { SmoothPopupMenuItem getMenuItem( final AppLocalizations appLocalizations, final bool enabled, - ) => - SmoothPopupMenuItem( - value: this, - icon: getIconData(), - label: getTitle(appLocalizations), - enabled: enabled, - ); + ) => SmoothPopupMenuItem( + value: this, + icon: getIconData(), + label: getTitle(appLocalizations), + enabled: enabled, + ); } /// Popup menu item for the product list page: compare side by side selected items. @@ -70,8 +65,9 @@ class ProductListItemPopupSideBySide extends ProductListItemPopupItem { required final BuildContext context, required final Set selectedBarcodes, }) async { - final OrderedNutrientsCache? cache = - await OrderedNutrientsCache.getCache(context); + final OrderedNutrientsCache? cache = await OrderedNutrientsCache.getCache( + context, + ); if (context.mounted) { if (cache == null) { ScaffoldMessenger.of(context).showSnackBar( diff --git a/packages/smooth_app/lib/pages/product/common/product_list_item_simple.dart b/packages/smooth_app/lib/pages/product/common/product_list_item_simple.dart index 7e7c00e8f0..d583897ca3 100644 --- a/packages/smooth_app/lib/pages/product/common/product_list_item_simple.dart +++ b/packages/smooth_app/lib/pages/product/common/product_list_item_simple.dart @@ -40,50 +40,45 @@ class _ProductListItemSimpleState extends State { @override Widget build(BuildContext context) => ChangeNotifierProvider( - create: (final BuildContext context) => _model, - builder: (final BuildContext context, _) { - context.watch(); - context.watch(); - _model.setLocalUpToDate(); + create: (final BuildContext context) => _model, + builder: (final BuildContext context, _) { + context.watch(); + context.watch(); + _model.setLocalUpToDate(); - switch (_model.loadingStatus) { - case ProductLoadingStatus.LOADING: - return SmoothProductCardTemplate( - barcode: widget.barcode, - ); - case ProductLoadingStatus.DOWNLOADING: - return SmoothProductCardTemplate( - barcode: widget.barcode, - message: - AppLocalizations.of(context).loading_dialog_default_title, - ); - case ProductLoadingStatus.LOADED: - if (_model.product != null) { - return SmoothProductCardItemFound( - heroTag: '${_model.product!.barcode!}_${_model.hashCode}', - product: _model.product!, - onTap: widget.onTap, - onLongPress: widget.onLongPress, - backgroundColor: widget.backgroundColor, - ); - } - break; - case ProductLoadingStatus.ERROR: - } - Logs.w( - 'product list item simple / could not load ${widget.barcode}', - ); + switch (_model.loadingStatus) { + case ProductLoadingStatus.LOADING: + return SmoothProductCardTemplate(barcode: widget.barcode); + case ProductLoadingStatus.DOWNLOADING: return SmoothProductCardTemplate( - message: _getErrorMessage(AppLocalizations.of(context)), barcode: widget.barcode, - actionButton: IconButton( - iconSize: MINIMUM_TOUCH_SIZE, - icon: const Icon(Icons.refresh), - onPressed: () async => _model.download(), - ), + message: AppLocalizations.of(context).loading_dialog_default_title, ); - }, + case ProductLoadingStatus.LOADED: + if (_model.product != null) { + return SmoothProductCardItemFound( + heroTag: '${_model.product!.barcode!}_${_model.hashCode}', + product: _model.product!, + onTap: widget.onTap, + onLongPress: widget.onLongPress, + backgroundColor: widget.backgroundColor, + ); + } + break; + case ProductLoadingStatus.ERROR: + } + Logs.w('product list item simple / could not load ${widget.barcode}'); + return SmoothProductCardTemplate( + message: _getErrorMessage(AppLocalizations.of(context)), + barcode: widget.barcode, + actionButton: IconButton( + iconSize: MINIMUM_TOUCH_SIZE, + icon: const Icon(Icons.refresh), + onPressed: () async => _model.download(), + ), ); + }, + ); String _getErrorMessage(final AppLocalizations appLocalizations) => _model.loadingError?.getErrorTitle(appLocalizations) ?? diff --git a/packages/smooth_app/lib/pages/product/common/product_list_page.dart b/packages/smooth_app/lib/pages/product/common/product_list_page.dart index 6977d1c005..affe2259f2 100644 --- a/packages/smooth_app/lib/pages/product/common/product_list_page.dart +++ b/packages/smooth_app/lib/pages/product/common/product_list_page.dart @@ -87,12 +87,10 @@ class _ProductListPageState extends State //returns bool to handle WillPopScope Future _handleUserBacktap() async { if (_selectionMode) { - setState( - () { - _selectionMode = false; - _selectedBarcodes.clear(); - }, - ); + setState(() { + _selectionMode = false; + _selectedBarcodes.clear(); + }); return false; } else { return true; @@ -111,9 +109,9 @@ class _ProductListPageState extends State /// If we were on a user list, but it has been deleted, we switch to history if (!daoProductList.exist(productList) && productList.listType == ProductListType.USER) { - WidgetsBinding.instance.addPostFrameCallback((_) => setState( - () => productList = ProductList.history(), - )); + WidgetsBinding.instance.addPostFrameCallback( + (_) => setState(() => productList = ProductList.history()), + ); return EMPTY_WIDGET; } @@ -149,33 +147,33 @@ class _ProductListPageState extends State ExternalScanCarouselManager.read(context).showSearchCard(), ) : _selectionMode - ? null - : SmoothExpandableFloatingActionButton( - scrollController: _scrollController, - onPressed: () => setState(() => _selectionMode = true), - label: Text( - appLocalizations.user_lists_action_multi_select, - style: const TextStyle( - fontWeight: FontWeight.w600, - fontSize: 15.0, - ), - ), - icon: const Icon(Icons.checklist), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(30.0), - ), + ? null + : SmoothExpandableFloatingActionButton( + scrollController: _scrollController, + onPressed: () => setState(() => _selectionMode = true), + label: Text( + appLocalizations.user_lists_action_multi_select, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15.0, ), + ), + icon: const Icon(Icons.checklist), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30.0), + ), + ), appBar: SmoothAppBar( centerTitle: false, actions: [ SmoothPopupMenuButton( onSelected: (final ProductListPopupItem action) async { - final ProductList? differentProductList = - await action.doSomething( - productList: productList, - localDatabase: localDatabase, - context: context, - ); + final ProductList? differentProductList = await action + .doSomething( + productList: productList, + localDatabase: localDatabase, + context: context, + ); if (differentProductList != null) { setState(() => productList = differentProductList); } @@ -195,10 +193,12 @@ class _ProductListPageState extends State ), backgroundColor: _selectionMode ? context.lightTheme() - ? context.extension().primaryMedium - : context - .extension() - .primarySemiDark + ? context + .extension() + .primaryMedium + : context + .extension() + .primarySemiDark : null, titleSpacing: 0.0, actionMode: _selectionMode, @@ -224,8 +224,9 @@ class _ProductListPageState extends State } }, itemBuilder: (_) => >[ - if (userPreferences.getFlag(UserPreferencesDevMode - .userPreferencesFlagBoostedComparison) == + if (userPreferences.getFlag( + UserPreferencesDevMode.userPreferencesFlagBoostedComparison, + ) == true) _sideBySideItems.getMenuItem( appLocalizations, @@ -280,8 +281,9 @@ class _ProductListPageState extends State onWillPop: () async => (await _handleUserBacktap(), null), child: RefreshIndicator( //if it is in selectmode then refresh indicator is not shown - notificationPredicate: - _selectionMode ? (_) => false : (_) => true, + notificationPredicate: _selectionMode + ? (_) => false + : (_) => true, onRefresh: () async => _refreshListProducts( products, localDatabase, @@ -325,15 +327,13 @@ class _ProductListPageState extends State ) { final String barcode = barcodes[index]; final bool selected = _selectedBarcodes.contains(barcode); - void onTap() => setState( - () { - if (selected) { - _selectedBarcodes.remove(barcode); - } else { - _selectedBarcodes.add(barcode); - } - }, - ); + void onTap() => setState(() { + if (selected) { + _selectedBarcodes.remove(barcode); + } else { + _selectedBarcodes.add(barcode); + } + }); final Widget child = InkWell( onTap: _selectionMode ? onTap : null, child: Container( @@ -344,8 +344,9 @@ class _ProductListPageState extends State children: [ AnimatedContainer( duration: const Duration(milliseconds: 200), - width: - _selectionMode ? (IconTheme.of(context).size ?? 20.0) : 0.0, + width: _selectionMode + ? (IconTheme.of(context).size ?? 20.0) + : 0.0, child: Offstage( offstage: !_selectionMode, child: Icon( @@ -358,12 +359,10 @@ class _ProductListPageState extends State barcode: barcode, onTap: _selectionMode ? onTap : null, onLongPress: !_selectionMode - ? () => setState( - () { - _selectedBarcodes.add(barcode); - _selectionMode = true; - }, - ) + ? () => setState(() { + _selectedBarcodes.add(barcode); + _selectionMode = true; + }) : null, ), ), @@ -378,11 +377,7 @@ class _ProductListPageState extends State alignment: AlignmentDirectional.centerEnd, color: RED_COLOR, padding: const EdgeInsetsDirectional.only(end: 30.0), - child: const Icon( - Icons.delete, - size: 30.0, - color: Colors.white, - ), + child: const Icon(Icons.delete, size: 30.0, color: Colors.white), ), key: Key(barcode), onDismissed: (final DismissDirection direction) async { @@ -430,10 +425,7 @@ class _ProductListPageState extends State child: child, ); } - return Container( - key: Key(barcode), - child: child, - ); + return Container(key: Key(barcode), child: child); } /// Calls the "refresh products" part with dialogs on top. @@ -484,34 +476,36 @@ class _ProductListPageState extends State bool fresh = true; try { final OpenFoodFactsLanguage language = ProductQuery.getLanguage(); - final Map> productTypes = - await DaoProduct(localDatabase).getProductTypes(barcodes); + final Map> productTypes = await DaoProduct( + localDatabase, + ).getProductTypes(barcodes); for (final MapEntry> entry in productTypes.entries) { final SearchResult searchResult = await SearchProductsManager.searchProducts( - ProductQuery.getReadUser(), - ProductRefresher().getBarcodeListQueryConfiguration( - entry.value, - language, - ), - uriHelper: ProductQuery.getUriProductHelper(productType: entry.key), - type: SearchProductsType.live, - ); + ProductQuery.getReadUser(), + ProductRefresher().getBarcodeListQueryConfiguration( + entry.value, + language, + ), + uriHelper: ProductQuery.getUriProductHelper( + productType: entry.key, + ), + type: SearchProductsType.live, + ); final List? freshProducts = searchResult.products; if (freshProducts == null) { fresh = false; } else { - await DaoProduct(localDatabase).putAll( - freshProducts, - language, - productType: entry.key, - ); + await DaoProduct( + localDatabase, + ).putAll(freshProducts, language, productType: entry.key); localDatabase.upToDate.setLatestDownloadedProducts(freshProducts); } } - final RobotoffInsightHelper robotoffInsightHelper = - RobotoffInsightHelper(localDatabase); + final RobotoffInsightHelper robotoffInsightHelper = RobotoffInsightHelper( + localDatabase, + ); await robotoffInsightHelper.clearInsightAnnotationsSaved(); return fresh; } catch (e) { @@ -526,23 +520,23 @@ class _ProductListPageState extends State ) async { final ProductList? selected = await showSmoothDraggableModalSheet( - context: context, - header: SmoothModalSheetHeader( - title: appLocalizations.product_list_select, - prefix: const SmoothModalSheetHeaderPrefixIndicator(), - suffix: SmoothModalSheetHeaderButton( - label: appLocalizations.product_list_create, - prefix: const Icon(Icons.add_circle_outline_sharp), - tooltip: appLocalizations.product_list_create_tooltip, - onTap: () async => ProductListUserDialogHelper(daoProductList) - .showCreateUserListDialog(context), - ), - ), - bodyBuilder: (BuildContext context) => AllProductListModal( - currentList: productList, - ), - initHeight: _computeModalInitHeight(context), - ); + context: context, + header: SmoothModalSheetHeader( + title: appLocalizations.product_list_select, + prefix: const SmoothModalSheetHeaderPrefixIndicator(), + suffix: SmoothModalSheetHeaderButton( + label: appLocalizations.product_list_create, + prefix: const Icon(Icons.add_circle_outline_sharp), + tooltip: appLocalizations.product_list_create_tooltip, + onTap: () async => ProductListUserDialogHelper( + daoProductList, + ).showCreateUserListDialog(context), + ), + ), + bodyBuilder: (BuildContext context) => + AllProductListModal(currentList: productList), + initHeight: _computeModalInitHeight(context), + ); if (selected == null) { return; @@ -598,13 +592,11 @@ class _ProductListAppBarTitle extends StatelessWidget { children: [ ConstrainedBox( constraints: BoxConstraints( - maxWidth: constraints.maxWidth * 0.9 - + maxWidth: + constraints.maxWidth * 0.9 - (enabled ? (MEDIUM_SPACE - 15.0) : 0), ), - child: AutoSizeText( - title, - maxLines: 2, - ), + child: AutoSizeText(title, maxLines: 2), ), if (enabled) ...[ const SizedBox(width: MEDIUM_SPACE), @@ -612,8 +604,8 @@ class _ProductListAppBarTitle extends StatelessWidget { semanticLabel: appLocalizations.action_change_list, size: 15.0, child: const icons.Chevron.down(), - ) - ] + ), + ], ], ); }, diff --git a/packages/smooth_app/lib/pages/product/common/product_list_popup_items.dart b/packages/smooth_app/lib/pages/product/common/product_list_popup_items.dart index cf526d8710..b69f872e71 100644 --- a/packages/smooth_app/lib/pages/product/common/product_list_popup_items.dart +++ b/packages/smooth_app/lib/pages/product/common/product_list_popup_items.dart @@ -57,12 +57,11 @@ abstract class ProductListPopupItem { /// Returns the popup menu item. SmoothPopupMenuItem getMenuItem( final AppLocalizations appLocalizations, - ) => - SmoothPopupMenuItem( - value: this, - icon: getIconData(), - label: getTitle(appLocalizations), - ); + ) => SmoothPopupMenuItem( + value: this, + icon: getIconData(), + label: getTitle(appLocalizations), + ); /// Returns the first possible URL/server that contains at least one product. @protected @@ -71,8 +70,9 @@ abstract class ProductListPopupItem { required final LocalDatabase localDatabase, }) async { final List products = productList.getList(); - final Map> productTypes = - await DaoProduct(localDatabase).getProductTypes(products); + final Map> productTypes = await DaoProduct( + localDatabase, + ).getProductTypes(products); for (final MapEntry> entry in productTypes.entries) { return shareProductList(entry.value, entry.key); @@ -149,9 +149,9 @@ class ProductListPopupRename extends ProductListPopupItem { required final ProductList productList, required final LocalDatabase localDatabase, required final BuildContext context, - }) async => - ProductListUserDialogHelper(DaoProductList(localDatabase)) - .showRenameUserListDialog(context, productList); + }) async => ProductListUserDialogHelper( + DaoProductList(localDatabase), + ).showRenameUserListDialog(context, productList); } /// Popup menu item for the product list page: share list. @@ -177,8 +177,7 @@ class ProductListPopupShare extends ProductListPopupItem { final String? url = (await _getFirstUrl( productList: productList, localDatabase: localDatabase, - )) - ?.toString(); + ))?.toString(); if (url != null) { AnalyticsHelper.trackEvent(AnalyticsEvent.shareList); unawaited( @@ -273,8 +272,11 @@ class ProductListPopupExport extends ProductListPopupItem { String _buildFileName(String listName) { final String name = listName.replaceAll(' ', '-').toLowerCase(); - final String timestamp = - DateTime.now().toIso8601String().replaceAll(':', '_').split('.').first; + final String timestamp = DateTime.now() + .toIso8601String() + .replaceAll(':', '_') + .split('.') + .first; return '$name-$timestamp.csv'; } @@ -337,9 +339,9 @@ class ProductListPopupDelete extends ProductListPopupItem { required final LocalDatabase localDatabase, required final BuildContext context, }) async { - final bool deleted = - await ProductListUserDialogHelper(DaoProductList(localDatabase)) - .showDeleteUserListDialog(context, productList); + final bool deleted = await ProductListUserDialogHelper( + DaoProductList(localDatabase), + ).showDeleteUserListDialog(context, productList); return deleted ? null : productList; } } diff --git a/packages/smooth_app/lib/pages/product/common/product_picture_banner.dart b/packages/smooth_app/lib/pages/product/common/product_picture_banner.dart index 3329b0485d..7e9f6fda72 100644 --- a/packages/smooth_app/lib/pages/product/common/product_picture_banner.dart +++ b/packages/smooth_app/lib/pages/product/common/product_picture_banner.dart @@ -41,25 +41,25 @@ Future showPhotoBanner({ return switch (action) { PhotoRowActions.takePicture => _takePicture( - context: context, - product: product, - imageField: imageField, - language: language, - pictureSource: UserPictureSource.CAMERA, - ), + context: context, + product: product, + imageField: imageField, + language: language, + pictureSource: UserPictureSource.CAMERA, + ), PhotoRowActions.selectFromGallery => _takePicture( - context: context, - product: product, - imageField: imageField, - language: language, - pictureSource: UserPictureSource.GALLERY, - ), + context: context, + product: product, + imageField: imageField, + language: language, + pictureSource: UserPictureSource.GALLERY, + ), PhotoRowActions.selectFromProductPhotos => _selectPictureFromProductGallery( - context: context, - product: product, - imageField: imageField, - language: language, - ), + context: context, + product: product, + imageField: imageField, + language: language, + ), }; } @@ -87,12 +87,12 @@ Future _selectPictureFromProductGallery({ }) async { final CropParameters? parameters = await ProductImageServerButton.selectImageFromGallery( - context: context, - product: product, - imageField: imageField, - language: language, - isLoggedInMandatory: true, - ); + context: context, + product: product, + imageField: imageField, + language: language, + isLoggedInMandatory: true, + ); return parameters?.smallCroppedFile; } @@ -104,8 +104,8 @@ Future _showPhotoBanner({ required final OpenFoodFactsLanguage language, required TransientFile? transientFile, }) async { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(listen: false); final bool imageAvailable = transientFile?.isImageAvailable() ?? false; @@ -113,52 +113,51 @@ Future _showPhotoBanner({ final PhotoRowActions? action = await showSmoothListOfChoicesModalSheet( - context: context, - title: imageAvailable - ? appLocalizations.product_image_action_replace_photo( - imageField.getProductImageTitle(appLocalizations)) - : appLocalizations.product_image_action_add_photo( - imageField.getProductImageTitle(appLocalizations)), - values: PhotoRowActions.values, - labels: [ - if (imageAvailable) - appLocalizations.product_image_action_take_new_picture - else - appLocalizations.product_image_action_take_picture, - appLocalizations.product_image_action_from_gallery, - appLocalizations.product_image_action_choose_existing_photo, - ], - prefixIconTint: - lightTheme ? extension.primaryDark : extension.primaryMedium, - prefixIcons: [ - const Icon(Icons.camera), - const Icon(Icons.perm_media_rounded), - const Icon(Icons.image_search_rounded), - ], - contentPadding: const EdgeInsetsDirectional.symmetric( - horizontal: LARGE_SPACE, - ), - addEndArrowToItems: true, - footerBackgroundColor: lightTheme ? extension.primaryLight : null, - footerSpace: VERY_SMALL_SPACE, - footer: transientFile?.isImageAvailable() == true - ? _PhotoRowBanner( - product: product, - imageField: imageField, - language: language, - transientFile: transientFile!, - ) - : null, - ); + context: context, + title: imageAvailable + ? appLocalizations.product_image_action_replace_photo( + imageField.getProductImageTitle(appLocalizations), + ) + : appLocalizations.product_image_action_add_photo( + imageField.getProductImageTitle(appLocalizations), + ), + values: PhotoRowActions.values, + labels: [ + if (imageAvailable) + appLocalizations.product_image_action_take_new_picture + else + appLocalizations.product_image_action_take_picture, + appLocalizations.product_image_action_from_gallery, + appLocalizations.product_image_action_choose_existing_photo, + ], + prefixIconTint: lightTheme + ? extension.primaryDark + : extension.primaryMedium, + prefixIcons: [ + const Icon(Icons.camera), + const Icon(Icons.perm_media_rounded), + const Icon(Icons.image_search_rounded), + ], + contentPadding: const EdgeInsetsDirectional.symmetric( + horizontal: LARGE_SPACE, + ), + addEndArrowToItems: true, + footerBackgroundColor: lightTheme ? extension.primaryLight : null, + footerSpace: VERY_SMALL_SPACE, + footer: transientFile?.isImageAvailable() == true + ? _PhotoRowBanner( + product: product, + imageField: imageField, + language: language, + transientFile: transientFile!, + ) + : null, + ); return action; } -enum PhotoRowActions { - takePicture, - selectFromGallery, - selectFromProductPhotos, -} +enum PhotoRowActions { takePicture, selectFromGallery, selectFromProductPhotos } class _PhotoRowBanner extends StatefulWidget { const _PhotoRowBanner({ @@ -197,8 +196,8 @@ class _PhotoRowBannerState extends State<_PhotoRowBanner> { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return ListTileTheme.merge( @@ -240,8 +239,9 @@ class _PhotoRowBannerState extends State<_PhotoRowBanner> { children: [ Expanded( child: Text( - AppLocalizations.of(context) - .product_image_details_label, + AppLocalizations.of( + context, + ).product_image_details_label, style: const TextStyle( color: Colors.white, fontSize: 17.0, @@ -251,28 +251,25 @@ class _PhotoRowBannerState extends State<_PhotoRowBanner> { ), if (!_expanded) Padding( - padding: const EdgeInsetsDirectional.only( - end: 9.0, - ), + padding: const EdgeInsetsDirectional.only(end: 9.0), child: Semantics( - value: MaterialLocalizations.of(context) - .expandedIconTapHint, + value: MaterialLocalizations.of( + context, + ).expandedIconTapHint, excludeSemantics: true, child: const icons.Chevron.down( size: 18.0, color: Colors.white, ), ), - ) + ), ], ), ), ), ), if (_expanded || _dateInitiallyVisible) - _PhotoRowDate( - transientFile: widget.transientFile, - ), + _PhotoRowDate(transientFile: widget.transientFile), if (_expanded) const Divider(color: Colors.white), if (_expanded || _contributorInitiallyVisible) _PhotoRowContributor( @@ -297,15 +294,17 @@ class _PhotoRowContributor extends StatelessWidget { final ImageField imageField; final OpenFoodFactsLanguage language; - static bool isVisible(Product product, ImageField imageField, - OpenFoodFactsLanguage language) => - product.isImageLocked(imageField, language) == true; + static bool isVisible( + Product product, + ImageField imageField, + OpenFoodFactsLanguage language, + ) => product.isImageLocked(imageField, language) == true; @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool isLocked = isVisible(product, imageField, language); final String? contributor = _contributor; @@ -370,9 +369,7 @@ class _PhotoRowContributor extends StatelessWidget { /// The date of the photo (used in the modal sheet) class _PhotoRowDate extends StatelessWidget { - const _PhotoRowDate({ - required this.transientFile, - }); + const _PhotoRowDate({required this.transientFile}); final TransientFile transientFile; @@ -381,8 +378,8 @@ class _PhotoRowDate extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool outdated = isVisible(transientFile); @@ -391,10 +388,7 @@ class _PhotoRowDate extends StatelessWidget { color: outdated ? extension.warning : extension.primaryDark, icon: outdated ? _outdatedIcon : _successIcon, padding: outdated - ? const EdgeInsetsDirectional.only( - top: 0.5, - end: 1.0, - ) + ? const EdgeInsetsDirectional.only(top: 0.5, end: 1.0) : null, ), title: Text(appLocalizations.date), @@ -418,17 +412,14 @@ class _PhotoRowDate extends StatelessWidget { } Widget get _outdatedIcon => const Padding( - padding: EdgeInsetsDirectional.only( - bottom: 1.5, - start: 1.5, - ), - child: icons.Outdated(size: 19.0), - ); + padding: EdgeInsetsDirectional.only(bottom: 1.5, start: 1.5), + child: icons.Outdated(size: 19.0), + ); Widget get _successIcon => const Padding( - padding: EdgeInsetsDirectional.only(bottom: 0.5), - child: icons.Clock(size: 19.0), - ); + padding: EdgeInsetsDirectional.only(bottom: 0.5), + child: icons.Clock(size: 19.0), + ); } class _PhotoRowDetailsIcon extends StatelessWidget { @@ -445,10 +436,7 @@ class _PhotoRowDetailsIcon extends StatelessWidget { @override Widget build(BuildContext context) { return DecoratedBox( - decoration: BoxDecoration( - color: color, - shape: BoxShape.circle, - ), + decoration: BoxDecoration(color: color, shape: BoxShape.circle), child: SizedBox.square( dimension: 35.0, child: Padding( diff --git a/packages/smooth_app/lib/pages/product/common/product_query_page.dart b/packages/smooth_app/lib/pages/product/common/product_query_page.dart index 5eb188196c..96ae460e8b 100644 --- a/packages/smooth_app/lib/pages/product/common/product_query_page.dart +++ b/packages/smooth_app/lib/pages/product/common/product_query_page.dart @@ -119,9 +119,7 @@ class _ProductQueryPageState extends State ); case LoadingStatus.LOADING: if (_model.isEmpty()) { - return SearchLoadingScreen( - title: widget.name, - ); + return SearchLoadingScreen(title: widget.name); } break; case LoadingStatus.LOADED: @@ -145,11 +143,7 @@ class _ProductQueryPageState extends State // Now used in two cases. // 1. we have data downloaded and we display it (normal mode) // 2. we are downloading extra data, and display what we already knew - return _getNotEmptyScreen( - screenSize, - themeData, - appLocalizations, - ); + return _getNotEmptyScreen(screenSize, themeData, appLocalizations); }, ); } @@ -176,13 +170,14 @@ class _ProductQueryPageState extends State child: RankingFloatingActionButton( onPressed: () => Navigator.of(context, rootNavigator: true).push( - MaterialPageRoute( - builder: (BuildContext context) => PersonalizedRankingPage( - barcodes: _model.displayBarcodes, - title: widget.name, + MaterialPageRoute( + builder: (BuildContext context) => + PersonalizedRankingPage( + barcodes: _model.displayBarcodes, + title: widget.name, + ), + ), ), - ), - ), ), ), Visibility( @@ -194,9 +189,7 @@ class _ProductQueryPageState extends State animationCurve: Curves.easeInOutBack, startOffset: const Offset(0.0, 1.0), child: Padding( - padding: const EdgeInsetsDirectional.only( - start: SMALL_SPACE, - ), + padding: const EdgeInsetsDirectional.only(start: SMALL_SPACE), child: SizedBox( height: MINIMUM_TOUCH_SIZE, child: ElevatedButton( @@ -335,10 +328,7 @@ class _ProductQueryPageState extends State ); } - Widget _getEmptyText( - final ThemeData themeData, - final String message, - ) { + Widget _getEmptyText(final ThemeData themeData, final String message) { final AppLocalizations appLocalizations = AppLocalizations.of(context); final PagedProductQuery pagedProductQuery = _model.supplier.productQuery; final PagedProductQuery? worldQuery = pagedProductQuery.getWorldQuery(); @@ -393,7 +383,9 @@ class _ProductQueryPageState extends State if (lastUpdate != null) { final String lastTime = ProductQueryPageHelper.getDurationStringFromTimestamp( - lastUpdate, context); + lastUpdate, + context, + ); messages.add('${appLocalizations.cached_results_from} $lastTime'); } return SizedBox( @@ -427,27 +419,26 @@ class _ProductQueryPageState extends State ); Widget _getIconButton(final _Action action) => IconButton( - tooltip: action.text, - icon: Icon(action.iconData), - onPressed: action.onPressed, - ); + tooltip: action.text, + icon: Icon(action.iconData), + onPressed: action.onPressed, + ); _Action _getWorldAction( final AppLocalizations appLocalizations, final PagedProductQuery worldQuery, final bool editableAppBarTitle, - ) => - _Action( - text: appLocalizations.world_results_action, - iconData: Icons.public, - onPressed: () async => ProductQueryPageHelper.openBestChoice( - productQuery: worldQuery, - localDatabase: context.read(), - name: widget.name, - context: context, - editableAppBarTitle: editableAppBarTitle, - ), - ); + ) => _Action( + text: appLocalizations.world_results_action, + iconData: Icons.public, + onPressed: () async => ProductQueryPageHelper.openBestChoice( + productQuery: worldQuery, + localDatabase: context.read(), + name: widget.name, + context: context, + editableAppBarTitle: editableAppBarTitle, + ), + ); void retryConnection() { if (mounted) { @@ -464,10 +455,7 @@ class _ProductQueryPageState extends State successfullyLoaded = await _model.loadFromTop(); } catch (e) { if (mounted) { - await LoadingDialog.error( - context: context, - title: _model.loadingError, - ); + await LoadingDialog.error(context: context, title: _model.loadingError); } } finally { if (successfullyLoaded) { diff --git a/packages/smooth_app/lib/pages/product/common/product_query_page_helper.dart b/packages/smooth_app/lib/pages/product/common/product_query_page_helper.dart index 52ad30169e..5378376b78 100644 --- a/packages/smooth_app/lib/pages/product/common/product_query_page_helper.dart +++ b/packages/smooth_app/lib/pages/product/common/product_query_page_helper.dart @@ -19,10 +19,7 @@ class ProductQueryPageHelper { bool searchResult = true, }) async { final ProductListSupplier supplier = - await ProductListSupplier.getBestSupplier( - productQuery, - localDatabase, - ); + await ProductListSupplier.getBestSupplier(productQuery, localDatabase); return ProductQueryPage( productListSupplier: supplier, @@ -55,9 +52,7 @@ class ProductQueryPageHelper { } final bool? result = await Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => widget, - ), + MaterialPageRoute(builder: (BuildContext context) => widget), ); if (result == true) { diff --git a/packages/smooth_app/lib/pages/product/common/product_refresher.dart b/packages/smooth_app/lib/pages/product/common/product_refresher.dart index 8e98c541ab..32dbad8d4f 100644 --- a/packages/smooth_app/lib/pages/product/common/product_refresher.dart +++ b/packages/smooth_app/lib/pages/product/common/product_refresher.dart @@ -34,29 +34,27 @@ class ProductRefresher { context: context, builder: (BuildContext context) => SmoothAlertDialog( body: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - SvgPicture.asset( - 'assets/onboarding/globe.svg', - height: MediaQuery.sizeOf(context).height * .5, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + SvgPicture.asset( + 'assets/onboarding/globe.svg', + height: MediaQuery.sizeOf(context).height * .5, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 25), + child: Text( + appLocalizations.account_create_message, + style: const TextStyle(fontWeight: FontWeight.bold), ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 25), - child: Text( - appLocalizations.account_create_message, - style: const TextStyle(fontWeight: FontWeight.bold), - ), - ), - ]), + ), + ], + ), actionsAxis: Axis.vertical, positiveAction: SmoothActionButton( text: appLocalizations.join_us, onPressed: () async { Navigator.of(context).pop(); // remove dialog - await Navigator.of( - context, - rootNavigator: true, - ).push( + await Navigator.of(context, rootNavigator: true).push( MaterialPageRoute( builder: (BuildContext context) => const LoginPage(), ), @@ -76,31 +74,29 @@ class ProductRefresher { ProductQueryConfiguration getBarcodeQueryConfiguration( final String barcode, final OpenFoodFactsLanguage language, - ) => - ProductQueryConfiguration( - barcode, - fields: ProductQuery.fields, - language: language, - country: ProductQuery.getCountry(), - version: ProductQuery.productQueryVersion, - productTypeFilter: ProductTypeFilter.all, - ); + ) => ProductQueryConfiguration( + barcode, + fields: ProductQuery.fields, + language: language, + country: ProductQuery.getCountry(), + version: ProductQuery.productQueryVersion, + productTypeFilter: ProductTypeFilter.all, + ); /// Returns the standard configuration for several barcodes product query. ProductSearchQueryConfiguration getBarcodeListQueryConfiguration( final List barcodes, final OpenFoodFactsLanguage language, - ) => - ProductSearchQueryConfiguration( - fields: ProductQuery.fields, - language: language, - country: ProductQuery.getCountry(), - parametersList: [ - BarcodeParameter.list(barcodes), - PageSize(size: barcodes.length), - ], - version: ProductQuery.productQueryVersion, - ); + ) => ProductSearchQueryConfiguration( + fields: ProductQuery.fields, + language: language, + country: ProductQuery.getCountry(), + parametersList: [ + BarcodeParameter.list(barcodes), + PageSize(size: barcodes.length), + ], + version: ProductQuery.productQueryVersion, + ); /// Fetches the products from the server and refreshes the local database. /// @@ -109,8 +105,7 @@ class ProductRefresher { required final List barcodes, required final LocalDatabase localDatabase, required final ProductType productType, - }) async => - _fetchAndRefreshList(localDatabase, barcodes, productType); + }) async => _fetchAndRefreshList(localDatabase, barcodes, productType); /// Fetches the product from the server and refreshes the local database. /// @@ -124,13 +119,13 @@ class ProductRefresher { final AppLocalizations appLocalizations = AppLocalizations.of(context); final FetchedProduct? fetchAndRefreshed = await LoadingDialog.run( - future: silentFetchAndRefresh( - localDatabase: localDatabase, - barcode: barcode, - ), - context: context, - title: appLocalizations.refreshing_product, - ); + future: silentFetchAndRefresh( + localDatabase: localDatabase, + barcode: barcode, + ), + context: context, + title: appLocalizations.refreshing_product, + ); if (fetchAndRefreshed == null) { // the user probably cancelled return false; @@ -147,7 +142,9 @@ class ProductRefresher { if (context.mounted) { ScaffoldMessenger.of(context).showSnackBar( SmoothFloatingSnackbar.positive( - context: context, text: appLocalizations.product_refreshed), + context: context, + text: appLocalizations.product_refreshed, + ), ); } return true; @@ -178,27 +175,22 @@ class ProductRefresher { try { final OpenFoodFactsLanguage language = ProductQuery.getLanguage(); final ProductResultV3 result = await OpenFoodAPIClient.getProductV3( - getBarcodeQueryConfiguration( - barcode, - language, - ), + getBarcodeQueryConfiguration(barcode, language), uriHelper: uriProductHelper, user: ProductQuery.getReadUser(), ); if (result.product != null) { - await DaoProduct(localDatabase).put( - result.product!, - language, - productType: productType, - ); + await DaoProduct( + localDatabase, + ).put(result.product!, language, productType: productType); localDatabase.upToDate.setLatestDownloadedProduct(result.product!); return FetchedProduct.found(result.product!); } return const FetchedProduct.internetNotFound(); } catch (e) { Logs.e('Refresh from server error', ex: e); - final List connectivityResult = - await Connectivity().checkConnectivity(); + final List connectivityResult = await Connectivity() + .checkConnectivity(); if (connectivityResult.contains(ConnectivityResult.none)) { return FetchedProduct.error( exceptionString: e.toString(), @@ -228,21 +220,22 @@ class ProductRefresher { final OpenFoodFactsLanguage language = ProductQuery.getLanguage(); final SearchResult searchResult = await SearchProductsManager.searchProducts( - ProductQuery.getReadUser(), - getBarcodeListQueryConfiguration(barcodes, language), - uriHelper: ProductQuery.getUriProductHelper(productType: productType), - type: SearchProductsType.live, - ); + ProductQuery.getReadUser(), + getBarcodeListQueryConfiguration(barcodes, language), + uriHelper: ProductQuery.getUriProductHelper( + productType: productType, + ), + type: SearchProductsType.live, + ); if (searchResult.products == null) { return null; } - await DaoProduct(localDatabase).putAll( + await DaoProduct( + localDatabase, + ).putAll(searchResult.products!, language, productType: productType); + localDatabase.upToDate.setLatestDownloadedProducts( searchResult.products!, - language, - productType: productType, ); - localDatabase.upToDate - .setLatestDownloadedProducts(searchResult.products!); return searchResult.products! .where((Product p) => p.barcode != null && p.barcode!.isNotEmpty) diff --git a/packages/smooth_app/lib/pages/product/common/search_app_bar_title.dart b/packages/smooth_app/lib/pages/product/common/search_app_bar_title.dart index 6be108d8fc..1e83aa0834 100644 --- a/packages/smooth_app/lib/pages/product/common/search_app_bar_title.dart +++ b/packages/smooth_app/lib/pages/product/common/search_app_bar_title.dart @@ -29,10 +29,7 @@ class SearchAppBarTitle extends StatelessWidget { onTap: () => Navigator.of(context).pop(true), child: Tooltip( message: appLocalizations.tap_to_edit_search, - child: SizedBox( - width: double.infinity, - child: child, - ), + child: SizedBox(width: double.infinity, child: child), ), ); } diff --git a/packages/smooth_app/lib/pages/product/common/search_empty_screen.dart b/packages/smooth_app/lib/pages/product/common/search_empty_screen.dart index 2849331ec9..65e3e4ca8e 100644 --- a/packages/smooth_app/lib/pages/product/common/search_empty_screen.dart +++ b/packages/smooth_app/lib/pages/product/common/search_empty_screen.dart @@ -24,10 +24,7 @@ class SearchEmptyScreen extends StatelessWidget { ? AppBar( backgroundColor: Theme.of(context).scaffoldBackgroundColor, leading: const SmoothBackButton(), - title: SearchAppBarTitle( - title: name, - editableAppBarTitle: false, - ), + title: SearchAppBarTitle(title: name, editableAppBarTitle: false), actions: actions, ) : null, diff --git a/packages/smooth_app/lib/pages/product/common/search_helper.dart b/packages/smooth_app/lib/pages/product/common/search_helper.dart index 0d114bc430..8fe2cdb4d4 100644 --- a/packages/smooth_app/lib/pages/product/common/search_helper.dart +++ b/packages/smooth_app/lib/pages/product/common/search_helper.dart @@ -36,15 +36,13 @@ abstract class SearchHelper extends ValueNotifier { Future addQuery( final LocalDatabase localDatabase, final String query, - ) async => - DaoStringList(localDatabase).add(historyKey, query); + ) async => DaoStringList(localDatabase).add(historyKey, query); /// Removes a query from the history. Future removeQuery( final LocalDatabase localDatabase, final String query, - ) async => - DaoStringList(localDatabase).remove(historyKey, query); + ) async => DaoStringList(localDatabase).remove(historyKey, query); /// Typical search when we have a controller+focus. void searchWithController( @@ -52,22 +50,19 @@ abstract class SearchHelper extends ValueNotifier { String query, TextEditingController controller, FocusNode focusNode, - ) => - search( - context, - query, - searchQueryCallback: (String query) { - controller.text = query; - focusNode.requestFocus(); - }, - ); + ) => search( + context, + query, + searchQueryCallback: (String query) { + controller.text = query; + focusNode.requestFocus(); + }, + ); } class SearchQuery { - const SearchQuery({ - required this.search, - required this.widget, - }) : assert(search.length > 0); + const SearchQuery({required this.search, required this.widget}) + : assert(search.length > 0); final String search; final Widget widget; diff --git a/packages/smooth_app/lib/pages/product/common/search_loading_screen.dart b/packages/smooth_app/lib/pages/product/common/search_loading_screen.dart index b4b662d51b..80d73c00a9 100644 --- a/packages/smooth_app/lib/pages/product/common/search_loading_screen.dart +++ b/packages/smooth_app/lib/pages/product/common/search_loading_screen.dart @@ -7,9 +7,7 @@ import 'package:smooth_app/widgets/smooth_text.dart'; /// Common search loading screen. class SearchLoadingScreen extends StatelessWidget { - const SearchLoadingScreen({ - required this.title, - }); + const SearchLoadingScreen({required this.title}); final String title; @@ -25,9 +23,7 @@ class SearchLoadingScreen extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - SearchEyeAnimation( - size: MediaQuery.sizeOf(context).width * 0.2, - ), + SearchEyeAnimation(size: MediaQuery.sizeOf(context).width * 0.2), const SizedBox(height: VERY_LARGE_SPACE * 2), TextHighlighter( text: appLocalizations.product_search_loading_message(title), diff --git a/packages/smooth_app/lib/pages/product/compare_products3_page.dart b/packages/smooth_app/lib/pages/product/compare_products3_page.dart index 42558c99a8..5ded62bd58 100644 --- a/packages/smooth_app/lib/pages/product/compare_products3_page.dart +++ b/packages/smooth_app/lib/pages/product/compare_products3_page.dart @@ -70,8 +70,8 @@ class _CompareProducts3PageState extends State { final AppLocalizations appLocalizations = AppLocalizations.of(context); context.watch(); - final ProductPreferences productPreferences = - context.watch(); + final ProductPreferences productPreferences = context + .watch(); final List> scoreAttributesArray = >[]; final List scoreWidgets = []; for (final Product product in widget.products) { @@ -108,15 +108,17 @@ class _CompareProducts3PageState extends State { names.add(getProductName(product, appLocalizations)); brands.add(getProductBrands(product, appLocalizations)); quantities.add(product.quantity ?? ''); - pictures.add(Expanded( - child: Center( - child: SmoothMainProductImage( - product: product, - width: screenSize.width * 0.20, - height: screenSize.width * 0.20, + pictures.add( + Expanded( + child: Center( + child: SmoothMainProductImage( + product: product, + width: screenSize.width * 0.20, + height: screenSize.width * 0.20, + ), ), ), - )); + ); } for (final Product product in widget.products) { final List tmp = []; @@ -149,12 +151,7 @@ class _CompareProducts3PageState extends State { } } if (notNull) { - nutrientValues.add( - _getNutrientRow( - values: values, - nutrient: nutrient, - ), - ); + nutrientValues.add(_getNutrientRow(values: values, nutrient: nutrient)); } } return SmoothScaffold( @@ -190,11 +187,9 @@ class _CompareProducts3PageState extends State { ); } - Row _getTextRow(final List texts) => _getWidgetRow( - [ - for (final String text in texts) Expanded(child: Text(text)), - ], - ); + Row _getTextRow(final List texts) => _getWidgetRow([ + for (final String text in texts) Expanded(child: Text(text)), + ]); Row _getWidgetRow(final List widgets) { final List children = []; @@ -227,25 +222,22 @@ class _CompareProducts3PageState extends State { return null; } - Widget? _getChild( - final Attribute attribute, - final Product product, - ) { + Widget? _getChild(final Attribute attribute, final Product product) { final Nutrient? nutrient = _getAttributeNutrient(attribute.id!); if (nutrient != null) { if (product.nutriments == null) { return null; } - final double? value = - product.nutriments!.getValue(nutrient, PerSize.oneHundredGrams); + final double? value = product.nutriments!.getValue( + nutrient, + PerSize.oneHundredGrams, + ); if (value == null) { return null; } return Text( '${value.toStringAsFixed(2)} ${UnitHelper.unitToString(nutrient.typicalUnit)}', - style: const TextStyle( - fontWeight: FontWeight.w500, - ), + style: const TextStyle(fontWeight: FontWeight.w500), ); } switch (attribute.id) { @@ -287,10 +279,7 @@ class _CompareProducts3PageState extends State { const Divider(), Padding( padding: const EdgeInsets.only(top: SMALL_SPACE), - child: AutoSizeText( - '$title (?)', - maxLines: 2, - ), + child: AutoSizeText('$title (?)', maxLines: 2), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -311,17 +300,10 @@ class _CompareProducts3PageState extends State { : Center( child: Text( '${value.toStringAsFixed(2)} ${UnitHelper.unitToString(nutrient.typicalUnit)}', - style: const TextStyle( - fontWeight: FontWeight.w500, - ), + style: const TextStyle(fontWeight: FontWeight.w500), ), ); - child = Expanded( - child: SizedBox( - height: 36, - child: child, - ), - ); + child = Expanded(child: SizedBox(height: 36, child: child)); children.add(child); } return Column( diff --git a/packages/smooth_app/lib/pages/product/edit_image_button.dart b/packages/smooth_app/lib/pages/product/edit_image_button.dart index dd30c53526..2e98230b47 100644 --- a/packages/smooth_app/lib/pages/product/edit_image_button.dart +++ b/packages/smooth_app/lib/pages/product/edit_image_button.dart @@ -47,9 +47,7 @@ class EditImageButton extends StatelessWidget { ), padding: _centerContent ? WidgetStateProperty.all( - const EdgeInsets.symmetric( - vertical: LARGE_SPACE, - ), + const EdgeInsets.symmetric(vertical: LARGE_SPACE), ) : null, alignment: _centerContent ? AlignmentDirectional.center : null, diff --git a/packages/smooth_app/lib/pages/product/edit_language_tabbar.dart b/packages/smooth_app/lib/pages/product/edit_language_tabbar.dart index b5baf0e5ac..aabccdc88d 100644 --- a/packages/smooth_app/lib/pages/product/edit_language_tabbar.dart +++ b/packages/smooth_app/lib/pages/product/edit_language_tabbar.dart @@ -41,13 +41,13 @@ class EditLanguageTabBar extends StatefulWidget { required this.onTabChanged, required this.forceUserLanguage, this.padding = const EdgeInsetsDirectional.only(start: 55.0), - }) : defaultLanguageMissingState = OpenFoodFactsLanguageState.normal, - mainLanguageMissingState = OpenFoodFactsLanguageState.normal, - userLanguageMissingState = OpenFoodFactsLanguageState.normal, - languageIndicatorNormal = null, - languageIndicatorWarning = null, - languageIndicatorError = null, - showLanguageIndicator = false; + }) : defaultLanguageMissingState = OpenFoodFactsLanguageState.normal, + mainLanguageMissingState = OpenFoodFactsLanguageState.normal, + userLanguageMissingState = OpenFoodFactsLanguageState.normal, + languageIndicatorNormal = null, + languageIndicatorWarning = null, + languageIndicatorError = null, + showLanguageIndicator = false; /// Compare two products to know if they are the same final DidProductChanged productEquality; @@ -115,43 +115,47 @@ class _EditLanguageTabBarState extends State child: Padding( padding: const EdgeInsetsDirectional.only(top: BALANCED_SPACE), child: Listener( - listener: (BuildContext context, _, Product product) { - _provider.attachProduct(product); - }, - child: ChangeNotifierProvider<_EditLanguageProvider>( - create: (_) => _provider, - child: Consumer<_EditLanguageProvider>( - builder: ( - final BuildContext context, - final _EditLanguageProvider provider, - _, - ) { - if (provider.value.languages == null) { - return const Center( - child: CircularProgressIndicator.adaptive(), - ); - } + listener: (BuildContext context, _, Product product) { + _provider.attachProduct(product); + }, + child: ChangeNotifierProvider<_EditLanguageProvider>( + create: (_) => _provider, + child: Consumer<_EditLanguageProvider>( + builder: + ( + final BuildContext context, + final _EditLanguageProvider provider, + _, + ) { + if (provider.value.languages == null) { + return const Center( + child: CircularProgressIndicator.adaptive(), + ); + } - /// We need a Stack to have to tab bar shadow below the button - return Stack( - children: [ - PositionedDirectional( - top: 0.0, - start: 0.0, - bottom: 0.0, - end: 40.0, - child: SmoothTabBar( - tabController: _tabController!, - items: provider.value.languages!.map( - (final OpenFoodFactsLanguage language) => - SmoothTabBarItem( - label: Languages().getNameInLanguage(language), - value: language, + /// We need a Stack to have to tab bar shadow below the button + return Stack( + children: [ + PositionedDirectional( + top: 0.0, + start: 0.0, + bottom: 0.0, + end: 40.0, + child: SmoothTabBar( + tabController: _tabController!, + items: provider.value.languages!.map( + (final OpenFoodFactsLanguage language) => + SmoothTabBarItem( + label: Languages().getNameInLanguage( + language, + ), + value: language, + ), ), - ), - leadingItems: widget.showLanguageIndicator - ? provider.value.languagesStates!.map( - (final OpenFoodFactsLanguageState state) { + leadingItems: widget.showLanguageIndicator + ? provider.value.languagesStates!.map(( + final OpenFoodFactsLanguageState state, + ) { switch (state) { case OpenFoodFactsLanguageState.normal: return widget.languageIndicatorNormal; @@ -163,30 +167,28 @@ class _EditLanguageTabBarState extends State return widget.languageIndicatorError ?? const icons.Warning(); } - }, - ) - : null, - onTabChanged: (final OpenFoodFactsLanguage value) { - widget.onTabChanged.call(value); - }, - padding: widget.padding.add( - const EdgeInsetsDirectional.only( - end: 20.0, + }) + : null, + onTabChanged: (final OpenFoodFactsLanguage value) { + widget.onTabChanged.call(value); + }, + padding: widget.padding.add( + const EdgeInsetsDirectional.only(end: 20.0), ), ), ), - ), - const PositionedDirectional( - top: 0.0, - end: 0.0, - bottom: 0.0, - child: _EditLanguageTabBarAddLanguageButton(), - ), - ], - ); - }, - ), - )), + const PositionedDirectional( + top: 0.0, + end: 0.0, + bottom: 0.0, + child: _EditLanguageTabBarAddLanguageButton(), + ), + ], + ); + }, + ), + ), + ), ), ); } @@ -225,8 +227,8 @@ class _EditLanguageTabBarAddLanguageButton extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); final bool lightTheme = context.lightTheme(); final BorderRadius borderRadius = BorderRadiusHelper.fromDirectional( @@ -263,9 +265,7 @@ class _EditLanguageTabBarAddLanguageButton extends StatelessWidget { start: LARGE_SPACE, end: MEDIUM_SPACE, ), - child: icons.Add( - color: Colors.white, - ), + child: icons.Add(color: Colors.white), ), ), ), @@ -275,14 +275,16 @@ class _EditLanguageTabBarAddLanguageButton extends StatelessWidget { } Future _addLanguage(BuildContext context) async { - final List? selectedLanguages = - context.read<_EditLanguageProvider>().value.languages; + final List? selectedLanguages = context + .read<_EditLanguageProvider>() + .value + .languages; final OpenFoodFactsLanguage? language = await LanguagesSelector.openLanguageSelector( - context, - selectedLanguages: selectedLanguages, - ); + context, + selectedLanguages: selectedLanguages, + ); if (language != null && context.mounted) { context.read<_EditLanguageProvider>().addLanguage(language); @@ -320,7 +322,7 @@ class _EditLanguageProvider void refreshLanguages({bool initial = false}) { final ( List imageLanguages, - List languagesStates + List languagesStates, ) = _extractLanguages(); final OpenFoodFactsLanguage userLanguage = ProductQuery.getLanguage(); @@ -371,8 +373,10 @@ class _EditLanguageProvider } } - if (!const ListEquality() - .equals(value.languages, languages)) { + if (!const ListEquality().equals( + value.languages, + languages, + )) { value = _EditLanguageTabBarProviderState( languages: languages, languagesStates: states, @@ -382,16 +386,15 @@ class _EditLanguageProvider } } - ( - List, - List, - ) _extractLanguages() { + (List, List) + _extractLanguages() { final List imageLanguagesWithState = - languagesProvider(product!) - ..sort((final ProductLanguageWithState a, - final ProductLanguageWithState b) { - return a.code.compareTo(b.code); - }); + languagesProvider(product!)..sort(( + final ProductLanguageWithState a, + final ProductLanguageWithState b, + ) { + return a.code.compareTo(b.code); + }); final List imageLanguages = []; @@ -456,22 +459,22 @@ class _EditLanguageTabBarProviderState { required this.selectedLanguage, this.hasNewLanguage = false, this.initialValue = false, - }) : assert( - selectedLanguage == null || languages!.contains(selectedLanguage), - ), - assert( - languagesStates == null && languages == null || - languagesStates != null && - languages != null && - languagesStates.length == languages.length, - ); + }) : assert( + selectedLanguage == null || languages!.contains(selectedLanguage), + ), + assert( + languagesStates == null && languages == null || + languagesStates != null && + languages != null && + languagesStates.length == languages.length, + ); const _EditLanguageTabBarProviderState.empty() - : languages = null, - languagesStates = null, - selectedLanguage = null, - hasNewLanguage = false, - initialValue = false; + : languages = null, + languagesStates = null, + selectedLanguage = null, + hasNewLanguage = false, + initialValue = false; final List? languages; final List? languagesStates; @@ -480,24 +483,17 @@ class _EditLanguageTabBarProviderState { final bool hasNewLanguage; } -typedef DidProductChanged = bool Function( - Product oldProduct, - Product newProduct, -); -typedef ProductLanguagesProvider = List Function( - Product product, -); +typedef DidProductChanged = + bool Function(Product oldProduct, Product newProduct); +typedef ProductLanguagesProvider = + List Function(Product product); @immutable class ProductLanguageWithState { - const ProductLanguageWithState({ - required this.language, - required this.state, - }); + const ProductLanguageWithState({required this.language, required this.state}); - const ProductLanguageWithState.normal({ - required this.language, - }) : state = OpenFoodFactsLanguageState.normal; + const ProductLanguageWithState.normal({required this.language}) + : state = OpenFoodFactsLanguageState.normal; final OpenFoodFactsLanguage language; final OpenFoodFactsLanguageState state; @@ -516,8 +512,4 @@ class ProductLanguageWithState { int get hashCode => language.hashCode ^ state.hashCode; } -enum OpenFoodFactsLanguageState { - normal, - warning, - error, -} +enum OpenFoodFactsLanguageState { normal, warning, error } diff --git a/packages/smooth_app/lib/pages/product/edit_new_packagings.dart b/packages/smooth_app/lib/pages/product/edit_new_packagings.dart index 2213bb368c..df7d584ad5 100644 --- a/packages/smooth_app/lib/pages/product/edit_new_packagings.dart +++ b/packages/smooth_app/lib/pages/product/edit_new_packagings.dart @@ -50,8 +50,10 @@ class _EditNewPackagingsState extends State final List _helpers = []; void _openPackagingImage(BuildContext context) { - final Iterable languages = - getProductImageLanguages(upToDateProduct, ImageField.PACKAGING); + final Iterable languages = getProductImageLanguages( + upToDateProduct, + ImageField.PACKAGING, + ); if (languages.isNotEmpty) { setState(() { @@ -92,9 +94,7 @@ class _EditNewPackagingsState extends State _decimalNumberFormat = SimpleInputNumberField.getNumberFormat( decimal: true, ); - _unitNumberFormat = SimpleInputNumberField.getNumberFormat( - decimal: false, - ); + _unitNumberFormat = SimpleInputNumberField.getNumberFormat(decimal: false); if (upToDateProduct.packagings != null) { upToDateProduct.packagings!.forEach(_addPackagingToControllers); } @@ -156,15 +156,13 @@ class _EditNewPackagingsState extends State ? Icons.check_box : Icons.check_box_outline_blank, ), - onTap: () => setState( - () { - if (_packagingsComplete == null) { - _packagingsComplete = true; - } else { - _packagingsComplete = !_packagingsComplete!; - } - }, - ), + onTap: () => setState(() { + if (_packagingsComplete == null) { + _packagingsComplete = true; + } else { + _packagingsComplete = !_packagingsComplete!; + } + }), ), ), ); @@ -226,8 +224,9 @@ class _EditNewPackagingsState extends State icon: hasPackagingImages ? const Picture.open() : const Icon(Icons.add_a_photo), - tooltip: ImageField.PACKAGING - .getProductImageButtonText(appLocalizations), + tooltip: ImageField.PACKAGING.getProductImageButtonText( + appLocalizations, + ), onPressed: () => _openPackagingImage(context), ), ], @@ -249,12 +248,9 @@ class _EditNewPackagingsState extends State ], ), bottomNavigationBar: ProductBottomButtonsBar( - onSave: () async => _exitPage( - await _mayExitPage(saving: true), - ), - onCancel: () async => _exitPage( - await _mayExitPage(saving: false), - ), + onSave: () async => _exitPage(await _mayExitPage(saving: true)), + onCancel: () async => + _exitPage(await _mayExitPage(saving: false)), ), ), ), @@ -330,8 +326,8 @@ class _EditNewPackagingsState extends State } if (!saving) { - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog(context); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog(context); if (pleaseSave == null) { return false; } @@ -361,8 +357,8 @@ class _EditNewPackagingsState extends State Color _getSmoothCardColor(final BuildContext context) => Theme.of(context).brightness == Brightness.light - ? GREY_COLOR - : PRIMARY_GREY_COLOR; + ? GREY_COLOR + : PRIMARY_GREY_COLOR; Color _getSmoothCardColorAlternate(final BuildContext context, int index) { final bool lightTheme = Theme.of(context).brightness == Brightness.light; diff --git a/packages/smooth_app/lib/pages/product/edit_new_packagings_component.dart b/packages/smooth_app/lib/pages/product/edit_new_packagings_component.dart index 9150348790..556f276a8b 100644 --- a/packages/smooth_app/lib/pages/product/edit_new_packagings_component.dart +++ b/packages/smooth_app/lib/pages/product/edit_new_packagings_component.dart @@ -117,9 +117,8 @@ class _EditNewPackagingsComponentState onPressed: widget.deleteCallback, ) : null, - onTap: () => setState( - () => widget.helper.expanded = !widget.helper.expanded, - ), + onTap: () => + setState(() => widget.helper.expanded = !widget.helper.expanded), ), ...expandedChildren, ], @@ -175,45 +174,45 @@ class _EditTextLineState extends State<_EditTextLine> { @override Widget build(BuildContext context) => Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListTile( - leading: SvgAsyncAsset( - AssetCacheHelper( - ['assets/packagings/${widget.iconName}.svg'], - 'no url for packagings/${widget.iconName}', - color: widget.iconColor, - width: MINIMUM_TOUCH_SIZE, - ), - ), - title: Text(widget.title), + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + leading: SvgAsyncAsset( + AssetCacheHelper( + ['assets/packagings/${widget.iconName}.svg'], + 'no url for packagings/${widget.iconName}', + color: widget.iconColor, + width: MINIMUM_TOUCH_SIZE, ), - LayoutBuilder( - builder: (_, BoxConstraints constraints) => SizedBox( - width: constraints.maxWidth, - child: SimpleInputTextField( - focusNode: _focusNode, - autocompleteKey: _autocompleteKey, - constraints: constraints, - tagType: widget.tagType, - hintText: '', - controller: widget.controller, - withClearButton: true, - minLengthForSuggestions: widget.minLengthForSuggestions, - categories: widget.categories, - shapeProvider: widget.shapeProvider, - productType: widget.productType, - ), - ), + ), + title: Text(widget.title), + ), + LayoutBuilder( + builder: (_, BoxConstraints constraints) => SizedBox( + width: constraints.maxWidth, + child: SimpleInputTextField( + focusNode: _focusNode, + autocompleteKey: _autocompleteKey, + constraints: constraints, + tagType: widget.tagType, + hintText: '', + controller: widget.controller, + withClearButton: true, + minLengthForSuggestions: widget.minLengthForSuggestions, + categories: widget.categories, + shapeProvider: widget.shapeProvider, + productType: widget.productType, ), - if (widget.hint != null) - Padding( - padding: const EdgeInsets.only(bottom: LARGE_SPACE), - child: ExplanationWidget(widget.hint!), - ), - ], - ); + ), + ), + if (widget.hint != null) + Padding( + padding: const EdgeInsets.only(bottom: LARGE_SPACE), + child: ExplanationWidget(widget.hint!), + ), + ], + ); } /// Edit display of a _number_ inside a [ProductPackaging], e.g. its weight. @@ -257,42 +256,42 @@ class _EditNumberLineState extends State<_EditNumberLine> { @override Widget build(BuildContext context) => Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ListTile( - leading: SvgAsyncAsset( - AssetCacheHelper( - ['assets/packagings/${widget.iconName}.svg'], - 'no url for packagings/${widget.iconName}', - color: widget.iconColor, - width: MINIMUM_TOUCH_SIZE, - ), - ), - title: Text(widget.title), + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ListTile( + leading: SvgAsyncAsset( + AssetCacheHelper( + ['assets/packagings/${widget.iconName}.svg'], + 'no url for packagings/${widget.iconName}', + color: widget.iconColor, + width: MINIMUM_TOUCH_SIZE, ), - LayoutBuilder( - builder: (_, BoxConstraints constraints) => SizedBox( - width: constraints.maxWidth, - child: SimpleInputNumberField( - focusNode: _focusNode, - constraints: constraints, - hintText: '', - controller: widget.controller, - decimal: widget.decimal, - withClearButton: true, - numberFormat: widget.numberFormat, - numberRegExp: SimpleInputNumberField.getNumberRegExp( - decimal: widget.decimal, - ), - ), + ), + title: Text(widget.title), + ), + LayoutBuilder( + builder: (_, BoxConstraints constraints) => SizedBox( + width: constraints.maxWidth, + child: SimpleInputNumberField( + focusNode: _focusNode, + constraints: constraints, + hintText: '', + controller: widget.controller, + decimal: widget.decimal, + withClearButton: true, + numberFormat: widget.numberFormat, + numberRegExp: SimpleInputNumberField.getNumberRegExp( + decimal: widget.decimal, ), ), - if (widget.hint != null) - Padding( - padding: const EdgeInsets.only(bottom: LARGE_SPACE), - child: ExplanationWidget(widget.hint!), - ), - ], - ); + ), + ), + if (widget.hint != null) + Padding( + padding: const EdgeInsets.only(bottom: LARGE_SPACE), + child: ExplanationWidget(widget.hint!), + ), + ], + ); } diff --git a/packages/smooth_app/lib/pages/product/edit_new_packagings_helper.dart b/packages/smooth_app/lib/pages/product/edit_new_packagings_helper.dart index be9d3bb0f8..49224d8bd5 100644 --- a/packages/smooth_app/lib/pages/product/edit_new_packagings_helper.dart +++ b/packages/smooth_app/lib/pages/product/edit_new_packagings_helper.dart @@ -23,31 +23,30 @@ class EditNewPackagingsHelper { required final NumberFormat decimalNumberFormat, required final NumberFormat unitNumberFormat, }) : this._( - controllerUnits: TextEditingController( - text: packaging.numberOfUnits == null - ? null - : unitNumberFormat.format(packaging.numberOfUnits), - ), - controllerShape: TextEditingController( - text: packaging.shape?.lcName, - ), - controllerMaterial: TextEditingController( - text: packaging.material?.lcName, - ), - controllerRecycling: TextEditingController( - text: packaging.recycling?.lcName, - ), - controllerQuantity: - TextEditingController(text: packaging.quantityPerUnit), - controllerWeight: TextEditingController( - text: packaging.weightMeasured == null - ? null - : decimalNumberFormat.format(packaging.weightMeasured), - ), - expanded: initiallyExpanded, - decimalNumberFormat: decimalNumberFormat, - unitNumberFormat: unitNumberFormat, - ); + controllerUnits: TextEditingController( + text: packaging.numberOfUnits == null + ? null + : unitNumberFormat.format(packaging.numberOfUnits), + ), + controllerShape: TextEditingController(text: packaging.shape?.lcName), + controllerMaterial: TextEditingController( + text: packaging.material?.lcName, + ), + controllerRecycling: TextEditingController( + text: packaging.recycling?.lcName, + ), + controllerQuantity: TextEditingController( + text: packaging.quantityPerUnit, + ), + controllerWeight: TextEditingController( + text: packaging.weightMeasured == null + ? null + : decimalNumberFormat.format(packaging.weightMeasured), + ), + expanded: initiallyExpanded, + decimalNumberFormat: decimalNumberFormat, + unitNumberFormat: unitNumberFormat, + ); final TextEditingController controllerUnits; final TextEditingController controllerShape; diff --git a/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_image.dart b/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_image.dart index 3906444f8f..5909c83b00 100644 --- a/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_image.dart +++ b/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_image.dart @@ -53,14 +53,14 @@ class _EditOCRImageWidgetState extends State { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); final AppLocalizations appLocalizations = AppLocalizations.of(context); - final ImageProvider? imageProvider = - widget.transientFile.getImageProvider(); + final ImageProvider? imageProvider = widget.transientFile + .getImageProvider(); final bool hasImage = imageProvider != null; final Size screenSize = MediaQuery.sizeOf(context); @@ -100,10 +100,7 @@ class _EditOCRImageWidgetState extends State { message: appLocalizations.product_image_outdated_message, textAlign: TextAlign.center, child: ConstrainedBox( - constraints: const BoxConstraints( - minHeight: 40.0, - minWidth: 40.0, - ), + constraints: const BoxConstraints(minHeight: 40.0, minWidth: 40.0), child: Padding( padding: const EdgeInsetsDirectional.all(VERY_SMALL_SPACE), child: Material( @@ -141,17 +138,12 @@ class _EditOCRImageWidgetState extends State { } else { headerIcons = Row( mainAxisSize: MainAxisSize.min, - children: [ - const OwnerFieldSmoothCardIcon(), - headerIcons, - ], + children: [const OwnerFieldSmoothCardIcon(), headerIcons], ); } } } else { - child = _EditOCRImageNotFound( - onTap: widget.onTakePictureWithChoices, - ); + child = _EditOCRImageNotFound(onTap: widget.onTakePictureWithChoices); } return SmoothCardWithRoundedHeader( @@ -273,31 +265,33 @@ class _EditOCRImageFoundState extends State<_EditOCRImageFound> { child: Image( fit: BoxFit.contain, image: widget.imageProvider, - frameBuilder: ( - BuildContext context, - Widget child, - int? frame, - bool wasSynchronouslyLoaded, - ) { - if (frame == null) { - return _loadingWidget(); - } else if (_isLoading) { - onNextFrame( - () => setState(() => _isLoading = false), - ); - } - return child; - }, - loadingBuilder: ( - BuildContext context, - Widget child, - ImageChunkEvent? loadingProgress, - ) { - if (loadingProgress == null) { - return child; - } - return _loadingWidget(); - }, + frameBuilder: + ( + BuildContext context, + Widget child, + int? frame, + bool wasSynchronouslyLoaded, + ) { + if (frame == null) { + return _loadingWidget(); + } else if (_isLoading) { + onNextFrame( + () => setState(() => _isLoading = false), + ); + } + return child; + }, + loadingBuilder: + ( + BuildContext context, + Widget child, + ImageChunkEvent? loadingProgress, + ) { + if (loadingProgress == null) { + return child; + } + return _loadingWidget(); + }, errorBuilder: _onError, ), ), @@ -309,21 +303,21 @@ class _EditOCRImageFoundState extends State<_EditOCRImageFound> { child: PinchToZoomExplainer(), ) else if (state == OcrState.IMAGE_LOADING) - const Center( - child: CloudUploadAnimation.circle(size: 65.0), - ) + const Center(child: CloudUploadAnimation.circle(size: 65.0)) else if (state == OcrState.EXTRACTING_DATA) - Builder(builder: (BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + Builder( + builder: (BuildContext context) { + final SmoothColorsThemeExtension extension = context + .extension(); - return Positioned.fill( - child: _ExtractTextAnimation( - tintColor: extension.secondaryNormal, - tintColorGradient: extension.secondaryLight, - ), - ); - }), + return Positioned.fill( + child: _ExtractTextAnimation( + tintColor: extension.secondaryNormal, + tintColorGradient: extension.secondaryLight, + ), + ); + }, + ), ], ); }, @@ -334,26 +328,18 @@ class _EditOCRImageFoundState extends State<_EditOCRImageFound> { ColoredBox _loadingWidget() { return const ColoredBox( color: PictureNotFound.defaultBackgroundColor, - child: Center( - child: CircularProgressIndicator(), - ), + child: Center(child: CircularProgressIndicator()), ); } - Widget _onError( - BuildContext context, - Object error, - StackTrace? stackTrace, - ) { + Widget _onError(BuildContext context, Object error, StackTrace? stackTrace) { widget.onError.call(); return EMPTY_WIDGET; } } class _EditOCRImageNotFound extends StatelessWidget { - const _EditOCRImageNotFound({ - required this.onTap, - }); + const _EditOCRImageNotFound({required this.onTap}); final VoidCallback onTap; @@ -421,12 +407,7 @@ class _EditOCRImageActions extends StatelessWidget { builder: (BuildContext context, OcrState ocrState, _) { return Column( children: [ - _extractTextButton( - context, - appLocalizations, - ocrState, - hasError, - ), + _extractTextButton(context, appLocalizations, ocrState, hasError), const SizedBox(height: BALANCED_SPACE), if (hasImage) _editPictureButton(appLocalizations, ocrState) @@ -459,9 +440,7 @@ class _EditOCRImageActions extends StatelessWidget { return _EditOCRImageButton( label: helper.getActionExtractShortText(appLocalizations), - icon: const icons.OCR( - size: 18.0, - ), + icon: const icons.OCR(size: 18.0), onPressed: onTap, enabled: hasImage && state == OcrState.IMAGE_LOADED && !hasError, ); @@ -473,9 +452,7 @@ class _EditOCRImageActions extends StatelessWidget { ) { return _EditOCRImageButton( label: appLocalizations.product_edit_photo_title, - icon: const icons.Edit( - size: 16.0, - ), + icon: const icons.Edit(size: 16.0), onPressed: state != OcrState.EXTRACTING_DATA ? onEditImage : null, ); } @@ -486,10 +463,7 @@ class _EditOCRImageActions extends StatelessWidget { ) { return _EditOCRImageButton( label: appLocalizations.edit_product_action_take_picture, - icon: const Icon( - Icons.add_a_photo_rounded, - size: 18.0, - ), + icon: const Icon(Icons.add_a_photo_rounded, size: 18.0), padding: const EdgeInsetsDirectional.only( start: VERY_SMALL_SPACE, end: 6.0, @@ -552,16 +526,14 @@ class _EditOCRImageButton extends StatelessWidget { @override Widget build(BuildContext context) { - final Color color = - (onPressed != null && enabled) ? Colors.white : const Color(0x88FFFFFF); + final Color color = (onPressed != null && enabled) + ? Colors.white + : const Color(0x88FFFFFF); return Ink( decoration: BoxDecoration( borderRadius: ROUNDED_BORDER_RADIUS, - border: Border.all( - color: color, - width: 1.0, - ), + border: Border.all(color: color, width: 1.0), ), child: InkWell( borderRadius: ROUNDED_BORDER_RADIUS, @@ -580,10 +552,8 @@ class _EditOCRImageButton extends StatelessWidget { shape: BoxShape.circle, ), child: Padding( - padding: padding ?? - const EdgeInsetsDirectional.all( - SMALL_SPACE, - ), + padding: + padding ?? const EdgeInsetsDirectional.all(SMALL_SPACE), child: icon, ), ), @@ -654,9 +624,10 @@ class _ExtractTextAnimationState extends State<_ExtractTextAnimation> }) ..repeat(); - _progress = Tween(begin: 0.0, end: 1.0) - .chain(CurveTween(curve: Curves.easeInOutCubic)) - .animate(_controller); + _progress = Tween( + begin: 0.0, + end: 1.0, + ).chain(CurveTween(curve: Curves.easeInOutCubic)).animate(_controller); _controller.forward(); } @@ -673,9 +644,7 @@ class _ExtractTextAnimationState extends State<_ExtractTextAnimation> gradient: LinearGradient( colors: [ Colors.transparent, - widget.tintColorGradient.withValues( - alpha: progress, - ), + widget.tintColorGradient.withValues(alpha: progress), ], stops: const [0.4, 1.0], ), @@ -719,11 +688,7 @@ class _ExtractTextAnimationPainter extends CustomPainter { ..style = PaintingStyle.stroke ..shader = null; - canvas.drawLine( - Offset(width, 0), - Offset(width, size.height), - paint, - ); + canvas.drawLine(Offset(width, 0), Offset(width, size.height), paint); } @override diff --git a/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_page.dart b/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_page.dart index 64177f3a08..c544bd47bd 100644 --- a/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_page.dart +++ b/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_page.dart @@ -94,12 +94,8 @@ class _EditOcrPageState extends State with UpToDateMixin { controller: _willPopScope2Controller, child: MultiProvider( providers: [ - Provider( - create: (BuildContext context) => upToDateProduct, - ), - Provider.value( - value: _extractState(transientFile), - ), + Provider(create: (BuildContext context) => upToDateProduct), + Provider.value(value: _extractState(transientFile)), ], child: UnfocusFieldWhenTapOutside( child: SmoothScaffold( @@ -112,10 +108,7 @@ class _EditOcrPageState extends State with UpToDateMixin { ? EditOcrTabBar( onTabChanged: (OpenFoodFactsLanguage language) { if (_multilingualHelper.changeLanguage(language)) { - onNextFrame( - () => setState(() {}), - forceRedraw: true, - ); + onNextFrame(() => setState(() {}), forceRedraw: true); } }, imageField: _helper.getImageField(), @@ -132,7 +125,8 @@ class _EditOcrPageState extends State with UpToDateMixin { EditOCRImageWidget( helper: _helper, transientFile: transientFile, - ownerField: upToDateProduct.isImageLocked( + ownerField: + upToDateProduct.isImageLocked( _helper.getImageField(), _multilingualHelper.getCurrentLanguage(), ) ?? @@ -163,12 +157,9 @@ class _EditOcrPageState extends State with UpToDateMixin { ), resizeToAvoidBottomInset: true, bottomNavigationBar: ProductBottomButtonsBar( - onSave: () async => _exitPage( - await _mayExitPage(saving: true), - ), - onCancel: () async => _exitPage( - await _mayExitPage(saving: false), - ), + onSave: () async => _exitPage(await _mayExitPage(saving: true)), + onCancel: () async => + _exitPage(await _mayExitPage(saving: false)), ), ), ), @@ -259,8 +250,8 @@ class _EditOcrPageState extends State with UpToDateMixin { } if (!saving) { - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog(context); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog(context); if (pleaseSave == false) { return true; @@ -304,8 +295,8 @@ class _EditOcrPageState extends State with UpToDateMixin { } List _getLanguagesWithText() { - final Map allLanguages = - _multilingualHelper.getInitialMultiLingualTexts(); + final Map allLanguages = _multilingualHelper + .getInitialMultiLingualTexts(); final List languages = []; @@ -331,8 +322,8 @@ class _EditOcrPageState extends State with UpToDateMixin { _helper.setMonolingualText(result, changed); } } else { - final Map? changed = - _multilingualHelper.getChangedMultilingualText(); + final Map? changed = _multilingualHelper + .getChangedMultilingualText(); if (changed != null) { result ??= getBasicProduct(); _helper.setMultilingualTexts(result, changed); @@ -366,9 +357,4 @@ class _EditOcrPageState extends State with UpToDateMixin { } } -enum OcrState { - IMAGE_LOADING, - IMAGE_LOADED, - EXTRACTING_DATA, - OTHER, -} +enum OcrState { IMAGE_LOADING, IMAGE_LOADED, EXTRACTING_DATA, OTHER } diff --git a/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_tabbar.dart b/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_tabbar.dart index 33f66ebf2e..510ed9426e 100644 --- a/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_tabbar.dart +++ b/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_tabbar.dart @@ -27,12 +27,14 @@ class EditOcrTabBar extends StatelessWidget implements PreferredSizeWidget { List productLanguages(Product product) { return getProductImageLanguages(product, imageField) - .map((OpenFoodFactsLanguage l) => ProductLanguageWithState( - language: l, - state: languagesWithText.contains(l) - ? OpenFoodFactsLanguageState.normal - : OpenFoodFactsLanguageState.warning, - )) + .map( + (OpenFoodFactsLanguage l) => ProductLanguageWithState( + language: l, + state: languagesWithText.contains(l) + ? OpenFoodFactsLanguageState.normal + : OpenFoodFactsLanguageState.warning, + ), + ) .toList(growable: false); } diff --git a/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_textfield.dart b/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_textfield.dart index 617b037cec..b19928a5c7 100644 --- a/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_textfield.dart +++ b/packages/smooth_app/lib/pages/product/edit_ocr/edit_ocr_textfield.dart @@ -36,18 +36,11 @@ class EditOCRTextField extends StatelessWidget { final AppLocalizations appLocalizations = AppLocalizations.of(context); return Consumer( - builder: ( - BuildContext context, - OcrState ocrState, - Widget? child, - ) { + builder: (BuildContext context, OcrState ocrState, Widget? child) { if (ocrState == OcrState.EXTRACTING_DATA) { return AbsorbPointer( absorbing: ocrState == OcrState.EXTRACTING_DATA, - child: Opacity( - opacity: 0.2, - child: child, - ), + child: Opacity(opacity: 0.2, child: child), ); } else { return child!; @@ -66,72 +59,74 @@ class EditOCRTextField extends StatelessWidget { ), ], ), - contentPadding: const EdgeInsetsDirectional.all( - MEDIUM_SPACE, - ), + contentPadding: const EdgeInsetsDirectional.all(MEDIUM_SPACE), child: Column( children: [ ConsumerFilter( - buildWhen: ( - UserPreferences? previousValue, - UserPreferences currentValue, - ) { - return previousValue?.getFlag(UserPreferencesDevMode - .userPreferencesFlagSpellCheckerOnOcr) != - currentValue.getFlag(UserPreferencesDevMode - .userPreferencesFlagSpellCheckerOnOcr); - }, - builder: ( - BuildContext context, - UserPreferences prefs, - Widget? child, - ) { - final ThemeData theme = Theme.of(context); + buildWhen: + ( + UserPreferences? previousValue, + UserPreferences currentValue, + ) { + return previousValue?.getFlag( + UserPreferencesDevMode + .userPreferencesFlagSpellCheckerOnOcr, + ) != + currentValue.getFlag( + UserPreferencesDevMode + .userPreferencesFlagSpellCheckerOnOcr, + ); + }, + builder: + (BuildContext context, UserPreferences prefs, Widget? child) { + final ThemeData theme = Theme.of(context); - return Theme( - data: theme.copyWith( - colorScheme: theme.colorScheme.copyWith( - onSurface: - context.read().isDarkMode(context) + return Theme( + data: theme.copyWith( + colorScheme: theme.colorScheme.copyWith( + onSurface: + context.read().isDarkMode(context) ? Colors.white : Colors.black, - ), - ), - child: TextFormField( - minLines: null, - maxLines: null, - controller: controller, - textInputAction: TextInputAction.newline, - textCapitalization: TextCapitalization.sentences, - spellCheckConfiguration: (prefs.getFlag( - UserPreferencesDevMode - .userPreferencesFlagSpellCheckerOnOcr) ?? - false) && - (Platform.isAndroid || Platform.isIOS) - ? const SpellCheckConfiguration() - : const SpellCheckConfiguration.disabled(), - decoration: const InputDecoration( - contentPadding: EdgeInsets.symmetric( - horizontal: LARGE_SPACE, - vertical: SMALL_SPACE, - ), - filled: true, - border: OutlineInputBorder( - borderRadius: ROUNDED_BORDER_RADIUS, - ), - enabledBorder: OutlineInputBorder( - borderRadius: ROUNDED_BORDER_RADIUS, - borderSide: BorderSide( - color: Colors.transparent, - width: 5.0, ), ), - ), - onTapOutside: (_) => - FocusManager.instance.primaryFocus?.unfocus(), - ), - ); - }, + child: TextFormField( + minLines: null, + maxLines: null, + controller: controller, + textInputAction: TextInputAction.newline, + textCapitalization: TextCapitalization.sentences, + spellCheckConfiguration: + (prefs.getFlag( + UserPreferencesDevMode + .userPreferencesFlagSpellCheckerOnOcr, + ) ?? + false) && + (Platform.isAndroid || Platform.isIOS) + ? const SpellCheckConfiguration() + : const SpellCheckConfiguration.disabled(), + decoration: const InputDecoration( + contentPadding: EdgeInsets.symmetric( + horizontal: LARGE_SPACE, + vertical: SMALL_SPACE, + ), + filled: true, + border: OutlineInputBorder( + borderRadius: ROUNDED_BORDER_RADIUS, + ), + enabledBorder: OutlineInputBorder( + borderRadius: ROUNDED_BORDER_RADIUS, + borderSide: BorderSide( + color: Colors.transparent, + width: 5.0, + ), + ), + ), + onTapOutside: (_) => + FocusManager.instance.primaryFocus?.unfocus(), + ), + ); + }, ), if (extraButton != null) extraButton!, ], diff --git a/packages/smooth_app/lib/pages/product/edit_ocr/ocr_helper.dart b/packages/smooth_app/lib/pages/product/edit_ocr/ocr_helper.dart index 4444dc4bed..d4de2e12d5 100644 --- a/packages/smooth_app/lib/pages/product/edit_ocr/ocr_helper.dart +++ b/packages/smooth_app/lib/pages/product/edit_ocr/ocr_helper.dart @@ -7,14 +7,9 @@ import 'package:smooth_app/query/product_query.dart'; /// OCR Helper, to be implemented for ingredients and packaging for instance. abstract class OcrHelper { - String? getMonolingualText( - final Product product, - ); + String? getMonolingualText(final Product product); - void setMonolingualText( - final Product product, - final String text, - ); + void setMonolingualText(final Product product, final String text); Map? getMultilingualTexts( final Product product, @@ -47,11 +42,13 @@ abstract class OcrHelper { /// Returns the title of the dialog to explain the "loading photo" state String getActionLoadingPhotoDialogTitle( - final AppLocalizations appLocalizations); + final AppLocalizations appLocalizations, + ); /// Returns the content of the dialog to explain the "loading photo" state String getActionLoadingPhotoDialogBody( - final AppLocalizations appLocalizations); + final AppLocalizations appLocalizations, + ); /// Returns the "Extracting data…" button label String getActionExtractingData(final AppLocalizations appLocalizations); diff --git a/packages/smooth_app/lib/pages/product/edit_ocr/ocr_ingredients_helper.dart b/packages/smooth_app/lib/pages/product/edit_ocr/ocr_ingredients_helper.dart index 96a70eac0d..35e734e9fd 100644 --- a/packages/smooth_app/lib/pages/product/edit_ocr/ocr_ingredients_helper.dart +++ b/packages/smooth_app/lib/pages/product/edit_ocr/ocr_ingredients_helper.dart @@ -13,24 +13,19 @@ class OcrIngredientsHelper extends OcrHelper { String? getMonolingualText(final Product product) => product.ingredientsText; @override - void setMonolingualText( - final Product product, - final String text, - ) => + void setMonolingualText(final Product product, final String text) => product.ingredientsText = text; @override Map? getMultilingualTexts( final Product product, - ) => - product.ingredientsTextInLanguages; + ) => product.ingredientsTextInLanguages; @override void setMultilingualTexts( final Product product, final Map texts, - ) => - product.ingredientsTextInLanguages = texts; + ) => product.ingredientsTextInLanguages = texts; @override String? getImageUrl(final Product product) => product.imageIngredientsUrl; @@ -113,13 +108,13 @@ class OcrIngredientsHelper extends OcrHelper { ) async { final OcrIngredientsResult result = await OpenFoodAPIClient.extractIngredients( - getUser(), - product.barcode!, - language, - uriHelper: ProductQuery.getUriProductHelper( - productType: product.productType, - ), - ); + getUser(), + product.barcode!, + language, + uriHelper: ProductQuery.getUriProductHelper( + productType: product.productType, + ), + ); return result.ingredientsTextFromImage; } diff --git a/packages/smooth_app/lib/pages/product/edit_ocr/ocr_packaging_helper.dart b/packages/smooth_app/lib/pages/product/edit_ocr/ocr_packaging_helper.dart index 8de2f824da..68d9e538f0 100644 --- a/packages/smooth_app/lib/pages/product/edit_ocr/ocr_packaging_helper.dart +++ b/packages/smooth_app/lib/pages/product/edit_ocr/ocr_packaging_helper.dart @@ -16,24 +16,20 @@ class OcrPackagingHelper extends OcrHelper { String? getMonolingualText(final Product product) => product.packaging; @override - void setMonolingualText( - final Product product, - final String text, - ) => + void setMonolingualText(final Product product, final String text) => // ignore: deprecated_member_use product.packaging = text; @override Map? getMultilingualTexts( - final Product product) => - product.packagingTextInLanguages; + final Product product, + ) => product.packagingTextInLanguages; @override void setMultilingualTexts( final Product product, final Map texts, - ) => - product.packagingTextInLanguages = texts; + ) => product.packagingTextInLanguages = texts; @override String? getImageUrl(final Product product) => product.imagePackagingUrl; diff --git a/packages/smooth_app/lib/pages/product/edit_product/edit_product_footer.dart b/packages/smooth_app/lib/pages/product/edit_product/edit_product_footer.dart index 0371778657..494dadc269 100644 --- a/packages/smooth_app/lib/pages/product/edit_product/edit_product_footer.dart +++ b/packages/smooth_app/lib/pages/product/edit_product/edit_product_footer.dart @@ -17,10 +17,7 @@ import 'package:smooth_app/widgets/smooth_text.dart'; import 'package:smooth_app/widgets/widget_height.dart'; class EditProductFooter extends StatefulWidget { - const EditProductFooter({ - required this.uploadIndicator, - super.key, - }); + const EditProductFooter({required this.uploadIndicator, super.key}); final bool uploadIndicator; @@ -46,33 +43,36 @@ class _EditProductFooterState extends State @override void initState() { super.initState(); - _menuController = AnimationController( - vsync: this, - duration: SmoothAnimationsDuration.medium, - ) - ..addListener(() { - setState(() { - _menuOffsetX = _menuAnimation.value; + _menuController = + AnimationController( + vsync: this, + duration: SmoothAnimationsDuration.medium, + ) + ..addListener(() { + setState(() { + _menuOffsetX = _menuAnimation.value; - /// Also move the upload indicator - if (widget.uploadIndicator) { - _loadingOffsetY = _height * - (1 - _menuOffsetX.progressAndClamp(0.0, _maxOffsetX, 1.0)); - } + /// Also move the upload indicator + if (widget.uploadIndicator) { + _loadingOffsetY = + _height * + (1 - _menuOffsetX.progressAndClamp(0.0, _maxOffsetX, 1.0)); + } + }); + }) + ..addStatusListener((AnimationStatus status) { + if (status == AnimationStatus.completed && _menuOffsetX > 0.0) { + _scrollController.jumpTo(0.0); + } + }); + + _loadingController = + AnimationController( + vsync: this, + duration: SmoothAnimationsDuration.long, + )..addListener(() { + setState(() => _loadingOffsetY = _loadingAnimation.value); }); - }) - ..addStatusListener((AnimationStatus status) { - if (status == AnimationStatus.completed && _menuOffsetX > 0.0) { - _scrollController.jumpTo(0.0); - } - }); - - _loadingController = AnimationController( - vsync: this, - duration: SmoothAnimationsDuration.long, - )..addListener(() { - setState(() => _loadingOffsetY = _loadingAnimation.value); - }); if (widget.uploadIndicator) { _loadingOffsetY = 0.0; @@ -81,9 +81,7 @@ class _EditProductFooterState extends State _loadingOffsetY = double.infinity; } - onNextFrame(() => setState( - () => _menuOffsetX = _maxOffsetX, - )); + onNextFrame(() => setState(() => _menuOffsetX = _maxOffsetX)); } @override @@ -120,10 +118,7 @@ class _EditProductFooterState extends State child: Opacity( opacity: 1 - _loadingOffsetY.progressAndClamp(0.0, _height, 1.0), child: Transform.translate( - offset: Offset( - 0.0, - _loadingOffsetY, - ), + offset: Offset(0.0, _loadingOffsetY), child: const _EditPageLoadingIndicator(), ), ), @@ -158,11 +153,11 @@ class _EditProductFooterState extends State ), color: context.lightTheme() ? context - .extension() - .primaryBlack + .extension() + .primaryBlack : context - .extension() - .primarySemiDark, + .extension() + .primarySemiDark, ), child: SizedBox( width: BUTTON_WIDTH, @@ -173,13 +168,15 @@ class _EditProductFooterState extends State bottom: MediaQuery.viewPaddingOf(context).bottom, ), child: Transform.rotate( - angle: math.pi * + angle: + math.pi * (1 - _menuOffsetX.progressAndClamp( - 0.0, width - BUTTON_WIDTH, 1.0)), - child: const Drag.start( - color: Colors.white, - ), + 0.0, + width - BUTTON_WIDTH, + 1.0, + )), + child: const Drag.start(color: Colors.white), ), ), ), @@ -214,14 +211,8 @@ class _EditProductFooterState extends State _loadingOffsetY = _height; } - _loadingAnimation = Tween( - begin: 0.0, - end: _height, - ).animate( - CurvedAnimation( - parent: _loadingController, - curve: Curves.easeOutQuint, - ), + _loadingAnimation = Tween(begin: 0.0, end: _height).animate( + CurvedAnimation(parent: _loadingController, curve: Curves.easeOutQuint), ); setState(() {}); @@ -230,15 +221,9 @@ class _EditProductFooterState extends State void _onTapMenu(double width) { if (_menuOffsetX == 0.0) { - _startMenuAnimation( - from: 0.0, - to: width - BUTTON_WIDTH, - ); + _startMenuAnimation(from: 0.0, to: width - BUTTON_WIDTH); } else { - _startMenuAnimation( - from: width - BUTTON_WIDTH, - to: 0.0, - ); + _startMenuAnimation(from: width - BUTTON_WIDTH, to: 0.0); } } @@ -253,7 +238,8 @@ class _EditProductFooterState extends State } if (widget.uploadIndicator) { - _loadingOffsetY = _height * + _loadingOffsetY = + _height * (1 - _menuOffsetX.progressAndClamp(0.0, _maxOffsetX, 1.0)); } }); @@ -262,25 +248,16 @@ class _EditProductFooterState extends State /// Snap to the closest edge void _onHorizontalDragEnd(DragEndDetails details, double width) { if (_dragStartDetails.localPosition.dx - details.localPosition.dx > 0) { - _startMenuAnimation( - from: _menuOffsetX, - to: 0.0, - ); + _startMenuAnimation(from: _menuOffsetX, to: 0.0); } else { - _startMenuAnimation( - from: _menuOffsetX, - to: width - BUTTON_WIDTH, - ); + _startMenuAnimation(from: _menuOffsetX, to: width - BUTTON_WIDTH); } } double get _maxOffsetX => MediaQuery.sizeOf(context).width - BUTTON_WIDTH; void _startMenuAnimation({required double from, required double to}) { - _menuAnimation = Tween( - begin: from, - end: to, - ).animate( + _menuAnimation = Tween(begin: from, end: to).animate( CurvedAnimation(parent: _menuController, curve: Curves.easeOutQuint), ); _menuController.forward(from: 0.0); @@ -309,8 +286,8 @@ class _EditPageLoadingIndicator extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); @@ -318,8 +295,9 @@ class _EditPageLoadingIndicator extends StatelessWidget { decoration: BoxDecoration( boxShadow: [ BoxShadow( - color: - context.lightTheme() ? Colors.black12 : const Color(0x10FFFFFF), + color: context.lightTheme() + ? Colors.black12 + : const Color(0x10FFFFFF), blurRadius: 6.0, offset: const Offset(0.0, -4.0), ), @@ -365,9 +343,7 @@ class _EditPageLoadingIndicator extends StatelessWidget { child: TextWithBoldParts( text: appLocalizations .edit_product_pending_operations_banner_short_message, - textStyle: const TextStyle( - fontSize: 14.5, - ), + textStyle: const TextStyle(fontSize: 14.5), maxLines: 2, overflow: TextOverflow.ellipsis, ), diff --git a/packages/smooth_app/lib/pages/product/edit_product/edit_product_page.dart b/packages/smooth_app/lib/pages/product/edit_product/edit_product_page.dart index 55ab716cb9..5999d3e68b 100644 --- a/packages/smooth_app/lib/pages/product/edit_product/edit_product_page.dart +++ b/packages/smooth_app/lib/pages/product/edit_product/edit_product_page.dart @@ -50,8 +50,8 @@ class _EditProductPageState extends State with UpToDateMixin { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); final AppLocalizations appLocalizations = AppLocalizations.of(context); @@ -63,10 +63,13 @@ class _EditProductPageState extends State with UpToDateMixin { upToDateProduct, appLocalizations, ); - final String productBrands = - getProductBrands(upToDateProduct, appLocalizations); - final bool hasUploadIndicator = UpToDateChanges(localDatabase) - .hasNotTerminatedOperations(upToDateProduct.barcode!); + final String productBrands = getProductBrands( + upToDateProduct, + appLocalizations, + ); + final bool hasUploadIndicator = UpToDateChanges( + localDatabase, + ).hasNotTerminatedOperations(upToDateProduct.barcode!); return Provider.value( value: upToDateProduct, @@ -77,8 +80,9 @@ class _EditProductPageState extends State with UpToDateMixin { title: AppLocalizations.of(context).edit_product_label, subTitle: '$productName, $productBrands', leadingAction: SmoothLeadingAction.back, - backgroundColor: - lightTheme ? extension.primaryBlack : extension.primaryUltraBlack, + backgroundColor: lightTheme + ? extension.primaryBlack + : extension.primaryUltraBlack, foregroundColor: lightTheme ? Colors.white : null, elevationColor: lightTheme ? Colors.black54 : Colors.white12, elevationOnScroll: false, @@ -123,25 +127,19 @@ class _EditProductPageState extends State with UpToDateMixin { context, MaterialPageRoute( builder: (BuildContext context) => - ProductImageGalleryView( - product: upToDateProduct, - ), + ProductImageGalleryView(product: upToDateProduct), ), ); }, ), - _getMultipleListTileItem( - [ - SimpleInputPageLabelHelper(), - SimpleInputPageStoreHelper(), - SimpleInputPageOriginHelper(), - SimpleInputPageEmbCodeHelper(), - SimpleInputPageCountryHelper( - context.read(), - ), - SimpleInputPageCategoryHelper(), - ], - ), + _getMultipleListTileItem([ + SimpleInputPageLabelHelper(), + SimpleInputPageStoreHelper(), + SimpleInputPageOriginHelper(), + SimpleInputPageEmbCodeHelper(), + SimpleInputPageCountryHelper(context.read()), + SimpleInputPageCategoryHelper(), + ]), if (upToDateProduct.productType != ProductType.product) _ListTitleItem( leading: const icons.Ingredients.alt(), @@ -162,31 +160,32 @@ class _EditProductPageState extends State with UpToDateMixin { if (upToDateProduct.productType != ProductType.beauty && upToDateProduct.productType != ProductType.product) _ListTitleItem( - leading: const icons.NutritionFacts(size: 18.0), - title: appLocalizations - .edit_product_form_item_nutrition_facts_title, - subtitle: appLocalizations - .edit_product_form_item_nutrition_facts_subtitle, - onTap: () async { - if (!await ProductRefresher().checkIfLoggedIn( - context, - isLoggedInMandatory: true, - )) { - return; - } - AnalyticsHelper.trackProductEdit( - AnalyticsEditEvents.nutrition_Facts, - upToDateProduct, - ); - if (!context.mounted) { - return; - } - await NutritionPageLoader.showNutritionPage( - product: upToDateProduct, - isLoggedInMandatory: true, - context: context, - ); - }), + leading: const icons.NutritionFacts(size: 18.0), + title: appLocalizations + .edit_product_form_item_nutrition_facts_title, + subtitle: appLocalizations + .edit_product_form_item_nutrition_facts_subtitle, + onTap: () async { + if (!await ProductRefresher().checkIfLoggedIn( + context, + isLoggedInMandatory: true, + )) { + return; + } + AnalyticsHelper.trackProductEdit( + AnalyticsEditEvents.nutrition_Facts, + upToDateProduct, + ); + if (!context.mounted) { + return; + } + await NutritionPageLoader.showNutritionPage( + product: upToDateProduct, + isLoggedInMandatory: true, + context: context, + ); + }, + ), _getSimpleListTileItem(SimpleInputPageLabelHelper()), _ListTitleItem( leading: const icons.Packaging(), @@ -207,9 +206,9 @@ class _EditProductPageState extends State with UpToDateMixin { _getSimpleListTileItem(SimpleInputPageStoreHelper()), _getSimpleListTileItem(SimpleInputPageOriginHelper()), _getSimpleListTileItem(SimpleInputPageEmbCodeHelper()), - _getSimpleListTileItem(SimpleInputPageCountryHelper( - context.read(), - )), + _getSimpleListTileItem( + SimpleInputPageCountryHelper(context.read()), + ), _ListTitleItem( title: appLocalizations.edit_product_form_item_other_details_title, @@ -240,20 +239,20 @@ class _EditProductPageState extends State with UpToDateMixin { Consumer( builder: (BuildContext context, UserPreferences preferences, _) { - return _ListTitleItem( - title: appLocalizations.prices_add_a_price, - leading: icons.AddPrice( - CurrencySelectorHelper().getSelected( - preferences.userCurrencyCode, - ), - ), - onTap: () async => ProductPriceAddPage.showProductPage( - context: context, - product: PriceMetaProduct.product(upToDateProduct), - proofType: ProofType.priceTag, - ), - ); - }, + return _ListTitleItem( + title: appLocalizations.prices_add_a_price, + leading: icons.AddPrice( + CurrencySelectorHelper().getSelected( + preferences.userCurrencyCode, + ), + ), + onTap: () async => ProductPriceAddPage.showProductPage( + context: context, + product: PriceMetaProduct.product(upToDateProduct), + proofType: ProofType.priceTag, + ), + ); + }, ), ], ), @@ -269,10 +268,9 @@ class _EditProductPageState extends State with UpToDateMixin { leading: helper.getIcon(), title: helper.getTitle(appLocalizations), subtitle: helper.getSubtitle(appLocalizations), - onTap: () async => ProductFieldSimpleEditor(helper).edit( - context: context, - product: upToDateProduct, - ), + onTap: () async => ProductFieldSimpleEditor( + helper, + ).edit(context: context, product: upToDateProduct), ); } @@ -322,16 +320,11 @@ class _ListTitleItem extends SmoothListTileCard { String? subtitle, super.onTap, }) : super.icon( - title: title == null - ? null - : Text( - title, - style: const TextStyle(fontWeight: FontWeight.bold), - ), - icon: leading, - subtitle: subtitle == null ? null : Text(subtitle), - margin: const EdgeInsetsDirectional.only( - top: SMALL_SPACE, - ), - ); + title: title == null + ? null + : Text(title, style: const TextStyle(fontWeight: FontWeight.bold)), + icon: leading, + subtitle: subtitle == null ? null : Text(subtitle), + margin: const EdgeInsetsDirectional.only(top: SMALL_SPACE), + ); } diff --git a/packages/smooth_app/lib/pages/product/edit_product_image_viewer.dart b/packages/smooth_app/lib/pages/product/edit_product_image_viewer.dart index fab6ef4e0c..899371d00f 100644 --- a/packages/smooth_app/lib/pages/product/edit_product_image_viewer.dart +++ b/packages/smooth_app/lib/pages/product/edit_product_image_viewer.dart @@ -48,9 +48,10 @@ class _EditProductImageViewerState extends State reverseDuration: SmoothAnimationsDuration.short, vsync: this, )..addListener(() => setState(() {})); - _animation = Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation(parent: _controller, curve: Curves.easeOutSine), - ); + _animation = Tween( + begin: 0.0, + end: 1.0, + ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeOutSine)); } @override @@ -107,9 +108,7 @@ class _EditProductImageViewerState extends State child: Tooltip( message: AppLocalizations.of(context).close, child: const SmoothIndicatorIcon( - icon: icons.Close( - size: 14.0, - ), + icon: icons.Close(size: 14.0), ), ), ), @@ -123,7 +122,7 @@ class _EditProductImageViewerState extends State offstage: _animation.value != 1.0, child: const PinchToZoomExplainer(), ), - ) + ), ], ), ), @@ -167,9 +166,7 @@ class _EditProductImageViewerState extends State if (frame == null) { return _loadingWidget(); } else if (_isLoading) { - onNextFrame( - () => setState(() => _isLoading = false), - ); + onNextFrame(() => setState(() => _isLoading = false)); } return child; } @@ -190,9 +187,7 @@ class _EditProductImageViewerState extends State Object error, StackTrace? stackTrace, ) { - onNextFrame( - () => setState(() => _isLoading = false), - ); + onNextFrame(() => setState(() => _isLoading = false)); return FractionallySizedBox( widthFactor: 0.6, @@ -200,10 +195,7 @@ class _EditProductImageViewerState extends State child: Text( AppLocalizations.of(context).nutrition_page_photo_error, textAlign: TextAlign.center, - style: const TextStyle( - color: Colors.white, - fontSize: 15.0, - ), + style: const TextStyle(color: Colors.white, fontSize: 15.0), ), ), ); diff --git a/packages/smooth_app/lib/pages/product/explanation_widget.dart b/packages/smooth_app/lib/pages/product/explanation_widget.dart index fe77d3a03e..35477ff734 100644 --- a/packages/smooth_app/lib/pages/product/explanation_widget.dart +++ b/packages/smooth_app/lib/pages/product/explanation_widget.dart @@ -27,9 +27,7 @@ class _ExplanationWidgetState extends State { crossFadeState: _expanded ? CrossFadeState.showFirst : CrossFadeState.showSecond, - firstChild: _ExpandedExplanation( - explanations: widget.explanations, - ), + firstChild: _ExpandedExplanation(explanations: widget.explanations), secondChild: _CollapsedExplanation( explanations: widget.explanations, ), @@ -41,20 +39,14 @@ class _ExplanationWidgetState extends State { } class _CollapsedExplanation extends StatelessWidget { - const _CollapsedExplanation({ - required this.explanations, - }); + const _CollapsedExplanation({required this.explanations}); final String explanations; @override Widget build(BuildContext context) { return ListTile( - title: Text( - explanations, - maxLines: 2, - overflow: TextOverflow.ellipsis, - ), + title: Text(explanations, maxLines: 2, overflow: TextOverflow.ellipsis), trailing: const Icon(Icons.info_outline), contentPadding: const EdgeInsetsDirectional.only( start: SMALL_SPACE * 2, @@ -65,9 +57,7 @@ class _CollapsedExplanation extends StatelessWidget { } class _ExpandedExplanation extends StatelessWidget { - const _ExpandedExplanation({ - required this.explanations, - }); + const _ExpandedExplanation({required this.explanations}); final String explanations; @@ -99,9 +89,6 @@ class _ExpandedExplanation extends StatelessWidget { } } - return Column( - mainAxisSize: MainAxisSize.min, - children: result, - ); + return Column(mainAxisSize: MainAxisSize.min, children: result); } } diff --git a/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_photo_row.dart b/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_photo_row.dart index 17d9a8d27e..15857f9881 100644 --- a/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_photo_row.dart +++ b/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_photo_row.dart @@ -64,11 +64,12 @@ class _ImageGalleryPhotoRowState extends State { final bool expired = transientFile.expired; final AppLocalizations appLocalizations = AppLocalizations.of(context); - final String label = - widget.imageField.getProductImageTitle(appLocalizations); + final String label = widget.imageField.getProductImageTitle( + appLocalizations, + ); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return Provider( create: (_) => transientFile, @@ -149,39 +150,37 @@ class _ImageGalleryPhotoRowState extends State { child: LayoutBuilder( builder: (BuildContext context, BoxConstraints box) { - if (_temporaryFile != null) { - return Image.file( - _temporaryFile!, - fit: BoxFit.contain, - ); - } + if (_temporaryFile != null) { + return Image.file( + _temporaryFile!, + fit: BoxFit.contain, + ); + } - return ProductPicture.fromTransientFile( - product: product, - imageField: widget.imageField, - language: widget.language, - allowAlternativeLanguage: false, - transientFile: transientFile, - size: Size(box.maxWidth, box.maxHeight), - onTap: null, - errorTextStyle: const TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.w600, - ), - heroTag: ProductPicture.generateHeroTag( - product.barcode!, - widget.imageField, - ), - showObsoleteIcon: false, - showOwnerIcon: true, - ); - }, + return ProductPicture.fromTransientFile( + product: product, + imageField: widget.imageField, + language: widget.language, + allowAlternativeLanguage: false, + transientFile: transientFile, + size: Size(box.maxWidth, box.maxHeight), + onTap: null, + errorTextStyle: const TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.w600, + ), + heroTag: ProductPicture.generateHeroTag( + product.barcode!, + widget.imageField, + ), + showObsoleteIcon: false, + showOwnerIcon: true, + ); + }, ), ), // Border - const Positioned.fill( - child: _PhotoBorder(), - ), + const Positioned.fill(child: _PhotoBorder()), // Upload animation if (_temporaryFile != null || transientFile.isImageAvailable() && @@ -251,34 +250,26 @@ class _ImageGalleryPhotoRowState extends State { required BuildContext context, required final Product product, required int initialImageIndex, - }) async => - Navigator.push( - context, - MaterialPageRoute( - builder: (_) => ProductImageSwipeableView( - initialImageIndex: initialImageIndex, - product: product, - isLoggedInMandatory: true, - initialLanguage: widget.language, - ), - ), - ); + }) async => Navigator.push( + context, + MaterialPageRoute( + builder: (_) => ProductImageSwipeableView( + initialImageIndex: initialImageIndex, + product: product, + isLoggedInMandatory: true, + initialLanguage: widget.language, + ), + ), + ); TransientFile _getTransientFile( final Product product, final ImageField imageField, - ) => - TransientFile.fromProduct( - product, - imageField, - widget.language, - ); + ) => TransientFile.fromProduct(product, imageField, widget.language); } class _PhotoRowIndicator extends StatelessWidget { - const _PhotoRowIndicator({ - required this.transientFile, - }); + const _PhotoRowIndicator({required this.transientFile}); final TransientFile transientFile; @@ -289,16 +280,10 @@ class _PhotoRowIndicator extends StatelessWidget { height: double.infinity, child: Ink( decoration: BoxDecoration( - borderRadius: const BorderRadius.only( - topLeft: ANGULAR_RADIUS, - ), - color: _getColor( - context.extension(), - ), - ), - child: Center( - child: child(), + borderRadius: const BorderRadius.only(topLeft: ANGULAR_RADIUS), + color: _getColor(context.extension()), ), + child: Center(child: child()), ), ); } @@ -306,18 +291,12 @@ class _PhotoRowIndicator extends StatelessWidget { Widget? child() { if (transientFile.isImageAvailable()) { if (transientFile.expired) { - return const icons.Outdated( - size: 18.0, - color: Colors.white, - ); + return const icons.Outdated(size: 18.0, color: Colors.white); } else { return null; } } else { - return const icons.Warning( - size: 15.0, - color: Colors.white, - ); + return const icons.Warning(size: 15.0, color: Colors.white); } } @@ -339,8 +318,8 @@ class _PhotoBorder extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); @@ -351,14 +330,8 @@ class _PhotoBorder extends StatelessWidget { return DecoratedBox( decoration: BoxDecoration( - borderRadius: const BorderRadius.vertical( - bottom: ANGULAR_RADIUS, - ), - border: Border( - right: borderSide, - left: borderSide, - bottom: borderSide, - ), + borderRadius: const BorderRadius.vertical(bottom: ANGULAR_RADIUS), + border: Border(right: borderSide, left: borderSide, bottom: borderSide), ), ); } diff --git a/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_tabs.dart b/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_tabs.dart index d0c2481c4b..d773226b09 100644 --- a/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_tabs.dart +++ b/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_tabs.dart @@ -6,9 +6,7 @@ import 'package:smooth_app/pages/product/edit_language_tabbar.dart'; class ProductImageGalleryTabBar extends StatelessWidget implements PreferredSizeWidget { - const ProductImageGalleryTabBar({ - required this.onTabChanged, - }); + const ProductImageGalleryTabBar({required this.onTabChanged}); final void Function(OpenFoodFactsLanguage) onTabChanged; @@ -24,11 +22,11 @@ class ProductImageGalleryTabBar extends StatelessWidget List productLanguages(Product product) { return { - ...getProductImageLanguages(product, ImageField.FRONT), - ...getProductImageLanguages(product, ImageField.INGREDIENTS), - ...getProductImageLanguages(product, ImageField.NUTRITION), - ...getProductImageLanguages(product, ImageField.PACKAGING), - } + ...getProductImageLanguages(product, ImageField.FRONT), + ...getProductImageLanguages(product, ImageField.INGREDIENTS), + ...getProductImageLanguages(product, ImageField.NUTRITION), + ...getProductImageLanguages(product, ImageField.PACKAGING), + } .map( (OpenFoodFactsLanguage l) => ProductLanguageWithState.normal(language: l), @@ -48,13 +46,19 @@ class ProductImageGalleryTabBar extends StatelessWidget product.imageNutritionSmallUrl == oldProduct.imageNutritionSmallUrl && product.imagePackagingUrl == oldProduct.imagePackagingUrl && product.imagePackagingSmallUrl == oldProduct.imagePackagingSmallUrl && - const ListEquality() - .equals(product.selectedImages, oldProduct.selectedImages) && - const ListEquality() - .equals(product.images, oldProduct.images) && + const ListEquality().equals( + product.selectedImages, + oldProduct.selectedImages, + ) && + const ListEquality().equals( + product.images, + oldProduct.images, + ) && product.lastImage == oldProduct.lastImage && - const ListEquality() - .equals(product.lastImageDates, oldProduct.lastImageDates); + const ListEquality().equals( + product.lastImageDates, + oldProduct.lastImageDates, + ); } @override diff --git a/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_view.dart b/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_view.dart index 97991fba7c..5931abee77 100644 --- a/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_view.dart +++ b/packages/smooth_app/lib/pages/product/gallery_view/product_image_gallery_view.dart @@ -33,9 +33,7 @@ import 'package:smooth_app/widgets/widget_height.dart'; /// Display of the main 4 pictures of a product, with edit options. class ProductImageGalleryView extends StatefulWidget { - const ProductImageGalleryView({ - required this.product, - }); + const ProductImageGalleryView({required this.product}); final Product product; @@ -50,11 +48,7 @@ class ProductImageGalleryView extends StatefulWidget { required OpenFoodFactsLanguage language, UserPictureSource? pictureSource, }) async { - AnalyticsHelper.trackProductEdit( - AnalyticsEditEvents.photos, - product, - true, - ); + AnalyticsHelper.trackProductEdit(AnalyticsEditEvents.photos, product, true); final CropParameters? cropParameters = await confirmAndUploadNewPicture( context, @@ -97,9 +91,7 @@ class _ProductImageGalleryViewState extends State return MultiProvider( providers: >[ Provider.value(value: upToDateProduct), - Provider.value( - value: _language, - ), + Provider.value(value: _language), ], child: SmoothScaffold( appBar: buildEditProductAppBar( @@ -108,16 +100,14 @@ class _ProductImageGalleryViewState extends State product: upToDateProduct, bottom: ProductImageGalleryTabBar( onTabChanged: (final OpenFoodFactsLanguage language) => onNextFrame( - () => setState( - () { - _language = language; - _scrollController.animateTo( - 0.0, - duration: SmoothAnimationsDuration.short, - curve: Curves.easeInOut, - ); - }, - ), + () => setState(() { + _language = language; + _scrollController.animateTo( + 0.0, + duration: SmoothAnimationsDuration.short, + curve: Curves.easeInOut, + ); + }), ), ), ), @@ -142,11 +132,12 @@ class _ProductImageGalleryViewState extends State sliver: SliverGrid( gridDelegate: SliverGridDelegateWithFixedCrossAxisCountAndFixedHeight( - crossAxisCount: 2, - height: - (MediaQuery.sizeOf(context).width / 2.15) + + crossAxisCount: 2, + height: + (MediaQuery.sizeOf(context).width / + 2.15) + ImageGalleryPhotoRow.itemHeight, - ), + ), delegate: SliverChildBuilderDelegate( (BuildContext context, int index) { return Padding( @@ -189,15 +180,16 @@ class _ProductImageGalleryViewState extends State ), if (_shouldDisplayRawGallery()) ProductImageGalleryOtherView( - onPhotosAvailable: (bool hasPhotos) { - if (_hideOtherPhotos != !hasPhotos) { - onNextFrame( - () => setState( - () => _hideOtherPhotos = !hasPhotos, - ), - ); - } - }) + onPhotosAvailable: (bool hasPhotos) { + if (_hideOtherPhotos != !hasPhotos) { + onNextFrame( + () => setState( + () => _hideOtherPhotos = !hasPhotos, + ), + ); + } + }, + ) else SliverToBoxAdapter( child: Padding( @@ -215,10 +207,11 @@ class _ProductImageGalleryViewState extends State ), SliverToBoxAdapter( child: SizedBox( - height: MediaQuery.viewPaddingOf(context).bottom + + height: + MediaQuery.viewPaddingOf(context).bottom + (VERY_LARGE_SPACE * 2.5), ), - ) + ), ], ), ), @@ -242,11 +235,10 @@ class _ProductImageGalleryViewState extends State Text _moreInterestingPhotoWidget( AppLocalizations appLocalizations, BuildContext context, - ) => - Text( - appLocalizations.more_photos, - style: Theme.of(context).textTheme.displayMedium, - ); + ) => Text( + appLocalizations.more_photos, + style: Theme.of(context).textTheme.displayMedium, + ); bool _shouldDisplayRawGallery() => _clickedOtherPictureButton || @@ -291,8 +283,8 @@ class _ProductImageGalleryFooterButtonState @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); final BorderRadius borderRadius = BorderRadiusHelper.fromDirectional( context: context, @@ -333,22 +325,22 @@ class _ProductImageGalleryFooterButtonState top: LARGE_SPACE, start: LARGE_SPACE, end: LARGE_SPACE, - bottom: MediaQuery.viewPaddingOf(context).bottom + + bottom: + MediaQuery.viewPaddingOf(context).bottom + VERY_SMALL_SPACE, ), child: Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, children: [ - const icons.Add( - color: Colors.black, - ), + const icons.Add(color: Colors.black), Offstage( offstage: _animation?.value == 1.0, child: MeasureSize( onChange: _onTextSizeAvailable, child: Opacity( - opacity: 1.0 - + opacity: + 1.0 - _controller.value.progressAndClamp(0.4, 1.0, 1.0), child: Padding( padding: const EdgeInsetsDirectional.only( @@ -378,14 +370,8 @@ class _ProductImageGalleryFooterButtonState } void _onTextSizeAvailable(Size size) { - _animation ??= Tween( - begin: 0.0, - end: size.width, - ).animate( - CurvedAnimation( - parent: _controller, - curve: Curves.fastOutSlowIn, - ), + _animation ??= Tween(begin: 0.0, end: size.width).animate( + CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn), ); } diff --git a/packages/smooth_app/lib/pages/product/helpers/pinch_to_zoom_indicator.dart b/packages/smooth_app/lib/pages/product/helpers/pinch_to_zoom_indicator.dart index db4f903367..8031df0e06 100644 --- a/packages/smooth_app/lib/pages/product/helpers/pinch_to_zoom_indicator.dart +++ b/packages/smooth_app/lib/pages/product/helpers/pinch_to_zoom_indicator.dart @@ -48,7 +48,7 @@ class PinchToZoomExplainer extends StatelessWidget { artboard: 'pinch-to-zoom', ), ), - ) + ), ], ), ), @@ -56,9 +56,7 @@ class PinchToZoomExplainer extends StatelessWidget { }, ); }, - child: const SmoothIndicatorIcon( - icon: icons.PinchToZoom(), - ), + child: const SmoothIndicatorIcon(icon: icons.PinchToZoom()), ), ), ); diff --git a/packages/smooth_app/lib/pages/product/hideable_container.dart b/packages/smooth_app/lib/pages/product/hideable_container.dart index cc784f6293..1adcb2ad56 100644 --- a/packages/smooth_app/lib/pages/product/hideable_container.dart +++ b/packages/smooth_app/lib/pages/product/hideable_container.dart @@ -3,10 +3,7 @@ import 'package:provider/provider.dart'; import 'package:smooth_app/generic_lib/duration_constants.dart'; class HideableContainer extends StatefulWidget { - const HideableContainer({ - required this.child, - super.key, - }); + const HideableContainer({required this.child, super.key}); final Widget child; @@ -42,10 +39,7 @@ class HideableContainerState extends State value: this, child: Transform.translate( offset: Offset(0.0, (1 - _animation.value) * 100), - child: Opacity( - opacity: _animation.value, - child: widget.child, - ), + child: Opacity(opacity: _animation.value, child: widget.child), ), ); } diff --git a/packages/smooth_app/lib/pages/product/may_exit_page_helper.dart b/packages/smooth_app/lib/pages/product/may_exit_page_helper.dart index 783e1cb8e7..b10e842565 100644 --- a/packages/smooth_app/lib/pages/product/may_exit_page_helper.dart +++ b/packages/smooth_app/lib/pages/product/may_exit_page_helper.dart @@ -22,8 +22,8 @@ class MayExitPageHelper { } final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return showSmoothAlertModalSheet( context: context, @@ -40,10 +40,7 @@ class MayExitPageHelper { Icon(Icons.save_rounded, color: extension.success), Icon(Icons.cancel_rounded, color: extension.error), ], - actionValues: [ - true, - false, - ], + actionValues: [true, false], ); } } diff --git a/packages/smooth_app/lib/pages/product/multilingual_helper.dart b/packages/smooth_app/lib/pages/product/multilingual_helper.dart index 6cf2faa731..57412e0b7c 100644 --- a/packages/smooth_app/lib/pages/product/multilingual_helper.dart +++ b/packages/smooth_app/lib/pages/product/multilingual_helper.dart @@ -42,9 +42,8 @@ class MultilingualHelper extends ChangeNotifier { void setMultilingualText( final OpenFoodFactsLanguage language, final String text, - ) => - _initialMultilingualTexts[language] = - _currentMultilingualTexts[language] = text; + ) => _initialMultilingualTexts[language] = + _currentMultilingualTexts[language] = text; _initialMonolingualText = monolingualText; diff --git a/packages/smooth_app/lib/pages/product/nutrition_page/nutrition_page.dart b/packages/smooth_app/lib/pages/product/nutrition_page/nutrition_page.dart index 3f3902d799..0607f87f01 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page/nutrition_page.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page/nutrition_page.dart @@ -76,13 +76,15 @@ class _NutritionPageLoadedState extends State product: upToDateProduct, )..addListener(_onChanged); - _servingController = - TextEditingControllerWithHistory(text: _nutritionContainer.servingSize) - ..addListener(_onChanged); - _servingController.selection = - TextSelection.collapsed(offset: _servingController.text.length - 1); - _decimalNumberFormat = - SimpleInputNumberField.getNumberFormat(decimal: true); + _servingController = TextEditingControllerWithHistory( + text: _nutritionContainer.servingSize, + )..addListener(_onChanged); + _servingController.selection = TextSelection.collapsed( + offset: _servingController.text.length - 1, + ); + _decimalNumberFormat = SimpleInputNumberField.getNumberFormat( + decimal: true, + ); } @override @@ -99,23 +101,19 @@ class _NutritionPageLoadedState extends State ChangeNotifierProvider( create: (_) => _nutritionContainer, ), - Provider.value( - value: upToDateProduct, - ), + Provider.value(value: upToDateProduct), Provider>.value( value: _controllers, ), - Provider.value( - value: _decimalNumberFormat, - ), + Provider.value(value: _decimalNumberFormat), ], child: UnfocusFieldWhenTapOutside( child: Theme( data: Theme.of(context).copyWith( scaffoldBackgroundColor: context.lightTheme() - ? Theme.of(context) - .extension()! - .primaryLight + ? Theme.of( + context, + ).extension()!.primaryLight : null, ), child: SmoothScaffold( @@ -128,8 +126,9 @@ class _NutritionPageLoadedState extends State if (!_imageVisible) IconButton( icon: const Picture.open(), - tooltip: ImageField.NUTRITION - .getProductImageButtonText(appLocalizations), + tooltip: ImageField.NUTRITION.getProductImageButtonText( + appLocalizations, + ), onPressed: () => _openProductImage(context), ), ], @@ -153,12 +152,9 @@ class _NutritionPageLoadedState extends State ], ), bottomNavigationBar: ProductBottomButtonsBar( - onSave: () async => _exitPage( - await _mayExitPage(saving: true), - ), - onCancel: () async => _exitPage( - await _mayExitPage(saving: false), - ), + onSave: () async => _exitPage(await _mayExitPage(saving: true)), + onCancel: () async => + _exitPage(await _mayExitPage(saving: false)), ), ), ), @@ -168,8 +164,10 @@ class _NutritionPageLoadedState extends State } void _openProductImage(BuildContext context) { - final Iterable languages = - getProductImageLanguages(upToDateProduct, ImageField.NUTRITION); + final Iterable languages = getProductImageLanguages( + upToDateProduct, + ImageField.NUTRITION, + ); if (languages.isNotEmpty) { setState(() { @@ -236,8 +234,8 @@ class _NutritionPageLoadedState extends State } final AppLocalizations appLocalizations = AppLocalizations.of(context); if (!saving) { - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog(context); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog(context); if (pleaseSave == null) { return false; } @@ -325,33 +323,31 @@ class _NutritionPageBodyState extends State<_NutritionPageBody> { slivers: [ const NutritionAvailabilityContainer(), Consumer( - builder: ( - BuildContext context, - NutritionContainerHelper nutritionContainer, - _, - ) { - final List children; + builder: + ( + BuildContext context, + NutritionContainerHelper nutritionContainer, + _, + ) { + final List children; - if (nutritionContainer.noNutritionData) { - children = []; - for (final FocusNode node in _focusNodes.values) { - node.dispose(); - } - _focusNodes.clear(); - } else { - children = [ - NutritionServingSize( - controller: widget.servingController, - ), - _nutritionDataWidgets( - context, - nutritionContainer, - ), - ]; - } + if (nutritionContainer.noNutritionData) { + children = []; + for (final FocusNode node in _focusNodes.values) { + node.dispose(); + } + _focusNodes.clear(); + } else { + children = [ + NutritionServingSize( + controller: widget.servingController, + ), + _nutritionDataWidgets(context, nutritionContainer), + ]; + } - return MultiSliver(children: children); - }, + return MultiSliver(children: children); + }, ), ], ), @@ -364,8 +360,8 @@ class _NutritionPageBodyState extends State<_NutritionPageBody> { NutritionContainerHelper nutritionContainer, ) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final List widgets = [ const NutritionServingSwitch(), @@ -373,8 +369,8 @@ class _NutritionPageBodyState extends State<_NutritionPageBody> { _extractNutrientsButton(context, nutritionContainer), */ ]; - final Iterable displayableNutrients = - nutritionContainer.getDisplayableNutrients(); + final Iterable displayableNutrients = nutritionContainer + .getDisplayableNutrients(); if (_focusNodes.length != displayableNutrients.length) { for (final OrderedNutrient nutrient in displayableNutrients) { _focusNodes[nutrient] ??= FocusNode(); @@ -412,11 +408,13 @@ class _NutritionPageBodyState extends State<_NutritionPageBody> { ); } - widgets.add(NutritionAddNutrientButton( - onNutrientSelected: (final OrderedNutrient nutrient) { - setState(() => _nutrientToHighlight = nutrient); - }, - )); + widgets.add( + NutritionAddNutrientButton( + onNutrientSelected: (final OrderedNutrient nutrient) { + setState(() => _nutrientToHighlight = nutrient); + }, + ), + ); if (_nutrientToHighlight != null) { final FocusNode focusNode = _focusNodes[_nutrientToHighlight]!; @@ -435,76 +433,81 @@ class _NutritionPageBodyState extends State<_NutritionPageBody> { sliver: SliverCardWithRoundedHeader( banner: nutritionContainer.robotoffNutrientExtraction == null ? Consumer( - builder: ( - BuildContext context, - NutritionContainerHelper nutritionContainer, - _, - ) { - final bool loading = - nutritionContainer.loadingRobotoffExtraction; + builder: + ( + BuildContext context, + NutritionContainerHelper nutritionContainer, + _, + ) { + final bool loading = + nutritionContainer.loadingRobotoffExtraction; - return Padding( - padding: const EdgeInsetsDirectional.all(MEDIUM_SPACE), - child: Row( - children: [ - const ExcludeSemantics( - child: icons.Sparkles( - size: 18.0, - ), - ), - const SizedBox(width: MEDIUM_SPACE), - Expanded( - child: Text( - appLocalizations.nutrition_facts_extract_new, - ), - ), - TextButton( - onPressed: nutritionContainer - .robotoffNutrientExtraction != - null || - loading - ? null - : () async { - if (widget.product.barcode == null) { - return; - } + return Padding( + padding: const EdgeInsetsDirectional.all(MEDIUM_SPACE), + child: Row( + children: [ + const ExcludeSemantics( + child: icons.Sparkles(size: 18.0), + ), + const SizedBox(width: MEDIUM_SPACE), + Expanded( + child: Text( + appLocalizations.nutrition_facts_extract_new, + ), + ), + TextButton( + onPressed: + nutritionContainer + .robotoffNutrientExtraction != + null || + loading + ? null + : () async { + if (widget.product.barcode == null) { + return; + } - final bool success = await nutritionContainer - .fetchRobotoffExtraction(widget.product); + final bool success = + await nutritionContainer + .fetchRobotoffExtraction( + widget.product, + ); - if (context.mounted) { - ScaffoldMessenger.of(context).showSnackBar( - success - ? SmoothFloatingSnackbar.positive( - context: context, - text: appLocalizations - .nutrition_facts_extract_succesful, - ) - : SmoothFloatingSnackbar.error( - context: context, - text: appLocalizations - .nutrition_facts_extract_failed, - ), - ); - } - }, - child: loading - ? const SizedBox.square( - dimension: 20.0, - child: CircularProgressIndicator(), - ) - : Text( - appLocalizations - .nutrition_facts_extract_button_text, - style: const TextStyle( - fontWeight: FontWeight.bold, - ), - ), + if (context.mounted) { + ScaffoldMessenger.of( + context, + ).showSnackBar( + success + ? SmoothFloatingSnackbar.positive( + context: context, + text: appLocalizations + .nutrition_facts_extract_succesful, + ) + : SmoothFloatingSnackbar.error( + context: context, + text: appLocalizations + .nutrition_facts_extract_failed, + ), + ); + } + }, + child: loading + ? const SizedBox.square( + dimension: 20.0, + child: CircularProgressIndicator(), + ) + : Text( + appLocalizations + .nutrition_facts_extract_button_text, + style: const TextStyle( + fontWeight: FontWeight.bold, + ), + ), + ), + ], ), - ], - ), - ); - }, + ); + }, ) : null, title: appLocalizations.edit_product_form_item_nutrition_facts_title, @@ -523,9 +526,7 @@ class _NutritionPageBodyState extends State<_NutritionPageBody> { contentPadding: EdgeInsets.zero, child: Stack( children: [ - Column( - children: widgets, - ), + Column(children: widgets), if (nutritionContainer.loadingRobotoffExtraction) Positioned.fill( child: Container( @@ -548,9 +549,7 @@ class _NutritionPageBodyState extends State<_NutritionPageBody> { child: Row( children: [ const ExcludeSemantics( - child: icons.Sparkles( - size: 18.0, - ), + child: icons.Sparkles(size: 18.0), ), const SizedBox(width: MEDIUM_SPACE), Text( diff --git a/packages/smooth_app/lib/pages/product/nutrition_page/nutrition_page_loader.dart b/packages/smooth_app/lib/pages/product/nutrition_page/nutrition_page_loader.dart index 0d125f2310..5efcdf857e 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page/nutrition_page_loader.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page/nutrition_page_loader.dart @@ -22,8 +22,9 @@ class NutritionPageLoader { return; } if (context.mounted) { - final OrderedNutrientsCache? cache = - await OrderedNutrientsCache.getCache(context); + final OrderedNutrientsCache? cache = await OrderedNutrientsCache.getCache( + context, + ); if (context.mounted) { if (cache == null) { ScaffoldMessenger.of(context).showSnackBar( diff --git a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_add_nutrient_button.dart b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_add_nutrient_button.dart index 1639bdb783..ef4331d852 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_add_nutrient_button.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_add_nutrient_button.dart @@ -28,8 +28,8 @@ class NutritionAddNutrientButton extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return Padding( padding: const EdgeInsetsDirectional.only( @@ -48,10 +48,8 @@ class NutritionAddNutrientButton extends StatelessWidget { child: SizedBox( width: double.infinity, child: InkWell( - onTap: () => _openNutrientSelectorModalSheet( - context, - onNutrientSelected, - ), + onTap: () => + _openNutrientSelectorModalSheet(context, onNutrientSelected), borderRadius: const BorderRadius.all(Radius.circular(15.0)), child: Padding( padding: const EdgeInsetsDirectional.symmetric( @@ -96,10 +94,8 @@ class NutritionAddNutrientHeaderButton extends StatelessWidget { return SmoothCardHeaderButton( tooltip: appLocalizations.nutrition_page_add_nutrient, child: const icons.Add.circled(), - onTap: () async => _openNutrientSelectorModalSheet( - context, - onNutrientSelected, - ), + onTap: () async => + _openNutrientSelectorModalSheet(context, onNutrientSelected), ); } } @@ -110,28 +106,31 @@ Future _openNutrientSelectorModalSheet( ) async { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final NutritionContainerHelper nutritionContainer = - context.read(); + final NutritionContainerHelper nutritionContainer = context + .read(); final List leftovers = List.from( nutritionContainer.getLeftoverNutrients(), ); - leftovers.sort((final OrderedNutrient a, final OrderedNutrient b) => - a.name!.compareTo(b.name!)); - final List filteredList = - List.from(leftovers); + leftovers.sort( + (final OrderedNutrient a, final OrderedNutrient b) => + a.name!.compareTo(b.name!), + ); + final List filteredList = List.from( + leftovers, + ); final OrderedNutrient? selected = await showSmoothModalSheetForTextField( - context: context, - header: SmoothModalSheetHeader( - title: appLocalizations.nutrition_page_add_nutrient, - prefix: const SmoothModalSheetHeaderPrefixIndicator(), - suffix: const SmoothModalSheetHeaderCloseButton(), - ), - bodyBuilder: (BuildContext context) { - return _NutrientList(list: filteredList); - }, - ); + context: context, + header: SmoothModalSheetHeader( + title: appLocalizations.nutrition_page_add_nutrient, + prefix: const SmoothModalSheetHeaderPrefixIndicator(), + suffix: const SmoothModalSheetHeaderCloseButton(), + ), + bodyBuilder: (BuildContext context) { + return _NutrientList(list: filteredList); + }, + ); if (selected != null) { nutritionContainer.add(selected); @@ -142,9 +141,7 @@ Future _openNutrientSelectorModalSheet( typedef OnNutrientSelected = Function(OrderedNutrient nutrient); class _NutrientList extends StatefulWidget { - const _NutrientList({ - required this.list, - }); + const _NutrientList({required this.list}); final List list; @@ -214,10 +211,10 @@ class _NutrientListState extends State<_NutrientList> { setState( () => _nutrients = widget.list .where( - (OrderedNutrient item) => - item.name!.trim().getComparisonSafeString().contains( - query!.trim().getComparisonSafeString(), - ), + (OrderedNutrient item) => item.name! + .trim() + .getComparisonSafeString() + .contains(query!.trim().getComparisonSafeString()), ) .toList(), ); @@ -230,7 +227,7 @@ class _NutrientListState extends State<_NutrientList> { height: keyboardHeight > 0.0 ? keyboardHeight : MediaQuery.viewPaddingOf(context).bottom, - ) + ), ], ); } diff --git a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_availability_container.dart b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_availability_container.dart index 31ad11a6cf..a23431423d 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_availability_container.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_availability_container.dart @@ -10,9 +10,7 @@ import 'package:smooth_app/widgets/smooth_explanation_banner.dart'; /// A toggle to indicate whether a product has nutrition facts. class NutritionAvailabilityContainer extends StatelessWidget { - const NutritionAvailabilityContainer({ - super.key, - }); + const NutritionAvailabilityContainer({super.key}); @override Widget build(BuildContext context) { @@ -42,36 +40,38 @@ class NutritionAvailabilityContainer extends StatelessWidget { ), ), Consumer( - builder: ( - BuildContext context, - NutritionContainerHelper helper, - _, - ) { - return SmoothDropdownButton( - value: !helper.noNutritionData, - items: >[ - SmoothDropdownItem( - value: true, - label: appLocalizations - .nutrition_page_nutritional_info_value_positive, - ), - SmoothDropdownItem( - value: false, - label: appLocalizations - .nutrition_page_nutritional_info_value_negative, - ), - ], - onChanged: (bool? value) { - if (value == null) { - return; - } + builder: + ( + BuildContext context, + NutritionContainerHelper helper, + _, + ) { + return SmoothDropdownButton( + value: !helper.noNutritionData, + items: >[ + SmoothDropdownItem( + value: true, + label: appLocalizations + .nutrition_page_nutritional_info_value_positive, + ), + SmoothDropdownItem( + value: false, + label: appLocalizations + .nutrition_page_nutritional_info_value_negative, + ), + ], + onChanged: (bool? value) { + if (value == null) { + return; + } - context - .read() - .noNutritionData = !value; + context + .read() + .noNutritionData = + !value; + }, + ); }, - ); - }, ), ], ), diff --git a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_container_helper.dart b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_container_helper.dart index 264e4e2090..b268f2b329 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_container_helper.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_container_helper.dart @@ -18,8 +18,8 @@ class NutritionContainerHelper extends ChangeNotifier { _loadValues(product.nutriments!); } setServingText(product.servingSize); - _initialNoNutritionData = - _noNutritionData = product.noNutritionData ?? false; + _initialNoNutritionData = _noNutritionData = + product.noNutritionData ?? false; } /// Returns the [Nutrient] that matches the [orderedNutrient]. @@ -106,7 +106,7 @@ class NutritionContainerHelper extends ChangeNotifier { Set extractedNutrients = extractionResult.latestInsight?.data?.nutrients?.keys.toSet() ?? - {}; + {}; extractedNutrients = extractedNutrients .where((String nutrient) => !nutrient.contains('_serving')) @@ -115,12 +115,10 @@ class NutritionContainerHelper extends ChangeNotifier { for (final String nutrientOffTag in extractedNutrients) { // If the nutrient is not in the list of nutrients, we add it - final OrderedNutrient? missingNutrient = - getLeftoverNutrients().firstWhereOrNull( - (final OrderedNutrient orderedNutrient) { - return orderedNutrient.nutrient?.offTag == nutrientOffTag; - }, - ); + final OrderedNutrient? missingNutrient = getLeftoverNutrients() + .firstWhereOrNull((final OrderedNutrient orderedNutrient) { + return orderedNutrient.nutrient?.offTag == nutrientOffTag; + }); if (missingNutrient != null) { add(missingNutrient); @@ -129,8 +127,8 @@ class NutritionContainerHelper extends ChangeNotifier { for (final OrderedNutrient orderedNutrient in _nutrients) { final Nutrient nutrient = getNutrient(orderedNutrient)!; - final RobotoffNutrientEntity? robotoffNutrientEntity = - extractionResult.getNutrientEntity(nutrient, perSize); + final RobotoffNutrientEntity? robotoffNutrientEntity = extractionResult + .getNutrientEntity(nutrient, perSize); if (robotoffNutrientEntity != null) { AnalyticsHelper.trackRobotoffExtraction( AnalyticsRobotoffEvents.robotoffNutritionExtracted, @@ -151,13 +149,13 @@ class NutritionContainerHelper extends ChangeNotifier { /// Returns the not interesting nutrients, for a "Please add me!" list. Iterable getLeftoverNutrients() => _nutrients.where( - (final OrderedNutrient element) => _isNotRelevant(element), - ); + (final OrderedNutrient element) => _isNotRelevant(element), + ); /// Returns the interesting nutrients that need to be displayed. Iterable getDisplayableNutrients() => _nutrients.where( - (final OrderedNutrient element) => !_isNotRelevant(element), - ); + (final OrderedNutrient element) => !_isNotRelevant(element), + ); /// Returns true if the [OrderedNutrient] is not relevant. bool _isNotRelevant(final OrderedNutrient orderedNutrient) { @@ -217,11 +215,7 @@ class NutritionContainerHelper extends ChangeNotifier { } List getUnits(final Nutrient nutrient) { - final List units = [ - Unit.G, - Unit.MILLI_G, - Unit.MICRO_G, - ]; + final List units = [Unit.G, Unit.MILLI_G, Unit.MICRO_G]; if (units.contains(getUnit(nutrient))) { return units; @@ -260,9 +254,7 @@ class NutritionContainerHelper extends ChangeNotifier { /// For some countries, there's energy or energyKJ, or both /// cf. https://github.com/openfoodfacts/openfoodfacts-server/blob/main/lib/ProductOpener/Food.pm /// Regarding our list of nutrients here, we need one and only one of them. - void _loadNutrients( - final List nutrients, - ) { + void _loadNutrients(final List nutrients) { bool alreadyEnergyKJ = false; // inner method, in order to use alreadyEnergyKJ without a private variable. diff --git a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_facts_editor.dart b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_facts_editor.dart index d7e45d48b5..643c02bf8a 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_facts_editor.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_facts_editor.dart @@ -49,16 +49,17 @@ class _NutrientRowState extends State @override void initState() { super.initState(); - _controller = AnimationController( - duration: SmoothAnimationsDuration.medium, - vsync: this, - ) - ..addListener(() => setState(() {})) - ..addStatusListener((final AnimationStatus status) { - if (status == AnimationStatus.completed) { - _colorAnimation = null; - } - }); + _controller = + AnimationController( + duration: SmoothAnimationsDuration.medium, + vsync: this, + ) + ..addListener(() => setState(() {})) + ..addStatusListener((final AnimationStatus status) { + if (status == AnimationStatus.completed) { + _colorAnimation = null; + } + }); } @override @@ -76,8 +77,8 @@ class _NutrientRowState extends State @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final String key = widget.orderedNutrient.id; Color color; @@ -87,29 +88,33 @@ class _NutrientRowState extends State color = _getColor(extension); } - final TextEditingControllerWithHistory controller = - context.watch(); + final TextEditingControllerWithHistory controller = context + .watch(); - final RobotoffNutrientEntity? robotoffNutrientEntity = - widget.nutritionContainer.robotoffNutrientExtraction?.getNutrientEntity( - widget.orderedNutrient.nutrient!, - PerSize.oneHundredGrams, - ); + final RobotoffNutrientEntity? robotoffNutrientEntity = widget + .nutritionContainer + .robotoffNutrientExtraction + ?.getNutrientEntity( + widget.orderedNutrient.nutrient!, + PerSize.oneHundredGrams, + ); String? extractionValue = robotoffNutrientEntity?.value; // We need to make sure the value is formatted properly if (extractionValue != null) { if (extractionValue != 'traces') { - final num? extractionValueNum = - NumberFormat().tryParse(extractionValue); + final num? extractionValueNum = NumberFormat().tryParse( + extractionValue, + ); if (extractionValueNum == null) { extractionValue = null; } else { try { // get a decent displayable numeric value if possible - extractionValue = - widget.decimalNumberFormat.format(extractionValueNum); + extractionValue = widget.decimalNumberFormat.format( + extractionValueNum, + ); } catch (e) { // at least we tried } @@ -156,7 +161,7 @@ class _NutrientRowState extends State orderedNutrient: widget.orderedNutrient, ), ), - const _NutrientUnitVisibility() + const _NutrientUnitVisibility(), ], ), ), @@ -166,12 +171,8 @@ class _NutrientRowState extends State ), if (extractionValue != null && extractionValue != controller.text) Container( - margin: const EdgeInsetsDirectional.only( - bottom: SMALL_SPACE, - ), - padding: const EdgeInsetsDirectional.only( - start: MEDIUM_SPACE, - ), + margin: const EdgeInsetsDirectional.only(bottom: SMALL_SPACE), + padding: const EdgeInsetsDirectional.only(start: MEDIUM_SPACE), decoration: BoxDecoration( color: extension.successBackground, borderRadius: BorderRadius.circular(8.0), @@ -194,8 +195,9 @@ class _NutrientRowState extends State ), ), Tooltip( - message: AppLocalizations.of(context) - .edit_product_form_item_add_suggestion, + message: AppLocalizations.of( + context, + ).edit_product_form_item_add_suggestion, child: IconButton( onPressed: () { controller.text = extractionValue!; @@ -218,10 +220,10 @@ class _NutrientRowState extends State color: extension.success, ), ), - ) + ), ], ), - ) + ), ], ), ), @@ -256,14 +258,15 @@ class _NutrientValueCell extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final Map focusNodes = - context.watch>(); + final Map focusNodes = context + .watch>(); final Product product = context.watch(); final bool isLast = position == focusNodes.length - 1; final Nutrient? nutrient = orderedNutrient.nutrient; - final bool ownerFieldVisible = nutrient != null && + final bool ownerFieldVisible = + nutrient != null && product.getOwnerFieldTimestamp(OwnerField.nutrient(nutrient)) != null; return Semantics( @@ -339,8 +342,9 @@ class _NutrientValueCell extends StatelessWidget { return; } - final int position = - focusNodes.keys.indexOf(orderedNutrient); + final int position = focusNodes.keys.indexOf( + orderedNutrient, + ); focusNodes[focusNodes.keys.elementAt(position + 1)] ?.requestFocus(); @@ -432,8 +436,9 @@ class _NutrientUnitCellState extends State<_NutrientUnitCell> { return; } setState( - () => widget.nutritionContainer - .setNextWeightUnit(widget.orderedNutrient), + () => widget.nutritionContainer.setNextWeightUnit( + widget.orderedNutrient, + ), ); } : null, @@ -462,50 +467,48 @@ class _NutrientUnitVisibility extends StatelessWidget { @override Widget build(BuildContext context) { return _NutritionCellTextWatcher( - builder: ( - BuildContext context, - TextEditingControllerWithHistory controller, - ) { - final bool isValueSet = controller.isSet; + builder: + (BuildContext context, TextEditingControllerWithHistory controller) { + final bool isValueSet = controller.isSet; - return AspectRatio( - aspectRatio: 1.0, - child: DecoratedBox( - decoration: ShapeDecoration( - color: isValueSet - ? context - .extension() - .primarySemiDark - : Theme.of(context).disabledColor, - shape: const CircleBorder(), - ), - child: Material( - type: MaterialType.transparency, - child: InkWell( - customBorder: const CircleBorder(), - onTap: () { - if (isValueSet) { - controller.text = _missingNutrientValue; - } else { - if (controller.previousValue != _missingNutrientValue) { - controller.text = - controller.previousValue ?? _missingNutrientValue; - } else { - controller.text = ''; - } - } - }, - child: Icon( - isValueSet - ? Icons.visibility_rounded - : Icons.visibility_off_rounded, - color: Colors.white, + return AspectRatio( + aspectRatio: 1.0, + child: DecoratedBox( + decoration: ShapeDecoration( + color: isValueSet + ? context + .extension() + .primarySemiDark + : Theme.of(context).disabledColor, + shape: const CircleBorder(), + ), + child: Material( + type: MaterialType.transparency, + child: InkWell( + customBorder: const CircleBorder(), + onTap: () { + if (isValueSet) { + controller.text = _missingNutrientValue; + } else { + if (controller.previousValue != _missingNutrientValue) { + controller.text = + controller.previousValue ?? _missingNutrientValue; + } else { + controller.text = ''; + } + } + }, + child: Icon( + isValueSet + ? Icons.visibility_rounded + : Icons.visibility_off_rounded, + color: Colors.white, + ), + ), ), ), - ), - ), - ); - }, + ); + }, ); } } @@ -518,37 +521,40 @@ extension NutritionTextEditionController on TextEditingController { /// Use this Widget to be notified when the value is set or not class _NutritionCellTextWatcher extends StatelessWidget { - const _NutritionCellTextWatcher({ - required this.builder, - }); + const _NutritionCellTextWatcher({required this.builder}); final Widget Function( BuildContext context, TextEditingControllerWithHistory value, - ) builder; + ) + builder; @override Widget build(BuildContext context) { - return Selector( + return Selector< + TextEditingControllerWithHistory, + TextEditingControllerWithHistory + >( selector: (_, TextEditingControllerWithHistory controller) { return controller; }, shouldRebuild: (_, TextEditingControllerWithHistory controller) { return controller.isDifferentFromPreviousValue; }, - builder: (BuildContext context, - TextEditingControllerWithHistory controller, _) { - return builder(context, controller); - }, + builder: + ( + BuildContext context, + TextEditingControllerWithHistory controller, + _, + ) { + return builder(context, controller); + }, ); } } class NutritionFactsEditorExplanation extends StatelessWidget { - const NutritionFactsEditorExplanation({ - super.key, - }); + const NutritionFactsEditorExplanation({super.key}); @override Widget build(BuildContext context) { diff --git a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_serving_size.dart b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_serving_size.dart index 9cf751c30d..c9c701c26c 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_serving_size.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_serving_size.dart @@ -11,10 +11,7 @@ import 'package:smooth_app/widgets/smooth_explanation_banner.dart'; /// A toggle to indicate whether a product has nutrition facts. class NutritionServingSize extends StatelessWidget { - const NutritionServingSize({ - required this.controller, - super.key, - }); + const NutritionServingSize({required this.controller, super.key}); final TextEditingController controller; @@ -73,10 +70,12 @@ class NutritionServingSize extends StatelessWidget { } bool hasOwnerField(Product product) => - product.getOwnerFieldTimestamp(OwnerField.productField( - ProductField.SERVING_SIZE, - ProductQuery.getLanguage(), - )) != + product.getOwnerFieldTimestamp( + OwnerField.productField( + ProductField.SERVING_SIZE, + ProductQuery.getLanguage(), + ), + ) != null; } diff --git a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_serving_switch.dart b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_serving_switch.dart index f546406c74..0e4a5fb1cd 100644 --- a/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_serving_switch.dart +++ b/packages/smooth_app/lib/pages/product/nutrition_page/widgets/nutrition_serving_switch.dart @@ -15,8 +15,8 @@ class NutritionServingSwitch extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final AppLocalizations appLocalizations = AppLocalizations.of(context); return DecoratedBox( @@ -47,32 +47,34 @@ class NutritionServingSwitch extends StatelessWidget { ), ), Consumer( - builder: ( - BuildContext context, - NutritionContainerHelper nutritionContainer, - _, - ) { - return SmoothDropdownButton( - loading: nutritionContainer.loadingRobotoffExtraction, - value: nutritionContainer.perSize, - items: >[ - SmoothDropdownItem( - value: PerSize.oneHundredGrams, - label: appLocalizations.nutrition_page_per_100g_100ml, - ), - SmoothDropdownItem( - value: PerSize.serving, - label: appLocalizations.nutrition_page_per_serving, - ), - ], - onChanged: (final PerSize? value) { - if (value == null) { - return; - } + builder: + ( + BuildContext context, + NutritionContainerHelper nutritionContainer, + _, + ) { + return SmoothDropdownButton( + loading: nutritionContainer.loadingRobotoffExtraction, + value: nutritionContainer.perSize, + items: >[ + SmoothDropdownItem( + value: PerSize.oneHundredGrams, + label: appLocalizations.nutrition_page_per_100g_100ml, + ), + SmoothDropdownItem( + value: PerSize.serving, + label: appLocalizations.nutrition_page_per_serving, + ), + ], + onChanged: (final PerSize? value) { + if (value == null) { + return; + } - nutritionContainer.perSize = value; - }); - }, + nutritionContainer.perSize = value; + }, + ); + }, ), ], ), diff --git a/packages/smooth_app/lib/pages/product/ordered_nutrients_cache.dart b/packages/smooth_app/lib/pages/product/ordered_nutrients_cache.dart index fdfe4d8a14..28ec3951d6 100644 --- a/packages/smooth_app/lib/pages/product/ordered_nutrients_cache.dart +++ b/packages/smooth_app/lib/pages/product/ordered_nutrients_cache.dart @@ -90,14 +90,11 @@ class OrderedNutrientsCache { return null; } - UriProductHelper get _uriProductHelper => ProductQuery.getUriProductHelper( - productType: ProductType.food, - ); + UriProductHelper get _uriProductHelper => + ProductQuery.getUriProductHelper(productType: ProductType.food); /// Downloads the ordered nutrients and caches them in the database. - Future _download( - final LocalDatabase localDatabase, - ) async { + Future _download(final LocalDatabase localDatabase) async { final String string = await OpenFoodAPIClient.getOrderedNutrientsJsonString( country: ProductQuery.getCountry(), language: ProductQuery.getLanguage(), diff --git a/packages/smooth_app/lib/pages/product/owner_field_info.dart b/packages/smooth_app/lib/pages/product/owner_field_info.dart index 1ddf8c05ff..69d5c6bf10 100644 --- a/packages/smooth_app/lib/pages/product/owner_field_info.dart +++ b/packages/smooth_app/lib/pages/product/owner_field_info.dart @@ -39,22 +39,18 @@ class OwnerFieldBanner extends StatelessWidget { /// Standard icon about "owner fields". class OwnerFieldIcon extends StatelessWidget { - const OwnerFieldIcon({ - this.size, - this.color, - super.key, - }); + const OwnerFieldIcon({this.size, this.color, super.key}); final double? size; final Color? color; @override Widget build(BuildContext context) => Icon( - _ownerFieldIconData, - size: size, - color: color, - semanticLabel: AppLocalizations.of(context).owner_field_info_title, - ); + _ownerFieldIconData, + size: size, + color: color, + semanticLabel: AppLocalizations.of(context).owner_field_info_title, + ); } class AnimatedOwnerFieldBanner extends StatefulWidget { diff --git a/packages/smooth_app/lib/pages/product/portion_calculator.dart b/packages/smooth_app/lib/pages/product/portion_calculator.dart index 0bc57006ed..a9fb5047e2 100644 --- a/packages/smooth_app/lib/pages/product/portion_calculator.dart +++ b/packages/smooth_app/lib/pages/product/portion_calculator.dart @@ -48,8 +48,8 @@ class _PortionCalculatorState extends State { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); final bool isQuantityValid = _isInputValid(); @@ -66,9 +66,7 @@ class _PortionCalculatorState extends State { color: lightTheme ? extension.primaryMedium : extension.primaryUltraBlack, - borderRadius: const BorderRadius.vertical( - top: ROUNDED_RADIUS, - ), + borderRadius: const BorderRadius.vertical(top: ROUNDED_RADIUS), ), child: Padding( padding: const EdgeInsetsDirectional.symmetric( @@ -104,9 +102,10 @@ class _PortionCalculatorState extends State { Container( height: MediaQuery.textScalerOf(context).scale(SMALL_SPACE * 2 + 15.0) * - 1.2, - padding: - const EdgeInsetsDirectional.symmetric(horizontal: MEDIUM_SPACE), + 1.2, + padding: const EdgeInsetsDirectional.symmetric( + horizontal: MEDIUM_SPACE, + ), child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.baseline, @@ -199,8 +198,9 @@ class _PortionCalculatorState extends State { _onComputationError(); return; } - final OrderedNutrientsCache? cache = - await OrderedNutrientsCache.getCache(context); + final OrderedNutrientsCache? cache = await OrderedNutrientsCache.getCache( + context, + ); if (cache == null) { _onComputationError(); return; @@ -227,37 +227,35 @@ class _PortionCalculatorState extends State { initHeight: 0.6, bodyBuilder: (BuildContext context) { return SliverList( - delegate: SliverChildBuilderDelegate( - childCount: helper.length, - (BuildContext context, int position) { - return Column( - children: [ - Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: VERY_LARGE_SPACE, - vertical: LARGE_SPACE, - ), - child: MergeSemantics( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Text( - helper.getName(position), - style: const TextStyle( - fontWeight: FontWeight.w500, - ), - ), - Text(helper.getValue(position)), - ], - ), + delegate: SliverChildBuilderDelegate(childCount: helper.length, ( + BuildContext context, + int position, + ) { + return Column( + children: [ + Padding( + padding: const EdgeInsetsDirectional.symmetric( + horizontal: VERY_LARGE_SPACE, + vertical: LARGE_SPACE, + ), + child: MergeSemantics( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + helper.getName(position), + style: const TextStyle(fontWeight: FontWeight.w500), + ), + Text(helper.getValue(position)), + ], ), ), - if (position < helper.length - 1) const Divider(height: 1.0) - ], - ); - }, - ), + ), + if (position < helper.length - 1) const Divider(height: 1.0), + ], + ); + }), ); }, ); diff --git a/packages/smooth_app/lib/pages/product/portion_helper.dart b/packages/smooth_app/lib/pages/product/portion_helper.dart index 769d3e0727..d83d42c2cb 100644 --- a/packages/smooth_app/lib/pages/product/portion_helper.dart +++ b/packages/smooth_app/lib/pages/product/portion_helper.dart @@ -45,8 +45,9 @@ class PortionHelper { final List orderedNutrients, ) { for (final OrderedNutrient orderedNutrient in orderedNutrients) { - final Nutrient? nutrient = - NutritionContainerHelper.getNutrient(orderedNutrient); + final Nutrient? nutrient = NutritionContainerHelper.getNutrient( + orderedNutrient, + ); if (nutrient != null) { if (orderedNutrient.name != null) { try { @@ -67,8 +68,10 @@ class PortionHelper { final Nutrient nutrient, final String nutrientName, ) { - double? value = - productNutriments.getValue(nutrient, PerSize.oneHundredGrams); + double? value = productNutriments.getValue( + nutrient, + PerSize.oneHundredGrams, + ); if (value == null) { return; } @@ -85,12 +88,10 @@ class PortionHelper { } _alreadyEnergyKJ = true; } - _table.add( - [ - nutrientName, - '${_numberFormat.format(value)} ${_unitStandardSpellings[unit] ?? ''}' - ], - ); + _table.add([ + nutrientName, + '${_numberFormat.format(value)} ${_unitStandardSpellings[unit] ?? ''}', + ]); } /// [Unit] standard spellings. diff --git a/packages/smooth_app/lib/pages/product/product_field_editor.dart b/packages/smooth_app/lib/pages/product/product_field_editor.dart index cc45a871fe..d5e8339cbc 100644 --- a/packages/smooth_app/lib/pages/product/product_field_editor.dart +++ b/packages/smooth_app/lib/pages/product/product_field_editor.dart @@ -57,10 +57,7 @@ class ProductFieldSimpleEditor extends ProductFieldEditor { return; } - AnalyticsHelper.trackProductEdit( - helper.getAnalyticsEditEvent(), - product, - ); + AnalyticsHelper.trackProductEdit(helper.getAnalyticsEditEvent(), product); if (!context.mounted) { return; @@ -68,10 +65,8 @@ class ProductFieldSimpleEditor extends ProductFieldEditor { await Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => SimpleInputPage( - helper: helper, - product: product, - ), + builder: (BuildContext context) => + SimpleInputPage(helper: helper, product: product), ), ); } @@ -105,10 +100,7 @@ class ProductFieldDetailsEditor extends ProductFieldEditor { return; } - AnalyticsHelper.trackProductEdit( - AnalyticsEditEvents.basicDetails, - product, - ); + AnalyticsHelper.trackProductEdit(AnalyticsEditEvents.basicDetails, product); if (!context.mounted) { return; @@ -181,12 +173,11 @@ class ProductFieldNutritionEditor extends ProductFieldEditor { required final BuildContext context, required final Product product, final bool isLoggedInMandatory = true, - }) async => - NutritionPageLoader.showNutritionPage( - product: product, - isLoggedInMandatory: isLoggedInMandatory, - context: context, - ); + }) async => NutritionPageLoader.showNutritionPage( + product: product, + isLoggedInMandatory: isLoggedInMandatory, + context: context, + ); } abstract class ProductFieldOcrEditor extends ProductFieldEditor { diff --git a/packages/smooth_app/lib/pages/product/product_image_button.dart b/packages/smooth_app/lib/pages/product/product_image_button.dart index 596c71de1a..9d3d314a43 100644 --- a/packages/smooth_app/lib/pages/product/product_image_button.dart +++ b/packages/smooth_app/lib/pages/product/product_image_button.dart @@ -66,37 +66,36 @@ enum ProductImageButtonType { required final bool isLoggedInMandatory, final double? borderWidth, required bool imageExists, - }) => - switch (this) { - ProductImageButtonType.local => ProductImageLocalButton( - product: product, - imageField: imageField, - language: language, - isLoggedInMandatory: isLoggedInMandatory, - borderWidth: borderWidth, - imageExists: imageExists, - ), - ProductImageButtonType.server => ProductImageServerButton( - product: product, - imageField: imageField, - language: language, - isLoggedInMandatory: isLoggedInMandatory, - borderWidth: borderWidth, - ), - ProductImageButtonType.unselect => ProductImageUnselectButton( - product: product, - productType: product.productType, - imageField: imageField, - language: language, - isLoggedInMandatory: isLoggedInMandatory, - borderWidth: borderWidth, - ), - ProductImageButtonType.edit => ProductImageCropButton( - product: product, - imageField: imageField, - language: language, - isLoggedInMandatory: isLoggedInMandatory, - borderWidth: borderWidth, - ), - }; + }) => switch (this) { + ProductImageButtonType.local => ProductImageLocalButton( + product: product, + imageField: imageField, + language: language, + isLoggedInMandatory: isLoggedInMandatory, + borderWidth: borderWidth, + imageExists: imageExists, + ), + ProductImageButtonType.server => ProductImageServerButton( + product: product, + imageField: imageField, + language: language, + isLoggedInMandatory: isLoggedInMandatory, + borderWidth: borderWidth, + ), + ProductImageButtonType.unselect => ProductImageUnselectButton( + product: product, + productType: product.productType, + imageField: imageField, + language: language, + isLoggedInMandatory: isLoggedInMandatory, + borderWidth: borderWidth, + ), + ProductImageButtonType.edit => ProductImageCropButton( + product: product, + imageField: imageField, + language: language, + isLoggedInMandatory: isLoggedInMandatory, + borderWidth: borderWidth, + ), + }; } diff --git a/packages/smooth_app/lib/pages/product/product_image_crop_button.dart b/packages/smooth_app/lib/pages/product/product_image_crop_button.dart index 20312f3b3e..7941ab1099 100644 --- a/packages/smooth_app/lib/pages/product/product_image_crop_button.dart +++ b/packages/smooth_app/lib/pages/product/product_image_crop_button.dart @@ -100,9 +100,7 @@ class ProductImageCropButton extends ProductImageButton { size: ImageSize.ORIGINAL, ).getUrl( barcode, - uriHelper: ProductQuery.getUriProductHelper( - productType: productType, - ), + uriHelper: ProductQuery.getUriProductHelper(productType: productType), ), DaoInt(localDatabase), ); @@ -135,23 +133,22 @@ class ProductImageCropButton extends ProductImageButton { Future _openCropNewPage( final NavigatorState navigatorState, final File imageFile, - ) async => - navigatorState.push( - MaterialPageRoute( - builder: (BuildContext context) => CropPage( - inputFile: imageFile, - initiallyDifferent: false, - isLoggedInMandatory: isLoggedInMandatory, - cropHelper: ProductCropNewHelper( - language: language, - barcode: barcode, - productType: product.productType, - imageField: _imageData.imageField, - ), - ), - fullscreenDialog: true, + ) async => navigatorState.push( + MaterialPageRoute( + builder: (BuildContext context) => CropPage( + inputFile: imageFile, + initiallyDifferent: false, + isLoggedInMandatory: isLoggedInMandatory, + cropHelper: ProductCropNewHelper( + language: language, + barcode: barcode, + productType: product.productType, + imageField: _imageData.imageField, ), - ); + ), + fullscreenDialog: true, + ), + ); ProductImage? _getBestProductImage() { if (product.images == null) { @@ -178,25 +175,19 @@ class ProductImageCropButton extends ProductImageButton { /// Sometimes you get all null coordinates, or all 0, or all -1. Rect? _getCropRect(final ProductImage productImage) => productImage.x1 == productImage.x2 && - productImage.y1 == productImage.y2 && - productImage.x1 == productImage.y1 - ? null - : Rect.fromLTRB( - productImage.x1!.toDouble(), - productImage.y1!.toDouble(), - productImage.x2!.toDouble(), - productImage.y2!.toDouble(), - ); + productImage.y1 == productImage.y2 && + productImage.x1 == productImage.y1 + ? null + : Rect.fromLTRB( + productImage.x1!.toDouble(), + productImage.y1!.toDouble(), + productImage.x2!.toDouble(), + productImage.y2!.toDouble(), + ); - ProductImageData get _imageData => getProductImageData( - product, - imageField, - language, - ); + ProductImageData get _imageData => + getProductImageData(product, imageField, language); - TransientFile get _transientFile => TransientFile.fromProduct( - product, - imageField, - language, - ); + TransientFile get _transientFile => + TransientFile.fromProduct(product, imageField, language); } diff --git a/packages/smooth_app/lib/pages/product/product_image_server_button.dart b/packages/smooth_app/lib/pages/product/product_image_server_button.dart index d63d3f9478..7ba87df8d3 100644 --- a/packages/smooth_app/lib/pages/product/product_image_server_button.dart +++ b/packages/smooth_app/lib/pages/product/product_image_server_button.dart @@ -99,18 +99,16 @@ class ProductImageServerButton extends ProductImageButton { } if (latestProduct != null) { // very likely - rawImages = getRawProductImages( - latestProduct, - ImageSize.DISPLAY, - ); + rawImages = getRawProductImages(latestProduct, ImageSize.DISPLAY); } if (rawImages.isEmpty) { await showDialog( context: context, builder: (BuildContext context) => SmoothAlertDialog( - body: - Text(appLocalizations.edit_photo_select_existing_downloaded_none), + body: Text( + appLocalizations.edit_photo_select_existing_downloaded_none, + ), actionsAxis: Axis.vertical, positiveAction: SmoothActionButton( text: appLocalizations.okay, @@ -139,18 +137,17 @@ class ProductImageServerButton extends ProductImageButton { required final ImageField imageField, required final OpenFoodFactsLanguage language, required final bool isLoggedInMandatory, - }) => - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => UploadedImageGallery( - barcode: barcode, - rawImages: rawImages, - imageField: imageField, - language: language, - isLoggedInMandatory: isLoggedInMandatory, - productType: productType, - ), - ), - ); + }) => Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => UploadedImageGallery( + barcode: barcode, + rawImages: rawImages, + imageField: imageField, + language: language, + isLoggedInMandatory: isLoggedInMandatory, + productType: productType, + ), + ), + ); } diff --git a/packages/smooth_app/lib/pages/product/product_image_swipeable_view.dart b/packages/smooth_app/lib/pages/product/product_image_swipeable_view.dart index f90c835d37..24457f1207 100644 --- a/packages/smooth_app/lib/pages/product/product_image_swipeable_view.dart +++ b/packages/smooth_app/lib/pages/product/product_image_swipeable_view.dart @@ -59,9 +59,7 @@ class _ProductImageSwipeableViewState extends State void initState() { super.initState(); initUpToDate(widget.product, context.read()); - _controller = PageController( - initialPage: widget.initialImageIndex, - ); + _controller = PageController(initialPage: widget.initialImageIndex); _currentImageDataIndex = ValueNotifier(widget.initialImageIndex); _currentLanguage = widget.initialLanguage ?? ProductQuery.getLanguage(); if (widget.imageField != null) { @@ -100,10 +98,11 @@ class _ProductImageSwipeableViewState extends State ), actions: [ ValueListenableBuilder( - valueListenable: _currentImageDataIndex, - builder: (_, int index, __) { - return _lockedIcon(_imageFields[index]); - }) + valueListenable: _currentImageDataIndex, + builder: (_, int index, __) { + return _lockedIcon(_imageFields[index]); + }, + ), ], ), body: PageView.builder( @@ -135,35 +134,34 @@ class _ProductImageSwipeableViewState extends State return IconButton( onPressed: () { showSmoothModalSheet( - context: context, - builder: (BuildContext context) { - return SmoothModalSheet( - title: appLocalizations.owner_field_info_title, - prefixIndicator: true, - body: SafeArea( - top: false, - child: Column( - children: [ - Container( - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.secondary, - shape: BoxShape.circle, - ), - padding: const EdgeInsetsDirectional.all(LARGE_SPACE), - child: const OwnerFieldIcon( - size: 30.0, - ), + context: context, + builder: (BuildContext context) { + return SmoothModalSheet( + title: appLocalizations.owner_field_info_title, + prefixIndicator: true, + body: SafeArea( + top: false, + child: Column( + children: [ + Container( + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.secondary, + shape: BoxShape.circle, ), - const SizedBox(height: MEDIUM_SPACE), - Text( - appLocalizations.owner_field_info_message, - style: const TextStyle(fontSize: 15.0), - ), - ], - ), + padding: const EdgeInsetsDirectional.all(LARGE_SPACE), + child: const OwnerFieldIcon(size: 30.0), + ), + const SizedBox(height: MEDIUM_SPACE), + Text( + appLocalizations.owner_field_info_message, + style: const TextStyle(fontSize: 15.0), + ), + ], ), - ); - }); + ), + ); + }, + ); }, tooltip: appLocalizations.owner_field_info_title, icon: const OwnerFieldIcon(), diff --git a/packages/smooth_app/lib/pages/product/product_image_unselect_button.dart b/packages/smooth_app/lib/pages/product/product_image_unselect_button.dart index 5808458483..eac2862f85 100644 --- a/packages/smooth_app/lib/pages/product/product_image_unselect_button.dart +++ b/packages/smooth_app/lib/pages/product/product_image_unselect_button.dart @@ -47,9 +47,7 @@ class ProductImageUnselectButton extends ProductImageButton { builder: (BuildContext context) { return SmoothAlertDialog( title: appLocalizations.confirm_button_label, - body: Text( - appLocalizations.are_you_sure, - ), + body: Text(appLocalizations.are_you_sure), close: true, positiveAction: SmoothActionButton( text: appLocalizations.yes, diff --git a/packages/smooth_app/lib/pages/product/product_image_viewer.dart b/packages/smooth_app/lib/pages/product/product_image_viewer.dart index 4a45073ae0..ea09ff649b 100644 --- a/packages/smooth_app/lib/pages/product/product_image_viewer.dart +++ b/packages/smooth_app/lib/pages/product/product_image_viewer.dart @@ -56,17 +56,16 @@ class _ProductImageViewerState extends State Widget _getImageButton( final ProductImageButtonType type, final bool imageExists, - ) => - Padding( - padding: const EdgeInsets.symmetric(horizontal: SMALL_SPACE), - child: type.getButton( - product: upToDateProduct, - imageField: widget.imageField, - imageExists: imageExists, - language: widget.language, - isLoggedInMandatory: widget.isLoggedInMandatory, - ), - ); + ) => Padding( + padding: const EdgeInsets.symmetric(horizontal: SMALL_SPACE), + child: type.getButton( + product: upToDateProduct, + imageField: widget.imageField, + imageExists: imageExists, + language: widget.language, + isLoggedInMandatory: widget.isLoggedInMandatory, + ), + ); @override Widget build(BuildContext context) { @@ -84,10 +83,7 @@ class _ProductImageViewerState extends State final bool isLoading = transientFile.isImageAvailable() && !transientFile.isServerImage(); final Iterable selectedLanguages = - getProductImageLanguages( - upToDateProduct, - widget.imageField, - ); + getProductImageLanguages(upToDateProduct, widget.imageField); return SafeArea( child: Column( @@ -101,9 +97,7 @@ class _ProductImageViewerState extends State ? Stack( children: [ const Positioned.fill( - child: ExcludeSemantics( - child: PictureNotFound(), - ), + child: ExcludeSemantics(child: PictureNotFound()), ), Align( alignment: const Alignment(0.0, -0.8), @@ -121,10 +115,9 @@ class _ProductImageViewerState extends State selectedLanguages.isEmpty ? appLocalizations.edit_photo_language_none : appLocalizations - .edit_photo_language_not_this_one, - style: Theme.of(context) - .textTheme - .headlineMedium + .edit_photo_language_not_this_one, + style: + Theme.of(context).textTheme.headlineMedium ?.copyWith(color: Colors.black) ?? const TextStyle(color: Colors.black), textAlign: TextAlign.center, @@ -170,34 +163,41 @@ class _ProductImageViewerState extends State barcode, widget.imageField, ), - flightShuttleBuilder: ( - _, - Animation animation, - HeroFlightDirection flightDirection, - BuildContext fromHeroContext, - BuildContext toHeroContext, - ) { - return AnimatedBuilder( - animation: animation, - builder: (_, __) { - Widget widget; - if (flightDirection == - HeroFlightDirection.push) { - widget = fromHeroContext.widget; - } else { - widget = toHeroContext.widget; - } + flightShuttleBuilder: + ( + _, + Animation animation, + HeroFlightDirection + flightDirection, + BuildContext fromHeroContext, + BuildContext toHeroContext, + ) { + return AnimatedBuilder( + animation: animation, + builder: (_, __) { + Widget widget; + if (flightDirection == + HeroFlightDirection + .push) { + widget = + fromHeroContext.widget; + } else { + widget = + toHeroContext.widget; + } - return ClipRRect( - borderRadius: - BorderRadius.circular(1 - - animation.value) * + return ClipRRect( + borderRadius: + BorderRadius.circular( + 1 - animation.value, + ) * ROUNDED_RADIUS.x, - child: widget, + child: widget, + ); + }, ); }, - ); - }) + ) : null, backgroundDecoration: const BoxDecoration( color: Colors.black, @@ -208,7 +208,8 @@ class _ProductImageViewerState extends State if (isLoading) Center( child: CloudUploadAnimation.circle( - size: MediaQuery.sizeOf(context).longestSide * + size: + MediaQuery.sizeOf(context).longestSide * 0.2, ), ), @@ -228,10 +229,7 @@ class _ProductImageViewerState extends State child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(LARGE_SPACE), - border: Border.all( - color: Colors.white, - width: 3, - ), + border: Border.all(color: Colors.white, width: 3), ), child: LanguagesSelector( setLanguage: widget.setLanguage, @@ -246,7 +244,7 @@ class _ProductImageViewerState extends State ), ), ), - ) + ), ], ), Row( @@ -293,9 +291,6 @@ class _ProductImageViewerState extends State ); } - TransientFile _getTransientFile() => TransientFile.fromProductImageData( - _imageData, - barcode, - widget.language, - ); + TransientFile _getTransientFile() => + TransientFile.fromProductImageData(_imageData, barcode, widget.language); } diff --git a/packages/smooth_app/lib/pages/product/product_incomplete_card.dart b/packages/smooth_app/lib/pages/product/product_incomplete_card.dart index 0fc4c58a79..c1b9e123d2 100644 --- a/packages/smooth_app/lib/pages/product/product_incomplete_card.dart +++ b/packages/smooth_app/lib/pages/product/product_incomplete_card.dart @@ -106,23 +106,19 @@ class ProductIncompleteCard extends StatelessWidget { ), ), ), - icon: const Icon( - Icons.bolt, - color: Colors.amber, - ), + icon: const Icon(Icons.bolt, color: Colors.amber), onPressed: () async => Navigator.of(context, rootNavigator: true).push( - MaterialPageRoute( - builder: (BuildContext context) => AddNewProductPage.fromProduct( - product, - isLoggedInMandatory: isLoggedInMandatory, + MaterialPageRoute( + builder: (BuildContext context) => + AddNewProductPage.fromProduct( + product, + isLoggedInMandatory: isLoggedInMandatory, + ), + ), ), - ), - ), style: ButtonStyle( - backgroundColor: WidgetStateProperty.all( - colorScheme.primary, - ), + backgroundColor: WidgetStateProperty.all(colorScheme.primary), foregroundColor: WidgetStateProperty.all( colorScheme.onPrimary, ), diff --git a/packages/smooth_app/lib/pages/product/product_list_helper.dart b/packages/smooth_app/lib/pages/product/product_list_helper.dart index 91a4b07b12..9c2c4424e4 100644 --- a/packages/smooth_app/lib/pages/product/product_list_helper.dart +++ b/packages/smooth_app/lib/pages/product/product_list_helper.dart @@ -33,18 +33,21 @@ class AddProductToListContainer extends StatelessWidget { barcode, ), child: Consumer<_ProductUserListsProvider>( - builder: ( - final BuildContext context, - final _ProductUserListsProvider productUserListsProvider, - final Widget? child, - ) { - return switch (productUserListsProvider.value) { - _ProductUserListsLoadingState _ => const _AddToProductListLoading(), - _ProductUserListsEmptyState _ => - const _AddToProductListNoListAvailable(), - _ProductUserListsWithState _ => const _AddToProductListWithLists(), - }; - }, + builder: + ( + final BuildContext context, + final _ProductUserListsProvider productUserListsProvider, + final Widget? child, + ) { + return switch (productUserListsProvider.value) { + _ProductUserListsLoadingState _ => + const _AddToProductListLoading(), + _ProductUserListsEmptyState _ => + const _AddToProductListNoListAvailable(), + _ProductUserListsWithState _ => + const _AddToProductListWithLists(), + }; + }, ), ); } @@ -57,9 +60,7 @@ class _AddToProductListLoading extends StatelessWidget { @override Widget build(BuildContext context) { return const SliverFillRemaining( - child: Center( - child: CircularProgressIndicator.adaptive(), - ), + child: Center(child: CircularProgressIndicator.adaptive()), ); } } @@ -93,10 +94,7 @@ class _AddToProductListNoListAvailable extends StatelessWidget { .secondaryLight, ), padding: const EdgeInsets.all(VERY_LARGE_SPACE), - child: const Milk( - size: 40.0, - color: Colors.white, - ), + child: const Milk(size: 40.0, color: Colors.white), ), ), const SizedBox(height: VERY_LARGE_SPACE), @@ -109,14 +107,12 @@ class _AddToProductListNoListAvailable extends StatelessWidget { SmoothSimpleButton( onPressed: () async { final ProductList? list = await ProductListUserDialogHelper( - DaoProductList(context.read())) - .showCreateUserListDialog( - context, - ); + DaoProductList(context.read()), + ).showCreateUserListDialog(context); if (list != null && context.mounted) { - final _ProductUserListsProvider provider = - context.read<_ProductUserListsProvider>(); + final _ProductUserListsProvider provider = context + .read<_ProductUserListsProvider>(); await provider.addAProductToAList(list.parameters); await provider.reloadLists(); } @@ -125,7 +121,7 @@ class _AddToProductListNoListAvailable extends StatelessWidget { appLocalizations.user_list_button_new, style: const TextStyle(fontWeight: FontWeight.w600), ), - ) + ), ], ), ), @@ -145,9 +141,9 @@ class _AddToProductListWithLists extends StatelessWidget { @override Widget build(BuildContext context) { - final _ProductUserListsWithState state = context - .watch<_ProductUserListsProvider>() - .value as _ProductUserListsWithState; + final _ProductUserListsWithState state = + context.watch<_ProductUserListsProvider>().value + as _ProductUserListsWithState; final List> userLists = state.userLists; final bool? scrollBarVisible = userLists.length > 5 ? true : null; @@ -174,7 +170,8 @@ class _AddToProductListWithLists extends StatelessWidget { listId: entry.key, selected: entry.value, // Force the divider when there is just one item - includeDivider: userLists.length == 1 || + includeDivider: + userLists.length == 1 || index < userLists.length - 1, ), ); @@ -183,9 +180,10 @@ class _AddToProductListWithLists extends StatelessWidget { ), ), _AddToProductListAddNewList( - userLists: - userLists.map((MapEntry entry) => entry.key), - ) + userLists: userLists.map( + (MapEntry entry) => entry.key, + ), + ), ], ), ), @@ -212,8 +210,10 @@ class _AddToProductListItem extends StatelessWidget { InkWell( onTap: () { SmoothHapticFeedback.lightNotification(); - Provider.of<_ProductUserListsProvider>(context, listen: false) - .toggleProductToList(listId); + Provider.of<_ProductUserListsProvider>( + context, + listen: false, + ).toggleProductToList(listId); }, child: ConstrainedBox( constraints: const BoxConstraints( @@ -224,16 +224,14 @@ class _AddToProductListItem extends StatelessWidget { horizontal: LARGE_SPACE, // The CupertinoCheckbox has huge paddings // (that we can't override) - vertical: - (Platform.isIOS || Platform.isMacOS) ? 2.0 : MEDIUM_SPACE, + vertical: (Platform.isIOS || Platform.isMacOS) + ? 2.0 + : MEDIUM_SPACE, ), child: Row( children: [ IgnorePointer( - child: SmoothCheckbox( - value: selected, - onChanged: (_) {}, - ), + child: SmoothCheckbox(value: selected, onChanged: (_) {}), ), const SizedBox(width: MEDIUM_SPACE), Expanded( @@ -248,7 +246,7 @@ class _AddToProductListItem extends StatelessWidget { ), ), ), - if (includeDivider) const _AddToProductListDivider() + if (includeDivider) const _AddToProductListDivider(), ], ); } @@ -290,26 +288,31 @@ class _AddToProductListAddNewListState } void _initAnimation() { - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; final bool lightTheme = context.lightTheme(listen: false); - _colorAnimation = ColorTween( - begin: lightTheme ? extension.primaryLight : extension.primarySemiDark, - end: extension.error, - ).animate(_animationController) - ..addListener(() { - setState(() {}); - }) - ..addStatusListener((AnimationStatus status) { - // Run back and forth the animation twice - if (status == AnimationStatus.completed && animationRepeat < 2) { - _animationController.reverse(); - } else if (status == AnimationStatus.dismissed && animationRepeat < 1) { - animationRepeat++; - _animationController.forward(); - } - }); + _colorAnimation = + ColorTween( + begin: lightTheme + ? extension.primaryLight + : extension.primarySemiDark, + end: extension.error, + ).animate(_animationController) + ..addListener(() { + setState(() {}); + }) + ..addStatusListener((AnimationStatus status) { + // Run back and forth the animation twice + if (status == AnimationStatus.completed && animationRepeat < 2) { + _animationController.reverse(); + } else if (status == AnimationStatus.dismissed && + animationRepeat < 1) { + animationRepeat++; + _animationController.forward(); + } + }); setState(() {}); } @@ -317,15 +320,15 @@ class _AddToProductListAddNewListState @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; final bool lightTheme = context.lightTheme(); final Color iconColor = lightTheme - ? Theme.of(context) - .checkboxTheme - .fillColor! - .resolve({WidgetState.selected})! + ? Theme.of(context).checkboxTheme.fillColor!.resolve({ + WidgetState.selected, + })! : Colors.white; return IconTheme( @@ -374,7 +377,8 @@ class _AddToProductListAddNewListState child: _editMode ? Padding( padding: const EdgeInsetsDirectional.only( - bottom: 1.0), + bottom: 1.0, + ), child: TextField( controller: _controller, autofocus: true, @@ -408,8 +412,9 @@ class _AddToProductListAddNewListState IconButton( icon: const Icon(Icons.cancel), onPressed: () => setState(() => _editMode = false), - tooltip: MaterialLocalizations.of(context) - .cancelButtonLabel, + tooltip: MaterialLocalizations.of( + context, + ).cancelButtonLabel, ), if (_editMode) IconButton( @@ -449,8 +454,10 @@ class _AddToProductListAddNewListState } SmoothHapticFeedback.lightNotification(); - Provider.of<_ProductUserListsProvider>(context, listen: false) - .createUserList(_controller.value.text); + Provider.of<_ProductUserListsProvider>( + context, + listen: false, + ).createUserList(_controller.value.text); setState(() => _editMode = false); } @@ -474,12 +481,11 @@ class _AddToProductListDivider extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; return Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: LARGE_SPACE, - ), + padding: const EdgeInsetsDirectional.symmetric(horizontal: LARGE_SPACE), child: CustomPaint( size: const Size(double.infinity, 1.0), painter: _AddToProductListDividerPainter( @@ -499,13 +505,13 @@ class _AddToProductListDividerPainter extends CustomPainter { required Color color, required this.dashWidth, required this.dashSpace, - }) : assert(color != Colors.transparent), - assert(dashWidth >= 0), - assert(dashSpace >= 0), - _paint = Paint() - ..color = color - ..strokeWidth = 1.0 - ..style = PaintingStyle.stroke; + }) : assert(color != Colors.transparent), + assert(dashWidth >= 0), + assert(dashSpace >= 0), + _paint = Paint() + ..color = color + ..strokeWidth = 1.0 + ..style = PaintingStyle.stroke; final Paint _paint; final double dashWidth; @@ -515,11 +521,7 @@ class _AddToProductListDividerPainter extends CustomPainter { void paint(Canvas canvas, Size size) { double startX = 0.0; while (startX < size.width) { - canvas.drawLine( - Offset(startX, 0), - Offset(startX + dashWidth, 0), - _paint, - ); + canvas.drawLine(Offset(startX, 0), Offset(startX + dashWidth, 0), _paint); startX += dashWidth + dashSpace; } } @@ -534,10 +536,8 @@ class _AddToProductListDividerPainter extends CustomPainter { /// Logic for the user lists class _ProductUserListsProvider extends ValueNotifier<_ProductUserListsState> { - _ProductUserListsProvider( - this.dao, - this.barcode, - ) : super(const _ProductUserListsLoadingState()) { + _ProductUserListsProvider(this.dao, this.barcode) + : super(const _ProductUserListsLoadingState()) { reloadLists(); } @@ -553,14 +553,15 @@ class _ProductUserListsProvider extends ValueNotifier<_ProductUserListsState> { return; } -// Sort by ignoring case + // Sort by ignoring case lists.sort( (String a, String b) => a.toLowerCase().compareTo(b.toLowerCase()), ); -// Create a list of user lists with a boolean if the product is in it - final List listsWithProduct = - await dao.getUserListsWithBarcodes([barcode]); + // Create a list of user lists with a boolean if the product is in it + final List listsWithProduct = await dao.getUserListsWithBarcodes( + [barcode], + ); final List> userLists = >[]; for (final String listId in lists) { @@ -578,21 +579,13 @@ class _ProductUserListsProvider extends ValueNotifier<_ProductUserListsState> { } /// Fake the UI first (otherwise there is a slight delay) - final bool selected = !(value as _ProductUserListsWithState) - .userLists + final bool selected = !(value as _ProductUserListsWithState).userLists .firstWhere((MapEntry item) => item.key == listId) .value; - _fakeStateChange( - listId, - selected, - ); + _fakeStateChange(listId, selected); - return dao.set( - ProductList.user(listId), - barcode, - selected, - ); + return dao.set(ProductList.user(listId), barcode, selected); } /// Create a new user list and add the product to it @@ -613,10 +606,12 @@ class _ProductUserListsProvider extends ValueNotifier<_ProductUserListsState> { /// If [listId] doesn't exist, it will be added at the top. bool _fakeStateChange(String listId, bool selected) { final List> lists = List>.of( - (value as _ProductUserListsWithState).userLists); + (value as _ProductUserListsWithState).userLists, + ); - final int position = - lists.indexWhere((MapEntry item) => item.key == listId); + final int position = lists.indexWhere( + (MapEntry item) => item.key == listId, + ); if (position >= 0) { lists[position] = MapEntry(listId, selected); diff --git a/packages/smooth_app/lib/pages/product/product_loader_page.dart b/packages/smooth_app/lib/pages/product/product_loader_page.dart index 21c22fdb2f..047c39ef12 100644 --- a/packages/smooth_app/lib/pages/product/product_loader_page.dart +++ b/packages/smooth_app/lib/pages/product/product_loader_page.dart @@ -44,11 +44,11 @@ class _ProductLoaderPageState extends State { _state = _ProductLoaderState.loading; }); - final FetchedProduct fetchedProduct = - await ProductRefresher().silentFetchAndRefresh( - barcode: widget.barcode, - localDatabase: context.read(), - ); + final FetchedProduct fetchedProduct = await ProductRefresher() + .silentFetchAndRefresh( + barcode: widget.barcode, + localDatabase: context.read(), + ); if (mounted) { if (fetchedProduct.product != null) { @@ -62,9 +62,7 @@ class _ProductLoaderPageState extends State { ); } else if (widget.mode == ProductLoaderMode.editProduct) { navigator.pushReplacement( - AppRoutes.PRODUCT_EDITOR( - widget.barcode, - ), + AppRoutes.PRODUCT_EDITOR(widget.barcode), extra: fetchedProduct.product, ); } @@ -92,20 +90,14 @@ class _ProductLoaderPageState extends State { child = const _ProductLoaderLoadingState(); break; case _ProductLoaderState.productNotFound: - child = _ProductLoaderNotFoundState( - barcode: widget.barcode, - ); + child = _ProductLoaderNotFoundState(barcode: widget.barcode); break; case _ProductLoaderState.serverError: - child = _ProductLoaderNetworkErrorState( - onRetry: () => _loadProduct(), - ); + child = _ProductLoaderNetworkErrorState(onRetry: () => _loadProduct()); break; } - return Scaffold( - body: Center(child: child), - ); + return Scaffold(body: Center(child: child)); } } @@ -119,9 +111,7 @@ class _ProductLoaderLoadingState extends StatelessWidget { } class _ProductLoaderNotFoundState extends StatelessWidget { - const _ProductLoaderNotFoundState({ - required this.barcode, - }); + const _ProductLoaderNotFoundState({required this.barcode}); final String barcode; @@ -152,11 +142,11 @@ class _ProductLoaderNotFoundState extends StatelessWidget { leadingIcon: const Icon(Icons.add), padding: const EdgeInsets.symmetric(vertical: LARGE_SPACE), onPressed: () { - AppNavigator.of(context).pushReplacement( - AppRoutes.PRODUCT_CREATOR(barcode), - ); + AppNavigator.of( + context, + ).pushReplacement(AppRoutes.PRODUCT_CREATOR(barcode)); }, - ) + ), ], ), ); @@ -164,9 +154,7 @@ class _ProductLoaderNotFoundState extends StatelessWidget { } class _ProductLoaderNetworkErrorState extends StatelessWidget { - const _ProductLoaderNetworkErrorState({ - required this.onRetry, - }); + const _ProductLoaderNetworkErrorState({required this.onRetry}); final VoidCallback onRetry; @@ -197,20 +185,13 @@ class _ProductLoaderNetworkErrorState extends StatelessWidget { leadingIcon: const Icon(Icons.sync), padding: const EdgeInsets.symmetric(vertical: LARGE_SPACE), onPressed: onRetry, - ) + ), ], ), ); } } -enum _ProductLoaderState { - loading, - productNotFound, - serverError; -} +enum _ProductLoaderState { loading, productNotFound, serverError } -enum ProductLoaderMode { - viewProduct, - editProduct, -} +enum ProductLoaderMode { viewProduct, editProduct } diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer.dart index 94981ba2d5..a1ce0f177d 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer.dart @@ -47,9 +47,9 @@ class ProductFooter extends StatelessWidget { color: Theme.of(context).scaffoldBackgroundColor, boxShadow: [ BoxShadow( - color: Theme.of(context) - .shadowColor - .withValues(alpha: context.lightTheme() ? 0.25 : 0.6), + color: Theme.of( + context, + ).shadowColor.withValues(alpha: context.lightTheme() ? 0.25 : 0.6), blurRadius: 10.0, ), ], @@ -125,8 +125,8 @@ class _ProductFooterButtonsBar extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension themeExtension = - context.extension(); + final SmoothColorsThemeExtension themeExtension = context + .extension(); double bottomPadding = MediaQuery.viewPaddingOf(context).bottom; // Add an extra padding (for Android) @@ -143,9 +143,7 @@ class _ProductFooterButtonsBar extends StatelessWidget { borderRadius: BorderRadius.circular(20.0), ), side: BorderSide(color: themeExtension.greyMedium), - padding: const EdgeInsetsDirectional.symmetric( - horizontal: 19.0, - ), + padding: const EdgeInsetsDirectional.symmetric(horizontal: 19.0), ), ), child: actions != null @@ -157,22 +155,23 @@ class _ProductFooterButtonsBar extends StatelessWidget { bottomPadding: bottomPadding, ) : ConsumerFilter( - buildWhen: (UserPreferences? previous, - UserPreferences current) => - previous?.productPageActions != current.productPageActions, + buildWhen: + (UserPreferences? previous, UserPreferences current) => + previous?.productPageActions != + current.productPageActions, builder: (BuildContext context, UserPreferences userPreferences, _) { - final List productPageActions = - userPreferences.productPageActions; + final List productPageActions = + userPreferences.productPageActions; - return _ProductFooterButtonsBarItems( - actions: productPageActions, - scrollController: scrollController, - showSettings: showSettings, - highlightFirstItem: highlightFirstItem, - bottomPadding: bottomPadding, - ); - }, + return _ProductFooterButtonsBarItems( + actions: productPageActions, + scrollController: scrollController, + showSettings: showSettings, + highlightFirstItem: highlightFirstItem, + bottomPadding: bottomPadding, + ); + }, ), ), ); @@ -209,8 +208,8 @@ class _ProductFooterButtonsBarItems extends StatelessWidget { itemBuilder: (BuildContext context, int index) { final ProductFooterActionBar action = index == actions.length && showSettings - ? ProductFooterActionBar.settings - : actions[index]; + ? ProductFooterActionBar.settings + : actions[index]; return Provider<_ProductFooterButtonType>.value( value: index == 0 && highlightFirstItem @@ -267,31 +266,28 @@ class ProductFooterButton extends StatelessWidget { @override Widget build(BuildContext context) { - final _ProductFooterButtonType buttonType = - context.watch<_ProductFooterButtonType>(); + final _ProductFooterButtonType buttonType = context + .watch<_ProductFooterButtonType>(); final Widget button = switch (buttonType) { _ProductFooterButtonType.filled => _ProductFooterFilledButton( - label: label, - icon: icon, - onTap: _onTap, - enabled: enabled, - semanticsLabel: semanticsLabel, - ), + label: label, + icon: icon, + onTap: _onTap, + enabled: enabled, + semanticsLabel: semanticsLabel, + ), _ProductFooterButtonType.outlined => _ProductFooterOutlinedButton( - label: label, - icon: icon, - onTap: _onTap, - enabled: enabled, - semanticsLabel: semanticsLabel, - ), + label: label, + icon: icon, + onTap: _onTap, + enabled: enabled, + semanticsLabel: semanticsLabel, + ), }; if (tooltip?.isNotEmpty == true) { - return Tooltip( - message: tooltip, - child: button, - ); + return Tooltip(message: tooltip, child: button); } else { return button; } @@ -305,10 +301,7 @@ class ProductFooterButton extends StatelessWidget { } } -enum _ProductFooterButtonType { - filled, - outlined, -} +enum _ProductFooterButtonType { filled, outlined } class _ProductFooterFilledButton extends StatelessWidget { const _ProductFooterFilledButton({ @@ -327,8 +320,8 @@ class _ProductFooterFilledButton extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension themeExtension = - context.extension(); + final SmoothColorsThemeExtension themeExtension = context + .extension(); ProductPageCompatibility? compatibility; try { @@ -339,19 +332,17 @@ class _ProductFooterFilledButton extends StatelessWidget { final Color contentColor = compatibility?.color != null ? compatibility!.color! : lightTheme - ? themeExtension.primaryBlack - : themeExtension.primarySemiDark; + ? themeExtension.primaryBlack + : themeExtension.primarySemiDark; final Color backgroundColor = enabled ? contentColor : (lightTheme ? Colors.grey.shade500 : Colors.black12); - final Color foregroundColor = - Colors.white.withValues(alpha: enabled ? 1.0 : 0.2); + final Color foregroundColor = Colors.white.withValues( + alpha: enabled ? 1.0 : 0.2, + ); final Widget child = IconTheme( - data: IconThemeData( - color: foregroundColor, - size: 18.0, - ), + data: IconThemeData(color: foregroundColor, size: 18.0), child: icon, ); @@ -375,9 +366,7 @@ class _ProductFooterFilledButton extends StatelessWidget { const SizedBox(width: 8.0), Text( label!, - style: const TextStyle( - fontWeight: FontWeight.bold, - ), + style: const TextStyle(fontWeight: FontWeight.bold), ), ], ), @@ -403,21 +392,19 @@ class _ProductFooterOutlinedButton extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension themeExtension = - context.extension(); + final SmoothColorsThemeExtension themeExtension = context + .extension(); final bool lightTheme = context.lightTheme(); - final Color contentColor = - lightTheme ? themeExtension.primaryBlack : Colors.white; + final Color contentColor = lightTheme + ? themeExtension.primaryBlack + : Colors.white; final Color foregroundColor = enabled ? contentColor : contentColor.withValues(alpha: lightTheme ? 0.4 : 0.2); final Widget child = IconTheme( - data: IconThemeData( - color: foregroundColor, - size: 18.0, - ), + data: IconThemeData(color: foregroundColor, size: 18.0), child: icon, ); @@ -441,9 +428,7 @@ class _ProductFooterOutlinedButton extends StatelessWidget { const SizedBox(width: 8.0), Text( label!, - style: const TextStyle( - fontWeight: FontWeight.bold, - ), + style: const TextStyle(fontWeight: FontWeight.bold), ), ], ), diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_add_product_properties.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_add_product_properties.dart index 33d81c8635..496971f851 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_add_product_properties.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_add_product_properties.dart @@ -18,10 +18,7 @@ class ProductFooterAddPropertyButton extends StatelessWidget { return ProductFooterButton( label: appLocalizations.add_tag, icon: const icons.AddProperty.alt(), - onTap: () => _openFolksonomyPage( - context, - context.read(), - ), + onTap: () => _openFolksonomyPage(context, context.read()), ); } @@ -43,10 +40,8 @@ class ProductFooterAddPropertyButton extends StatelessWidget { await Navigator.of(context).push( MaterialPageRoute( - builder: (BuildContext context) => FolksonomyPage( - product: product, - provider: provider, - ), + builder: (BuildContext context) => + FolksonomyPage(product: product, provider: provider), ), ); diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_add_to_lists.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_add_to_lists.dart index 641f97859e..f9b4a521c8 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_add_to_lists.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_add_to_lists.dart @@ -53,9 +53,8 @@ class _ProductFooterAddToListButtonState title: appLocalizations.user_list_title, suffix: const SmoothModalSheetHeaderCloseButton(), ), - bodyBuilder: (BuildContext context) => AddProductToListContainer( - barcode: product.barcode!, - ), + bodyBuilder: (BuildContext context) => + AddProductToListContainer(barcode: product.barcode!), ); if (context.mounted) { @@ -67,10 +66,7 @@ class _ProductFooterAddToListButtonState } class _ProductUserListsProvider extends ValueNotifier { - _ProductUserListsProvider( - this.dao, - this.barcode, - ) : super(0) { + _ProductUserListsProvider(this.dao, this.barcode) : super(0) { reload(); } diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_barcode.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_barcode.dart index 9a42ef3d49..a205693398 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_barcode.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_barcode.dart @@ -57,9 +57,7 @@ class ProductFooterBarcodeButton extends StatelessWidget { onPressed: () { Navigator.of(context).pop(); - Clipboard.setData( - ClipboardData(text: barcode), - ); + Clipboard.setData(ClipboardData(text: barcode)); SmoothHapticFeedback.click(); @@ -69,7 +67,8 @@ class ProductFooterBarcodeButton extends StatelessWidget { margin: EdgeInsetsDirectional.only( start: SMALL_SPACE, end: SMALL_SPACE, - bottom: ProductFooter.kHeight + + bottom: + ProductFooter.kHeight + MediaQuery.viewPaddingOf(context).bottom, ), text: appLocalizations.clipboard_barcode_copied(barcode), diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_compare.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_compare.dart index ffe2224b53..6a7f5c041d 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_compare.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_compare.dart @@ -18,9 +18,7 @@ class ProductFooterCompareButton extends StatelessWidget { final AppLocalizations appLocalizations = AppLocalizations.of(context); final Product product = context.read(); - const Set blackListedCategories = { - 'fr:vegan', - }; + const Set blackListedCategories = {'fr:vegan'}; String? categoryTag; String? categoryLabel; final List? labels = diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_data_contributor_guide.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_data_contributor_guide.dart index 8ab244ed51..f596598909 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_data_contributor_guide.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_data_contributor_guide.dart @@ -15,9 +15,9 @@ class ProductFooterContributorGuideButton extends StatelessWidget { label: appLocalizations.product_footer_action_contributor_guide, semanticsLabel: appLocalizations.product_footer_action_contributor_guide, icon: const icons.Lifebuoy(), - onTap: () => AppNavigator.of(context).push( - AppRoutes.EXTERNAL('https://wiki.openfoodfacts.org/Data_fields'), - ), + onTap: () => AppNavigator.of( + context, + ).push(AppRoutes.EXTERNAL('https://wiki.openfoodfacts.org/Data_fields')), ); } } diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_data_quality.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_data_quality.dart index 0d83502b49..bfb862822e 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_data_quality.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_data_quality.dart @@ -21,7 +21,9 @@ class ProductFooterDataQualityButton extends StatelessWidget { } Future _openDataQualityWarnings( - BuildContext context, Product product) async { + BuildContext context, + Product product, + ) async { // TODO(g123k): Not implemented in off-dart } } diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_open_website.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_open_website.dart index 10fe521c65..36c22fc040 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_open_website.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_open_website.dart @@ -21,9 +21,11 @@ class ProductFooterOpenWebsiteButton extends StatelessWidget { semanticsLabel: appLocalizations.product_footer_action_open_website, icon: const icons.ExternalLink(), onTap: () => AppNavigator.of(context).push( - AppRoutes.EXTERNAL('https://' - '${ProductQuery.getCountry().offTag}.${(product.productType ?? ProductType.food).getDomain()}.org' - '/product/${product.barcode}'), + AppRoutes.EXTERNAL( + 'https://' + '${ProductQuery.getCountry().offTag}.${(product.productType ?? ProductType.food).getDomain()}.org' + '/product/${product.barcode}', + ), ), ); } diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_settings.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_settings.dart index 4fdd312f07..776bbc64cd 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_settings.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_settings.dart @@ -75,21 +75,18 @@ class _ProductActionBarModal extends StatelessWidget { @override Widget build(BuildContext context) { return ChangeNotifierProvider<_ProductActionBarProvider>( - create: (BuildContext context) => _ProductActionBarProvider( - context.read(), + create: (BuildContext context) => + _ProductActionBarProvider(context.read()), + child: Consumer<_ProductActionBarProvider>( + builder: (BuildContext context, _ProductActionBarProvider provider, _) { + return switch (provider.value) { + _ProductActionBarLoadingState() => + const _ProductActionBarModalLoading(), + _ProductActionBarChangedState() => + const _ProductActionBarModalEditor(), + }; + }, ), - child: Consumer<_ProductActionBarProvider>(builder: ( - BuildContext context, - _ProductActionBarProvider provider, - _, - ) { - return switch (provider.value) { - _ProductActionBarLoadingState() => - const _ProductActionBarModalLoading(), - _ProductActionBarChangedState() => - const _ProductActionBarModalEditor(), - }; - }), ); } } @@ -99,9 +96,7 @@ class _ProductActionBarModalLoading extends StatelessWidget { @override Widget build(BuildContext context) { - return const Center( - child: CircularProgressIndicator.adaptive(), - ); + return const Center(child: CircularProgressIndicator.adaptive()); } } @@ -115,35 +110,34 @@ class _ProductActionBarModalEditor extends StatefulWidget { class _ProductActionBarModalEditorState extends State<_ProductActionBarModalEditor> { - static const EdgeInsetsDirectional PADDING = - EdgeInsetsDirectional.all(MEDIUM_SPACE); + static const EdgeInsetsDirectional PADDING = EdgeInsetsDirectional.all( + MEDIUM_SPACE, + ); static const double SEPARATOR_SIZE = MEDIUM_SPACE; @override Widget build(BuildContext context) { - final List<_ProductActionBarEntry> entries = (context - .watch<_ProductActionBarProvider>() - .value as _ProductActionBarChangedState) - .entries; + final List<_ProductActionBarEntry> entries = + (context.watch<_ProductActionBarProvider>().value + as _ProductActionBarChangedState) + .entries; return SmoothAnimatedList<_ProductActionBarEntry>( data: entries, - itemBuilder: ( - BuildContext context, - _ProductActionBarEntry entry, - int index, - ) { - return KeyedSubtree( - key: ValueKey(entry.action), - child: _ProductActionBarModalItemEditor( - entry: entry, - position: index, - canMoveUp: entry.visible && index > 0, - canMoveDown: entry.visible && - (index < entries.length - 1 && entries[index + 1].visible), - ), - ); - }, + itemBuilder: + (BuildContext context, _ProductActionBarEntry entry, int index) { + return KeyedSubtree( + key: ValueKey(entry.action), + child: _ProductActionBarModalItemEditor( + entry: entry, + position: index, + canMoveUp: entry.visible && index > 0, + canMoveDown: + entry.visible && + (index < entries.length - 1 && entries[index + 1].visible), + ), + ); + }, separatorSize: SEPARATOR_SIZE, padding: PADDING, ); @@ -192,15 +186,16 @@ class _ProductActionBarModalItemEditorState if (widget.entry.visible != oldWidget.entry.visible) { _controller.stop(); - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; - _colorAnimation = ColorTween( - begin: _invisibleColor(extension), - end: _visibleColor(extension), - ).animate(_controller) - ..addListener(() { - setState(() {}); - }); + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; + _colorAnimation = + ColorTween( + begin: _invisibleColor(extension), + end: _visibleColor(extension), + ).animate(_controller)..addListener(() { + setState(() {}); + }); if (widget.entry.visible) { _controller.forward(); @@ -224,8 +219,9 @@ class _ProductActionBarModalItemEditorState @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; return AnimatedContainer( duration: SmoothAnimationsDuration.medium, @@ -233,7 +229,8 @@ class _ProductActionBarModalItemEditorState constraints: const BoxConstraints(minHeight: MIN_HEIGHT), child: DecoratedBox( decoration: BoxDecoration( - color: _colorAnimation?.value ?? + color: + _colorAnimation?.value ?? (widget.entry.visible ? _visibleColor(extension) : _invisibleColor(extension)), @@ -249,9 +246,9 @@ class _ProductActionBarModalItemEditorState _ProductActionBarModalItemActionVisibility( visible: widget.entry.visible, onTap: () { - context - .read<_ProductActionBarProvider>() - .changeVisibility(widget.entry); + context.read<_ProductActionBarProvider>().changeVisibility( + widget.entry, + ); SmoothHapticFeedback.lightNotification(); }, @@ -273,8 +270,9 @@ class _ProductActionBarModalItemEditorState style: TextStyle( fontSize: 15.0, fontWeight: FontWeight.bold, - color: - context.darkTheme() ? extension.primaryBlack : null, + color: context.darkTheme() + ? extension.primaryBlack + : null, ), ), ), @@ -284,9 +282,10 @@ class _ProductActionBarModalItemEditorState visible: widget.entry.visible, enabled: widget.canMoveUp, onTap: () { - context - .read<_ProductActionBarProvider>() - .reorderPosition(widget.position, widget.position - 1); + context.read<_ProductActionBarProvider>().reorderPosition( + widget.position, + widget.position - 1, + ); SmoothHapticFeedback.lightNotification(); }, @@ -296,9 +295,10 @@ class _ProductActionBarModalItemEditorState visible: widget.entry.visible, enabled: widget.canMoveDown, onTap: () { - context - .read<_ProductActionBarProvider>() - .reorderPosition(widget.position, widget.position + 1); + context.read<_ProductActionBarProvider>().reorderPosition( + widget.position, + widget.position + 1, + ); SmoothHapticFeedback.lightNotification(); }, @@ -324,8 +324,9 @@ class _ProductActionBarModalItemEditorState ProductFooterActionBar.contributionGuide => const icons.Lifebuoy(), ProductFooterActionBar.dataQuality => const icons.CheckList(), ProductFooterActionBar.addProperty => const icons.AddProperty.alt(), - ProductFooterActionBar.settings => - throw Exception('This item should not be displayed'), + ProductFooterActionBar.settings => throw Exception( + 'This item should not be displayed', + ), }; } @@ -349,8 +350,9 @@ class _ProductActionBarModalItemEditorState ProductFooterActionBar.dataQuality => appLocalizations.product_footer_action_data_quality_tags, ProductFooterActionBar.addProperty => appLocalizations.add_tag, - ProductFooterActionBar.settings => - throw Exception('This item should not be displayed'), + ProductFooterActionBar.settings => throw Exception( + 'This item should not be displayed', + ), }; } @@ -374,15 +376,15 @@ class _ProductActionBarModalItemActionMoveUp extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; return _ProductActionBarModalItemAction( - icon: const icons.Chevron.up( - size: 14.0, - ), - semanticsLabel: - AppLocalizations.of(context).product_page_action_bar_item_move_up, + icon: const icons.Chevron.up(size: 14.0), + semanticsLabel: AppLocalizations.of( + context, + ).product_page_action_bar_item_move_up, enabled: enabled, visible: visible, disabledColor: visible ? extension.primaryLight : extension.primaryMedium, @@ -404,16 +406,16 @@ class _ProductActionBarModalItemActionMoveDown extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; return _ProductActionBarModalItemAction( - icon: const icons.Chevron.down( - size: 14.0, - ), + icon: const icons.Chevron.down(size: 14.0), padding: const EdgeInsetsDirectional.only(top: 1.0), - semanticsLabel: - AppLocalizations.of(context).product_page_action_bar_item_move_down, + semanticsLabel: AppLocalizations.of( + context, + ).product_page_action_bar_item_move_down, enabled: enabled, visible: visible, disabledColor: visible ? extension.primaryLight : extension.primaryMedium, @@ -437,12 +439,8 @@ class _ProductActionBarModalItemActionVisibility extends StatelessWidget { return _ProductActionBarModalItemAction( icon: visible - ? const icons.Eye.visible( - size: 20.0, - ) - : const icons.Eye.invisible( - size: 19.5, - ), + ? const icons.Eye.visible(size: 20.0) + : const icons.Eye.invisible(size: 19.5), padding: EdgeInsetsDirectional.only(bottom: visible ? 0.0 : 1.0), semanticsLabel: visible ? localizations.product_page_action_bar_item_disable @@ -502,8 +500,9 @@ class _ProductActionBarModalItemActionState void didUpdateWidget(covariant _ProductActionBarModalItemAction oldWidget) { super.didUpdateWidget(oldWidget); - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; Color? initColor; Color? endColor; @@ -529,21 +528,20 @@ class _ProductActionBarModalItemActionState _controller.stop(); - _colorAnimation = ColorTween( - begin: initColor, - end: endColor, - ).animate(_controller) - ..addListener(() { - setState(() {}); - }); + _colorAnimation = + ColorTween(begin: initColor, end: endColor).animate(_controller) + ..addListener(() { + setState(() {}); + }); _controller.forward(); } @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension extension = Theme.of( + context, + ).extension()!; return Semantics( label: widget.semanticsLabel, @@ -566,16 +564,15 @@ class _ProductActionBarModalItemActionState child: DecoratedBox( decoration: BoxDecoration( shape: BoxShape.circle, - color: _colorAnimation?.value ?? + color: + _colorAnimation?.value ?? (widget.enabled ? widget.enabledColor ?? _enabledColor(extension) : widget.disabledColor ?? _disabledColor(extension)), ), child: Padding( padding: widget.padding ?? EdgeInsets.zero, - child: Center( - child: widget.icon, - ), + child: Center(child: widget.icon), ), ), ), @@ -602,7 +599,7 @@ class _ProductActionBarModalItemActionState class _ProductActionBarProvider extends ValueNotifier<_ProductActionBarState> { _ProductActionBarProvider(this.preferences) - : super(const _ProductActionBarLoadingState()) { + : super(const _ProductActionBarLoadingState()) { _loadEntries(); } @@ -614,24 +611,16 @@ class _ProductActionBarProvider extends ValueNotifier<_ProductActionBarState> { preferences.productPageActions; final Iterable disabledActions = ProductFooterActionBar.defaultOrder().where( - (ProductFooterActionBar action) => !enabledActions.contains(action), - ); + (ProductFooterActionBar action) => !enabledActions.contains(action), + ); emit( - _ProductActionBarChangedState( - <_ProductActionBarEntry>[ - for (final ProductFooterActionBar action in enabledActions) - _ProductActionBarEntry( - action: action, - visible: true, - ), - for (final ProductFooterActionBar action in disabledActions) - _ProductActionBarEntry( - action: action, - visible: false, - ), - ], - ), + _ProductActionBarChangedState(<_ProductActionBarEntry>[ + for (final ProductFooterActionBar action in enabledActions) + _ProductActionBarEntry(action: action, visible: true), + for (final ProductFooterActionBar action in disabledActions) + _ProductActionBarEntry(action: action, visible: false), + ]), ); } @@ -642,42 +631,44 @@ class _ProductActionBarProvider extends ValueNotifier<_ProductActionBarState> { if (entry.visible) { // Move it to last position emit( - _ProductActionBarChangedState( - <_ProductActionBarEntry>[ - ...currentEntries.where((_ProductActionBarEntry e) => e != entry), - entry.copyWith(visible: false), - ], - ), + _ProductActionBarChangedState(<_ProductActionBarEntry>[ + ...currentEntries.where((_ProductActionBarEntry e) => e != entry), + entry.copyWith(visible: false), + ]), ); } else { // Move it to the last visible position emit( - _ProductActionBarChangedState( - <_ProductActionBarEntry>[ - ...currentEntries - .where((_ProductActionBarEntry e) => e != entry && e.visible), - entry.copyWith(visible: true), - ...currentEntries - .where((_ProductActionBarEntry e) => e != entry && !e.visible), - ], - ), + _ProductActionBarChangedState(<_ProductActionBarEntry>[ + ...currentEntries.where( + (_ProductActionBarEntry e) => e != entry && e.visible, + ), + entry.copyWith(visible: true), + ...currentEntries.where( + (_ProductActionBarEntry e) => e != entry && !e.visible, + ), + ]), ); } - preferences.setProductPageActions((value as _ProductActionBarChangedState) - .entries - .where((_ProductActionBarEntry e) => e.visible) - .map((_ProductActionBarEntry e) => e.action)); + preferences.setProductPageActions( + (value as _ProductActionBarChangedState).entries + .where((_ProductActionBarEntry e) => e.visible) + .map((_ProductActionBarEntry e) => e.action), + ); } void reorderPosition(int oldPosition, int newPosition) { final List<_ProductActionBarEntry> currentEntries = (value as _ProductActionBarChangedState).entries; - final int max = - currentEntries.indexWhere((_ProductActionBarEntry e) => !e.visible); - newPosition = - math.min(newPosition, max == -1 ? currentEntries.length - 1 : max - 1); + final int max = currentEntries.indexWhere( + (_ProductActionBarEntry e) => !e.visible, + ); + newPosition = math.min( + newPosition, + max == -1 ? currentEntries.length - 1 : max - 1, + ); final _ProductActionBarEntry entry = currentEntries[oldPosition]; final List<_ProductActionBarEntry> newEntries = <_ProductActionBarEntry>[ @@ -686,16 +677,13 @@ class _ProductActionBarProvider extends ValueNotifier<_ProductActionBarState> { newEntries.insert(newPosition, entry); - emit( - _ProductActionBarChangedState( - newEntries, - ), - ); + emit(_ProductActionBarChangedState(newEntries)); - preferences.setProductPageActions((value as _ProductActionBarChangedState) - .entries - .where((_ProductActionBarEntry e) => e.visible) - .map((_ProductActionBarEntry e) => e.action)); + preferences.setProductPageActions( + (value as _ProductActionBarChangedState).entries + .where((_ProductActionBarEntry e) => e.visible) + .map((_ProductActionBarEntry e) => e.action), + ); } } @@ -714,10 +702,7 @@ class _ProductActionBarChangedState extends _ProductActionBarState { } class _ProductActionBarEntry { - _ProductActionBarEntry({ - required this.action, - required this.visible, - }); + _ProductActionBarEntry({required this.action, required this.visible}); final ProductFooterActionBar action; final bool visible; diff --git a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_share.dart b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_share.dart index 1673be6745..79444e3578 100644 --- a/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_share.dart +++ b/packages/smooth_app/lib/pages/product/product_page/footer/new_product_footer_share.dart @@ -32,19 +32,22 @@ class ProductFooterShareButton extends StatelessWidget { final AppLocalizations appLocalizations = AppLocalizations.of(context); // We need to provide a sharePositionOrigin to make the plugin work on ipad final RenderBox? box = context.findRenderObject() as RenderBox?; - final String url = 'https://' + final String url = + 'https://' '${ProductQuery.getCountry().offTag}.${(product.productType ?? ProductType.food).getDomain()}.org' '/product/${product.barcode}'; Share.share( switch (product.productType) { ProductType.beauty => appLocalizations.share_product_text_beauty(url), - ProductType.petFood => - appLocalizations.share_product_text_pet_food(url), + ProductType.petFood => appLocalizations.share_product_text_pet_food( + url, + ), ProductType.product => appLocalizations.share_product_text_product(url), _ => appLocalizations.share_product_text(url), }, - sharePositionOrigin: - box == null ? null : box.localToGlobal(Offset.zero) & box.size, + sharePositionOrigin: box == null + ? null + : box.localToGlobal(Offset.zero) & box.size, ); } } diff --git a/packages/smooth_app/lib/pages/product/product_page/header/product_page_tabs.dart b/packages/smooth_app/lib/pages/product/product_page/header/product_page_tabs.dart index 95d7bd54e0..75188c1840 100644 --- a/packages/smooth_app/lib/pages/product/product_page/header/product_page_tabs.dart +++ b/packages/smooth_app/lib/pages/product/product_page/header/product_page_tabs.dart @@ -35,10 +35,7 @@ class ProductPageTab { } class ProductPageTabBar extends StatelessWidget { - const ProductPageTabBar({ - required this.tabController, - required this.tabs, - }); + const ProductPageTabBar({required this.tabController, required this.tabs}); final TabController tabController; final List tabs; @@ -51,12 +48,14 @@ class ProductPageTabBar extends StatelessWidget { preferredSize: const Size.fromHeight(SmoothTabBar.TAB_BAR_HEIGHT), child: SmoothTabBar( tabController: tabController, - items: tabs.map((ProductPageTab tab) { - return SmoothTabBarItem( - label: tab.labelBuilder(context), - value: tab, - ); - }).toList(growable: false), + items: tabs + .map((ProductPageTab tab) { + return SmoothTabBarItem( + label: tab.labelBuilder(context), + value: tab, + ); + }) + .toList(growable: false), onTabChanged: (_) {}, ), ), @@ -154,9 +153,7 @@ class ProductPageTabBar extends StatelessWidget { AppLocalizations.of(context).product_page_tab_website, builder: (_, Product product) => ListView( padding: EdgeInsetsDirectional.zero, - children: [ - WebsiteCard(product.website!), - ], + children: [WebsiteCard(product.website!)], ), ), ); @@ -168,15 +165,14 @@ class ProductPageTabBar extends StatelessWidget { AppLocalizations.of(context).product_page_tab_prices, builder: (_, Product product) => ListView( padding: EdgeInsetsDirectional.zero, - children: [ - PricesCard(product), - ], + children: [PricesCard(product)], ), ), ); if (context.read().getFlag( - UserPreferencesDevMode.userPreferencesFlagHideFolksonomy) == + UserPreferencesDevMode.userPreferencesFlagHideFolksonomy, + ) == false) { tabs.add( ProductPageTab( diff --git a/packages/smooth_app/lib/pages/product/product_page/new_product_header.dart b/packages/smooth_app/lib/pages/product/product_page/new_product_header.dart index 13982012f8..62b2aa3550 100644 --- a/packages/smooth_app/lib/pages/product/product_page/new_product_header.dart +++ b/packages/smooth_app/lib/pages/product/product_page/new_product_header.dart @@ -18,10 +18,7 @@ import 'package:smooth_app/themes/smooth_theme_colors.dart'; import 'package:visibility_detector/visibility_detector.dart'; class ProductHeader extends StatefulWidget { - const ProductHeader({ - this.backButtonType, - super.key, - }); + const ProductHeader({this.backButtonType, super.key}); final ProductPageBackButton? backButtonType; @@ -42,61 +39,61 @@ class _ProductHeaderState extends State { key: const Key('product_header'), onVisibilityChanged: _onVisibilityChanged, child: Listener( - listener: ( - _, - __, - ScrollController scrollController, - ) => + listener: (_, __, ScrollController scrollController) => _onScroll(scrollController), child: Consumer( - builder: ( - BuildContext context, - ProductPageCompatibility productCompatibility, - _, - ) { - final Color tintColor = productCompatibility.color ?? - Theme.of(context) - .extension()! - .greyNormal; + builder: + ( + BuildContext context, + ProductPageCompatibility productCompatibility, + _, + ) { + final Color tintColor = + productCompatibility.color ?? + Theme.of( + context, + ).extension()!.greyNormal; - return Material( - color: tintColor, - shadowColor: tintColor, - elevation: _shadow, - child: DefaultTextStyle.merge( - style: const TextStyle(color: Colors.white), - child: IconTheme( - data: const IconThemeData(color: Colors.white), - child: SizedBox( - height: kToolbarHeight + statusBarHeight, - child: Padding( - padding: EdgeInsetsDirectional.only(top: statusBarHeight), - child: Row( - children: [ - _ProductHeaderBackButton( - backButtonType: widget.backButtonType, + return Material( + color: tintColor, + shadowColor: tintColor, + elevation: _shadow, + child: DefaultTextStyle.merge( + style: const TextStyle(color: Colors.white), + child: IconTheme( + data: const IconThemeData(color: Colors.white), + child: SizedBox( + height: kToolbarHeight + statusBarHeight, + child: Padding( + padding: EdgeInsetsDirectional.only( + top: statusBarHeight, ), - Expanded( - child: Offstage( - offstage: _titleOpacity == 0.0, - child: Opacity( - opacity: _titleOpacity, - child: const _ProductHeaderName(), + child: Row( + children: [ + _ProductHeaderBackButton( + backButtonType: widget.backButtonType, ), - ), + Expanded( + child: Offstage( + offstage: _titleOpacity == 0.0, + child: Opacity( + opacity: _titleOpacity, + child: const _ProductHeaderName(), + ), + ), + ), + if (productCompatibility.score != null) + _ProductCompatibilityScore( + progress: _compatibilityScoreOpacity, + ), + ], ), - if (productCompatibility.score != null) - _ProductCompatibilityScore( - progress: _compatibilityScoreOpacity, - ), - ], + ), ), ), ), - ), - ), - ); - }, + ); + }, ), ), ); @@ -109,12 +106,12 @@ class _ProductHeaderState extends State { LARGE_SPACE * 2 + kToolbarHeight * 1.5, 1.0, ); - final double compatibilityScoreOpacity = - scrollController.offset.progressAndClamp( - LARGE_SPACE * 1.5, - LARGE_SPACE + kToolbarHeight * 2, - 1.0, - ); + final double compatibilityScoreOpacity = scrollController.offset + .progressAndClamp( + LARGE_SPACE * 1.5, + LARGE_SPACE + kToolbarHeight * 2, + 1.0, + ); final double shadow = scrollController.offset.progressAndClamp( 0.0, kToolbarHeight / 2, @@ -150,9 +147,7 @@ class _ProductHeaderState extends State { } class _ProductHeaderBackButton extends StatelessWidget { - const _ProductHeaderBackButton({ - this.backButtonType, - }); + const _ProductHeaderBackButton({this.backButtonType}); final ProductPageBackButton? backButtonType; @@ -221,17 +216,13 @@ class _ProductHeaderName extends StatelessWidget { fontSize: 17.0, height: 1.0, ), - strutStyle: const StrutStyle( - forceStrutHeight: true, - ), + strutStyle: const StrutStyle(forceStrutHeight: true), ), Text( getProductBrands(product, appLocalizations), maxLines: 1, overflow: TextOverflow.ellipsis, - style: const TextStyle( - fontSize: 16.5, - ), + style: const TextStyle(fontSize: 16.5), ), ], ); @@ -242,9 +233,7 @@ class _ProductHeaderName extends StatelessWidget { } class _ProductCompatibilityScore extends StatelessWidget { - const _ProductCompatibilityScore({ - required this.progress, - }); + const _ProductCompatibilityScore({required this.progress}); //ignore: constant_identifier_names static const double MAX_WIDTH = 40.0; @@ -257,13 +246,12 @@ class _ProductCompatibilityScore extends StatelessWidget { @override Widget build(BuildContext context) { - final ProductPageCompatibility compatibility = - context.watch(); + final ProductPageCompatibility compatibility = context + .watch(); - final String tooltipMessage = - AppLocalizations.of(context).product_page_compatibility_score_tooltip( - compatibility.score!, - ); + final String tooltipMessage = AppLocalizations.of( + context, + ).product_page_compatibility_score_tooltip(compatibility.score!); return Semantics( excludeSemantics: true, @@ -281,9 +269,9 @@ class _ProductCompatibilityScore extends StatelessWidget { border: Border.all(color: Colors.white), ), child: InkWell( - onTap: () => AppNavigator.of(context).push( - AppRoutes.PREFERENCES(PreferencePageType.FOOD), - ), + onTap: () => AppNavigator.of( + context, + ).push(AppRoutes.PREFERENCES(PreferencePageType.FOOD)), borderRadius: ROUNDED_BORDER_RADIUS, child: ClipRRect( borderRadius: ROUNDED_BORDER_RADIUS, @@ -301,8 +289,9 @@ class _ProductCompatibilityScore extends StatelessWidget { BuildContext context, ProductPageCompatibility compatibility, ) { - final String compatibilityLabel = - AppLocalizations.of(context).product_page_compatibility_score; + final String compatibilityLabel = AppLocalizations.of( + context, + ).product_page_compatibility_score; return IntrinsicHeight( child: Row( @@ -322,11 +311,7 @@ class _ProductCompatibilityScore extends StatelessWidget { ), child: Transform.translate( offset: Offset((1 - progress) * 10, 0.0), - child: SizedBox( - child: icons.Info( - color: compatibility.color, - ), - ), + child: SizedBox(child: icons.Info(color: compatibility.color)), ), ), ), diff --git a/packages/smooth_app/lib/pages/product/product_page/new_product_page.dart b/packages/smooth_app/lib/pages/product/product_page/new_product_page.dart index 92456a36d1..7f577f537f 100644 --- a/packages/smooth_app/lib/pages/product/product_page/new_product_page.dart +++ b/packages/smooth_app/lib/pages/product/product_page/new_product_page.dart @@ -95,8 +95,9 @@ class ProductPageState extends State _productPreferences, ); - final bool hasPendingOperations = UpToDateChanges(localDatabase) - .hasNotTerminatedOperations(upToDateProduct.barcode!); + final bool hasPendingOperations = UpToDateChanges( + localDatabase, + ).hasNotTerminatedOperations(upToDateProduct.barcode!); return MultiProvider( providers: [ @@ -132,13 +133,12 @@ class ProductPageState extends State leading: EMPTY_WIDGET, leadingWidth: 0.0, titleSpacing: 0.0, - title: ProductHeader( - backButtonType: widget.backButton, - ), + title: ProductHeader(backButtonType: widget.backButton), ), SliverToBoxAdapter( child: HeroMode( - enabled: widget.withHeroAnimation && + enabled: + widget.withHeroAnimation && widget.heroTag?.isNotEmpty == true, child: SummaryCard( upToDateProduct, @@ -148,20 +148,14 @@ class ProductPageState extends State ), ), ), - ProductPageTabBar( - tabController: _tabController, - tabs: _tabs, - ), + ProductPageTabBar(tabController: _tabController, tabs: _tabs), ]; }, body: TabBarView( controller: _tabController, children: _tabs .map( - (ProductPageTab tab) => tab.builder( - context, - upToDateProduct, - ), + (ProductPageTab tab) => tab.builder(context, upToDateProduct), ) .toList(growable: false), ), @@ -192,10 +186,7 @@ class ProductPageState extends State final BuildContext context, ) async { final LocalDatabase localDatabase = context.read(); - await DaoProductList(localDatabase).push( - ProductList.history(), - barcode, - ); + await DaoProductList(localDatabase).push(ProductList.history(), barcode); localDatabase.notifyListeners(); } @@ -208,8 +199,8 @@ class ProductPageState extends State } static ProductPageState of(BuildContext context) { - final ProductPageState? result = - context.findAncestorStateOfType(); + final ProductPageState? result = context + .findAncestorStateOfType(); assert(result != null, 'No ProductPageState found in context'); return result!; } @@ -219,9 +210,10 @@ class ProductPageCompatibility { ProductPageCompatibility({ required Color color, required MatchedProductV2 matchedProductV2, - }) : _color = color, - score = ProductCompatibilityHelper.product(matchedProductV2) - .getFormattedScore(); + }) : _color = color, + score = ProductCompatibilityHelper.product( + matchedProductV2, + ).getFormattedScore(); final Color _color; final String? score; diff --git a/packages/smooth_app/lib/pages/product/product_page/new_product_page_loading_indicator.dart b/packages/smooth_app/lib/pages/product/product_page/new_product_page_loading_indicator.dart index e24a2ad11b..ad836e506b 100644 --- a/packages/smooth_app/lib/pages/product/product_page/new_product_page_loading_indicator.dart +++ b/packages/smooth_app/lib/pages/product/product_page/new_product_page_loading_indicator.dart @@ -8,10 +8,7 @@ import 'package:smooth_app/themes/theme_provider.dart'; import 'package:smooth_app/widgets/smooth_banner.dart'; class ProductPageLoadingIndicator extends StatelessWidget { - const ProductPageLoadingIndicator({ - this.addSafeArea = false, - super.key, - }); + const ProductPageLoadingIndicator({this.addSafeArea = false, super.key}); final bool addSafeArea; @@ -20,19 +17,19 @@ class ProductPageLoadingIndicator extends StatelessWidget { final AppLocalizations appLocalizations = AppLocalizations.of(context); final bool lightTheme = context.lightTheme(); - final Color color = context.watchSafe()?.color ?? + final Color color = + context.watchSafe()?.color ?? (lightTheme ? Colors.grey : Colors.grey[600]!); return SmoothBanner( - icon: CloudUploadAnimation( - size: MediaQuery.sizeOf(context).width * 0.10, - ), + icon: CloudUploadAnimation(size: MediaQuery.sizeOf(context).width * 0.10), iconAlignment: AlignmentDirectional.center, iconBackgroundColor: color, title: appLocalizations.product_page_pending_operations_banner_title, titleColor: lightTheme ? null : Colors.white, - contentBackgroundColor: - lightTheme ? color.lighten(0.6) : color.darken(0.3), + contentBackgroundColor: lightTheme + ? color.lighten(0.6) + : color.darken(0.3), contentColor: lightTheme ? null : Colors.grey[200], topShadow: true, content: appLocalizations.product_page_pending_operations_banner_message, diff --git a/packages/smooth_app/lib/pages/product/product_questions_widget.dart b/packages/smooth_app/lib/pages/product/product_questions_widget.dart index 979a1c98e1..10b08b798c 100644 --- a/packages/smooth_app/lib/pages/product/product_questions_widget.dart +++ b/packages/smooth_app/lib/pages/product/product_questions_widget.dart @@ -51,8 +51,9 @@ class _ProductQuestionsWidgetState extends State void didChangeDependencies() { super.didChangeDependencies(); - final bool shouldKeepWidgetAlive = - KeepQuestionWidgetAlive.shouldKeepAlive(context); + final bool shouldKeepWidgetAlive = KeepQuestionWidgetAlive.shouldKeepAlive( + context, + ); // Force the Widget to reload questions only when transitioning // from not kept alive (false) to keep alive (true) @@ -82,8 +83,7 @@ class _ProductQuestionsWidgetState extends State MaterialPageRoute( builder: (BuildContext context) => QuestionsPage( product: widget.product, - questions: (_state as _ProductQuestionsWithQuestions) - .questions + questions: (_state as _ProductQuestionsWithQuestions).questions .toList(growable: false), ), ), @@ -103,8 +103,8 @@ class _ProductQuestionsWidgetState extends State }) async { final List? currentQuestions = _state is _ProductQuestionsWithQuestions - ? (_state as _ProductQuestionsWithQuestions).questions - : null; + ? (_state as _ProductQuestionsWithQuestions).questions + : null; setState(() => _state = const _ProductQuestionsLoading()); @@ -117,16 +117,19 @@ class _ProductQuestionsWidgetState extends State if (updateInsightAnnotations) { final LocalDatabase localDatabase = context.read(); - final RobotoffInsightHelper robotoffInsightHelper = - RobotoffInsightHelper(localDatabase); + final RobotoffInsightHelper robotoffInsightHelper = RobotoffInsightHelper( + localDatabase, + ); if (questions.isEmpty) { - await robotoffInsightHelper - .removeInsightAnnotationsSavedForProduct(widget.product.barcode!); + await robotoffInsightHelper.removeInsightAnnotationsSavedForProduct( + widget.product.barcode!, + ); } - _annotationVoted = - await robotoffInsightHelper.areQuestionsAlreadyVoted(questions); + _annotationVoted = await robotoffInsightHelper.areQuestionsAlreadyVoted( + questions, + ); } if (questions.isNotEmpty == true && !_annotationVoted) { @@ -144,27 +147,29 @@ class _ProductQuestionsWidgetState extends State } void _trackEvent(AnalyticsEvent event) => AnalyticsHelper.trackProductEvent( - event, - eventValue: 1, - product: widget.product, - ); + event, + eventValue: 1, + product: widget.product, + ); Future?> _loadProductQuestions() async { final LocalDatabase localDatabase = context.read(); try { - final List questions = - await ProductQuestionsQuery(widget.product.barcode!) - .getQuestions(localDatabase, 3); + final List questions = await ProductQuestionsQuery( + widget.product.barcode!, + ).getQuestions(localDatabase, 3); if (!mounted) { return null; } - final RobotoffInsightHelper robotoffInsightHelper = - RobotoffInsightHelper(localDatabase); - _annotationVoted = - await robotoffInsightHelper.areQuestionsAlreadyVoted(questions); + final RobotoffInsightHelper robotoffInsightHelper = RobotoffInsightHelper( + localDatabase, + ); + _annotationVoted = await robotoffInsightHelper.areQuestionsAlreadyVoted( + questions, + ); return questions; } catch (_) { return null; @@ -197,10 +202,7 @@ class _ProductQuestionBanner extends StatelessWidget { final Widget child; if (state is! _ProductQuestionsWithQuestions) { - child = const BlockSemantics( - blocking: true, - child: EMPTY_WIDGET, - ); + child = const BlockSemantics(blocking: true, child: EMPTY_WIDGET); } else { child = DecoratedBox( decoration: BoxDecoration( @@ -223,14 +225,15 @@ class _ProductQuestionBanner extends StatelessWidget { child: Ink( width: double.infinity, color: backgroundColor, - padding: const EdgeInsetsDirectional.symmetric( - vertical: SMALL_SPACE, - horizontal: MEDIUM_SPACE, - ).add( - EdgeInsetsDirectional.only( - bottom: MediaQuery.viewPaddingOf(context).bottom, - ), - ), + padding: + const EdgeInsetsDirectional.symmetric( + vertical: SMALL_SPACE, + horizontal: MEDIUM_SPACE, + ).add( + EdgeInsetsDirectional.only( + bottom: MediaQuery.viewPaddingOf(context).bottom, + ), + ), child: Row( children: [ const _ProductQuestionIcon(), @@ -246,10 +249,8 @@ class _ProductQuestionBanner extends StatelessWidget { children: [ TextSpan( text: appLocalizations.contribute_to_get_rewards, - style: - theme.primaryTextTheme.bodyMedium!.copyWith( - color: contentColor, - ), + style: theme.primaryTextTheme.bodyMedium! + .copyWith(color: contentColor), ), ], ), @@ -259,7 +260,7 @@ class _ProductQuestionBanner extends StatelessWidget { Icons.arrow_circle_right_outlined, color: contentColor, size: 20.0, - ) + ), ], ), ), @@ -334,8 +335,8 @@ class KeepQuestionWidgetAlive extends InheritedWidget { final bool keepWidgetAlive; static bool shouldKeepAlive(BuildContext context) { - final KeepQuestionWidgetAlive? result = - context.dependOnInheritedWidgetOfExactType(); + final KeepQuestionWidgetAlive? result = context + .dependOnInheritedWidgetOfExactType(); return result?.keepWidgetAlive ?? false; } diff --git a/packages/smooth_app/lib/pages/product/product_type_extensions.dart b/packages/smooth_app/lib/pages/product/product_type_extensions.dart index 2213b86eee..c3f0fbc876 100644 --- a/packages/smooth_app/lib/pages/product/product_type_extensions.dart +++ b/packages/smooth_app/lib/pages/product/product_type_extensions.dart @@ -30,18 +30,18 @@ extension ProductTypeExtension on ProductType { } String getDomain() => switch (this) { - ProductType.food => 'openfoodfacts', - ProductType.beauty => 'openbeautyfacts', - ProductType.petFood => 'openpetfoodfacts', - ProductType.product => 'openproductsfacts', - }; + ProductType.food => 'openfoodfacts', + ProductType.beauty => 'openbeautyfacts', + ProductType.petFood => 'openpetfoodfacts', + ProductType.product => 'openproductsfacts', + }; String getLabel(final AppLocalizations appLocalizations) => switch (this) { - ProductType.food => appLocalizations.product_type_label_food, - ProductType.beauty => appLocalizations.product_type_label_beauty, - ProductType.petFood => appLocalizations.product_type_label_pet_food, - ProductType.product => appLocalizations.product_type_label_product, - }; + ProductType.food => appLocalizations.product_type_label_food, + ProductType.beauty => appLocalizations.product_type_label_beauty, + ProductType.petFood => appLocalizations.product_type_label_pet_food, + ProductType.product => appLocalizations.product_type_label_product, + }; String getRoadToScoreLabel(final AppLocalizations appLocalizations) => switch (this) { @@ -57,19 +57,10 @@ extension ProductTypeExtension on ProductType { String getShareProductLabel( final AppLocalizations appLocalizations, final String url, - ) => - switch (this) { - ProductType.food => appLocalizations.share_product_text( - url, - ), - ProductType.beauty => appLocalizations.share_product_text_beauty( - url, - ), - ProductType.petFood => appLocalizations.share_product_text_pet_food( - url, - ), - ProductType.product => appLocalizations.share_product_text_product( - url, - ), - }; + ) => switch (this) { + ProductType.food => appLocalizations.share_product_text(url), + ProductType.beauty => appLocalizations.share_product_text_beauty(url), + ProductType.petFood => appLocalizations.share_product_text_pet_food(url), + ProductType.product => appLocalizations.share_product_text_product(url), + }; } diff --git a/packages/smooth_app/lib/pages/product/reorderable_knowledge_panel_page.dart b/packages/smooth_app/lib/pages/product/reorderable_knowledge_panel_page.dart index 8324f49078..602875decf 100644 --- a/packages/smooth_app/lib/pages/product/reorderable_knowledge_panel_page.dart +++ b/packages/smooth_app/lib/pages/product/reorderable_knowledge_panel_page.dart @@ -19,8 +19,10 @@ class ReorderableKnowledgePanelPage extends StatefulWidget { if (order.isNotEmpty) { return order; } - return List.from(ReorderableKnowledgePanelPage._initialOrder, - growable: true); + return List.from( + ReorderableKnowledgePanelPage._initialOrder, + growable: true, + ); } // cf. product.knowledgePanels!.panelIdToPanelMap.keys @@ -35,19 +37,19 @@ class ReorderableKnowledgePanelPage extends StatefulWidget { 'serving_size', 'ingredients', 'nova', -// 'environment_card', -// 'health_card', + // 'environment_card', + // 'health_card', 'ingredients_analysis_en:palm-oil-free', 'ingredients_analysis_en:vegan', 'ingredients_analysis_en:vegetarian', -// 'ingredients_analysis', + // 'ingredients_analysis', 'ingredients_analysis_details', 'ecoscore', -// 'packaging_components', -// 'packaging_materials', + // 'packaging_components', + // 'packaging_materials', 'packaging_recycling', 'origins_of_ingredients', -// 'root', + // 'root', ]; @override @@ -112,22 +114,20 @@ class _ReorderableKnowledgePanelPageState } setState(() => _initOrder(context)); }, - ) + ), ], ), body: ReorderableListView( buildDefaultDragHandles: false, children: children, - onReorder: (int oldIndex, int newIndex) => setState( - () { - if (oldIndex < newIndex) { - newIndex -= 1; - } - final String item = _order.removeAt(oldIndex); - _order.insert(newIndex, item); - _setOrder(); - }, - ), + onReorder: (int oldIndex, int newIndex) => setState(() { + if (oldIndex < newIndex) { + newIndex -= 1; + } + final String item = _order.removeAt(oldIndex); + _order.insert(newIndex, item); + _setOrder(); + }), ), ); } diff --git a/packages/smooth_app/lib/pages/product/reordered_knowledge_panel_cards.dart b/packages/smooth_app/lib/pages/product/reordered_knowledge_panel_cards.dart index 58c66e1b3c..576e248bb4 100644 --- a/packages/smooth_app/lib/pages/product/reordered_knowledge_panel_cards.dart +++ b/packages/smooth_app/lib/pages/product/reordered_knowledge_panel_cards.dart @@ -16,7 +16,8 @@ class ReorderedKnowledgePanelCards extends StatelessWidget { final UserPreferences userPreferences = context.watch(); final List order = ReorderableKnowledgePanelPage.getOrderedKnowledgePanels( - userPreferences); + userPreferences, + ); final List children = []; for (final String panelId in order) { children.add( diff --git a/packages/smooth_app/lib/pages/product/simple_input/list/simple_input_list.dart b/packages/smooth_app/lib/pages/product/simple_input/list/simple_input_list.dart index b063a9935a..42a70bd618 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/list/simple_input_list.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/list/simple_input_list.dart @@ -31,40 +31,40 @@ class SimpleInputList extends StatelessWidget { @override Widget build(BuildContext context) { - final List localTerms = - context.watch>>().value; + final List localTerms = context + .watch>>() + .value; if (!helper.reorderable) { return Column( children: [ - SimpleInputListSuggestions( - (String suggestion) { - controller.text = suggestion; - onAddItem.call(); - }, - ), + SimpleInputListSuggestions((String suggestion) { + controller.text = suggestion; + onAddItem.call(); + }), AnimatedList( key: listKey, initialItemCount: localTerms.length, padding: EdgeInsets.zero, - itemBuilder: ( - BuildContext context, - int position, - Animation animation, - ) { - return KeyedSubtree( - key: ValueKey(localTerms[position]), - child: SizeTransition( - sizeFactor: animation, - child: Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: SMALL_SPACE, + itemBuilder: + ( + BuildContext context, + int position, + Animation animation, + ) { + return KeyedSubtree( + key: ValueKey(localTerms[position]), + child: SizeTransition( + sizeFactor: animation, + child: Padding( + padding: const EdgeInsetsDirectional.symmetric( + horizontal: SMALL_SPACE, + ), + child: _getItem(context, localTerms, position), + ), ), - child: _getItem(context, localTerms, position), - ), - ), - ); - }, + ); + }, shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), ), @@ -110,11 +110,7 @@ class SimpleInputList extends StatelessWidget { ); } - Widget _getItem( - BuildContext context, - List localTerms, - int position, - ) { + Widget _getItem(BuildContext context, List localTerms, int position) { final String localTerm = localTerms[position]; return SimpleInputListItem( diff --git a/packages/smooth_app/lib/pages/product/simple_input/list/simple_input_list_item.dart b/packages/smooth_app/lib/pages/product/simple_input/list/simple_input_list_item.dart index 92d40ff43b..e165e0e645 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/list/simple_input_list_item.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/list/simple_input_list_item.dart @@ -49,8 +49,8 @@ class _SimpleInputListItemState extends State { @override Widget build(BuildContext context) { final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); Widget child; if (widget.editable) { @@ -73,23 +73,17 @@ class _SimpleInputListItemState extends State { _SimpleInputListItemAction( tooltip: appLocalizations .edit_product_form_item_save_edit_item_tooltip, - icon: Icon( - Icons.check_circle_rounded, - color: extension.success, - ), + icon: Icon(Icons.check_circle_rounded, color: extension.success), visible: _isEditing, onTap: _saveEdit, ), _SimpleInputListItemAction( tooltip: appLocalizations .edit_product_form_item_cancel_edit_item_tooltip, - icon: Icon( - Icons.cancel, - color: extension.error, - ), + icon: Icon(Icons.cancel, color: extension.error), visible: _isEditing, onTap: _cancelEdit, - ) + ), ], _SimpleInputListItemAction( tooltip: @@ -119,7 +113,8 @@ class _SimpleInputListItemState extends State { return Text( widget.term, style: TextStyle( - fontWeight: widget.isNew ? FontWeight.bold : FontWeight.normal), + fontWeight: widget.isNew ? FontWeight.bold : FontWeight.normal, + ), ); } @@ -210,12 +205,10 @@ class _SimpleInputListItemActionState extends State<_SimpleInputListItemAction> _controller.forward(from: 1.0); } - _opacityAnimation = Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation( - parent: _controller, - curve: Curves.easeInOut, - ), - ); + _opacityAnimation = Tween( + begin: 0.0, + end: 1.0, + ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut)); _sizeAnimation = Tween(begin: 0.0, end: 1.0).animate( CurvedAnimation( diff --git a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/list_suggestions.dart b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/list_suggestions.dart index 5db3858615..081ef63302 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/list_suggestions.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/list_suggestions.dart @@ -9,23 +9,21 @@ import 'package:smooth_app/themes/smooth_theme_colors.dart'; import 'package:smooth_app/themes/theme_provider.dart'; class SimpleInputListSuggestions extends StatelessWidget { - const SimpleInputListSuggestions( - this.onSelected, - ); + const SimpleInputListSuggestions(this.onSelected); final Function(String) onSelected; @override Widget build(BuildContext context) { - final ValueNotifier state = - context.watch>(); + final ValueNotifier state = context + .watch>(); if (state.value is! SimpleInputSuggestionsLoaded) { return EMPTY_WIDGET; } - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return Padding( @@ -38,14 +36,13 @@ class SimpleInputListSuggestions extends StatelessWidget { end: VERY_SMALL_SPACE, ), child: Column( - children: - (state.value as SimpleInputSuggestionsLoaded).suggestions.map( - (String suggestion) { - return _SimpleInputListSuggestionItem(suggestion, () { - onSelected(suggestion); - }); - }, - ).toList(growable: false), + children: (state.value as SimpleInputSuggestionsLoaded).suggestions + .map((String suggestion) { + return _SimpleInputListSuggestionItem(suggestion, () { + onSelected(suggestion); + }); + }) + .toList(growable: false), ), ), ), @@ -54,45 +51,40 @@ class SimpleInputListSuggestions extends StatelessWidget { } class _SimpleInputListSuggestionItem extends StatelessWidget { - const _SimpleInputListSuggestionItem( - this.label, - this.onSelected, - ); + const _SimpleInputListSuggestionItem(this.label, this.onSelected); final String label; final VoidCallback onSelected; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return Row( children: [ ExcludeSemantics( - child: icons.Sparkles( - color: extension.success, - size: 18.0, - ), + child: icons.Sparkles(color: extension.success, size: 18.0), ), const SizedBox(width: SMALL_SPACE), Expanded( child: Text( label, style: TextTheme.of(context).bodyLarge?.copyWith( - color: extension.success, - fontWeight: FontWeight.w500, - ), + color: extension.success, + fontWeight: FontWeight.w500, + ), ), ), Tooltip( - message: AppLocalizations.of(context) - .edit_product_form_item_add_suggestion, + message: AppLocalizations.of( + context, + ).edit_product_form_item_add_suggestion, child: IconButton( onPressed: onSelected, icon: const icons.Add(size: 20.0), ), - ) + ), ], ); } diff --git a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestion_item_button.dart b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestion_item_button.dart index b2601441c6..b3ed191323 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestion_item_button.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestion_item_button.dart @@ -31,12 +31,13 @@ class _RobotoffSuggestionListItemButtonState @override void initState() { super.initState(); - _controller = AnimationController( - duration: SmoothAnimationsDuration.short, - vsync: this, - ) - ..addListener(() => setState(() {})) - ..value = widget.visible ? 1.0 : 0.0; + _controller = + AnimationController( + duration: SmoothAnimationsDuration.short, + vsync: this, + ) + ..addListener(() => setState(() {})) + ..value = widget.visible ? 1.0 : 0.0; _animation = Tween(begin: 0.0, end: 1.0).animate(_controller); } @@ -70,10 +71,7 @@ class _RobotoffSuggestionListItemButtonState onTap: widget.onTap, child: Opacity( opacity: _animation.value, - child: Padding( - padding: widget.padding, - child: widget.icon, - ), + child: Padding(padding: widget.padding, child: widget.icon), ), ), ), diff --git a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestion_item_picture.dart b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestion_item_picture.dart index eb62edcc45..fb5c6f1000 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestion_item_picture.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestion_item_picture.dart @@ -7,9 +7,7 @@ import 'package:smooth_app/l10n/app_localizations.dart'; import 'package:smooth_app/resources/app_icons.dart' as icons; class RobotoffSuggestionListItemPicture extends StatelessWidget { - const RobotoffSuggestionListItemPicture({ - required this.onTap, - }); + const RobotoffSuggestionListItemPicture({required this.onTap}); final Function(String heroTag) onTap; @@ -56,10 +54,7 @@ class RobotoffSuggestionListItemPicture extends StatelessWidget { vertical: MEDIUM_SPACE, ), child: const ExcludeSemantics( - child: icons.Expand( - color: Colors.white, - size: 14.0, - ), + child: icons.Expand(color: Colors.white, size: 14.0), ), ), ), diff --git a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestions_item.dart b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestions_item.dart index fba492bc74..5e79584966 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestions_item.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestions_item.dart @@ -18,9 +18,7 @@ import 'package:smooth_app/themes/smooth_theme_colors.dart'; import 'package:smooth_app/themes/theme_provider.dart'; class RobotoffSuggestionListItem extends StatefulWidget { - const RobotoffSuggestionListItem({ - required this.onChanged, - }); + const RobotoffSuggestionListItem({required this.onChanged}); final Function(bool? value) onChanged; @@ -38,38 +36,30 @@ class _RobotoffSuggestionListItemState extends State void initState() { super.initState(); - _imageController = AnimationController( - duration: SmoothAnimationsDuration.short, - vsync: this, - ) - ..addListener(() => setState(() {})) - // Image is disabled by default - ..value = 1.0; + _imageController = + AnimationController( + duration: SmoothAnimationsDuration.short, + vsync: this, + ) + ..addListener(() => setState(() {})) + // Image is disabled by default + ..value = 1.0; _pictureAnimation = Tween(begin: 1.0, end: 0.0).animate( - CurvedAnimation( - parent: _imageController, - curve: Curves.easeInOut, - ), + CurvedAnimation(parent: _imageController, curve: Curves.easeInOut), ); } @override Widget build(BuildContext context) { return IconTheme( - data: const IconThemeData( - color: Colors.black, - ), + data: const IconThemeData(color: Colors.black), child: SizedBox( height: 50.0 + (130.0 * _pictureAnimation.value), child: Stack( children: [ Positioned.fill( child: Consumer( - builder: ( - BuildContext context, - RobotoffQuestion question, - _, - ) { + builder: (BuildContext context, RobotoffQuestion question, _) { if (question.imageUrl?.isEmpty == true) { return EMPTY_WIDGET; } @@ -85,9 +75,9 @@ class _RobotoffSuggestionListItemState extends State MaterialPageRoute( builder: (BuildContext context) => QuestionImageFullPage( - question: question, - heroTag: heroTag, - ), + question: question, + heroTag: heroTag, + ), ), ); }, @@ -170,18 +160,16 @@ class _SimpleInputListRobotoffSuggestionHeaderState void initState() { super.initState(); - _valueController = AnimationController( - duration: SmoothAnimationsDuration.short, - vsync: this, - ) - ..addListener(() => setState(() {})) - ..value = 0.0; + _valueController = + AnimationController( + duration: SmoothAnimationsDuration.short, + vsync: this, + ) + ..addListener(() => setState(() {})) + ..value = 0.0; _valueAnimation = Tween(begin: 0.0, end: 1.0).animate( - CurvedAnimation( - parent: _valueController, - curve: Curves.easeInOut, - ), + CurvedAnimation(parent: _valueController, curve: Curves.easeInOut), ); _colorAnimation = ColorTween( begin: null, @@ -191,20 +179,25 @@ class _SimpleInputListRobotoffSuggestionHeaderState @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); final AppLocalizations appLocalizations = AppLocalizations.of(context); final InsightAnnotation? annotation = context.watch(); return Listener( - listener: ( - BuildContext context, - InsightAnnotation? previousValue, - InsightAnnotation? currentValue, - ) => - _updateAnimations(context, previousValue, currentValue, lightTheme), + listener: + ( + BuildContext context, + InsightAnnotation? previousValue, + InsightAnnotation? currentValue, + ) => _updateAnimations( + context, + previousValue, + currentValue, + lightTheme, + ), child: Material( color: Color.lerp( (lightTheme ? extension.primaryMedium : extension.primarySemiDark) @@ -219,9 +212,7 @@ class _SimpleInputListRobotoffSuggestionHeaderState color: context.lightTheme() ? Colors.black : Colors.white, ), child: Padding( - padding: const EdgeInsetsDirectional.symmetric( - horizontal: 10.0, - ), + padding: const EdgeInsetsDirectional.symmetric(horizontal: 10.0), child: IntrinsicHeight( child: Row( children: [ @@ -247,8 +238,7 @@ class _SimpleInputListRobotoffSuggestionHeaderState builder: (_, RobotoffQuestion question, __) { return AutoSizeText( question.value!, - style: TextTheme.of(context) - .bodyLarge + style: TextTheme.of(context).bodyLarge ?.copyWith( color: _colorAnimation.value, fontWeight: FontWeight.w600, @@ -276,15 +266,13 @@ class _SimpleInputListRobotoffSuggestionHeaderState ), ), RobotoffSuggestionListItemButton( - icon: const Icon( - Icons.delete, - size: 25.0, - ), + icon: const Icon(Icons.delete, size: 25.0), padding: const EdgeInsetsDirectional.all(7.5), tooltip: appLocalizations.edit_product_form_item_deny_suggestion, onTap: () => widget.onValueChanged(false), - visible: annotation == null || + visible: + annotation == null || annotation == InsightAnnotation.YES, ), RobotoffSuggestionListItemButton( @@ -293,7 +281,8 @@ class _SimpleInputListRobotoffSuggestionHeaderState tooltip: appLocalizations.edit_product_form_item_add_suggestion, onTap: () => widget.onValueChanged(true), - visible: annotation == null || + visible: + annotation == null || annotation == InsightAnnotation.NO, ), ], @@ -326,8 +315,8 @@ class _SimpleInputListRobotoffSuggestionHeaderState } Color _getTextColor(InsightAnnotation? value, bool lightTheme) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return switch (value) { InsightAnnotation.YES => @@ -346,9 +335,7 @@ class _SimpleInputListRobotoffSuggestionHeaderState } class _RobotoffSuggestionSparkles extends StatefulWidget { - const _RobotoffSuggestionSparkles({ - required this.status, - }); + const _RobotoffSuggestionSparkles({required this.status}); final _RobotoffSuggestionStatus status; @@ -383,8 +370,8 @@ class _RobotoffSuggestionSparklesState } _isInitialized = true; - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); _circleColorAnimation = ColorTween( @@ -400,8 +387,8 @@ class _RobotoffSuggestionSparklesState super.didUpdateWidget(oldWidget); if (oldWidget.status != widget.status) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); _circleColorAnimation = ColorTween( @@ -446,8 +433,11 @@ class _RobotoffSuggestionSparklesState ); } - Color _backgroundColor(_RobotoffSuggestionStatus status, - SmoothColorsThemeExtension ext, bool lightTheme) { + Color _backgroundColor( + _RobotoffSuggestionStatus status, + SmoothColorsThemeExtension ext, + bool lightTheme, + ) { return switch (status) { _RobotoffSuggestionStatus.positive => ext.successBackground, _RobotoffSuggestionStatus.negative => ext.errorBackground, @@ -455,8 +445,11 @@ class _RobotoffSuggestionSparklesState }; } - Color _iconColor(_RobotoffSuggestionStatus status, - SmoothColorsThemeExtension ext, bool lightTheme) { + Color _iconColor( + _RobotoffSuggestionStatus status, + SmoothColorsThemeExtension ext, + bool lightTheme, + ) { return switch (status) { _RobotoffSuggestionStatus.positive => ext.success, _RobotoffSuggestionStatus.negative => ext.error, diff --git a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestions_list.dart b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestions_list.dart index c345a7934f..9020c15a5b 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestions_list.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/list/suggestions/robotoff/robotoff_suggestions_list.dart @@ -12,10 +12,7 @@ import 'package:smooth_app/themes/theme_provider.dart'; import 'package:smooth_app/widgets/auto_scale_widget.dart'; class RobotoffSuggestionList extends StatefulWidget { - const RobotoffSuggestionList({ - required this.helper, - super.key, - }); + const RobotoffSuggestionList({required this.helper, super.key}); final AbstractSimpleInputPageHelper helper; @@ -29,8 +26,8 @@ class _RobotoffSuggestionListState extends State Widget build(BuildContext context) { super.build(context); final ValueNotifier> - questionsNotifier = context - .watch>>(); + questionsNotifier = context + .watch>>(); final Map questions = questionsNotifier.value; @@ -45,17 +42,14 @@ class _RobotoffSuggestionListState extends State ), itemCount: questions.entries.length, itemBuilder: (BuildContext context, int position) { - final MapEntry entry = - questions.entries.elementAt(position); + final MapEntry entry = questions + .entries + .elementAt(position); return MultiProvider( providers: [ - Provider.value( - value: entry.value, - ), - Provider.value( - value: entry.key, - ), + Provider.value(value: entry.value), + Provider.value(value: entry.key), ], child: AutoScaleWidget( vsync: this, @@ -67,8 +61,8 @@ class _RobotoffSuggestionListState extends State value == true ? InsightAnnotation.YES : value == false - ? InsightAnnotation.NO - : null, + ? InsightAnnotation.NO + : null, ); }, ), @@ -80,8 +74,8 @@ class _RobotoffSuggestionListState extends State return EMPTY_WIDGET; } - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return Divider( diff --git a/packages/smooth_app/lib/pages/product/simple_input/simple_input_page.dart b/packages/smooth_app/lib/pages/product/simple_input/simple_input_page.dart index dcd78aec3e..9b480f13de 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/simple_input_page.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/simple_input_page.dart @@ -25,14 +25,12 @@ class SimpleInputPage extends StatefulWidget { required final AbstractSimpleInputPageHelper helper, required final Product product, }) : this.multiple( - helpers: [helper], - product: product, - ); + helpers: [helper], + product: product, + ); - SimpleInputPage.multiple({ - required this.helpers, - required this.product, - }) : assert(helpers.isNotEmpty); + SimpleInputPage.multiple({required this.helpers, required this.product}) + : assert(helpers.isNotEmpty); final List helpers; final Product product; @@ -50,9 +48,7 @@ class _SimpleInputPageState extends State { super.initState(); for (int i = 0; i < widget.helpers.length; i++) { - _controllers.add( - TextEditingController()..addListener(_onChanged), - ); + _controllers.add(TextEditingController()..addListener(_onChanged)); widget.helpers[i].addListener(_onChanged); } @@ -110,9 +106,9 @@ class _SimpleInputPageState extends State { product: widget.product, ), backgroundColor: context.lightTheme() - ? Theme.of(context) - .extension()! - .primaryLight + ? Theme.of( + context, + ).extension()!.primaryLight : null, body: Scrollbar( child: ListView( @@ -121,12 +117,8 @@ class _SimpleInputPageState extends State { ), ), bottomNavigationBar: ProductBottomButtonsBar( - onSave: () async => _exitPage( - await _mayExitPage(saving: true), - ), - onCancel: () async => _exitPage( - await _mayExitPage(saving: false), - ), + onSave: () async => _exitPage(await _mayExitPage(saving: true)), + onCancel: () async => _exitPage(await _mayExitPage(saving: false)), ), ), ), @@ -192,8 +184,8 @@ class _SimpleInputPageState extends State { } if (!saving) { - final bool? pleaseSave = - await MayExitPageHelper().openSaveBeforeLeavingDialog(context); + final bool? pleaseSave = await MayExitPageHelper() + .openSaveBeforeLeavingDialog(context); if (pleaseSave == null) { for (int i = 0; i < widget.helpers.length; i++) { widget.helpers[i].restoreItemsBeforeLastAddition(); @@ -208,9 +200,9 @@ class _SimpleInputPageState extends State { } } -// If there is more than one helper, we are in the power edit mode. -// else we take the only helper ie 0th element of the [helpers] list -// and get the analytics event from it. + // If there is more than one helper, we are in the power edit mode. + // else we take the only helper ie 0th element of the [helpers] list + // and get the analytics event from it. if (widget.helpers.length > 1) { AnalyticsHelper.trackProductEdit( diff --git a/packages/smooth_app/lib/pages/product/simple_input/simple_input_page_helpers.dart b/packages/smooth_app/lib/pages/product/simple_input/simple_input_page_helpers.dart index edddb1fbc0..de6469da6a 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/simple_input_page_helpers.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/simple_input_page_helpers.dart @@ -180,10 +180,7 @@ abstract class AbstractSimpleInputPageHelper extends ChangeNotifier { Widget getIcon(); /// Extra widget to be displayed after the list. - Widget? getExtraWidget( - final BuildContext context, - final Product product, - ) => + Widget? getExtraWidget(final BuildContext context, final Product product) => null; /// Text capitalization for the text field. @@ -198,34 +195,33 @@ abstract class AbstractSimpleInputPageHelper extends ChangeNotifier { final BuildContext context, final Product product, final String title, - ) => - Padding( - padding: const EdgeInsetsDirectional.only( - top: 0, - start: SMALL_SPACE, - end: SMALL_SPACE, - bottom: SMALL_SPACE, - ), - child: addPanelButton( - title, - onPressed: () async => confirmAndUploadNewPicture( - context, - imageField: ImageField.OTHER, - barcode: product.barcode!, - productType: product.productType, - language: ProductQuery.getLanguage(), - // we're already logged in if needed - isLoggedInMandatory: false, - ), - leadingIcon: const Icon(Icons.add_a_photo), - elevation: const WidgetStatePropertyAll(0.0), - padding: const EdgeInsetsDirectional.only( - top: SMALL_SPACE, - bottom: SMALL_SPACE, - start: VERY_SMALL_SPACE, - ), - ), - ); + ) => Padding( + padding: const EdgeInsetsDirectional.only( + top: 0, + start: SMALL_SPACE, + end: SMALL_SPACE, + bottom: SMALL_SPACE, + ), + child: addPanelButton( + title, + onPressed: () async => confirmAndUploadNewPicture( + context, + imageField: ImageField.OTHER, + barcode: product.barcode!, + productType: product.productType, + language: ProductQuery.getLanguage(), + // we're already logged in if needed + isLoggedInMandatory: false, + ), + leadingIcon: const Icon(Icons.add_a_photo), + elevation: const WidgetStatePropertyAll(0.0), + padding: const EdgeInsetsDirectional.only( + top: SMALL_SPACE, + bottom: SMALL_SPACE, + start: VERY_SMALL_SPACE, + ), + ), + ); /// Returns true if changes were made. bool getChangedProduct(final Product product) { @@ -247,9 +243,10 @@ abstract class AbstractSimpleInputPageHelper extends ChangeNotifier { if (input.isEmpty) { return []; } - return input.split(separator.trim()).map((String e) => e.trim()).toList( - growable: false, - ); + return input + .split(separator.trim()) + .map((String e) => e.trim()) + .toList(growable: false); } /// Returns the current language. @@ -321,9 +318,10 @@ abstract class AbstractSimpleInputPageHelper extends ChangeNotifier { bool isOwnerField(final Product product) => false; final ValueNotifier> - robotoffQuestionsNotifier = + robotoffQuestionsNotifier = ValueNotifier>( - {}); + {}, + ); InsightType? get _robotoffInsightType; @@ -337,12 +335,11 @@ abstract class AbstractSimpleInputPageHelper extends ChangeNotifier { try { final List questions = (await RobotoffAPIClient.getProductQuestions( - product.barcode!, - getLanguage(), - insightTypes: [type], - )) - .questions ?? - []; + product.barcode!, + getLanguage(), + insightTypes: [type], + )).questions ?? + []; robotoffQuestionsNotifier.value = { for (final RobotoffQuestion question in questions) question: null, @@ -359,17 +356,18 @@ abstract class AbstractSimpleInputPageHelper extends ChangeNotifier { final InsightAnnotation? annotation, ) { robotoffQuestionsNotifier.value = robotoffQuestionsNotifier.value - .map( - (final RobotoffQuestion key, final InsightAnnotation? value) { - if (key == question) { - return MapEntry( - key, - annotation, - ); - } - return MapEntry(key, value); - }, - ); + .map(( + final RobotoffQuestion key, + final InsightAnnotation? value, + ) { + if (key == question) { + return MapEntry( + key, + annotation, + ); + } + return MapEntry(key, value); + }); _changed = _computeHasChanged(); notifyListeners(); @@ -400,9 +398,7 @@ class SimpleInputSuggestionsNoSuggestion extends SimpleInputSuggestionsState { } class SimpleInputSuggestionsLoaded extends SimpleInputSuggestionsState { - const SimpleInputSuggestionsLoaded({ - required this.suggestions, - }); + const SimpleInputSuggestionsLoaded({required this.suggestions}); final List suggestions; } @@ -449,53 +445,53 @@ class SimpleInputPageBrandsHelper extends AbstractSimpleInputPageHelper { @override WidgetBuilder? getAddExplanationsContent() => (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); - return Column( - children: [ - ExplanationBodyInfo( - text: appLocalizations.add_basic_details_product_brand_help_info1, - icon: false, - ), - ExplanationTextContainer( - title: appLocalizations - .add_basic_details_product_brand_help_info2_title, - items: [ - ExplanationTextContainerContentText( - text: appLocalizations - .add_basic_details_product_brand_help_info2_content, - ), - ], - ), - ExplanationTextContainer( - title: appLocalizations - .add_basic_details_product_brand_help_info3_title, - items: [ - ExplanationTextContainerContentItem( - text: appLocalizations - .add_basic_details_product_brand_help_info3_item1_text, - example: appLocalizations - .add_basic_details_product_brand_help_info3_item1_explanation, - ), - ExplanationTextContainerContentItem( - text: appLocalizations - .add_basic_details_product_brand_help_info3_item2_text, - example: appLocalizations - .add_basic_details_product_brand_help_info3_item2_explanation, - ), - ], - ), - const SizedBox(height: MEDIUM_SPACE), - ExplanationGoodExamplesContainer( - items: [ - appLocalizations - .add_basic_details_product_brand_help_good_examples_1, - appLocalizations - .add_basic_details_product_brand_help_good_examples_2, - ], + final AppLocalizations appLocalizations = AppLocalizations.of(context); + return Column( + children: [ + ExplanationBodyInfo( + text: appLocalizations.add_basic_details_product_brand_help_info1, + icon: false, + ), + ExplanationTextContainer( + title: + appLocalizations.add_basic_details_product_brand_help_info2_title, + items: [ + ExplanationTextContainerContentText( + text: appLocalizations + .add_basic_details_product_brand_help_info2_content, ), ], - ); - }; + ), + ExplanationTextContainer( + title: + appLocalizations.add_basic_details_product_brand_help_info3_title, + items: [ + ExplanationTextContainerContentItem( + text: appLocalizations + .add_basic_details_product_brand_help_info3_item1_text, + example: appLocalizations + .add_basic_details_product_brand_help_info3_item1_explanation, + ), + ExplanationTextContainerContentItem( + text: appLocalizations + .add_basic_details_product_brand_help_info3_item2_text, + example: appLocalizations + .add_basic_details_product_brand_help_info3_item2_explanation, + ), + ], + ), + const SizedBox(height: MEDIUM_SPACE), + ExplanationGoodExamplesContainer( + items: [ + appLocalizations + .add_basic_details_product_brand_help_good_examples_1, + appLocalizations + .add_basic_details_product_brand_help_good_examples_2, + ], + ), + ], + ); + }; @override TextCapitalization? getTextCapitalization() => TextCapitalization.sentences; @@ -509,18 +505,18 @@ class SimpleInputPageBrandsHelper extends AbstractSimpleInputPageHelper { @override AutocompleteManager? getAutocompleteManager() => AutocompleteManager( - TaxonomyNameAutocompleter( - taxonomyNames: [TaxonomyName.brand], - // for brands, language must be English - language: OpenFoodFactsLanguage.ENGLISH, - user: ProductQuery.getReadUser(), - limit: 25, - fuzziness: Fuzziness.none, - uriHelper: ProductQuery.getUriProductHelper( - productType: product.productType, - ), - ), - ); + TaxonomyNameAutocompleter( + taxonomyNames: [TaxonomyName.brand], + // for brands, language must be English + language: OpenFoodFactsLanguage.ENGLISH, + user: ProductQuery.getReadUser(), + limit: 25, + fuzziness: Fuzziness.none, + uriHelper: ProductQuery.getUriProductHelper( + productType: product.productType, + ), + ), + ); @override Widget getIcon() => const icons.Fruit(); @@ -586,27 +582,27 @@ class SimpleInputPageStoreHelper extends AbstractSimpleInputPageHelper { @override @override WidgetBuilder? getAddExplanationsContent() => (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); + final AppLocalizations appLocalizations = AppLocalizations.of(context); - return Column( - children: [ - ExplanationBodyInfo( - text: appLocalizations - .edit_product_form_item_stores_explanation_info1, - ), - ExplanationGoodExamplesContainer( - items: [ - appLocalizations - .edit_product_form_item_stores_explanation_good_examples_1, - appLocalizations - .edit_product_form_item_stores_explanation_good_examples_2, - appLocalizations - .edit_product_form_item_stores_explanation_good_examples_3, - ], - ), + return Column( + children: [ + ExplanationBodyInfo( + text: + appLocalizations.edit_product_form_item_stores_explanation_info1, + ), + ExplanationGoodExamplesContainer( + items: [ + appLocalizations + .edit_product_form_item_stores_explanation_good_examples_1, + appLocalizations + .edit_product_form_item_stores_explanation_good_examples_2, + appLocalizations + .edit_product_form_item_stores_explanation_good_examples_3, ], - ); - }; + ), + ], + ); + }; @override TagType? getTagType() => null; @@ -662,26 +658,26 @@ class SimpleInputPageOriginHelper extends AbstractSimpleInputPageHelper { @override WidgetBuilder? getAddExplanationsContent() => (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); + final AppLocalizations appLocalizations = AppLocalizations.of(context); - return Column( - children: [ - ExplanationBodyInfo( - text: appLocalizations - .edit_product_form_item_origins_explanation_info1, - icon: false, - ), - ExplanationGoodExamplesContainer( - items: [ - appLocalizations - .edit_product_form_item_origins_explanation_good_examples_1, - appLocalizations - .edit_product_form_item_origins_explanation_good_examples_2, - ], - ), + return Column( + children: [ + ExplanationBodyInfo( + text: + appLocalizations.edit_product_form_item_origins_explanation_info1, + icon: false, + ), + ExplanationGoodExamplesContainer( + items: [ + appLocalizations + .edit_product_form_item_origins_explanation_good_examples_1, + appLocalizations + .edit_product_form_item_origins_explanation_good_examples_2, ], - ); - }; + ), + ], + ); + }; @override TagType? getTagType() => TagType.ORIGINS; @@ -696,10 +692,7 @@ class SimpleInputPageOriginHelper extends AbstractSimpleInputPageHelper { AnalyticsEditEvents getAnalyticsEditEvent() => AnalyticsEditEvents.origins; @override - Widget? getExtraWidget( - final BuildContext context, - final Product product, - ) => + Widget? getExtraWidget(final BuildContext context, final Product product) => getExtraPhotoWidget( context, product, @@ -746,63 +739,58 @@ class SimpleInputPageEmbCodeHelper extends AbstractSimpleInputPageHelper { @override WidgetBuilder? getAddExplanationsContent() => (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); + final AppLocalizations appLocalizations = AppLocalizations.of(context); - return Column( - children: [ - ExplanationBodyInfo( - text: appLocalizations.edit_product_form_item_emb_help_info1, - icon: false, - ), - ExplanationTextContainer( - title: - appLocalizations.edit_product_form_item_emb_help_info2_title, - items: [ - ExplanationTextContainerContentItem( - text: appLocalizations - .edit_product_form_item_emb_help_info2_item1_text, - example: appLocalizations - .edit_product_form_item_emb_help_info2_item1_explanation, - visualExamplePosition: - ExplanationVisualExamplePosition.afterTitle, - visualExample: Container( - width: 104.0, - decoration: BoxDecoration( - border: Border.all( - color: - context.lightTheme() ? Colors.black : Colors.white, - width: 1.0, - ), - borderRadius: const BorderRadius.all( - Radius.elliptical(100, 50), - ), - ), - padding: const EdgeInsetsDirectional.symmetric( - vertical: VERY_SMALL_SPACE, - ), - child: Text( - appLocalizations - .edit_product_form_item_emb_help_info2_item1_example, - textAlign: TextAlign.center, - textScaler: TextScaler.noScaling, - style: const TextStyle( - fontSize: 12.0, - height: 1.2, - ), - ), + return Column( + children: [ + ExplanationBodyInfo( + text: appLocalizations.edit_product_form_item_emb_help_info1, + icon: false, + ), + ExplanationTextContainer( + title: appLocalizations.edit_product_form_item_emb_help_info2_title, + items: [ + ExplanationTextContainerContentItem( + text: appLocalizations + .edit_product_form_item_emb_help_info2_item1_text, + example: appLocalizations + .edit_product_form_item_emb_help_info2_item1_explanation, + visualExamplePosition: + ExplanationVisualExamplePosition.afterTitle, + visualExample: Container( + width: 104.0, + decoration: BoxDecoration( + border: Border.all( + color: context.lightTheme() ? Colors.black : Colors.white, + width: 1.0, + ), + borderRadius: const BorderRadius.all( + Radius.elliptical(100, 50), ), ), - ExplanationTextContainerContentItem( - text: appLocalizations - .edit_product_form_item_emb_help_info2_item2_text, - example: appLocalizations - .edit_product_form_item_emb_help_info2_item2_explanation, + padding: const EdgeInsetsDirectional.symmetric( + vertical: VERY_SMALL_SPACE, ), - ], + child: Text( + appLocalizations + .edit_product_form_item_emb_help_info2_item1_example, + textAlign: TextAlign.center, + textScaler: TextScaler.noScaling, + style: const TextStyle(fontSize: 12.0, height: 1.2), + ), + ), + ), + ExplanationTextContainerContentItem( + text: appLocalizations + .edit_product_form_item_emb_help_info2_item2_text, + example: appLocalizations + .edit_product_form_item_emb_help_info2_item2_explanation, ), ], - ); - }; + ), + ], + ); + }; @override TagType? getTagType() => TagType.EMB_CODES; @@ -818,10 +806,7 @@ class SimpleInputPageEmbCodeHelper extends AbstractSimpleInputPageHelper { AnalyticsEditEvents.traceabilityCodes; @override - Widget? getExtraWidget( - final BuildContext context, - final Product product, - ) => + Widget? getExtraWidget(final BuildContext context, final Product product) => getExtraPhotoWidget( context, product, @@ -884,32 +869,32 @@ class SimpleInputPageLabelHelper extends AbstractSimpleInputPageHelper { @override @override WidgetBuilder? getAddExplanationsContent() => (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); + final AppLocalizations appLocalizations = AppLocalizations.of(context); - return Column( - children: [ - ExplanationBodyInfo( - text: appLocalizations - .edit_product_form_item_labels_explanation_info1, - icon: false, - ), - ExplanationGoodExamplesContainer( - items: [ - appLocalizations - .edit_product_form_item_labels_explanation_good_examples_1, - appLocalizations - .edit_product_form_item_labels_explanation_good_examples_2, - appLocalizations - .edit_product_form_item_labels_explanation_good_examples_3, - appLocalizations - .edit_product_form_item_labels_explanation_good_examples_4, - appLocalizations - .edit_product_form_item_labels_explanation_good_examples_5, - ], - ), + return Column( + children: [ + ExplanationBodyInfo( + text: + appLocalizations.edit_product_form_item_labels_explanation_info1, + icon: false, + ), + ExplanationGoodExamplesContainer( + items: [ + appLocalizations + .edit_product_form_item_labels_explanation_good_examples_1, + appLocalizations + .edit_product_form_item_labels_explanation_good_examples_2, + appLocalizations + .edit_product_form_item_labels_explanation_good_examples_3, + appLocalizations + .edit_product_form_item_labels_explanation_good_examples_4, + appLocalizations + .edit_product_form_item_labels_explanation_good_examples_5, ], - ); - }; + ), + ], + ); + }; @override TagType? getTagType() => TagType.LABELS; @@ -925,10 +910,7 @@ class SimpleInputPageLabelHelper extends AbstractSimpleInputPageHelper { AnalyticsEditEvents.labelsAndCertifications; @override - Widget? getExtraWidget( - final BuildContext context, - final Product product, - ) => + Widget? getExtraWidget(final BuildContext context, final Product product) => getExtraPhotoWidget( context, product, @@ -978,36 +960,36 @@ class SimpleInputPageCategoryHelper extends AbstractSimpleInputPageHelper { @override WidgetBuilder? getAddExplanationsContent() => (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); + final AppLocalizations appLocalizations = AppLocalizations.of(context); - return Column( - children: [ - ExplanationBodyInfo( + return Column( + children: [ + ExplanationBodyInfo( + text: appLocalizations + .edit_product_form_item_categories_explanation_info1, + icon: false, + ), + ExplanationTextContainer( + title: appLocalizations + .edit_product_form_item_categories_explanation_info2_title, + items: [ + ExplanationTextContainerContentText( text: appLocalizations - .edit_product_form_item_categories_explanation_info1, - icon: false, - ), - ExplanationTextContainer( - title: appLocalizations - .edit_product_form_item_categories_explanation_info2_title, - items: [ - ExplanationTextContainerContentText( - text: appLocalizations - .edit_product_form_item_categories_explanation_info2_content, - ), - ], - ), - ExplanationGoodExamplesContainer( - items: [ - appLocalizations - .edit_product_form_item_categories_explanation_good_examples_1, - appLocalizations - .edit_product_form_item_categories_explanation_good_examples_2, - ], + .edit_product_form_item_categories_explanation_info2_content, ), ], - ); - }; + ), + ExplanationGoodExamplesContainer( + items: [ + appLocalizations + .edit_product_form_item_categories_explanation_good_examples_1, + appLocalizations + .edit_product_form_item_categories_explanation_good_examples_2, + ], + ), + ], + ); + }; @override String getAddHint(final AppLocalizations appLocalizations) => @@ -1050,14 +1032,14 @@ class SimpleInputPageCategoryNotFoodHelper /// Implementation for "Countries" of an [AbstractSimpleInputPageHelper]. class SimpleInputPageCountryHelper extends AbstractSimpleInputPageHelper { SimpleInputPageCountryHelper(UserPreferences userPreferences) - : _userCountryCode = userPreferences.userCountryCode ?? 'fr'; + : _userCountryCode = userPreferences.userCountryCode ?? 'fr'; final String _userCountryCode; ValueNotifier _suggestionsNotifier = ValueNotifier( - const SimpleInputSuggestionsLoading(), - ); + const SimpleInputSuggestionsLoading(), + ); final List _countries = OpenFoodFactsCountry.values; @override @@ -1151,13 +1133,13 @@ class SimpleInputPageCountryHelper extends AbstractSimpleInputPageHelper { @override @override WidgetBuilder? getAddExplanationsContent() => (BuildContext context) { - final AppLocalizations appLocalizations = AppLocalizations.of(context); - return ExplanationBodyInfo( - text: appLocalizations - .edit_product_form_item_countries_explanations_info1, - safeArea: true, - ); - }; + final AppLocalizations appLocalizations = AppLocalizations.of(context); + return ExplanationBodyInfo( + text: + appLocalizations.edit_product_form_item_countries_explanations_info1, + safeArea: true, + ); + }; @override TagType? getTagType() => TagType.COUNTRIES; diff --git a/packages/smooth_app/lib/pages/product/simple_input/simple_input_text_field.dart b/packages/smooth_app/lib/pages/product/simple_input/simple_input_text_field.dart index 0044aeadd9..1fae49e527 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/simple_input_text_field.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/simple_input_text_field.dart @@ -56,7 +56,8 @@ class _SimpleInputTextFieldState extends State { @override void initState() { super.initState(); - _manager = widget.autocompleteManager ?? + _manager = + widget.autocompleteManager ?? (widget.tagType == null ? null : AutocompleteManager( diff --git a/packages/smooth_app/lib/pages/product/simple_input/simple_input_widget.dart b/packages/smooth_app/lib/pages/product/simple_input/simple_input_widget.dart index 39a97370f8..43cefdd485 100644 --- a/packages/smooth_app/lib/pages/product/simple_input/simple_input_widget.dart +++ b/packages/smooth_app/lib/pages/product/simple_input/simple_input_widget.dart @@ -74,9 +74,8 @@ class _SimpleInputWidgetState extends State create: (_) => ValueNotifier>(_localTerms), ), ChangeNotifierProvider< - ValueNotifier>>.value( - value: widget.helper.robotoffQuestionsNotifier, - ), + ValueNotifier> + >.value(value: widget.helper.robotoffQuestionsNotifier), ], builder: (BuildContext context, Widget? child) => Column( mainAxisSize: MainAxisSize.min, @@ -99,10 +98,10 @@ class _SimpleInputWidgetState extends State focusNode: _focusNode, constraints: constraints, tagType: widget.helper.getTagType(), - autocompleteManager: - widget.helper.getAutocompleteManager(), - textCapitalization: - widget.helper.getTextCapitalization(), + autocompleteManager: widget.helper + .getAutocompleteManager(), + textCapitalization: widget.helper + .getTextCapitalization(), allowEmojis: widget.helper.getAllowEmojis(), hintText: widget.helper.getAddHint(appLocalizations), controller: widget.controller, @@ -110,9 +109,7 @@ class _SimpleInputWidgetState extends State horizontal: LARGE_SPACE, vertical: MEDIUM_SPACE, ), - margin: const EdgeInsetsDirectional.only( - start: 3.0, - ), + margin: const EdgeInsetsDirectional.only(start: 3.0), productType: widget.product.productType, borderRadius: CIRCULAR_BORDER_RADIUS, ), @@ -124,29 +121,21 @@ class _SimpleInputWidgetState extends State splashRadius: 20.0, icon: ListenableBuilder( listenable: widget.controller, - builder: ( - BuildContext context, - _, - ) => - icons.Add( + builder: (BuildContext context, _) => icons.Add( size: 20.0, color: IconTheme.of(context).color?.withValues( - alpha: widget.controller.text.isEmpty - ? 0.7 - : 1.0, - ), + alpha: widget.controller.text.isEmpty ? 0.7 : 1.0, + ), ), ), ), - ) + ), ], ), ); }, ), - RobotoffSuggestionList( - helper: widget.helper, - ), + RobotoffSuggestionList(helper: widget.helper), SimpleInputList( listKey: _listKey, helper: widget.helper, @@ -164,16 +153,19 @@ class _SimpleInputWidgetState extends State ) else if (_localTerms.isEmpty) Consumer>>( - builder: (BuildContext context, - ValueNotifier> - notif, - _) { - if (notif.value.isEmpty) { - return const SizedBox(height: VERY_SMALL_SPACE); - } else { - return EMPTY_WIDGET; - } - }, + builder: + ( + BuildContext context, + ValueNotifier> + notif, + _, + ) { + if (notif.value.isEmpty) { + return const SizedBox(height: VERY_SMALL_SPACE); + } else { + return EMPTY_WIDGET; + } + }, ) else const SizedBox(height: VERY_SMALL_SPACE), @@ -193,9 +185,7 @@ class _SimpleInputWidgetState extends State leading: widget.helper.getIcon(), title: widget.helper.getTitle(appLocalizations), trailing: trailingHeader, - contentPadding: const EdgeInsetsDirectional.only( - top: BALANCED_SPACE, - ), + contentPadding: const EdgeInsetsDirectional.only(top: BALANCED_SPACE), child: child, ), const SizedBox(height: MEDIUM_SPACE), @@ -230,10 +220,7 @@ class _SimpleInputWidgetState extends State } else if (children.length == 1) { return children.first; } else { - return Row( - mainAxisSize: MainAxisSize.min, - children: children, - ); + return Row(mainAxisSize: MainAxisSize.min, children: children); } } @@ -269,8 +256,9 @@ class _SimpleInputWidgetState extends State ScaffoldMessenger.of(context).showSnackBar( SmoothFloatingSnackbar.error( context: context, - text: AppLocalizations.of(context) - .edit_product_form_item_error_existing, + text: AppLocalizations.of( + context, + ).edit_product_form_item_error_existing, ), ); diff --git a/packages/smooth_app/lib/pages/product/simple_input_number_field.dart b/packages/smooth_app/lib/pages/product/simple_input_number_field.dart index 09e074c226..b4f4ef63f7 100644 --- a/packages/smooth_app/lib/pages/product/simple_input_number_field.dart +++ b/packages/smooth_app/lib/pages/product/simple_input_number_field.dart @@ -39,49 +39,50 @@ class SimpleInputNumberField extends StatelessWidget { @override Widget build(BuildContext context) => Padding( - padding: const EdgeInsetsDirectional.only(start: LARGE_SPACE), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - SizedBox( - width: constraints.maxWidth - - LARGE_SPACE - - (withClearButton ? MINIMUM_TOUCH_SIZE : 0), - child: TextField( - keyboardType: TextInputType.numberWithOptions( - signed: false, - decimal: decimal, - ), - controller: controller, - decoration: InputDecoration( - filled: true, - border: const OutlineInputBorder( - borderRadius: ANGULAR_BORDER_RADIUS, - borderSide: BorderSide.none, - ), - contentPadding: const EdgeInsets.symmetric( - horizontal: SMALL_SPACE, - vertical: SMALL_SPACE, - ), - hintText: hintText, - ), - // a lot of confusion if set to `true` - autofocus: false, - focusNode: focusNode, - inputFormatters: [ - FilteringTextInputFormatter.allow(numberRegExp), - if (decimal) DecimalSeparatorRewriter(numberFormat), - ], - ), + padding: const EdgeInsetsDirectional.only(start: LARGE_SPACE), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + SizedBox( + width: + constraints.maxWidth - + LARGE_SPACE - + (withClearButton ? MINIMUM_TOUCH_SIZE : 0), + child: TextField( + keyboardType: TextInputType.numberWithOptions( + signed: false, + decimal: decimal, ), - if (withClearButton) - IconButton( - icon: const Icon(Icons.clear), - onPressed: () => controller.text = '', + controller: controller, + decoration: InputDecoration( + filled: true, + border: const OutlineInputBorder( + borderRadius: ANGULAR_BORDER_RADIUS, + borderSide: BorderSide.none, ), - ], + contentPadding: const EdgeInsets.symmetric( + horizontal: SMALL_SPACE, + vertical: SMALL_SPACE, + ), + hintText: hintText, + ), + // a lot of confusion if set to `true` + autofocus: false, + focusNode: focusNode, + inputFormatters: [ + FilteringTextInputFormatter.allow(numberRegExp), + if (decimal) DecimalSeparatorRewriter(numberFormat), + ], + ), ), - ); + if (withClearButton) + IconButton( + icon: const Icon(Icons.clear), + onPressed: () => controller.text = '', + ), + ], + ), + ); } diff --git a/packages/smooth_app/lib/pages/product/summary_attribute_group.dart b/packages/smooth_app/lib/pages/product/summary_attribute_group.dart index 9de2856d23..805ef9b35e 100644 --- a/packages/smooth_app/lib/pages/product/summary_attribute_group.dart +++ b/packages/smooth_app/lib/pages/product/summary_attribute_group.dart @@ -29,13 +29,8 @@ class SummaryAttributeGroup extends StatelessWidget { Align( alignment: AlignmentDirectional.topStart, child: attributeChips.length == 1 - ? SizedBox( - width: double.infinity, - child: attributeChips.first, - ) - : Wrap( - children: attributeChips, - ), + ? SizedBox(width: double.infinity, child: attributeChips.first) + : Wrap(children: attributeChips), ), ], ), @@ -62,15 +57,12 @@ class _SummaryAttributeGroupHeader extends StatelessWidget { ), child: Text( groupName!, - style: Theme.of(context) - .textTheme - .bodyMedium! - .apply(color: Colors.grey), + style: Theme.of( + context, + ).textTheme.bodyMedium!.apply(color: Colors.grey), ), ) : isFirstGroup - ? const SizedBox(height: SMALL_SPACE) - : Divider( - color: context.lightTheme() ? Colors.black12 : Colors.white24, - ); + ? const SizedBox(height: SMALL_SPACE) + : Divider(color: context.lightTheme() ? Colors.black12 : Colors.white24); } diff --git a/packages/smooth_app/lib/pages/product/summary_card.dart b/packages/smooth_app/lib/pages/product/summary_card.dart index b6f08830a6..28f7ec85d2 100644 --- a/packages/smooth_app/lib/pages/product/summary_card.dart +++ b/packages/smooth_app/lib/pages/product/summary_card.dart @@ -132,11 +132,12 @@ class _SummaryCardState extends State with UpToDateMixin { } Widget _buildLimitedSizeSummaryCard() { - final SmoothColorsThemeExtension themeExtension = - context.extension(); + final SmoothColorsThemeExtension themeExtension = context + .extension(); return Padding( - padding: widget.margin ?? + padding: + widget.margin ?? const EdgeInsets.symmetric( horizontal: SMALL_SPACE, vertical: VERY_SMALL_SPACE, @@ -157,16 +158,16 @@ class _SummaryCardState extends State with UpToDateMixin { ), Container( width: double.infinity, - padding: widget.buttonPadding ?? - const EdgeInsets.symmetric( - vertical: SMALL_SPACE, - ), + padding: + widget.buttonPadding ?? + const EdgeInsets.symmetric(vertical: SMALL_SPACE), decoration: BoxDecoration( color: context.lightTheme() ? themeExtension.primaryDark : themeExtension.primarySemiDark, - borderRadius: - const BorderRadius.vertical(bottom: ROUNDED_RADIUS), + borderRadius: const BorderRadius.vertical( + bottom: ROUNDED_RADIUS, + ), ), child: Padding( padding: const EdgeInsetsDirectional.only( @@ -187,9 +188,7 @@ class _SummaryCardState extends State with UpToDateMixin { fontWeight: FontWeight.w600, ), ), - const SizedBox( - width: BALANCED_SPACE, - ), + const SizedBox(width: BALANCED_SPACE), Container( decoration: BoxDecoration( shape: BoxShape.circle, @@ -216,8 +215,8 @@ class _SummaryCardState extends State with UpToDateMixin { final AppLocalizations localizations = AppLocalizations.of(context); final UserPreferences userPreferences = context.read(); - final List excludedAttributeIds = - userPreferences.getExcludedAttributeIds(); + final List excludedAttributeIds = userPreferences + .getExcludedAttributeIds(); final List scoreAttributes = getPopulatedAttributes( upToDateProduct, SCORE_ATTRIBUTE_IDS, @@ -305,10 +304,12 @@ class _SummaryCardState extends State with UpToDateMixin { upToDateProduct.statesTags ?? List.empty(); // Complete basic details - if (statesTags - .contains(ProductState.PRODUCT_NAME_COMPLETED.toBeCompletedTag) || - statesTags - .contains(ProductState.QUANTITY_COMPLETED.toBeCompletedTag)) { + if (statesTags.contains( + ProductState.PRODUCT_NAME_COMPLETED.toBeCompletedTag, + ) || + statesTags.contains( + ProductState.QUANTITY_COMPLETED.toBeCompletedTag, + )) { final ProductFieldEditor editor = ProductFieldDetailsEditor(); summaryCardButtons.add( addPanelButton( @@ -331,8 +332,8 @@ class _SummaryCardState extends State with UpToDateMixin { isPictureVisible: widget.isPictureVisible, onRemove: (BuildContext context) async { HideableContainerState.of(context).hide(() async { - final ContinuousScanModel model = - context.read(); + final ContinuousScanModel model = context + .read(); await model.removeBarcode(barcode); // Vibrate twice @@ -349,9 +350,7 @@ class _SummaryCardState extends State with UpToDateMixin { ); if (widget.scrollableContent) { - return SingleChildScrollView( - child: child, - ); + return SingleChildScrollView(child: child); } else { return child; } @@ -367,9 +366,7 @@ class _SummaryCardState extends State with UpToDateMixin { padding: const EdgeInsets.symmetric(vertical: SMALL_SPACE), child: InkWell( borderRadius: ANGULAR_BORDER_RADIUS, - onTap: () async => _openFullKnowledgePanel( - attribute: attribute, - ), + onTap: () async => _openFullKnowledgePanel(attribute: attribute), child: ScoreCard.attribute( attribute: attribute, isClickable: true, @@ -380,10 +377,7 @@ class _SummaryCardState extends State with UpToDateMixin { ); } else { attributes.add( - ScoreCard.attribute( - attribute: attribute, - isClickable: false, - ), + ScoreCard.attribute(attribute: attribute, isClickable: false), ); } } @@ -393,8 +387,9 @@ class _SummaryCardState extends State with UpToDateMixin { List _buildAttributeChips(final List attributes) { final List result = []; for (final Attribute attribute in attributes) { - final Widget? attributeChip = - _buildAttributeChipForValidAttributes(attribute); + final Widget? attributeChip = _buildAttributeChipForValidAttributes( + attribute, + ); if (attributeChip != null) { result.add(attributeChip); } @@ -419,9 +414,7 @@ class _SummaryCardState extends State with UpToDateMixin { child: InkWell( borderRadius: ANGULAR_BORDER_RADIUS, enableFeedback: _isAttributeOpeningAllowed(attribute), - onTap: () async => _openFullKnowledgePanel( - attribute: attribute, - ), + onTap: () async => _openFullKnowledgePanel(attribute: attribute), child: Padding( padding: const EdgeInsets.symmetric(vertical: SMALL_SPACE), child: Row( @@ -456,10 +449,7 @@ class _SummaryCardState extends State with UpToDateMixin { return; } final KnowledgePanel? knowledgePanel = - KnowledgePanelsBuilder.getKnowledgePanel( - upToDateProduct, - panelId, - ); + KnowledgePanelsBuilder.getKnowledgePanel(upToDateProduct, panelId); if (knowledgePanel == null) { return; } @@ -467,10 +457,8 @@ class _SummaryCardState extends State with UpToDateMixin { await Navigator.push( context, MaterialPageRoute( - builder: (BuildContext context) => KnowledgePanelPage( - panelId: panelId, - product: upToDateProduct, - ), + builder: (BuildContext context) => + KnowledgePanelPage(panelId: panelId, product: upToDateProduct), ), ); } diff --git a/packages/smooth_app/lib/pages/product/website_card.dart b/packages/smooth_app/lib/pages/product/website_card.dart index cc82ccb215..17d98b72ab 100644 --- a/packages/smooth_app/lib/pages/product/website_card.dart +++ b/packages/smooth_app/lib/pages/product/website_card.dart @@ -47,20 +47,14 @@ class WebsiteCard extends StatelessWidget { child: Text( website, overflow: TextOverflow.ellipsis, - style: Theme.of(context) - .textTheme - .bodyMedium - ?.copyWith(color: Colors.blue), + style: Theme.of( + context, + ).textTheme.bodyMedium?.copyWith(color: Colors.blue), ), ), const Padding( - padding: EdgeInsetsDirectional.only( - start: 5.0, - end: 3.0, - ), - child: icons.ExternalLink( - size: 20.0, - ), + padding: EdgeInsetsDirectional.only(start: 5.0, end: 3.0), + child: icons.ExternalLink(size: 20.0), ), ], ), diff --git a/packages/smooth_app/lib/pages/product/world_map_page.dart b/packages/smooth_app/lib/pages/product/world_map_page.dart index 616bb001a2..661bbe7659 100644 --- a/packages/smooth_app/lib/pages/product/world_map_page.dart +++ b/packages/smooth_app/lib/pages/product/world_map_page.dart @@ -20,12 +20,10 @@ class WorldMapPage extends StatelessWidget { Widget build(BuildContext context) { return SmoothScaffold( appBar: AppBar( - title: Text( - title ?? '', - maxLines: 2, - ), - backgroundColor: - AppBarTheme.of(context).backgroundColor?.withValues(alpha: 0.8), + title: Text(title ?? '', maxLines: 2), + backgroundColor: AppBarTheme.of( + context, + ).backgroundColor?.withValues(alpha: 0.8), ), extendBodyBehindAppBar: true, body: FlutterMap( @@ -41,8 +39,9 @@ class WorldMapPage extends StatelessWidget { showFlutterMapAttribution: false, attributions: [ TextSourceAttribution( - AppLocalizations.of(context) - .open_street_map_contributor_attribution, + AppLocalizations.of( + context, + ).open_street_map_contributor_attribution, onTap: () => LaunchUrlHelper.launchURL( 'https://www.openstreetmap.org/copyright', ), diff --git a/packages/smooth_app/lib/pages/product_crop_helper.dart b/packages/smooth_app/lib/pages/product_crop_helper.dart index ea39b077e5..cf24eec9fa 100644 --- a/packages/smooth_app/lib/pages/product_crop_helper.dart +++ b/packages/smooth_app/lib/pages/product_crop_helper.dart @@ -211,13 +211,12 @@ class ProductCropAgainHelper extends ProductCropHelper { final Offset offset, final CropController controller, final ui.Image image, - ) => - _getRotatedOffsetForOffHelper( - controller.rotation, - offset, - image.width.toDouble(), - image.height.toDouble(), - ); + ) => _getRotatedOffsetForOffHelper( + controller.rotation, + offset, + image.width.toDouble(), + image.height.toDouble(), + ); /// Returns the offset as rotated, for the OFF-dart rotation/crop tool. Offset _getRotatedOffsetForOffHelper( @@ -229,16 +228,10 @@ class ProductCropAgainHelper extends ProductCropHelper { switch (rotation) { case CropRotation.up: case CropRotation.down: - return Offset( - noonWidth * offset01.dx, - noonHeight * offset01.dy, - ); + return Offset(noonWidth * offset01.dx, noonHeight * offset01.dy); case CropRotation.right: case CropRotation.left: - return Offset( - noonHeight * offset01.dx, - noonWidth * offset01.dy, - ); + return Offset(noonHeight * offset01.dx, noonWidth * offset01.dy); } } } diff --git a/packages/smooth_app/lib/pages/product_list_user_dialog_helper.dart b/packages/smooth_app/lib/pages/product_list_user_dialog_helper.dart index 44b5b58445..2bd75bb1a9 100644 --- a/packages/smooth_app/lib/pages/product_list_user_dialog_helper.dart +++ b/packages/smooth_app/lib/pages/product_list_user_dialog_helper.dart @@ -137,8 +137,10 @@ class ProductListUserDialogHelper { if (newName == null) { return null; } - final ProductList result = - await daoProductList.rename(initialProductList, newName); + final ProductList result = await daoProductList.rename( + initialProductList, + newName, + ); daoProductList.localDatabase.notifyListeners(); return result; } @@ -205,10 +207,8 @@ class ProductListUserDialogHelper { return false; } - final List selectedLists = - await daoProductList.getUserListsWithBarcodes( - barcodes.toList(growable: false), - ); + final List selectedLists = await daoProductList + .getUserListsWithBarcodes(barcodes.toList(growable: false)); if (!context.mounted) { return null; @@ -294,29 +294,32 @@ class _UserListsState extends State<_UserLists> { positiveAction: SmoothActionButton( text: appLocalizations.save, onPressed: () async { - Navigator.of(context).pop( - await widget.onListsSubmitted(selectedLists), - ); + Navigator.of( + context, + ).pop(await widget.onListsSubmitted(selectedLists)); }, ), body: Column( - children: widget.lists.map((String name) { - return ListTile( - leading: Icon( - selectedLists.contains(name) - ? Icons.check_box - : Icons.check_box_outline_blank, - ), - title: Text(name), - onTap: () { - if (selectedLists.contains(name)) { - selectedLists.removeWhere((String e) => e == name); - } else { - selectedLists.add(name); - } - setState(() {}); - }); - }).toList(growable: false), + children: widget.lists + .map((String name) { + return ListTile( + leading: Icon( + selectedLists.contains(name) + ? Icons.check_box + : Icons.check_box_outline_blank, + ), + title: Text(name), + onTap: () { + if (selectedLists.contains(name)) { + selectedLists.removeWhere((String e) => e == name); + } else { + selectedLists.add(name); + } + setState(() {}); + }, + ); + }) + .toList(growable: false), ), ); } @@ -325,9 +328,7 @@ class _UserListsState extends State<_UserLists> { /// Widget indicate that the user has no lists yet /// Pop returns true if a new list is created class _UserEmptyLists extends StatefulWidget { - const _UserEmptyLists( - this.daoProductList, - ); + const _UserEmptyLists(this.daoProductList); final DaoProductList daoProductList; @@ -367,9 +368,9 @@ class _UserEmptyListsState extends State<_UserEmptyLists> { actionsOrder: SmoothButtonsBarOrder.auto, positiveAction: SmoothActionButton( onPressed: () async { - final ProductList? productList = - await ProductListUserDialogHelper(widget.daoProductList) - .showCreateUserListDialog(context); + final ProductList? productList = await ProductListUserDialogHelper( + widget.daoProductList, + ).showCreateUserListDialog(context); if (productList != null && context.mounted) { Navigator.pop(context, true); @@ -384,8 +385,9 @@ class _UserEmptyListsState extends State<_UserEmptyLists> { /// Closes the dialog and returns false, as no products were added SmoothActionButton _cancelButton( - AppLocalizations appLocalizations, BuildContext context) => - SmoothActionButton( - onPressed: () => Navigator.pop(context, false), - text: appLocalizations.cancel, - ); + AppLocalizations appLocalizations, + BuildContext context, +) => SmoothActionButton( + onPressed: () => Navigator.pop(context, false), + text: appLocalizations.cancel, +); diff --git a/packages/smooth_app/lib/pages/proof_crop_helper.dart b/packages/smooth_app/lib/pages/proof_crop_helper.dart index 1af520c56d..5de68362b9 100644 --- a/packages/smooth_app/lib/pages/proof_crop_helper.dart +++ b/packages/smooth_app/lib/pages/proof_crop_helper.dart @@ -12,9 +12,7 @@ import 'package:smooth_app/pages/prices/proof_type_extensions.dart'; /// Crop Helper for proof images: brand new image. class ProofCropHelper extends CropHelper { - ProofCropHelper({ - required this.model, - }); + ProofCropHelper({required this.model}); final PriceModel model; diff --git a/packages/smooth_app/lib/pages/scan/camera_scan_page.dart b/packages/smooth_app/lib/pages/scan/camera_scan_page.dart index cdefa99ca6..581b04e6c0 100644 --- a/packages/smooth_app/lib/pages/scan/camera_scan_page.dart +++ b/packages/smooth_app/lib/pages/scan/camera_scan_page.dart @@ -87,9 +87,7 @@ class _CameraScannerPageState extends State final AppLocalizations appLocalizations = AppLocalizations.of(context); if (!CameraHelper.hasACamera) { - return Center( - child: Text(appLocalizations.permission_photo_none_found), - ); + return Center(child: Text(appLocalizations.permission_photo_none_found)); } final double statusBarHeight = MediaQuery.viewPaddingOf(context).top; @@ -127,9 +125,7 @@ class _CameraScannerPageState extends State top: statusBarHeight, left: 0.0, right: 0.0, - child: ScanHeader( - key: _headerKey, - ), + child: ScanHeader(key: _headerKey), ), ], ), diff --git a/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/news/scan_news_card.dart b/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/news/scan_news_card.dart index a0dc6864d8..4d62e43fc6 100644 --- a/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/news/scan_news_card.dart +++ b/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/news/scan_news_card.dart @@ -16,9 +16,7 @@ import 'package:smooth_app/themes/theme_provider.dart'; import 'package:smooth_app/widgets/smooth_text.dart'; class ScanNewsCard extends StatefulWidget { - const ScanNewsCard({ - required this.news, - }); + const ScanNewsCard({required this.news}); final Iterable news; @@ -135,8 +133,9 @@ class _TagLineContentBodyState extends State<_TagLineContentBody> { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension theme = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension theme = Theme.of( + context, + ).extension()!; final Widget text = TextWithBoldParts( text: widget.message, @@ -145,7 +144,8 @@ class _TagLineContentBodyState extends State<_TagLineContentBody> { maxLines: widget.dense ? 500 : null, overflow: widget.dense ? TextOverflow.ellipsis : null, textStyle: TextStyle( - color: widget.textColor ?? + color: + widget.textColor ?? (context.lightTheme(listen: true) ? theme.primaryBlack : theme.primaryLight), @@ -155,10 +155,7 @@ class _TagLineContentBodyState extends State<_TagLineContentBody> { // There's no check for the dark image, as it's optional. if (widget.image == null || _imageError) { - return Padding( - padding: _contentPadding, - child: text, - ); + return Padding(padding: _contentPadding, child: text); } final int imageFlex = ((widget.image!.width ?? 0.2) * 10).toInt(); @@ -173,18 +170,12 @@ class _TagLineContentBodyState extends State<_TagLineContentBody> { constraints: BoxConstraints( maxHeight: MediaQuery.sizeOf(context).height * 0.06, ), - child: AspectRatio( - aspectRatio: 1.0, - child: _image(), - ), + child: AspectRatio(aspectRatio: 1.0, child: _image()), ), ), SizedBox(width: widget.dense ? SMALL_SPACE : MEDIUM_SPACE), ], - Expanded( - flex: 10 - imageFlex, - child: text, - ), + Expanded(flex: 10 - imageFlex, child: text), ], ), ); @@ -205,11 +196,7 @@ class _TagLineContentBodyState extends State<_TagLineContentBody> { } else { return Image.network( semanticLabel: image.alt, - loadingBuilder: ( - _, - Widget child, - ImageChunkEvent? loadingProgress, - ) { + loadingBuilder: (_, Widget child, ImageChunkEvent? loadingProgress) { if (loadingProgress == null) { return _onLoading(); } @@ -253,8 +240,9 @@ class _TagLineContentButton extends StatelessWidget { @override Widget build(BuildContext context) { final AppLocalizations localizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension theme = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension theme = Theme.of( + context, + ).extension()!; return Padding( padding: const EdgeInsetsDirectional.only(bottom: SMALL_SPACE), diff --git a/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/news/scan_news_provider.dart b/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/news/scan_news_provider.dart index a034126252..5358d490b8 100644 --- a/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/news/scan_news_provider.dart +++ b/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/news/scan_news_provider.dart @@ -11,9 +11,9 @@ import 'package:smooth_app/helpers/provider_helper.dart'; /// randomly sorted by unread, then displayed and clicked news. class ScanNewsFeedProvider extends ValueNotifier { ScanNewsFeedProvider(BuildContext context) - : _newsFeedProvider = context.read(), - _userPreferences = context.read(), - super(const ScanTagLineStateLoading()) { + : _newsFeedProvider = context.read(), + _userPreferences = context.read(), + super(const ScanTagLineStateLoading()) { _newsFeedProvider.addListener(_onNewsFeedStateChanged); // Refresh with the current state _onNewsFeedStateChanged(); @@ -30,7 +30,8 @@ class ScanNewsFeedProvider extends ValueNotifier { emit(const ScanTagLineStateNoContent()); case AppNewsStateLoaded(): _onTagLineContentAvailable( - (_newsFeedProvider.state as AppNewsStateLoaded).content); + (_newsFeedProvider.state as AppNewsStateLoaded).content, + ); } } @@ -60,13 +61,11 @@ class ScanNewsFeedProvider extends ValueNotifier { } emit( - ScanTagLineStateLoaded( - [ - ...unreadNews..shuffle(), - ...displayedNews..shuffle(), - ...clickedNews..shuffle(), - ], - ), + ScanTagLineStateLoaded([ + ...unreadNews..shuffle(), + ...displayedNews..shuffle(), + ...clickedNews..shuffle(), + ]), ); } diff --git a/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/scan_app_review_card.dart b/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/scan_app_review_card.dart index a8e47b14de..228e5cc838 100644 --- a/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/scan_app_review_card.dart +++ b/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/scan_app_review_card.dart @@ -50,10 +50,8 @@ class ScanAppReview extends StatelessWidget { text: appLocalizations.app_review_medium, backgroundColor: const Color(0xFFFF8C14), borderRadius: BorderRadius.zero, - onTap: () => _showUserFeedBackModalSheet( - context, - AppReviewResult.neutral, - ), + onTap: () => + _showUserFeedBackModalSheet(context, AppReviewResult.neutral), ), ), Expanded( @@ -66,8 +64,8 @@ class ScanAppReview extends StatelessWidget { bottomEnd: ScanBottomCardContainer.radius, ), onTap: () async { - final AppReviewProvider appReview = - context.read(); + final AppReviewProvider appReview = context + .read(); await ApplicationStore.openAppReview(); appReview.markAsReviewed(AppReviewResult.satisfied); }, @@ -82,8 +80,8 @@ class ScanAppReview extends StatelessWidget { BuildContext context, AppReviewResult result, ) async { - final SmoothColorsThemeExtension colors = - context.extension(); + final SmoothColorsThemeExtension colors = context + .extension(); final bool lightTheme = context.lightTheme(listen: false); final AppLocalizations appLocalizations = AppLocalizations.of(context); @@ -108,10 +106,12 @@ class ScanAppReview extends StatelessWidget { child: _AppReviewButton( onPressed: () => Navigator.of(context).pop(true), text: appLocalizations.app_review_feedback_modal_open_form, - backgroundColor: - lightTheme ? colors.primaryBlack : colors.primaryLight, - foregroundColor: - lightTheme ? Colors.white : colors.primaryDark, + backgroundColor: lightTheme + ? colors.primaryBlack + : colors.primaryLight, + foregroundColor: lightTheme + ? Colors.white + : colors.primaryDark, icon: DecoratedBox( decoration: ShapeDecoration( shape: const CircleBorder(), @@ -137,10 +137,12 @@ class ScanAppReview extends StatelessWidget { child: _AppReviewButton( onPressed: () => Navigator.of(context).pop(false), text: appLocalizations.app_review_feedback_modal_later, - backgroundColor: - lightTheme ? colors.primaryLight : colors.primaryDark, - foregroundColor: - lightTheme ? colors.primaryDark : colors.primaryLight, + backgroundColor: lightTheme + ? colors.primaryLight + : colors.primaryDark, + foregroundColor: lightTheme + ? colors.primaryDark + : colors.primaryLight, ), ), ], @@ -201,17 +203,12 @@ class _AppReviewButton extends StatelessWidget { children: [ AutoSizeText( text, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15.0, - ), + style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15.0), maxLines: 1, ), if (icon != null) ...[ const SizedBox(width: SMALL_SPACE), - FittedBox( - child: icon, - ) + FittedBox(child: icon), ], ], ), diff --git a/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/scan_bottom_card.dart b/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/scan_bottom_card.dart index 67acf23f19..dff6488954 100644 --- a/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/scan_bottom_card.dart +++ b/packages/smooth_app/lib/pages/scan/carousel/main_card/bottom_cards/scan_bottom_card.dart @@ -16,10 +16,7 @@ import 'package:smooth_app/themes/smooth_theme_colors.dart'; import 'package:smooth_app/themes/theme_provider.dart'; class ScanBottomCard extends StatelessWidget { - const ScanBottomCard({ - required this.dense, - super.key, - }); + const ScanBottomCard({required this.dense, super.key}); final bool dense; @@ -37,40 +34,36 @@ class ScanBottomCard extends StatelessWidget { ), ], child: Consumer2( - builder: ( - BuildContext context, - ScanNewsFeedProvider scanTagLineProvider, - AppReviewProvider appReviewProvider, - Widget? child, - ) { - switch (appReviewProvider.value) { - case AppReviewState.checking: - return const ScanBottomCardLoading(); - case AppReviewState.askForReview: - return const ScanAppReview(); - default: - // Nothing (-> news) - } + builder: + ( + BuildContext context, + ScanNewsFeedProvider scanTagLineProvider, + AppReviewProvider appReviewProvider, + Widget? child, + ) { + switch (appReviewProvider.value) { + case AppReviewState.checking: + return const ScanBottomCardLoading(); + case AppReviewState.askForReview: + return const ScanAppReview(); + default: + // Nothing (-> news) + } - final ScanTagLineState state = scanTagLineProvider.value; + final ScanTagLineState state = scanTagLineProvider.value; - return switch (state) { - ScanTagLineStateLoading() => const ScanBottomCardLoading(), - ScanTagLineStateNoContent() => EMPTY_WIDGET, - ScanTagLineStateLoaded() => ScanNewsCard( - news: state.tagLine, - ), - }; - }, + return switch (state) { + ScanTagLineStateLoading() => const ScanBottomCardLoading(), + ScanTagLineStateNoContent() => EMPTY_WIDGET, + ScanTagLineStateLoaded() => ScanNewsCard(news: state.tagLine), + }; + }, ), ); } } -enum ScanBottomCardDensity { - dense, - normal, -} +enum ScanBottomCardDensity { dense, normal } class ScanBottomCardLoading extends StatelessWidget { const ScanBottomCardLoading({super.key}); @@ -86,8 +79,9 @@ class ScanBottomCardLoading extends StatelessWidget { margin: EdgeInsets.zero, child: SizedBox( width: double.infinity, - height: - density == ScanBottomCardDensity.dense ? 200.0 : double.infinity, + height: density == ScanBottomCardDensity.dense + ? 200.0 + : double.infinity, ), ), ); @@ -119,8 +113,8 @@ class ScanBottomCardContainer extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool dense = context.read() == ScanBottomCardDensity.dense; @@ -129,7 +123,8 @@ class ScanBottomCardContainer extends StatelessWidget { children: [ DecoratedBox( decoration: BoxDecoration( - color: titleBackgroundColor ?? + color: + titleBackgroundColor ?? (context.lightTheme() ? extension.primarySemiDark : extension.secondaryVibrant), @@ -154,11 +149,7 @@ class ScanBottomCardContainer extends StatelessWidget { ), ), ), - _buildBody( - context: context, - dense: dense, - extension: extension, - ), + _buildBody(context: context, dense: dense, extension: extension), ], ); } @@ -170,7 +161,8 @@ class ScanBottomCardContainer extends StatelessWidget { }) { final Widget child = Material( type: MaterialType.card, - color: backgroundColor ?? + color: + backgroundColor ?? (context.lightTheme() ? extension.primaryMedium : extension.primaryUltraBlack), @@ -246,8 +238,9 @@ class _ScanBottomCardContainerTitle extends StatelessWidget { onTap: onClose, customBorder: const CircleBorder(), child: Tooltip( - message: - MaterialLocalizations.of(context).closeButtonTooltip, + message: MaterialLocalizations.of( + context, + ).closeButtonTooltip, child: Padding( padding: const EdgeInsetsDirectional.all(SMALL_SPACE), child: Close( @@ -258,7 +251,7 @@ class _ScanBottomCardContainerTitle extends StatelessWidget { ), ), ), - ] + ], ], ), ), diff --git a/packages/smooth_app/lib/pages/scan/carousel/main_card/scan_main_card.dart b/packages/smooth_app/lib/pages/scan/carousel/main_card/scan_main_card.dart index 6c700d4885..f8fe4119a2 100644 --- a/packages/smooth_app/lib/pages/scan/carousel/main_card/scan_main_card.dart +++ b/packages/smooth_app/lib/pages/scan/carousel/main_card/scan_main_card.dart @@ -16,19 +16,18 @@ class ScanMainCard extends StatelessWidget { return ConsumerFilter( buildWhen: (AppNewsProvider? previousValue, AppNewsProvider currentValue) { - return previousValue?.hasContent != currentValue.hasContent; - }, + return previousValue?.hasContent != currentValue.hasContent; + }, builder: (BuildContext context, AppNewsProvider newsFeed, _) { if (!newsFeed.hasContent) { - return const ScanSearchCard( - expandedMode: true, - ); + return const ScanSearchCard(expandedMode: true); } else { return Semantics( explicitChildNodes: true, child: LayoutBuilder( builder: (_, BoxConstraints constraints) { - final bool dense = constraints.maxHeight * 0.4 <= + final bool dense = + constraints.maxHeight * 0.4 <= _maxHeight(context.textScaler()); if (dense) { @@ -42,9 +41,7 @@ class ScanMainCard extends StatelessWidget { constraints.maxHeight * 0.5, ), ), - child: const ScanSearchCard( - expandedMode: false, - ), + child: const ScanSearchCard(expandedMode: false), ), const SizedBox(height: SMALL_SPACE), const ScanBottomCard(dense: true), @@ -55,15 +52,10 @@ class ScanMainCard extends StatelessWidget { children: [ Expanded( flex: 6, - child: ScanSearchCard( - expandedMode: false, - ), + child: ScanSearchCard(expandedMode: false), ), SizedBox(height: SMALL_SPACE), - Expanded( - flex: 4, - child: ScanBottomCard(dense: false), - ), + Expanded(flex: 4, child: ScanBottomCard(dense: false)), ], ); } diff --git a/packages/smooth_app/lib/pages/scan/carousel/main_card/top_card/scan_search_card.dart b/packages/smooth_app/lib/pages/scan/carousel/main_card/top_card/scan_search_card.dart index 767840cb21..02e5589ddd 100644 --- a/packages/smooth_app/lib/pages/scan/carousel/main_card/top_card/scan_search_card.dart +++ b/packages/smooth_app/lib/pages/scan/carousel/main_card/top_card/scan_search_card.dart @@ -15,9 +15,7 @@ import 'package:smooth_app/themes/theme_provider.dart'; import 'package:smooth_app/widgets/smooth_text.dart'; class ScanSearchCard extends StatelessWidget { - const ScanSearchCard({ - required this.expandedMode, - }); + const ScanSearchCard({required this.expandedMode}); /// Expanded is when this card is the only one (no tagline, no app review…) final bool expandedMode; @@ -43,16 +41,18 @@ class ScanSearchCard extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - LayoutBuilder(builder: (_, BoxConstraints constraints) { - return SvgPicture.asset( - lightTheme - ? 'assets/app/logo_text_black.svg' - : 'assets/app/logo_text_white.svg', - width: math.min(311.0, constraints.maxWidth * 0.85), - semanticsLabel: - localizations.homepage_main_card_logo_description, - ); - }), + LayoutBuilder( + builder: (_, BoxConstraints constraints) { + return SvgPicture.asset( + lightTheme + ? 'assets/app/logo_text_black.svg' + : 'assets/app/logo_text_white.svg', + width: math.min(311.0, constraints.maxWidth * 0.85), + semanticsLabel: + localizations.homepage_main_card_logo_description, + ); + }, + ), const SizedBox(height: VERY_SMALL_SPACE), TextWithBoldParts( text: localizations.homepage_main_card_subheading, diff --git a/packages/smooth_app/lib/pages/scan/carousel/scan_carousel.dart b/packages/smooth_app/lib/pages/scan/carousel/scan_carousel.dart index 52c3ff7513..68a06a6ef4 100644 --- a/packages/smooth_app/lib/pages/scan/carousel/scan_carousel.dart +++ b/packages/smooth_app/lib/pages/scan/carousel/scan_carousel.dart @@ -12,9 +12,7 @@ import 'package:smooth_app/pages/scan/carousel/scan_carousel_manager.dart'; import 'package:smooth_app/pages/scan/scan_product_card_loader.dart'; class ScanPageCarousel extends StatefulWidget { - const ScanPageCarousel({ - this.onPageChangedTo, - }); + const ScanPageCarousel({this.onPageChangedTo}); final Function(int page, String? productBarcode)? onPageChangedTo; @@ -77,10 +75,7 @@ class _ScanPageCarouselState extends State { Future _moveControllerTo(int page) async { if (_carrouselMovingTo == null && _lastIndex != page) { - widget.onPageChangedTo?.call( - page, - page >= 1 ? barcodes[page - 1] : null, - ); + widget.onPageChangedTo?.call(page, page >= 1 ? barcodes[page - 1] : null); _carrouselMovingTo = page; ExternalScanCarouselManager.read(context).animatePageTo(page); @@ -98,19 +93,20 @@ class _ScanPageCarouselState extends State { itemCount: barcodes.length + 1, itemBuilder: (BuildContext context, int itemIndex, int itemRealIndex) { - return SizedBox.expand( - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: HORIZONTAL_SPACE_BETWEEN_CARDS, - ), - child: itemIndex == 0 - ? const ScanMainCard() - : _getWidget(itemIndex - 1), - ), - ); - }, - carouselController: - ExternalScanCarouselManager.watch(context).controller, + return SizedBox.expand( + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: HORIZONTAL_SPACE_BETWEEN_CARDS, + ), + child: itemIndex == 0 + ? const ScanMainCard() + : _getWidget(itemIndex - 1), + ), + ); + }, + carouselController: ExternalScanCarouselManager.watch( + context, + ).controller, options: CarouselOptions( enlargeCenterPage: false, viewportFraction: _computeViewPortFraction(), @@ -148,18 +144,18 @@ class _ScanPageCarouselState extends State { final String barcode = barcodes[index]; - return LayoutBuilder(builder: ( - BuildContext context, - BoxConstraints constraints, - ) { - final bool dense = constraints.maxHeight <= 400.0 || - MediaQuery.textScalerOf(context).scale(1.0) >= 1.30; + return LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + final bool dense = + constraints.maxHeight <= 400.0 || + MediaQuery.textScalerOf(context).scale(1.0) >= 1.30; - return Provider( - create: (_) => dense ? ScanCardDensity.DENSE : ScanCardDensity.NORMAL, - child: _cardWidget(barcode), - ); - }); + return Provider( + create: (_) => dense ? ScanCardDensity.DENSE : ScanCardDensity.NORMAL, + child: _cardWidget(barcode), + ); + }, + ); } Widget _cardWidget(final String barcode) { diff --git a/packages/smooth_app/lib/pages/scan/carousel/scan_carousel_manager.dart b/packages/smooth_app/lib/pages/scan/carousel/scan_carousel_manager.dart index f19003055c..0144d8a612 100644 --- a/packages/smooth_app/lib/pages/scan/carousel/scan_carousel_manager.dart +++ b/packages/smooth_app/lib/pages/scan/carousel/scan_carousel_manager.dart @@ -4,10 +4,7 @@ import 'package:smooth_app/helpers/haptic_feedback_helper.dart'; /// Allow to control the [ScanPageCarousel] from outside class ExternalScanCarouselManager extends StatefulWidget { - const ExternalScanCarouselManager({ - super.key, - required this.child, - }); + const ExternalScanCarouselManager({super.key, required this.child}); final Widget child; @@ -44,15 +41,10 @@ class ExternalScanCarouselManagerState @override Widget build(BuildContext context) { - return _InheritedCarouselManager( - state: this, - child: widget.child, - ); + return _InheritedCarouselManager(state: this, child: widget.child); } - void showSearchCard({ - bool notify = false, - }) { + void showSearchCard({bool notify = false}) { animatePageTo(0); if (notify) { @@ -83,10 +75,7 @@ class ExternalScanCarouselManagerState } class _InheritedCarouselManager extends InheritedWidget { - const _InheritedCarouselManager({ - required super.child, - required this.state, - }); + const _InheritedCarouselManager({required super.child, required this.state}); final ExternalScanCarouselManagerState state; diff --git a/packages/smooth_app/lib/pages/scan/scan_header.dart b/packages/smooth_app/lib/pages/scan/scan_header.dart index 02fc2893a7..6adac2d308 100644 --- a/packages/smooth_app/lib/pages/scan/scan_header.dart +++ b/packages/smooth_app/lib/pages/scan/scan_header.dart @@ -41,8 +41,9 @@ class _ScanHeaderState extends State { final bool compareFeatureAvailable = model.compareFeatureAvailable; return AnimatedOpacity( - opacity: - model.compareFeatureEnabled ? _visibleOpacity : _invisibleOpacity, + opacity: model.compareFeatureEnabled + ? _visibleOpacity + : _invisibleOpacity, duration: SmoothAnimationsDuration.brief, child: Padding( padding: const EdgeInsets.symmetric( @@ -65,10 +66,7 @@ class _ScanHeaderState extends State { icon: const icons.Clear(), onPressed: model.clearScanSession, label: FittedBox( - child: Text( - appLocalizations.clear, - maxLines: 1, - ), + child: Text(appLocalizations.clear, maxLines: 1), ), ), ), @@ -80,21 +78,19 @@ class _ScanHeaderState extends State { child: Tooltip( message: compareFeatureAvailable ? appLocalizations - .scan_header_compare_button_valid_state_tooltip + .scan_header_compare_button_valid_state_tooltip : appLocalizations - .scan_header_compare_button_invalid_state_tooltip, + .scan_header_compare_button_invalid_state_tooltip, child: AnimatedOpacity( opacity: compareFeatureAvailable ? 1.0 : 0.5, duration: SmoothAnimationsDuration.brief, child: ElevatedButton.icon( style: buttonStyle, - icon: const icons.Compare( - size: 19.0, - ), + icon: const icons.Compare(size: 19.0), onPressed: compareFeatureAvailable ? () async { - final ContinuousScanModel model = - context.read(); + final ContinuousScanModel model = context + .read(); await model.refreshProductList(); if (!context.mounted) { return; @@ -104,14 +100,15 @@ class _ScanHeaderState extends State { MaterialPageRoute( builder: (BuildContext context) => PersonalizedRankingPage( - barcodes: - model.getAvailableBarcodes().toList(), - title: ProductQueryPageHelper - .getProductListLabel( - model.productList, - appLocalizations, - ), - ), + barcodes: model + .getAvailableBarcodes() + .toList(), + title: + ProductQueryPageHelper.getProductListLabel( + model.productList, + appLocalizations, + ), + ), ), ); } diff --git a/packages/smooth_app/lib/pages/scan/scan_page.dart b/packages/smooth_app/lib/pages/scan/scan_page.dart index 9391ea4495..758622e075 100644 --- a/packages/smooth_app/lib/pages/scan/scan_page.dart +++ b/packages/smooth_app/lib/pages/scan/scan_page.dart @@ -53,44 +53,41 @@ class _ScanPageState extends State { } final AppLocalizations appLocalizations = AppLocalizations.of(context); - final SmoothColorsThemeExtension themeExtension = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension themeExtension = Theme.of( + context, + ).extension()!; final TextDirection direction = Directionality.of(context); final bool hasACamera = CameraHelper.hasACamera; return SmoothScaffold( brightness: Brightness.light, - backgroundColor: - context.lightTheme() ? themeExtension.primaryLight : null, + backgroundColor: context.lightTheme() + ? themeExtension.primaryLight + : null, body: Column( children: [ if (hasACamera) Expanded( flex: 100 - _carouselHeightPct, child: Consumer( - builder: ( - BuildContext context, - PermissionListener listener, - _, - ) { - switch (listener.value.status) { - case DevicePermissionStatus.checking: - return EMPTY_WIDGET; - case DevicePermissionStatus.granted: - // TODO(m123): change - return const CameraScannerPage(); - default: - return const _PermissionDeniedCard(); - } - }, + builder: + (BuildContext context, PermissionListener listener, _) { + switch (listener.value.status) { + case DevicePermissionStatus.checking: + return EMPTY_WIDGET; + case DevicePermissionStatus.granted: + // TODO(m123): change + return const CameraScannerPage(); + default: + return const _PermissionDeniedCard(); + } + }, ), ), Expanded( flex: _carouselHeightPct, child: Padding( - padding: const EdgeInsetsDirectional.only( - bottom: BALANCED_SPACE, - ), + padding: const EdgeInsetsDirectional.only(bottom: BALANCED_SPACE), child: ScanPageCarousel( onPageChangedTo: (int page, String? barcode) async { if (barcode == null) { @@ -218,10 +215,7 @@ class _PermissionDeniedCard extends StatelessWidget { APP_NAME, ), textAlign: TextAlign.center, - style: const TextStyle( - height: 1.4, - fontSize: 15.5, - ), + style: const TextStyle(height: 1.4, fontSize: 15.5), ), ), ), @@ -240,8 +234,9 @@ class _PermissionDeniedCard extends StatelessWidget { return Provider.of( context, listen: false, - ).askPermission(onRationaleNotAvailable: () async { - return showDialog( + ).askPermission( + onRationaleNotAvailable: () async { + return showDialog( context: context, builder: (BuildContext context) { final AppLocalizations localizations = AppLocalizations.of(context); @@ -251,9 +246,7 @@ class _PermissionDeniedCard extends StatelessWidget { localizations.permission_photo_denied_dialog_settings_title, body: Text( localizations.permission_photo_denied_dialog_settings_message, - style: const TextStyle( - height: 1.6, - ), + style: const TextStyle(height: 1.6), ), negativeAction: SmoothActionButton( text: localizations @@ -269,7 +262,9 @@ class _PermissionDeniedCard extends StatelessWidget { ), actionsAxis: Axis.vertical, ); - }); - }); + }, + ); + }, + ); } } diff --git a/packages/smooth_app/lib/pages/scan/scan_product_card.dart b/packages/smooth_app/lib/pages/scan/scan_product_card.dart index dd7b43e49c..9e639f11f3 100644 --- a/packages/smooth_app/lib/pages/scan/scan_product_card.dart +++ b/packages/smooth_app/lib/pages/scan/scan_product_card.dart @@ -12,11 +12,9 @@ import 'package:smooth_app/pages/product/product_page/new_product_header.dart'; import 'package:smooth_app/pages/product/summary_card.dart'; class ScanProductCardFound extends StatelessWidget { - ScanProductCardFound({ - required this.product, - required this.onRemoveProduct, - }) : assert(product.barcode!.isNotEmpty), - super(key: Key(product.barcode!)); + ScanProductCardFound({required this.product, required this.onRemoveProduct}) + : assert(product.barcode!.isNotEmpty), + super(key: Key(product.barcode!)); final Product product; final OnRemoveCallback? onRemoveProduct; @@ -25,14 +23,11 @@ class ScanProductCardFound extends StatelessWidget { Widget build(BuildContext context) { final ProductCompatibilityHelper helper = ProductCompatibilityHelper.product( - MatchedProductV2( - product, - context.watch(), - ), - ); + MatchedProductV2(product, context.watch()), + ); - final ProductPreferences productPreferences = - context.watch(); + final ProductPreferences productPreferences = context + .watch(); final String? compatibilityScore = helper.getFormattedScore(); return GestureDetector( @@ -70,10 +65,8 @@ class ScanProductCardFound extends StatelessWidget { ); } - String get _heroTag => ProductPicture.generateHeroTag( - product.barcode!, - ImageField.FRONT, - ); + String get _heroTag => + ProductPicture.generateHeroTag(product.barcode!, ImageField.FRONT); void _openProductPage(BuildContext context) { AppNavigator.of(context).push( diff --git a/packages/smooth_app/lib/pages/scan/scan_product_card_loader.dart b/packages/smooth_app/lib/pages/scan/scan_product_card_loader.dart index 0d254effcf..75e672c110 100644 --- a/packages/smooth_app/lib/pages/scan/scan_product_card_loader.dart +++ b/packages/smooth_app/lib/pages/scan/scan_product_card_loader.dart @@ -22,21 +22,19 @@ class ScanProductCardLoader extends StatelessWidget { final LocalDatabase localDatabase = context.watch(); return FutureBuilder( future: DaoProduct(localDatabase).get(barcode), - builder: ( - final BuildContext context, - final AsyncSnapshot snapshot, - ) { - if (snapshot.data != null) { - return ScanProductCardFound( - product: snapshot.data!, - onRemoveProduct: onRemoveProduct, - ); - } - return ScanProductCardLoading( - barcode: barcode, - onRemoveProduct: onRemoveProduct, - ); - }, + builder: + (final BuildContext context, final AsyncSnapshot snapshot) { + if (snapshot.data != null) { + return ScanProductCardFound( + product: snapshot.data!, + onRemoveProduct: onRemoveProduct, + ); + } + return ScanProductCardLoading( + barcode: barcode, + onRemoveProduct: onRemoveProduct, + ); + }, ); } } diff --git a/packages/smooth_app/lib/pages/scan/smooth_barcode_scanner_mockup.dart b/packages/smooth_app/lib/pages/scan/smooth_barcode_scanner_mockup.dart index 4a5ebf08f9..7b21026042 100644 --- a/packages/smooth_app/lib/pages/scan/smooth_barcode_scanner_mockup.dart +++ b/packages/smooth_app/lib/pages/scan/smooth_barcode_scanner_mockup.dart @@ -2,9 +2,7 @@ import 'package:flutter/material.dart'; /// Fake barcode scanner, for tests. class SmoothBarcodeScannerMocked extends StatelessWidget { - const SmoothBarcodeScannerMocked({ - super.key, - }); + const SmoothBarcodeScannerMocked({super.key}); @override Widget build(BuildContext context) => Container(color: Colors.red); diff --git a/packages/smooth_app/lib/pages/search/search_field.dart b/packages/smooth_app/lib/pages/search/search_field.dart index 4333c14c35..b11d4f1527 100644 --- a/packages/smooth_app/lib/pages/search/search_field.dart +++ b/packages/smooth_app/lib/pages/search/search_field.dart @@ -102,10 +102,7 @@ class _SearchFieldState extends State { enableSuggestions: widget.enableSuggestions, autocorrect: widget.autocorrect, style: textStyle, - decoration: _getInputDecoration( - context, - localizations, - ), + decoration: _getInputDecoration(context, localizations), cursorColor: textStyle.color, ), if (additionalFilter != null) additionalFilter, @@ -142,24 +139,18 @@ class _SearchFieldState extends State { child: _BackIcon(), ), prefixIconConstraints: BoxConstraints.tightFor( - width: SearchFieldUIHelper.SEARCH_BAR_HEIGHT + + width: + SearchFieldUIHelper.SEARCH_BAR_HEIGHT + (SearchFieldUIHelper.SEARCH_BAR_PADDING.horizontal) / 2, ), suffixIcon: widget.showClearButton - ? _SearchIcon( - onTap: () => _performSearch(context, _controller!.text), - ) + ? _SearchIcon(onTap: () => _performSearch(context, _controller!.text)) : null, ); } - void _performSearch(BuildContext context, String query) => - widget.searchHelper.searchWithController( - context, - query, - _controller!, - _focusNode, - ); + void _performSearch(BuildContext context, String query) => widget.searchHelper + .searchWithController(context, query, _controller!, _focusNode); @override void dispose() { @@ -203,12 +194,8 @@ class _SearchIcon extends StatelessWidget { } class SearchBarIcon extends StatelessWidget { - const SearchBarIcon({ - this.icon, - this.onTap, - this.label, - super.key, - }) : assert(label == null || onTap != null); + const SearchBarIcon({this.icon, this.onTap, this.label, super.key}) + : assert(label == null || onTap != null); final VoidCallback? onTap; final String? label; @@ -216,8 +203,9 @@ class SearchBarIcon extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension theme = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension theme = Theme.of( + context, + ).extension()!; final Widget widget = AspectRatio( aspectRatio: 1.0, @@ -229,10 +217,7 @@ class SearchBarIcon extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(BALANCED_SPACE), child: IconTheme( - data: const IconThemeData( - size: 20.0, - color: Colors.white, - ), + data: const IconThemeData(size: 20.0, color: Colors.white), child: icon ?? const icons.Search(), ), ), @@ -268,11 +253,7 @@ class SearchFieldUIHelper { Radius.circular(30.0), ); static const EdgeInsetsGeometry SEARCH_BAR_PADDING = - EdgeInsetsDirectional.only( - start: 20.0, - end: BALANCED_SPACE, - bottom: 3.0, - ); + EdgeInsetsDirectional.only(start: 20.0, end: BALANCED_SPACE, bottom: 3.0); static TextStyle textStyle(BuildContext context) { final bool lightTheme = !context.watch().isDarkMode(context); @@ -280,15 +261,17 @@ class SearchFieldUIHelper { } static BoxDecoration decoration(BuildContext context) { - final SmoothColorsThemeExtension theme = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension theme = Theme.of( + context, + ).extension()!; final bool lightTheme = !context.watch().isDarkMode(context); return BoxDecoration( borderRadius: SearchFieldUIHelper.SEARCH_BAR_BORDER_RADIUS, color: lightTheme ? Colors.white : theme.greyDark, border: Border.all( - color: lightTheme ? theme.primaryBlack : theme.primarySemiDark), + color: lightTheme ? theme.primaryBlack : theme.primarySemiDark, + ), ); } } diff --git a/packages/smooth_app/lib/pages/search/search_history_view.dart b/packages/smooth_app/lib/pages/search/search_history_view.dart index 7c2ab7e3c1..978f651e33 100644 --- a/packages/smooth_app/lib/pages/search/search_history_view.dart +++ b/packages/smooth_app/lib/pages/search/search_history_view.dart @@ -36,8 +36,9 @@ class _SearchHistoryViewState extends State { void _fetchQueries() { final LocalDatabase localDatabase = context.watch(); - final List queries = - widget.searchHelper.getAllQueries(localDatabase); + final List queries = widget.searchHelper.getAllQueries( + localDatabase, + ); setState(() => _queries = queries); } @@ -91,7 +92,8 @@ class _SearchHistoryViewState extends State { }, ); }, - itemCount: _queries.length + + itemCount: + _queries.length + widget.preloadedList.length + 1, // +1 for the "Copy from clipboard" ), @@ -105,8 +107,9 @@ class _SearchHistoryViewState extends State { ); controller.text = query; - controller.selection = - TextSelection.fromPosition(TextPosition(offset: query.length)); + controller.selection = TextSelection.fromPosition( + TextPosition(offset: query.length), + ); // If the keyboard is hidden, show it. if (View.of(context).viewInsets.bottom == 0) { @@ -144,10 +147,7 @@ class _SearchHistoryTile extends StatelessWidget { color: RED_COLOR, alignment: AlignmentDirectional.centerEnd, padding: const EdgeInsetsDirectional.only(end: LARGE_SPACE * 2), - child: const Icon( - Icons.delete, - color: Colors.white, - ), + child: const Icon(Icons.delete, color: Colors.white), ), child: InkWell( onTap: () => onTap(), @@ -156,9 +156,7 @@ class _SearchHistoryTile extends StatelessWidget { child: ListTile( leading: const Padding( padding: EdgeInsetsDirectional.only(top: VERY_SMALL_SPACE), - child: Icon( - Icons.search, - ), + child: Icon(Icons.search), ), trailing: InkWell( customBorder: const CircleBorder(), @@ -182,9 +180,7 @@ class _SearchHistoryTile extends StatelessWidget { } class _SearchItemPasteFromClipboard extends StatelessWidget { - const _SearchItemPasteFromClipboard({ - required this.onData, - }); + const _SearchItemPasteFromClipboard({required this.onData}); final Function(String) onData; diff --git a/packages/smooth_app/lib/pages/search/search_page.dart b/packages/smooth_app/lib/pages/search/search_page.dart index 5717eb8e41..2f3776a67d 100644 --- a/packages/smooth_app/lib/pages/search/search_page.dart +++ b/packages/smooth_app/lib/pages/search/search_page.dart @@ -22,12 +22,12 @@ class SearchPage extends StatefulWidget { }); SearchPage.fromExtra(SearchPageExtra extra) - : this( - extra.searchHelper, - preloadedList: extra.preloadedList, - autofocus: extra.autofocus ?? true, - heroTag: extra.heroTag, - ); + : this( + extra.searchHelper, + preloadedList: extra.preloadedList, + autofocus: extra.autofocus ?? true, + heroTag: extra.heroTag, + ); final SearchHelper searchHelper; final List? preloadedList; @@ -104,22 +104,18 @@ class _SearchPageState extends State { ), Expanded( child: Consumer( - builder: ( - BuildContext context, - SearchHelper searchHelper, - _, - ) { + builder: (BuildContext context, SearchHelper searchHelper, _) { /// Show the history when there is no search if (searchHelper.value == null) { return SearchHistoryView( focusNode: _searchFocusNode, onTap: (String query) => widget.searchHelper.searchWithController( - context, - query, - _searchTextController, - _searchFocusNode, - ), + context, + query, + _searchTextController, + _searchFocusNode, + ), searchHelper: widget.searchHelper, preloadedList: widget.preloadedList ?? [], @@ -131,9 +127,7 @@ class _SearchPageState extends State { return Navigator( key: _navigatorKey, pages: >[ - MaterialPage( - child: searchHelper.value!.widget, - ), + MaterialPage(child: searchHelper.value!.widget), ], onDidRemovePage: (_) { /// Mandatory to provide this method diff --git a/packages/smooth_app/lib/pages/search/search_product_helper.dart b/packages/smooth_app/lib/pages/search/search_product_helper.dart index 10c9072735..1a2aa60a04 100644 --- a/packages/smooth_app/lib/pages/search/search_product_helper.dart +++ b/packages/smooth_app/lib/pages/search/search_product_helper.dart @@ -34,8 +34,8 @@ class SearchProductHelper extends SearchHelper { @override Widget? getAdditionalFilter() => UserPreferences.getUserPreferencesSync().searchProductTypeFilterVisible - ? _ProductTypeFilter(this) - : null; + ? _ProductTypeFilter(this) + : null; @override void search( @@ -62,15 +62,11 @@ class SearchProductHelper extends SearchHelper { // TODO(monsieurtanuki): we should use searchQueryCallback here too, shouldn't we? ); } else { - _onSubmittedText( - query, - context, - localDatabase, - ); + _onSubmittedText(query, context, localDatabase); } } -// used to be in now defunct `ChoosePage` + // used to be in now defunct `ChoosePage` Future _onSubmittedBarcode( final String value, final BuildContext context, @@ -81,8 +77,8 @@ class SearchProductHelper extends SearchHelper { context: context, localDatabase: localDatabase, ); - final FetchedProduct fetchedProduct = - await productDialogHelper.openBestChoice(); + final FetchedProduct fetchedProduct = await productDialogHelper + .openBestChoice(); if (fetchedProduct.status == FetchedProductStatus.ok && fetchedProduct.isValid) { // TODO(monsieurtanuki): add OxF to Matomo data? @@ -123,7 +119,8 @@ class SearchProductHelper extends SearchHelper { localDatabase: localDatabase, productQuery: KeywordsProductQuery( value, - productType: UserPreferences.getUserPreferencesSync() + productType: + UserPreferences.getUserPreferencesSync() .searchProductTypeFilterVisible ? ProductType.food : _productType, diff --git a/packages/smooth_app/lib/pages/text_field_helper.dart b/packages/smooth_app/lib/pages/text_field_helper.dart index 5f2d47390a..8f82986e73 100644 --- a/packages/smooth_app/lib/pages/text_field_helper.dart +++ b/packages/smooth_app/lib/pages/text_field_helper.dart @@ -4,8 +4,8 @@ import 'package:flutter/material.dart'; /// and persists the previous value. class TextEditingControllerWithHistory extends TextEditingController { TextEditingControllerWithHistory({super.text}) - : _initialValue = text, - _previousValue = text; + : _initialValue = text, + _previousValue = text; final String? _initialValue; String? _previousValue; diff --git a/packages/smooth_app/lib/pages/user_management/forgot_password_page.dart b/packages/smooth_app/lib/pages/user_management/forgot_password_page.dart index 1a7f14fb53..2dea34656e 100644 --- a/packages/smooth_app/lib/pages/user_management/forgot_password_page.dart +++ b/packages/smooth_app/lib/pages/user_management/forgot_password_page.dart @@ -77,9 +77,7 @@ class _ForgotPasswordPageState extends State appBar: SmoothAppBar( backgroundColor: Colors.transparent, elevation: 0, - iconTheme: IconThemeData( - color: Theme.of(context).colorScheme.primary, - ), + iconTheme: IconThemeData(color: Theme.of(context).colorScheme.primary), ), body: Form( key: _formKey, @@ -115,9 +113,7 @@ class _ForgotPasswordPageState extends State color: _send ? Colors.green : Colors.red, child: Text(_message), ), - const Spacer( - flex: 1, - ) + const Spacer(flex: 1), ], if (!_send) SmoothTextFormField( diff --git a/packages/smooth_app/lib/pages/user_management/login_page.dart b/packages/smooth_app/lib/pages/user_management/login_page.dart index 47dcd727e4..a6fb0dd105 100644 --- a/packages/smooth_app/lib/pages/user_management/login_page.dart +++ b/packages/smooth_app/lib/pages/user_management/login_page.dart @@ -38,8 +38,8 @@ class _LoginPageState extends State with TraceableClientMixin { return; } - final UserManagementProvider userManagementProvider = - context.read(); + final UserManagementProvider userManagementProvider = context + .read(); setState(() { _runningQuery = true; @@ -47,10 +47,7 @@ class _LoginPageState extends State with TraceableClientMixin { }); _loginResult = await userManagementProvider.login( - User( - userId: userIdController.text, - password: passwordController.text, - ), + User(userId: userIdController.text, password: passwordController.text), context.read(), ); if (!context.mounted) { @@ -92,9 +89,7 @@ class _LoginPageState extends State with TraceableClientMixin { appBar: SmoothAppBar( backgroundColor: Colors.transparent, elevation: 0, - iconTheme: IconThemeData( - color: Theme.of(context).colorScheme.primary, - ), + iconTheme: IconThemeData(color: Theme.of(context).colorScheme.primary), ), body: Form( key: _formKey, @@ -129,9 +124,7 @@ class _LoginPageState extends State with TraceableClientMixin { ), ), - const SizedBox( - height: LARGE_SPACE * 3, - ), + const SizedBox(height: LARGE_SPACE * 3), if (_loginResult != null && _loginResult!.type != LoginResultType.successful) @@ -162,9 +155,7 @@ class _LoginPageState extends State with TraceableClientMixin { enabled: !_runningQuery, // Moves focus to the next field textInputAction: TextInputAction.next, - autofillHints: const [ - AutofillHints.email, - ], + autofillHints: const [AutofillHints.email], validator: (String? value) { if (value == null || value.isEmpty) { return appLocalizations @@ -174,9 +165,7 @@ class _LoginPageState extends State with TraceableClientMixin { }, ), - const SizedBox( - height: LARGE_SPACE * 2, - ), + const SizedBox(height: LARGE_SPACE * 2), //Password SmoothTextFormField( @@ -189,9 +178,7 @@ class _LoginPageState extends State with TraceableClientMixin { enabled: !_runningQuery, textInputAction: TextInputAction.send, // Hides the keyboard - autofillHints: const [ - AutofillHints.password, - ], + autofillHints: const [AutofillHints.password], validator: (String? value) { if (value == null || value.isEmpty) { return appLocalizations @@ -206,9 +193,7 @@ class _LoginPageState extends State with TraceableClientMixin { }, ), - const SizedBox( - height: LARGE_SPACE * 2, - ), + const SizedBox(height: LARGE_SPACE * 2), //Sign in button if (_runningQuery) @@ -218,15 +203,17 @@ class _LoginPageState extends State with TraceableClientMixin { onPressed: () => _login(context), style: ButtonStyle( minimumSize: WidgetStateProperty.all( - Size(size.width * 0.5, - theme.buttonTheme.height + 10), + Size( + size.width * 0.5, + theme.buttonTheme.height + 10, + ), ), shape: WidgetStateProperty.all( - const RoundedRectangleBorder( - borderRadius: CIRCULAR_BORDER_RADIUS, - ), - ), + const RoundedRectangleBorder( + borderRadius: CIRCULAR_BORDER_RADIUS, + ), + ), ), child: Text( appLocalizations.sign_in, @@ -238,9 +225,7 @@ class _LoginPageState extends State with TraceableClientMixin { ), ), - const SizedBox( - height: LARGE_SPACE * 2, - ), + const SizedBox(height: LARGE_SPACE * 2), //Forgot password TextButton( @@ -253,10 +238,10 @@ class _LoginPageState extends State with TraceableClientMixin { ), shape: WidgetStateProperty.all( - const RoundedRectangleBorder( - borderRadius: CIRCULAR_BORDER_RADIUS, - ), - ), + const RoundedRectangleBorder( + borderRadius: CIRCULAR_BORDER_RADIUS, + ), + ), ), onPressed: () async => Navigator.push( context, @@ -274,9 +259,7 @@ class _LoginPageState extends State with TraceableClientMixin { ), ), - const SizedBox( - height: LARGE_SPACE * 2, - ), + const SizedBox(height: LARGE_SPACE * 2), //Open register page SizedBox( @@ -302,21 +285,24 @@ class _LoginPageState extends State with TraceableClientMixin { style: ButtonStyle( side: WidgetStateProperty.all( BorderSide( - color: theme.colorScheme.primary, width: 2.0), + color: theme.colorScheme.primary, + width: 2.0, + ), ), minimumSize: WidgetStateProperty.all( Size(size.width * 0.5, theme.buttonTheme.height), ), shape: WidgetStateProperty.all( - const RoundedRectangleBorder( - borderRadius: CIRCULAR_BORDER_RADIUS, - ), - ), + const RoundedRectangleBorder( + borderRadius: CIRCULAR_BORDER_RADIUS, + ), + ), ), child: Padding( - padding: - const EdgeInsetsDirectional.only(bottom: 2.0), + padding: const EdgeInsetsDirectional.only( + bottom: 2.0, + ), child: Text( appLocalizations.create_account, style: theme.textTheme.bodyMedium?.copyWith( diff --git a/packages/smooth_app/lib/pages/user_management/sign_up_page.dart b/packages/smooth_app/lib/pages/user_management/sign_up_page.dart index d084e64f80..b705481691 100644 --- a/packages/smooth_app/lib/pages/user_management/sign_up_page.dart +++ b/packages/smooth_app/lib/pages/user_management/sign_up_page.dart @@ -101,9 +101,7 @@ class _SignUpPageState extends State with TraceableClientMixin { textInputAction: TextInputAction.next, hintText: appLocalizations.sign_up_page_display_name_hint, prefixIcon: const Icon(Icons.person), - autofillHints: const [ - AutofillHints.name, - ], + autofillHints: const [AutofillHints.name], validator: (String? value) { if (value == null || value.isEmpty) { return appLocalizations @@ -121,14 +119,13 @@ class _SignUpPageState extends State with TraceableClientMixin { textInputAction: TextInputAction.next, hintText: appLocalizations.sign_up_page_email_hint, prefixIcon: const Icon(Icons.person), - autofillHints: const [ - AutofillHints.email, - ], + autofillHints: const [AutofillHints.email], validator: (String? value) { if (value == null || value.isEmpty) { return appLocalizations.sign_up_page_email_error_empty; } else if (!UserManagementHelper.isEmailValid( - _emailController.trimmedText)) { + _emailController.trimmedText, + )) { return appLocalizations.sign_up_page_email_error_invalid; } else { return null; @@ -143,19 +140,19 @@ class _SignUpPageState extends State with TraceableClientMixin { textInputAction: TextInputAction.next, hintText: appLocalizations.sign_up_page_username_hint, prefixIcon: const Icon(Icons.person), - autofillHints: const [ - AutofillHints.newUsername, - ], + autofillHints: const [AutofillHints.newUsername], validator: (String? value) { if (value == null || value.isEmpty) { return appLocalizations.sign_up_page_username_error_empty; } if (!UserManagementHelper.isUsernameValid( - _userController.trimmedText)) { + _userController.trimmedText, + )) { return appLocalizations.sign_up_page_username_description; } if (!UserManagementHelper.isUsernameLengthValid( - _userController.trimmedText)) { + _userController.trimmedText, + )) { const int maxLength = OpenFoodAPIClient.USER_NAME_MAX_LENGTH; return appLocalizations @@ -175,9 +172,7 @@ class _SignUpPageState extends State with TraceableClientMixin { onFieldSubmitted: (_) => FocusScope.of(context).requestFocus(_password2FocusNode), prefixIcon: const Icon(Icons.vpn_key), - autofillHints: const [ - AutofillHints.newPassword, - ], + autofillHints: const [AutofillHints.newPassword], validator: (String? value) { if (value == null || value.isEmpty) { return appLocalizations.sign_up_page_password_error_empty; @@ -198,9 +193,7 @@ class _SignUpPageState extends State with TraceableClientMixin { hintText: appLocalizations.sign_up_page_confirm_password_hint, maxLines: 1, prefixIcon: const Icon(Icons.vpn_key), - autofillHints: const [ - AutofillHints.newPassword, - ], + autofillHints: const [AutofillHints.newPassword], validator: (String? value) { if (value == null || value.isEmpty) { return appLocalizations @@ -227,11 +220,9 @@ class _SignUpPageState extends State with TraceableClientMixin { disagree: _disagreed, checkboxColorResolver: getCheckBoxColor, onCheckboxChanged: (bool checked) { - setState( - () { - _agree = checked; - }, - ); + setState(() { + _agree = checked; + }); }, ), const SizedBox(height: space), @@ -244,15 +235,17 @@ class _SignUpPageState extends State with TraceableClientMixin { ignoring: true, child: Checkbox( value: _foodProducer, - fillColor: - WidgetStateProperty.resolveWith(getCheckBoxColor), + fillColor: WidgetStateProperty.resolveWith( + getCheckBoxColor, + ), onChanged: (_) {}, ), ), title: Text( appLocalizations.sign_up_page_producer_checkbox, - style: theme.textTheme.bodyMedium - ?.copyWith(color: theme.colorScheme.onSurface), + style: theme.textTheme.bodyMedium?.copyWith( + color: theme.colorScheme.onSurface, + ), ), ), if (_foodProducer) ...[ @@ -270,7 +263,7 @@ class _SignUpPageState extends State with TraceableClientMixin { } return null; }, - ) + ), ], const SizedBox(height: space), ListTile( @@ -282,15 +275,17 @@ class _SignUpPageState extends State with TraceableClientMixin { ignoring: true, child: Checkbox( value: _subscribe, - fillColor: - WidgetStateProperty.resolveWith(getCheckBoxColor), + fillColor: WidgetStateProperty.resolveWith( + getCheckBoxColor, + ), onChanged: (_) {}, ), ), title: Text( appLocalizations.sign_up_page_subscribe_checkbox, - style: theme.textTheme.bodyMedium - ?.copyWith(color: theme.colorScheme.onSurface), + style: theme.textTheme.bodyMedium?.copyWith( + color: theme.colorScheme.onSurface, + ), ), ), const SizedBox(height: space), @@ -336,9 +331,10 @@ class _SignUpPageState extends State with TraceableClientMixin { userId: _userController.trimmedText, password: _password1Controller.text, ); - final bool prodUrl = context - .read() - .getFlag(UserPreferencesDevMode.userPreferencesFlagProd) ?? + final bool prodUrl = + context.read().getFlag( + UserPreferencesDevMode.userPreferencesFlagProd, + ) ?? true; final SignUpStatus? status = await LoadingDialog.run( @@ -366,37 +362,43 @@ class _SignUpPageState extends State with TraceableClientMixin { // Highlight the field with the error if (status.statusErrors?.isNotEmpty == true) { - if (status.statusErrors! - .contains(SignUpStatusError.EMAIL_ALREADY_USED)) { + if (status.statusErrors!.contains( + SignUpStatusError.EMAIL_ALREADY_USED, + )) { _emailFocusNode.requestFocus(); errorMessage = '${_emailController.trimmedText} ${appLocalisations.sign_up_page_email_already_exists}'; - } else if (status.statusErrors! - .contains(SignUpStatusError.INCORRECT_EMAIL) || + } else if (status.statusErrors!.contains( + SignUpStatusError.INCORRECT_EMAIL, + ) || status.error!.contains('Invalid e-mail address')) { _emailFocusNode.requestFocus(); errorMessage = appLocalisations.sign_up_page_provide_valid_email; - } else if (status.statusErrors! - .contains(SignUpStatusError.INVALID_PASSWORD)) { + } else if (status.statusErrors!.contains( + SignUpStatusError.INVALID_PASSWORD, + )) { _password1FocusNode.requestFocus(); errorMessage = appLocalisations.sign_up_page_password_error_invalid; - } else if (status.statusErrors! - .contains(SignUpStatusError.INVALID_USERNAME)) { + } else if (status.statusErrors!.contains( + SignUpStatusError.INVALID_USERNAME, + )) { _userFocusNode.requestFocus(); errorMessage = '${appLocalisations.sign_up_page_username_description} ${appLocalisations.sign_up_page_username_length_invalid}'; - } else if (status.statusErrors! - .contains(SignUpStatusError.USERNAME_ALREADY_USED)) { + } else if (status.statusErrors!.contains( + SignUpStatusError.USERNAME_ALREADY_USED, + )) { _userFocusNode.requestFocus(); errorMessage = appLocalisations.sign_up_page_user_name_already_used; - } else if (status.statusErrors! - .contains(SignUpStatusError.SERVER_BUSY)) { + } else if (status.statusErrors!.contains( + SignUpStatusError.SERVER_BUSY, + )) { errorMessage = appLocalisations.sign_up_page_server_busy; } else { // Let's try to find the error in - final Iterable allMatches = - RegExp('(
  • )(.*?)(
  • )') - .allMatches(status.error!); + final Iterable allMatches = RegExp( + '(
  • )(.*?)(
  • )', + ).allMatches(status.error!); if (allMatches.isNotEmpty) { final StringBuffer buffer = StringBuffer(); for (final RegExpMatch match in allMatches) { @@ -527,9 +529,9 @@ class _TermsOfUseCheckbox extends StatelessWidget { child: Icon( semanticLabel: appLocalizations.termsOfUse, Icons.info, - color: checkboxColorResolver( - {WidgetState.selected}, - ), + color: checkboxColorResolver({ + WidgetState.selected, + }), ), ), ), @@ -542,7 +544,7 @@ class _TermsOfUseCheckbox extends StatelessWidget { appLocalizations.sign_up_page_agree_error_invalid, style: TextStyle(color: theme.colorScheme.error), ), - ) + ), ], ), ); @@ -552,10 +554,7 @@ class _TermsOfUseCheckbox extends StatelessWidget { final String url = appLocalizations.sign_up_page_agree_url; try { - await launchUrl( - Uri.parse(url), - mode: LaunchMode.platformDefault, - ); + await launchUrl(Uri.parse(url), mode: LaunchMode.platformDefault); } catch (_) {} } } diff --git a/packages/smooth_app/lib/query/barcode_product_query.dart b/packages/smooth_app/lib/query/barcode_product_query.dart index 88904ed1c2..7faaddd3a1 100644 --- a/packages/smooth_app/lib/query/barcode_product_query.dart +++ b/packages/smooth_app/lib/query/barcode_product_query.dart @@ -19,11 +19,11 @@ class BarcodeProductQuery { Future getFetchedProduct() async { ProductQuery.setUserAgentComment(isScanned ? 'scan' : 'search'); - final FetchedProduct fetchedProduct = - await ProductRefresher().silentFetchAndRefresh( - barcode: barcode, - localDatabase: daoProduct.localDatabase, - ); + final FetchedProduct fetchedProduct = await ProductRefresher() + .silentFetchAndRefresh( + barcode: barcode, + localDatabase: daoProduct.localDatabase, + ); ProductQuery.setUserAgentComment(''); if (fetchedProduct.product != null) { if (fetchedProduct.product!.obsolete == true) { diff --git a/packages/smooth_app/lib/query/category_product_query.dart b/packages/smooth_app/lib/query/category_product_query.dart index 9b996d42f8..769db0a154 100644 --- a/packages/smooth_app/lib/query/category_product_query.dart +++ b/packages/smooth_app/lib/query/category_product_query.dart @@ -16,23 +16,24 @@ class CategoryProductQuery extends PagedSearchProductQuery { @override Parameter getParameter() => TagFilter.fromType( - tagFilterType: TagFilterType.CATEGORIES, - contains: true, - tagName: categoryTag, - ); + tagFilterType: TagFilterType.CATEGORIES, + contains: true, + tagName: categoryTag, + ); @override ProductList getProductList() => ProductList.categorySearch( - categoryTag, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - country: country, - productType: productType, - ); + categoryTag, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + country: country, + productType: productType, + ); @override - String toString() => 'CategoryProductQuery(' + String toString() => + 'CategoryProductQuery(' '"$categoryTag"' ', $pageSize' ', $pageNumber' diff --git a/packages/smooth_app/lib/query/keywords_product_query.dart b/packages/smooth_app/lib/query/keywords_product_query.dart index d2cde92f44..9ae178af1e 100644 --- a/packages/smooth_app/lib/query/keywords_product_query.dart +++ b/packages/smooth_app/lib/query/keywords_product_query.dart @@ -18,16 +18,17 @@ class KeywordsProductQuery extends PagedSearchProductQuery { @override ProductList getProductList() => ProductList.keywordSearch( - keywords, - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - country: country, - productType: productType, - ); + keywords, + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + country: country, + productType: productType, + ); @override - String toString() => 'KeywordsProductQuery(' + String toString() => + 'KeywordsProductQuery(' '"$keywords"' ', $pageSize' ', $pageNumber' @@ -39,11 +40,7 @@ class KeywordsProductQuery extends PagedSearchProductQuery { @override PagedProductQuery? getWorldQuery() => world ? null - : KeywordsProductQuery( - keywords, - productType: productType, - world: true, - ); + : KeywordsProductQuery(keywords, productType: productType, world: true); @override bool hasDifferentCountryWorldData() => true; diff --git a/packages/smooth_app/lib/query/paged_product_query.dart b/packages/smooth_app/lib/query/paged_product_query.dart index e4dda790bf..8362c0ab49 100644 --- a/packages/smooth_app/lib/query/paged_product_query.dart +++ b/packages/smooth_app/lib/query/paged_product_query.dart @@ -5,10 +5,7 @@ import 'package:smooth_app/query/search_products_manager.dart'; /// Paged product query (with [pageSize] and [pageNumber]). abstract class PagedProductQuery { - PagedProductQuery({ - required this.productType, - this.world = false, - }); + PagedProductQuery({required this.productType, this.world = false}); final ProductType productType; final int pageSize = _typicalPageSize; diff --git a/packages/smooth_app/lib/query/paged_search_product_query.dart b/packages/smooth_app/lib/query/paged_search_product_query.dart index b4973bd752..e7b991f3d9 100644 --- a/packages/smooth_app/lib/query/paged_search_product_query.dart +++ b/packages/smooth_app/lib/query/paged_search_product_query.dart @@ -4,10 +4,7 @@ import 'package:smooth_app/query/product_query.dart'; /// Back-end paged queries around search. abstract class PagedSearchProductQuery extends PagedProductQuery { - PagedSearchProductQuery({ - required super.productType, - super.world, - }); + PagedSearchProductQuery({required super.productType, super.world}); Parameter getParameter(); diff --git a/packages/smooth_app/lib/query/paged_to_be_completed_product_query.dart b/packages/smooth_app/lib/query/paged_to_be_completed_product_query.dart index 8115feeed3..75e8b9527e 100644 --- a/packages/smooth_app/lib/query/paged_to_be_completed_product_query.dart +++ b/packages/smooth_app/lib/query/paged_to_be_completed_product_query.dart @@ -5,10 +5,7 @@ import 'package:smooth_app/query/product_query.dart'; /// Back-end paged query for all "to-be-completed" products. class PagedToBeCompletedProductQuery extends PagedProductQuery { - PagedToBeCompletedProductQuery({ - required super.productType, - super.world, - }); + PagedToBeCompletedProductQuery({required super.productType, super.world}); @override AbstractQueryConfiguration getQueryConfiguration() => @@ -20,9 +17,7 @@ class PagedToBeCompletedProductQuery extends PagedProductQuery { PageSize(size: pageSize), PageNumber(page: pageNumber), const StatesTagsParameter( - map: { - ProductState.CATEGORIES_COMPLETED: false, - }, + map: {ProductState.CATEGORIES_COMPLETED: false}, ), const SortBy(option: SortOption.EDIT), ], @@ -31,15 +26,16 @@ class PagedToBeCompletedProductQuery extends PagedProductQuery { @override ProductList getProductList() => ProductList.allToBeCompleted( - pageSize: pageSize, - pageNumber: pageNumber, - language: language, - country: country, - productType: productType, - ); + pageSize: pageSize, + pageNumber: pageNumber, + language: language, + country: country, + productType: productType, + ); @override - String toString() => 'PagedToBeCompletedProductQuery(' + String toString() => + 'PagedToBeCompletedProductQuery(' '$pageSize' ', $pageNumber' ', $language' @@ -50,10 +46,7 @@ class PagedToBeCompletedProductQuery extends PagedProductQuery { @override PagedProductQuery? getWorldQuery() => world ? null - : PagedToBeCompletedProductQuery( - productType: productType, - world: true, - ); + : PagedToBeCompletedProductQuery(productType: productType, world: true); @override bool hasDifferentCountryWorldData() => true; diff --git a/packages/smooth_app/lib/query/paged_user_product_query.dart b/packages/smooth_app/lib/query/paged_user_product_query.dart index 7d4e48b107..e395a49031 100644 --- a/packages/smooth_app/lib/query/paged_user_product_query.dart +++ b/packages/smooth_app/lib/query/paged_user_product_query.dart @@ -17,10 +17,7 @@ enum UserSearchType { /// Where the user edited a product that still needs to be completed. TO_BE_COMPLETED(TagFilterType.INFORMERS, toBeCompleted: true); - const UserSearchType( - this.type, { - this.toBeCompleted = false, - }); + const UserSearchType(this.type, {this.toBeCompleted = false}); final TagFilterType type; final bool toBeCompleted; @@ -31,23 +28,20 @@ enum UserSearchType { final int pageNumber, final OpenFoodFactsLanguage language, final List fields, - ) => - ProductSearchQueryConfiguration( - parametersList: [ - TagFilter.fromType(tagFilterType: type, tagName: userId), - PageSize(size: pageSize), - PageNumber(page: pageNumber), - if (toBeCompleted) - const StatesTagsParameter( - map: { - ProductState.COMPLETED: false, - }, - ), - ], - language: language, - fields: fields, - version: ProductQuery.productQueryVersion, - ); + ) => ProductSearchQueryConfiguration( + parametersList: [ + TagFilter.fromType(tagFilterType: type, tagName: userId), + PageSize(size: pageSize), + PageNumber(page: pageNumber), + if (toBeCompleted) + const StatesTagsParameter( + map: {ProductState.COMPLETED: false}, + ), + ], + language: language, + fields: fields, + version: ProductQuery.productQueryVersion, + ); } /// Back-end paged queries around User. @@ -63,12 +57,12 @@ class PagedUserProductQuery extends PagedProductQuery { @override AbstractQueryConfiguration getQueryConfiguration() => type.getConfiguration( - userId, - pageSize, - pageNumber, - language, - ProductQuery.fields, - ); + userId, + pageSize, + pageNumber, + language, + ProductQuery.fields, + ); @override ProductList getProductList() { @@ -109,7 +103,8 @@ class PagedUserProductQuery extends PagedProductQuery { } @override - String toString() => 'PagedUserProductQuery(' + String toString() => + 'PagedUserProductQuery(' '$type' ', "$userId"' ', $pageSize' diff --git a/packages/smooth_app/lib/query/product_query.dart b/packages/smooth_app/lib/query/product_query.dart index 303ab6fa91..2fc18fd9ba 100644 --- a/packages/smooth_app/lib/query/product_query.dart +++ b/packages/smooth_app/lib/query/product_query.dart @@ -44,12 +44,14 @@ abstract class ProductQuery { final UserPreferences userPreferences, { String? languageCode, }) { - languageCode ??= userPreferences.appLanguageCode ?? + languageCode ??= + userPreferences.appLanguageCode ?? (context == null ? 'en' : Localizations.localeOf(context).languageCode); OpenFoodFactsCountryLocalization.setLocale(languageCode); - final OpenFoodFactsLanguage language = - LanguageHelper.fromJson(languageCode); + final OpenFoodFactsLanguage language = LanguageHelper.fromJson( + languageCode, + ); OpenFoodAPIConfiguration.globalLanguages = [ language, ]; @@ -62,12 +64,11 @@ abstract class ProductQuery { static OpenFoodFactsCountry getCountry() => _country; /// Sets the global country for API queries: implicit choice at init time. - static Future initCountry( - final UserPreferences userPreferences, - ) async { + static Future initCountry(final UserPreferences userPreferences) async { // not ideal, but we have many contributors monitoring France const OpenFoodFactsCountry defaultCountry = OpenFoodFactsCountry.FRANCE; - final String? isoCode = userPreferences.userCountryCode ?? + final String? isoCode = + userPreferences.userCountryCode ?? PlatformDispatcher.instance.locale.countryCode?.toLowerCase(); final OpenFoodFactsCountry country = OpenFoodFactsCountry.fromOffTag(isoCode) ?? defaultCountry; @@ -88,8 +89,9 @@ abstract class ProductQuery { final UserPreferences userPreferences, final String isoCode, ) async { - final OpenFoodFactsCountry? country = - OpenFoodFactsCountry.fromOffTag(isoCode); + final OpenFoodFactsCountry? country = OpenFoodFactsCountry.fromOffTag( + isoCode, + ); if (country == null) { return false; } @@ -113,7 +115,8 @@ abstract class ProductQuery { } /// Returns the global locale string (e.g. 'pt_BR') - static String getLocaleString() => '${getLanguage().code}' + static String getLocaleString() => + '${getLanguage().code}' '_' '${getCountry().offTag.toUpperCase()}'; @@ -164,10 +167,10 @@ abstract class ProductQuery { OpenFoodAPIConfiguration.globalUser ?? _testUser; static User get _testUser => const User( - userId: 'smoothie-app', - password: 'strawberrybanana', - comment: 'Test user for project smoothie', - ); + userId: 'smoothie-app', + password: 'strawberrybanana', + comment: 'Test user for project smoothie', + ); static late UriProductHelper _uriProductHelper; @@ -183,8 +186,8 @@ abstract class ProductQuery { static void setQueryType(final UserPreferences userPreferences) { UriProductHelper getProductHelper(final String flagProd) => userPreferences.getFlag(flagProd) ?? true - ? uriHelperFoodProd - : getTestUriProductHelper(userPreferences); + ? uriHelperFoodProd + : getTestUriProductHelper(userPreferences); _uriProductHelper = getProductHelper( UserPreferencesDevMode.userPreferencesFlagProd, @@ -193,7 +196,8 @@ abstract class ProductQuery { UserPreferencesDevMode.userPreferencesFlagPriceProd, ); uriFolksonomyHelper = UriHelper( - host: userPreferences.getDevModeString( + host: + userPreferences.getDevModeString( UserPreferencesDevMode.userPreferencesFolksonomyHost, ) ?? uriHelperFolksonomyProd.host, @@ -202,9 +206,12 @@ abstract class ProductQuery { /// Returns the standard test env, or the custom test env if relevant. static UriProductHelper getTestUriProductHelper( - final UserPreferences userPreferences) { - final String testEnvDomain = userPreferences.getDevModeString( - UserPreferencesDevMode.userPreferencesTestEnvDomain) ?? + final UserPreferences userPreferences, + ) { + final String testEnvDomain = + userPreferences.getDevModeString( + UserPreferencesDevMode.userPreferencesTestEnvDomain, + ) ?? ''; return testEnvDomain.isEmpty ? uriHelperFoodTest @@ -235,8 +242,9 @@ abstract class ProductQuery { if (productType == null) { return currentUriProductHelper; } - final ProductType? currentProductType = - extractProductType(currentUriProductHelper); + final ProductType? currentProductType = extractProductType( + currentUriProductHelper, + ); if (currentProductType == null) { return currentUriProductHelper; } @@ -256,61 +264,61 @@ abstract class ProductQuery { } static List get fields => const [ - ProductField.NAME, - ProductField.NAME_ALL_LANGUAGES, - ProductField.BRANDS, - ProductField.BARCODE, - ProductField.PRODUCT_TYPE, - ProductField.NUTRISCORE, - ProductField.FRONT_IMAGE, - ProductField.IMAGE_FRONT_URL, - ProductField.IMAGE_INGREDIENTS_URL, - ProductField.IMAGE_NUTRITION_URL, - ProductField.IMAGE_PACKAGING_URL, - ProductField.IMAGES, - ProductField.SELECTED_IMAGE, - ProductField.QUANTITY, - ProductField.SERVING_SIZE, - ProductField.STORES, - ProductField.PACKAGING_QUANTITY, - ProductField.PACKAGING, - ProductField.PACKAGINGS, - ProductField.PACKAGINGS_COMPLETE, - ProductField.PACKAGING_TAGS, - ProductField.PACKAGING_TEXT_ALL_LANGUAGES, - ProductField.NO_NUTRITION_DATA, - ProductField.NUTRIMENT_DATA_PER, - ProductField.NUTRITION_DATA, - ProductField.NUTRIMENTS, - ProductField.NUTRIENT_LEVELS, - ProductField.NUTRIMENT_ENERGY_UNIT, - ProductField.ADDITIVES, - ProductField.INGREDIENTS_ANALYSIS_TAGS, - ProductField.INGREDIENTS_TEXT, - ProductField.INGREDIENTS_TEXT_ALL_LANGUAGES, - ProductField.LABELS_TAGS, - ProductField.LABELS_TAGS_IN_LANGUAGES, - ProductField.COMPARED_TO_CATEGORY, - ProductField.CATEGORIES_TAGS, - ProductField.CATEGORIES_TAGS_IN_LANGUAGES, - ProductField.LANGUAGE, - ProductField.ATTRIBUTE_GROUPS, - ProductField.STATES_TAGS, - ProductField.ECOSCORE_DATA, - ProductField.ECOSCORE_GRADE, - ProductField.ECOSCORE_SCORE, - ProductField.KNOWLEDGE_PANELS, - ProductField.COUNTRIES, - ProductField.COUNTRIES_TAGS, - ProductField.COUNTRIES_TAGS_IN_LANGUAGES, - ProductField.EMB_CODES, - ProductField.ORIGINS, - ProductField.WEBSITE, - ProductField.OBSOLETE, - ProductField.OWNER_FIELDS, - ProductField.OWNER, - ProductField.TRACES, - ProductField.TRACES_TAGS, - ProductField.TRACES_TAGS_IN_LANGUAGES, - ]; + ProductField.NAME, + ProductField.NAME_ALL_LANGUAGES, + ProductField.BRANDS, + ProductField.BARCODE, + ProductField.PRODUCT_TYPE, + ProductField.NUTRISCORE, + ProductField.FRONT_IMAGE, + ProductField.IMAGE_FRONT_URL, + ProductField.IMAGE_INGREDIENTS_URL, + ProductField.IMAGE_NUTRITION_URL, + ProductField.IMAGE_PACKAGING_URL, + ProductField.IMAGES, + ProductField.SELECTED_IMAGE, + ProductField.QUANTITY, + ProductField.SERVING_SIZE, + ProductField.STORES, + ProductField.PACKAGING_QUANTITY, + ProductField.PACKAGING, + ProductField.PACKAGINGS, + ProductField.PACKAGINGS_COMPLETE, + ProductField.PACKAGING_TAGS, + ProductField.PACKAGING_TEXT_ALL_LANGUAGES, + ProductField.NO_NUTRITION_DATA, + ProductField.NUTRIMENT_DATA_PER, + ProductField.NUTRITION_DATA, + ProductField.NUTRIMENTS, + ProductField.NUTRIENT_LEVELS, + ProductField.NUTRIMENT_ENERGY_UNIT, + ProductField.ADDITIVES, + ProductField.INGREDIENTS_ANALYSIS_TAGS, + ProductField.INGREDIENTS_TEXT, + ProductField.INGREDIENTS_TEXT_ALL_LANGUAGES, + ProductField.LABELS_TAGS, + ProductField.LABELS_TAGS_IN_LANGUAGES, + ProductField.COMPARED_TO_CATEGORY, + ProductField.CATEGORIES_TAGS, + ProductField.CATEGORIES_TAGS_IN_LANGUAGES, + ProductField.LANGUAGE, + ProductField.ATTRIBUTE_GROUPS, + ProductField.STATES_TAGS, + ProductField.ECOSCORE_DATA, + ProductField.ECOSCORE_GRADE, + ProductField.ECOSCORE_SCORE, + ProductField.KNOWLEDGE_PANELS, + ProductField.COUNTRIES, + ProductField.COUNTRIES_TAGS, + ProductField.COUNTRIES_TAGS_IN_LANGUAGES, + ProductField.EMB_CODES, + ProductField.ORIGINS, + ProductField.WEBSITE, + ProductField.OBSOLETE, + ProductField.OWNER_FIELDS, + ProductField.OWNER, + ProductField.TRACES, + ProductField.TRACES_TAGS, + ProductField.TRACES_TAGS_IN_LANGUAGES, + ]; } diff --git a/packages/smooth_app/lib/query/product_questions_query.dart b/packages/smooth_app/lib/query/product_questions_query.dart index f6f943dcc9..8a3f84aa94 100644 --- a/packages/smooth_app/lib/query/product_questions_query.dart +++ b/packages/smooth_app/lib/query/product_questions_query.dart @@ -18,10 +18,10 @@ class ProductQuestionsQuery extends QuestionsQuery { ) async { final RobotoffQuestionResult result = await RobotoffAPIClient.getProductQuestions( - barcode, - ProductQuery.getLanguage(), - count: count, - ); + barcode, + ProductQuery.getLanguage(), + count: count, + ); if (result.questions?.isNotEmpty != true) { return []; } diff --git a/packages/smooth_app/lib/query/search_products_manager.dart b/packages/smooth_app/lib/query/search_products_manager.dart index ad64b48ee1..b712458246 100644 --- a/packages/smooth_app/lib/query/search_products_manager.dart +++ b/packages/smooth_app/lib/query/search_products_manager.dart @@ -14,32 +14,25 @@ enum SearchProductsType { /// General threshold: 10 requests per minute. static final TooManyRequestsManager _generalRequestManager = TooManyRequestsManager( - maxCount: 10, - duration: const Duration(minutes: 1), - ); + maxCount: 10, + duration: const Duration(minutes: 1), + ); /// Specific threshold for background tasks. static final TooManyRequestsManager _backgroundRequestManager = - TooManyRequestsManager( - maxCount: 3, - duration: const Duration(minutes: 1), - ); + TooManyRequestsManager(maxCount: 3, duration: const Duration(minutes: 1)); /// Specific threshold for count tasks. /// /// For the record there are currently 4 counts displayed. static final TooManyRequestsManager _countRequestManager = - TooManyRequestsManager( - maxCount: 4, - duration: const Duration(minutes: 1), - ); + TooManyRequestsManager(maxCount: 4, duration: const Duration(minutes: 1)); Future _specificWaitIfNeeded() async => switch (this) { - SearchProductsType.background => - _backgroundRequestManager.waitIfNeeded(), - SearchProductsType.count => _countRequestManager.waitIfNeeded(), - SearchProductsType.live => null, - }; + SearchProductsType.background => _backgroundRequestManager.waitIfNeeded(), + SearchProductsType.count => _countRequestManager.waitIfNeeded(), + SearchProductsType.live => null, + }; Future waitIfNeeded() async { await _specificWaitIfNeeded(); diff --git a/packages/smooth_app/lib/resources/app_animations.dart b/packages/smooth_app/lib/resources/app_animations.dart index a13d337acf..53980e690f 100644 --- a/packages/smooth_app/lib/resources/app_animations.dart +++ b/packages/smooth_app/lib/resources/app_animations.dart @@ -15,10 +15,7 @@ import 'package:smooth_app/themes/theme_provider.dart'; /// Widget to inject in the hierarchy to have a single instance of the RiveFile /// (assets/animations/off.riv) class AnimationsLoader extends StatefulWidget { - const AnimationsLoader({ - required this.child, - super.key, - }); + const AnimationsLoader({required this.child, super.key}); final Widget child; @@ -47,26 +44,18 @@ class _AnimationsLoaderState extends State { _file = RiveFile.import(data); }); }, - onError: (dynamic error) => Logs.e( - 'Unable to load Rive file', - ex: error, - ), + onError: (dynamic error) => Logs.e('Unable to load Rive file', ex: error), ); } @override Widget build(BuildContext context) { - return Provider.value( - value: _file, - child: widget.child, - ); + return Provider.value(value: _file, child: widget.child); } } class BarcodeAnimation extends StatelessWidget { - const BarcodeAnimation({ - super.key, - }); + const BarcodeAnimation({super.key}); @override Widget build(BuildContext context) { @@ -86,11 +75,8 @@ class BarcodeAnimation extends StatelessWidget { } class CloudUploadAnimation extends StatelessWidget { - const CloudUploadAnimation({ - required this.size, - this.color, - super.key, - }) : _circleColor = null; + const CloudUploadAnimation({required this.size, this.color, super.key}) + : _circleColor = null; const CloudUploadAnimation.circle({ required this.size, @@ -113,15 +99,13 @@ class CloudUploadAnimation extends StatelessWidget { animations: const ['Animation'], onInit: (Artboard artboard) { if (color != null) { - artboard.forEachComponent( - (Component child) { - if (child is Stroke) { - child.paint.color = color!; - } else if (child is SolidColor) { - child.color = color!; - } - }, - ); + artboard.forEachComponent((Component child) { + if (child is Stroke) { + child.paint.color = color!; + } else if (child is SolidColor) { + child.color = color!; + } + }); } }, ), @@ -129,10 +113,7 @@ class CloudUploadAnimation extends StatelessWidget { if (_circleColor != null) { widget = DecoratedBox( - decoration: BoxDecoration( - color: _circleColor, - shape: BoxShape.circle, - ), + decoration: BoxDecoration(color: _circleColor, shape: BoxShape.circle), child: Padding( padding: EdgeInsetsDirectional.only( top: size * 0.2, @@ -145,23 +126,16 @@ class CloudUploadAnimation extends StatelessWidget { ); } - return SizedBox.square( - dimension: size, - child: widget, - ); + return SizedBox.square(dimension: size, child: widget); } } class DoubleChevronAnimation extends StatefulWidget { - const DoubleChevronAnimation.animate({ - this.size, - super.key, - }) : animated = true; + const DoubleChevronAnimation.animate({this.size, super.key}) + : animated = true; - const DoubleChevronAnimation.stopped({ - this.size, - super.key, - }) : animated = false; + const DoubleChevronAnimation.stopped({this.size, super.key}) + : animated = false; final double? size; final bool animated; @@ -189,10 +163,7 @@ class _DoubleChevronAnimationState extends State { AnimationsLoader.of(context)!, artboard: 'Double chevron', onInit: (Artboard artboard) { - _controller = StateMachineController.fromArtboard( - artboard, - 'Loop', - ); + _controller = StateMachineController.fromArtboard(artboard, 'Loop'); artboard.addController(_controller!); _changeAnimation(widget.animated); @@ -216,10 +187,7 @@ class _DoubleChevronAnimationState extends State { } class OrangeErrorAnimation extends StatefulWidget { - const OrangeErrorAnimation({ - this.sizeMultiplier = 1.0, - super.key, - }); + const OrangeErrorAnimation({this.sizeMultiplier = 1.0, super.key}); final double sizeMultiplier; @@ -269,10 +237,7 @@ class _OrangeErrorAnimationState extends State { } class SearchEyeAnimation extends StatefulWidget { - const SearchEyeAnimation({ - this.size, - super.key, - }); + const SearchEyeAnimation({this.size, super.key}); final double? size; @@ -292,16 +257,19 @@ class _SearchEyeAnimationState extends State { child: SizedBox( width: size, height: (80 / 87) * size, - child: RiveAnimation.direct(AnimationsLoader.of(context)!, - artboard: 'Search eye', onInit: (Artboard artboard) { - _controller = StateMachineController.fromArtboard( - artboard, - 'LoopMachine', - ); + child: RiveAnimation.direct( + AnimationsLoader.of(context)!, + artboard: 'Search eye', + onInit: (Artboard artboard) { + _controller = StateMachineController.fromArtboard( + artboard, + 'LoopMachine', + ); - artboard.addController(_controller!); - _controller!.findInput('light')?.value = !lightTheme; - }), + artboard.addController(_controller!); + _controller!.findInput('light')?.value = !lightTheme; + }, + ), ), ); } @@ -383,10 +351,7 @@ enum SearchAnimationType { } class SunAnimation extends StatelessWidget { - const SunAnimation({ - required this.type, - super.key, - }); + const SunAnimation({required this.type, super.key}); final SunAnimationType type; @@ -401,7 +366,7 @@ class SunAnimation extends StatelessWidget { riveFile, artboard: 'Success', stateMachines: [ - if (type == SunAnimationType.loop) 'Loop' else 'Animation' + if (type == SunAnimationType.loop) 'Loop' else 'Animation', ], ); }, @@ -409,21 +374,12 @@ class SunAnimation extends StatelessWidget { } } -enum SunAnimationType { - loop, - fullAnimation, -} +enum SunAnimationType { loop, fullAnimation } class TorchAnimation extends StatefulWidget { - const TorchAnimation.on({ - this.size, - super.key, - }) : isOn = true; + const TorchAnimation.on({this.size, super.key}) : isOn = true; - const TorchAnimation.off({ - this.size, - super.key, - }) : isOn = false; + const TorchAnimation.off({this.size, super.key}) : isOn = false; final bool isOn; final double? size; @@ -459,10 +415,7 @@ class _TorchAnimationState extends State { artboard: 'Torch', fit: BoxFit.cover, onInit: (Artboard artboard) { - _controller = StateMachineController.fromArtboard( - artboard, - 'Switch', - ); + _controller = StateMachineController.fromArtboard(artboard, 'Switch'); artboard.addController(_controller!); _changeTorchValue(widget.isOn); @@ -479,11 +432,7 @@ class _TorchAnimationState extends State { } class ScaleAnimation extends StatefulWidget { - const ScaleAnimation({ - required this.animated, - this.size, - super.key, - }); + const ScaleAnimation({required this.animated, this.size, super.key}); final double? size; final bool animated; @@ -522,13 +471,11 @@ class _ScaleAnimationState extends State { _controller!.artboard!.forEachComponent((Component child) { if (child is RuntimeNestedArtboard) { - child.sourceArtboard!.forEachComponent( - (Component nestedChild) { - if (nestedChild is SolidColor) { - nestedChild.colorValue = color.intValue; - } - }, - ); + child.sourceArtboard!.forEachComponent((Component nestedChild) { + if (nestedChild is SolidColor) { + nestedChild.colorValue = color.intValue; + } + }); } }); @@ -590,10 +537,7 @@ class _SparkleAnimationState extends State { return SizedBox.square( dimension: size, child: ColorFiltered( - colorFilter: ColorFilter.mode( - widget.color, - BlendMode.srcIn, - ), + colorFilter: ColorFilter.mode(widget.color, BlendMode.srcIn), child: RiveAnimation.direct( AnimationsLoader.of(context)!, artboard: 'sparkles', @@ -647,35 +591,17 @@ class NutriScoreAnimation extends StatefulWidget { }; } - const NutriScoreAnimation.unknown({ - this.size, - super.key, - }) : level = -1; + const NutriScoreAnimation.unknown({this.size, super.key}) : level = -1; - const NutriScoreAnimation.A({ - this.size, - super.key, - }) : level = 0; + const NutriScoreAnimation.A({this.size, super.key}) : level = 0; - const NutriScoreAnimation.B({ - this.size, - super.key, - }) : level = 1; + const NutriScoreAnimation.B({this.size, super.key}) : level = 1; - const NutriScoreAnimation.C({ - this.size, - super.key, - }) : level = 2; + const NutriScoreAnimation.C({this.size, super.key}) : level = 2; - const NutriScoreAnimation.D({ - this.size, - super.key, - }) : level = 3; + const NutriScoreAnimation.D({this.size, super.key}) : level = 3; - const NutriScoreAnimation.E({ - this.size, - super.key, - }) : level = 4; + const NutriScoreAnimation.E({this.size, super.key}) : level = 4; final int level; final Size? size; @@ -724,10 +650,8 @@ class _NutriScoreAnimationState extends State { }, image: true, child: SizedBox.fromSize( - size: widget.size ?? - Size.fromHeight( - IconTheme.of(context).size ?? 24.0, - ), + size: + widget.size ?? Size.fromHeight(IconTheme.of(context).size ?? 24.0), child: AspectRatio( aspectRatio: 176 / 94, child: RiveAnimation.asset( diff --git a/packages/smooth_app/lib/resources/app_icons.dart b/packages/smooth_app/lib/resources/app_icons.dart index 4194451a1e..84a7f490f0 100644 --- a/packages/smooth_app/lib/resources/app_icons.dart +++ b/packages/smooth_app/lib/resources/app_icons.dart @@ -219,8 +219,8 @@ class Arrow extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 0, - super._(_IconsFont.arrow_right); + }) : turns = 0, + super._(_IconsFont.arrow_right); const Arrow.left({ super.color, @@ -228,8 +228,8 @@ class Arrow extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 2, - super._(_IconsFont.arrow_right); + }) : turns = 2, + super._(_IconsFont.arrow_right); const Arrow.down({ super.color, @@ -237,8 +237,8 @@ class Arrow extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 1, - super._(_IconsFont.arrow_right); + }) : turns = 1, + super._(_IconsFont.arrow_right); const Arrow.up({ super.color, @@ -246,17 +246,14 @@ class Arrow extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 3, - super._(_IconsFont.arrow_right); + }) : turns = 3, + super._(_IconsFont.arrow_right); final int turns; @override Widget build(BuildContext context) { - return RotatedBox( - quarterTurns: turns, - child: super.build(context), - ); + return RotatedBox(quarterTurns: turns, child: super.build(context)); } } @@ -367,8 +364,8 @@ class Chevron extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 2, - super._(_IconsFont.chevron_right); + }) : turns = 2, + super._(_IconsFont.chevron_right); const Chevron.right({ super.color, @@ -376,8 +373,8 @@ class Chevron extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 0, - super._(_IconsFont.chevron_right); + }) : turns = 0, + super._(_IconsFont.chevron_right); const Chevron.up({ super.color, @@ -385,8 +382,8 @@ class Chevron extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 2, - super._(_IconsFont.chevron_down); + }) : turns = 2, + super._(_IconsFont.chevron_down); const Chevron.down({ super.color, @@ -394,17 +391,14 @@ class Chevron extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 0, - super._(_IconsFont.chevron_down); + }) : turns = 0, + super._(_IconsFont.chevron_down); final int turns; @override Widget build(BuildContext context) { - return RotatedBox( - quarterTurns: turns, - child: super.build(context), - ); + return RotatedBox(quarterTurns: turns, child: super.build(context)); } } @@ -419,16 +413,16 @@ class CircledArrow extends AppIcon { String? semanticLabel, Key? key, }) : this._base( - type: type, - turns: 0, - circleColor: circleColor, - color: color, - size: size, - padding: padding, - shadow: shadow, - semanticLabel: semanticLabel, - key: key, - ); + type: type, + turns: 0, + circleColor: circleColor, + color: color, + size: size, + padding: padding, + shadow: shadow, + semanticLabel: semanticLabel, + key: key, + ); const CircledArrow.left({ CircledArrowType? type, @@ -440,16 +434,16 @@ class CircledArrow extends AppIcon { String? semanticLabel, Key? key, }) : this._base( - type: type, - turns: 2, - circleColor: circleColor, - color: color, - size: size, - padding: padding, - shadow: shadow, - semanticLabel: semanticLabel, - key: key, - ); + type: type, + turns: 2, + circleColor: circleColor, + color: color, + size: size, + padding: padding, + shadow: shadow, + semanticLabel: semanticLabel, + key: key, + ); const CircledArrow.down({ CircledArrowType? type, @@ -461,16 +455,16 @@ class CircledArrow extends AppIcon { String? semanticLabel, Key? key, }) : this._base( - type: type, - turns: 1, - circleColor: circleColor, - color: color, - size: size, - padding: padding, - shadow: shadow, - semanticLabel: semanticLabel, - key: key, - ); + type: type, + turns: 1, + circleColor: circleColor, + color: color, + size: size, + padding: padding, + shadow: shadow, + semanticLabel: semanticLabel, + key: key, + ); const CircledArrow.up({ CircledArrowType? type, @@ -482,16 +476,16 @@ class CircledArrow extends AppIcon { String? semanticLabel, Key? key, }) : this._base( - type: type, - turns: 3, - circleColor: circleColor, - color: color, - size: size, - padding: padding, - shadow: shadow, - semanticLabel: semanticLabel, - key: key, - ); + type: type, + turns: 3, + circleColor: circleColor, + color: color, + size: size, + padding: padding, + shadow: shadow, + semanticLabel: semanticLabel, + key: key, + ); const CircledArrow._base({ CircledArrowType? type, @@ -503,18 +497,18 @@ class CircledArrow extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : assert( - (circleColor == null && - (type == null || type == CircledArrowType.thin)) || - (circleColor != null && type == CircledArrowType.normal), - 'circleColor is only supported and must be provided when type = CircledArrowType.normal', - ), - type = type ?? CircledArrowType.thin, - super._( - type == CircledArrowType.thin - ? _IconsFont.circled_arrow - : _IconsFont.arrow_right, - ); + }) : assert( + (circleColor == null && + (type == null || type == CircledArrowType.thin)) || + (circleColor != null && type == CircledArrowType.normal), + 'circleColor is only supported and must be provided when type = CircledArrowType.normal', + ), + type = type ?? CircledArrowType.thin, + super._( + type == CircledArrowType.thin + ? _IconsFont.circled_arrow + : _IconsFont.arrow_right, + ); final int turns; final CircledArrowType type; @@ -530,10 +524,7 @@ class CircledArrow extends AppIcon { if (type == CircledArrowType.normal) { return Container( - decoration: BoxDecoration( - shape: BoxShape.circle, - color: circleColor, - ), + decoration: BoxDecoration(shape: BoxShape.circle, color: circleColor), padding: padding ?? const EdgeInsets.all(4.0), child: child, ); @@ -576,10 +567,7 @@ class Clear extends AppIcon { }) : super._(_IconsFont.clear); } -enum CircledArrowType { - thin, - normal, -} +enum CircledArrowType { thin, normal } class Clock extends AppIcon { const Clock({ @@ -760,8 +748,8 @@ class DoubleChevron extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 3, - super._(_IconsFont.double_chevron); + }) : turns = 3, + super._(_IconsFont.double_chevron); const DoubleChevron.right({ super.color, @@ -769,8 +757,8 @@ class DoubleChevron extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 1, - super._(_IconsFont.double_chevron); + }) : turns = 1, + super._(_IconsFont.double_chevron); const DoubleChevron.up({ super.color, @@ -778,8 +766,8 @@ class DoubleChevron extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 0, - super._(_IconsFont.double_chevron); + }) : turns = 0, + super._(_IconsFont.double_chevron); const DoubleChevron.down({ super.color, @@ -787,17 +775,14 @@ class DoubleChevron extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 2, - super._(_IconsFont.double_chevron); + }) : turns = 2, + super._(_IconsFont.double_chevron); final int turns; @override Widget build(BuildContext context) { - return RotatedBox( - quarterTurns: turns, - child: super.build(context), - ); + return RotatedBox(quarterTurns: turns, child: super.build(context)); } } @@ -1552,8 +1537,8 @@ class ThreeDots extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 0, - super._(_IconsFont.dots_vertical); + }) : turns = 0, + super._(_IconsFont.dots_vertical); const ThreeDots.horizontal({ super.color, @@ -1561,17 +1546,14 @@ class ThreeDots extends AppIcon { super.shadow, super.semanticLabel, super.key, - }) : turns = 1, - super._(_IconsFont.dots_vertical); + }) : turns = 1, + super._(_IconsFont.dots_vertical); final int turns; @override Widget build(BuildContext context) { - return RotatedBox( - quarterTurns: turns, - child: super.build(context), - ); + return RotatedBox(quarterTurns: turns, child: super.build(context)); } } @@ -1649,9 +1631,9 @@ abstract class AppIcon extends StatelessWidget { double? size, this.semanticLabel, super.key, - }) : _size = size, - _color = color, - assert(size == null || size >= 0); + }) : _size = size, + _color = color, + assert(size == null || size >= 0); final IconData icon; final Color? _color; @@ -1670,9 +1652,10 @@ abstract class AppIcon extends StatelessWidget { final IconThemeData iconThemeData = IconTheme.of(context); final Color? color = switch (this.color) { Color _ => this.color, - _ => iconTheme?.color ?? - iconThemeData.color ?? - Theme.of(context).iconTheme.color, + _ => + iconTheme?.color ?? + iconThemeData.color ?? + Theme.of(context).iconTheme.color, }; return Icon( @@ -1683,8 +1666,8 @@ abstract class AppIcon extends StatelessWidget { shadows: shadow != null ? [shadow!] : iconTheme?.shadow != null - ? [iconTheme!.shadow!] - : null, + ? [iconTheme!.shadow!] + : null, ); } diff --git a/packages/smooth_app/lib/resources/app_icons_font.dart b/packages/smooth_app/lib/resources/app_icons_font.dart index 8361f680b9..78a66901c8 100644 --- a/packages/smooth_app/lib/resources/app_icons_font.dart +++ b/packages/smooth_app/lib/resources/app_icons_font.dart @@ -9,298 +9,736 @@ class _IconsFont { static const String _kFontFam = 'SmoothIcons'; static const String? _kFontPkg = null; - static const IconData chicken = - IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData eye_invisible = - IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData settings = - IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData magic_wand = - IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData camera_outlined = - IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData camera_filled = - IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData categories = - IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData check = - IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData double_chevron = - IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData circled_arrow = - IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lab = - IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData compare = - IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData countries = - IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData cupcake = - IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData edit = - IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData environment = - IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData expand = - IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sparkles = - IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData fruit = - IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData info = - IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ingredients = - IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData labels = - IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lifebuoy = - IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_circled = - IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_british_pound = - IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_dollar = - IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData packaging = - IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData toggle_camera = - IconData(0xe81b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData warning = - IconData(0xe81c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData store = - IconData(0xe81d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_euro = - IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_ruble = - IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_rupee = - IconData(0xe820, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_swiss_franc = - IconData(0xe821, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_turkish_lira = - IconData(0xe822, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_ukrainian_hryvnia = - IconData(0xe823, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_won = - IconData(0xe824, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData torch_off = - IconData(0xe825, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData language = - IconData(0xe826, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sound_off = - IconData(0xe827, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sound_on = - IconData(0xe828, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData torch_on = - IconData(0xe829, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData camera_happy = - IconData(0xe82a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData vibration = - IconData(0xe82b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData programming = - IconData(0xe82c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add = - IconData(0xe82d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData barcode_corners = - IconData(0xe82e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData barcode_rounded = - IconData(0xe82f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData personalization = - IconData(0xe830, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData no_picture = - IconData(0xe831, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qrcode = - IconData(0xe832, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qrcode_corners = - IconData(0xe833, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData hamburger_menu = - IconData(0xe834, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list = - IconData(0xe835, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData outdated = - IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData question_circled = - IconData(0xe837, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData question = - IconData(0xe838, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData salt = - IconData(0xe839, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search = - IconData(0xe83a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData advanced_search = - IconData(0xe83b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData history = - IconData(0xe83c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData arrow_right = - IconData(0xe83d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData chevron_down = - IconData(0xe83e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData chevron_right = - IconData(0xe83f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData external_link = - IconData(0xe840, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData barcode = - IconData(0xe841, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData fish = - IconData(0xe842, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData milk = - IconData(0xe843, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData soda_happy = - IconData(0xe844, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData soda_unhappy = - IconData(0xe845, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_price_yen = - IconData(0xe846, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_5 = - IconData(0xe847, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData eye_visible = - IconData(0xe848, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_4 = - IconData(0xe849, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData delete_trash = - IconData(0xe84a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_property = - IconData(0xe84b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_property_alt = - IconData(0xe84c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData app_store = - IconData(0xe84d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData document = - IconData(0xe84e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData github = - IconData(0xe84f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ingredients_basket = - IconData(0xe850, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData close = - IconData(0xe851, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData suggestion = - IconData(0xe852, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData clear_text = - IconData(0xe853, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData contribute = - IconData(0xe854, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData crash = - IconData(0xe855, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData currency = - IconData(0xe856, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData nutritional_facts = - IconData(0xe857, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData help_circled = - IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dots_vertical = - IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData country = - IconData(0xe85a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_1 = - IconData(0xe85b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData compare_disabled = - IconData(0xe85c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData password = - IconData(0xe85d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData incognito = - IconData(0xe85e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData logout = - IconData(0xe85f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lists = - IconData(0xe860, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData donate = - IconData(0xe861, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData dangerous_zone = - IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData happy_toast = - IconData(0xe863, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData light_bulb = - IconData(0xe864, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData language_world = - IconData(0xe865, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData personalization_alt = - IconData(0xe866, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_3 = - IconData(0xe867, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_2 = - IconData(0xe868, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_6 = - IconData(0xe869, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ocr = - IconData(0xe86a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_7 = - IconData(0xe86b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_8 = - IconData(0xe86c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_9_plus = - IconData(0xe86d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData add_to_list_9 = - IconData(0xe86e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData search_alt = - IconData(0xe86f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData profile = - IconData(0xe870, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData photo_select = - IconData(0xe871, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData image_error = - IconData(0xe876, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData milk_download = - IconData(0xe877, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData clock = - IconData(0xe878, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData clear = - IconData(0xe879, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scale_alt = - IconData(0xe87b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData scale = - IconData(0xe87c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData milk_filled_unhappy = - IconData(0xe87e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData move = - IconData(0xe87f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData milk_add = - IconData(0xe880, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData pinch_to_zoom = - IconData(0xe881, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData camera_restart = - IconData(0xe882, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData weight_alt = - IconData(0xe883, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData weight = - IconData(0xe884, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData flag = - IconData(0xe885, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData nutrition_facts = - IconData(0xe886, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData checklist = - IconData(0xe887, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData copy = - IconData(0xe888, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData creative_commons_attribution = - IconData(0xe889, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData creative_commons_share_alike = - IconData(0xe88a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData creative_commons = - IconData(0xe88b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message_edit = - IconData(0xe88c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData drag_start = - IconData(0xe88d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData image_add = - IconData(0xe88e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData image_check = - IconData(0xe88f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData gallery = - IconData(0xe890, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData image_open = - IconData(0xe891, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData share_cupertino = - IconData(0xe8a4, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData share_material = - IconData(0xe8a5, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData ingredients_alt = - IconData(0xe8e0, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData milk_filled = - IconData(0xe8e1, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData recycling = - IconData(0xe8e2, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData remove = - IconData(0xe91c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData chicken = IconData( + 0xe800, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData eye_invisible = IconData( + 0xe801, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData settings = IconData( + 0xe802, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData magic_wand = IconData( + 0xe803, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData camera_outlined = IconData( + 0xe804, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData camera_filled = IconData( + 0xe805, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData categories = IconData( + 0xe806, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData check = IconData( + 0xe807, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData double_chevron = IconData( + 0xe808, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData circled_arrow = IconData( + 0xe809, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData lab = IconData( + 0xe80a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData compare = IconData( + 0xe80b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData countries = IconData( + 0xe80c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData cupcake = IconData( + 0xe80d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData edit = IconData( + 0xe80e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData environment = IconData( + 0xe80f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData expand = IconData( + 0xe810, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData sparkles = IconData( + 0xe811, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData fruit = IconData( + 0xe812, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData info = IconData( + 0xe813, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData ingredients = IconData( + 0xe814, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData labels = IconData( + 0xe815, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData lifebuoy = IconData( + 0xe816, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_circled = IconData( + 0xe817, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_british_pound = IconData( + 0xe818, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_dollar = IconData( + 0xe819, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData packaging = IconData( + 0xe81a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData toggle_camera = IconData( + 0xe81b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData warning = IconData( + 0xe81c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData store = IconData( + 0xe81d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_euro = IconData( + 0xe81e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_ruble = IconData( + 0xe81f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_rupee = IconData( + 0xe820, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_swiss_franc = IconData( + 0xe821, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_turkish_lira = IconData( + 0xe822, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_ukrainian_hryvnia = IconData( + 0xe823, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_won = IconData( + 0xe824, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData torch_off = IconData( + 0xe825, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData language = IconData( + 0xe826, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData sound_off = IconData( + 0xe827, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData sound_on = IconData( + 0xe828, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData torch_on = IconData( + 0xe829, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData camera_happy = IconData( + 0xe82a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData vibration = IconData( + 0xe82b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData programming = IconData( + 0xe82c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add = IconData( + 0xe82d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData barcode_corners = IconData( + 0xe82e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData barcode_rounded = IconData( + 0xe82f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData personalization = IconData( + 0xe830, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData no_picture = IconData( + 0xe831, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData qrcode = IconData( + 0xe832, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData qrcode_corners = IconData( + 0xe833, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData hamburger_menu = IconData( + 0xe834, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list = IconData( + 0xe835, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData outdated = IconData( + 0xe836, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData question_circled = IconData( + 0xe837, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData question = IconData( + 0xe838, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData salt = IconData( + 0xe839, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData search = IconData( + 0xe83a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData advanced_search = IconData( + 0xe83b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData history = IconData( + 0xe83c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData arrow_right = IconData( + 0xe83d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData chevron_down = IconData( + 0xe83e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData chevron_right = IconData( + 0xe83f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData external_link = IconData( + 0xe840, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData barcode = IconData( + 0xe841, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData fish = IconData( + 0xe842, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData milk = IconData( + 0xe843, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData soda_happy = IconData( + 0xe844, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData soda_unhappy = IconData( + 0xe845, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_price_yen = IconData( + 0xe846, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_5 = IconData( + 0xe847, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData eye_visible = IconData( + 0xe848, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_4 = IconData( + 0xe849, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData delete_trash = IconData( + 0xe84a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_property = IconData( + 0xe84b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_property_alt = IconData( + 0xe84c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData app_store = IconData( + 0xe84d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData document = IconData( + 0xe84e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData github = IconData( + 0xe84f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData ingredients_basket = IconData( + 0xe850, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData close = IconData( + 0xe851, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData suggestion = IconData( + 0xe852, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData clear_text = IconData( + 0xe853, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData contribute = IconData( + 0xe854, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData crash = IconData( + 0xe855, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData currency = IconData( + 0xe856, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData nutritional_facts = IconData( + 0xe857, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData help_circled = IconData( + 0xe858, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData dots_vertical = IconData( + 0xe859, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData country = IconData( + 0xe85a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_1 = IconData( + 0xe85b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData compare_disabled = IconData( + 0xe85c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData password = IconData( + 0xe85d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData incognito = IconData( + 0xe85e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData logout = IconData( + 0xe85f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData lists = IconData( + 0xe860, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData donate = IconData( + 0xe861, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData dangerous_zone = IconData( + 0xe862, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData happy_toast = IconData( + 0xe863, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData light_bulb = IconData( + 0xe864, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData language_world = IconData( + 0xe865, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData personalization_alt = IconData( + 0xe866, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_3 = IconData( + 0xe867, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_2 = IconData( + 0xe868, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_6 = IconData( + 0xe869, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData ocr = IconData( + 0xe86a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_7 = IconData( + 0xe86b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_8 = IconData( + 0xe86c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_9_plus = IconData( + 0xe86d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData add_to_list_9 = IconData( + 0xe86e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData search_alt = IconData( + 0xe86f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData profile = IconData( + 0xe870, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData photo_select = IconData( + 0xe871, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData image_error = IconData( + 0xe876, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData milk_download = IconData( + 0xe877, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData clock = IconData( + 0xe878, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData clear = IconData( + 0xe879, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData scale_alt = IconData( + 0xe87b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData scale = IconData( + 0xe87c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData milk_filled_unhappy = IconData( + 0xe87e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData move = IconData( + 0xe87f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData milk_add = IconData( + 0xe880, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData pinch_to_zoom = IconData( + 0xe881, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData camera_restart = IconData( + 0xe882, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData weight_alt = IconData( + 0xe883, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData weight = IconData( + 0xe884, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData flag = IconData( + 0xe885, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData nutrition_facts = IconData( + 0xe886, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData checklist = IconData( + 0xe887, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData copy = IconData( + 0xe888, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData creative_commons_attribution = IconData( + 0xe889, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData creative_commons_share_alike = IconData( + 0xe88a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData creative_commons = IconData( + 0xe88b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData message_edit = IconData( + 0xe88c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData drag_start = IconData( + 0xe88d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData image_add = IconData( + 0xe88e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData image_check = IconData( + 0xe88f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData gallery = IconData( + 0xe890, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData image_open = IconData( + 0xe891, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData share_cupertino = IconData( + 0xe8a4, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData share_material = IconData( + 0xe8a5, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData ingredients_alt = IconData( + 0xe8e0, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData milk_filled = IconData( + 0xe8e1, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData recycling = IconData( + 0xe8e2, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData remove = IconData( + 0xe91c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); } class _FoodIconsFont { @@ -309,64 +747,154 @@ class _FoodIconsFont { static const String _kFontFam = 'FoodIcons'; static const String? _kFontPkg = null; - static const IconData additives = - IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData celery = - IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData crustaceans = - IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData eggs = - IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData fair_trade = - IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData fat = - IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData fish = - IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData forest_footprint = - IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData gluten = - IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData lupin = - IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData milk = - IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData molluscs = - IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData mustard = - IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData nuts = - IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData organic_farming = - IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData palm_oil = - IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData peanuts = - IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData salt = - IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData saturated_fat = - IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sesame_seeds = - IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData soybeans = - IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sugar = - IconData(0xe815, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData nova = - IconData(0xe816, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData vegan = - IconData(0xe817, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData vegetarian = - IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData sulphites = - IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData nova_3 = - IconData(0xe81c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData nova_2 = - IconData(0xe81d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData nova_1 = - IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData nova_4 = - IconData(0xe81f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData additives = IconData( + 0xe800, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData celery = IconData( + 0xe801, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData crustaceans = IconData( + 0xe802, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData eggs = IconData( + 0xe803, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData fair_trade = IconData( + 0xe804, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData fat = IconData( + 0xe805, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData fish = IconData( + 0xe806, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData forest_footprint = IconData( + 0xe807, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData gluten = IconData( + 0xe808, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData lupin = IconData( + 0xe809, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData milk = IconData( + 0xe80a, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData molluscs = IconData( + 0xe80b, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData mustard = IconData( + 0xe80c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData nuts = IconData( + 0xe80d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData organic_farming = IconData( + 0xe80e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData palm_oil = IconData( + 0xe80f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData peanuts = IconData( + 0xe810, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData salt = IconData( + 0xe811, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData saturated_fat = IconData( + 0xe812, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData sesame_seeds = IconData( + 0xe813, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData soybeans = IconData( + 0xe814, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData sugar = IconData( + 0xe815, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData nova = IconData( + 0xe816, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData vegan = IconData( + 0xe817, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData vegetarian = IconData( + 0xe818, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData sulphites = IconData( + 0xe819, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData nova_3 = IconData( + 0xe81c, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData nova_2 = IconData( + 0xe81d, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData nova_1 = IconData( + 0xe81e, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); + static const IconData nova_4 = IconData( + 0xe81f, + fontFamily: _kFontFam, + fontPackage: _kFontPkg, + ); } diff --git a/packages/smooth_app/lib/services/app_store/app_store_service.dart b/packages/smooth_app/lib/services/app_store/app_store_service.dart index 7ab261929b..7809a291fa 100644 --- a/packages/smooth_app/lib/services/app_store/app_store_service.dart +++ b/packages/smooth_app/lib/services/app_store/app_store_service.dart @@ -3,8 +3,10 @@ import 'package:smooth_app/services/smooth_service.dart'; class AppStoreService extends SmoothService { Future openAppDetails() { - assert(impls.isNotEmpty, - 'Please attach an [AppStore] before calling this method!'); + assert( + impls.isNotEmpty, + 'Please attach an [AppStore] before calling this method!', + ); return impls.first.openAppDetails(); } diff --git a/packages/smooth_app/lib/services/logs/fimber/trees/base_fimber_tree.dart b/packages/smooth_app/lib/services/logs/fimber/trees/base_fimber_tree.dart index 710efd9b1f..c2248bc5a8 100644 --- a/packages/smooth_app/lib/services/logs/fimber/trees/base_fimber_tree.dart +++ b/packages/smooth_app/lib/services/logs/fimber/trees/base_fimber_tree.dart @@ -4,11 +4,11 @@ import 'package:smooth_app/services/logs/smooth_log_levels.dart'; abstract class BaseFimberTree extends LogTree { BaseFimberTree({required List logLevels}) - : assert(logLevels.isNotEmpty), - _logLevels = logLevels - .map((LogLevel level) => level.fimberLevel) - .toList(growable: false), - super(); + : assert(logLevels.isNotEmpty), + _logLevels = logLevels + .map((LogLevel level) => level.fimberLevel) + .toList(growable: false), + super(); final List _logLevels; diff --git a/packages/smooth_app/lib/services/logs/fimber/trees/debug_fimber_tree.dart b/packages/smooth_app/lib/services/logs/fimber/trees/debug_fimber_tree.dart index ea81dfdea5..293b384d12 100644 --- a/packages/smooth_app/lib/services/logs/fimber/trees/debug_fimber_tree.dart +++ b/packages/smooth_app/lib/services/logs/fimber/trees/debug_fimber_tree.dart @@ -4,10 +4,10 @@ import 'package:smooth_app/services/logs/smooth_log_levels.dart'; class DebugFimberTree extends DebugTree { DebugFimberTree({required List logLevels}) - : assert(logLevels.isNotEmpty), - super( - logLevels: logLevels - .map((LogLevel level) => level.fimberLevel) - .toList(growable: false), - ); + : assert(logLevels.isNotEmpty), + super( + logLevels: logLevels + .map((LogLevel level) => level.fimberLevel) + .toList(growable: false), + ); } diff --git a/packages/smooth_app/lib/services/logs/fimber/trees/file_fimber_tree.dart b/packages/smooth_app/lib/services/logs/fimber/trees/file_fimber_tree.dart index bbfe650729..d251af1e31 100644 --- a/packages/smooth_app/lib/services/logs/fimber/trees/file_fimber_tree.dart +++ b/packages/smooth_app/lib/services/logs/fimber/trees/file_fimber_tree.dart @@ -7,10 +7,7 @@ import 'package:smooth_app/services/logs/fimber/trees/base_fimber_tree.dart'; /// Single file fimber implementation /// When the maxDataSize is reached, half of the content is removed class FileFimberTree extends BaseFimberTree { - FileFimberTree({ - required super.logLevels, - required this.outputFile, - }) { + FileFimberTree({required super.logLevels, required this.outputFile}) { outputFile.createSync(); } @@ -61,10 +58,7 @@ class FileFimberTree extends BaseFimberTree { mode: FileMode.writeOnly, ); } else { - outputFile.writeAsStringSync( - content, - mode: FileMode.writeOnlyAppend, - ); + outputFile.writeAsStringSync(content, mode: FileMode.writeOnlyAppend); } } } diff --git a/packages/smooth_app/lib/services/logs/fimber/trees/sentry_fimber_tree.dart b/packages/smooth_app/lib/services/logs/fimber/trees/sentry_fimber_tree.dart index 99256d0fe3..f60e9598b0 100644 --- a/packages/smooth_app/lib/services/logs/fimber/trees/sentry_fimber_tree.dart +++ b/packages/smooth_app/lib/services/logs/fimber/trees/sentry_fimber_tree.dart @@ -4,9 +4,7 @@ import 'package:smooth_app/services/logs/fimber/trees/base_fimber_tree.dart'; /// Custom Fimber [LogTree] that send logs to Sentry class SentryFimberTree extends BaseFimberTree { - SentryFimberTree({ - required super.logLevels, - }); + SentryFimberTree({required super.logLevels}); @override void log( diff --git a/packages/smooth_app/lib/services/logs/logs_fimber_impl.dart b/packages/smooth_app/lib/services/logs/logs_fimber_impl.dart index bd3d620676..f175e3c104 100644 --- a/packages/smooth_app/lib/services/logs/logs_fimber_impl.dart +++ b/packages/smooth_app/lib/services/logs/logs_fimber_impl.dart @@ -21,24 +21,14 @@ class FimberLogImpl implements AppLogService { @override Future init() async { if (kReleaseMode) { - Fimber.plantTree( - DebugTree( - logLevels: ['E'], - ), - ); + Fimber.plantTree(DebugTree(logLevels: ['E'])); _fileTree = FileFimberTree( outputFile: await _fileName, logLevels: LogLevels.prodLogLevels, ); - Fimber.plantTree( - SentryFimberTree(logLevels: LogLevels.allLogLevels), - ); + Fimber.plantTree(SentryFimberTree(logLevels: LogLevels.allLogLevels)); } else { - Fimber.plantTree( - DebugFimberTree( - logLevels: LogLevels.allLogLevels, - ), - ); + Fimber.plantTree(DebugFimberTree(logLevels: LogLevels.allLogLevels)); _fileTree = FileFimberTree( outputFile: await _fileName, @@ -51,8 +41,9 @@ class FimberLogImpl implements AppLogService { log(LogLevel.info, 'New app session started'); } - Future get _fileName => _filesDirectory - .then((Directory dir) => File(join(dir.absolute.path, 'app_logs.log'))); + Future get _fileName => _filesDirectory.then( + (Directory dir) => File(join(dir.absolute.path, 'app_logs.log')), + ); Future get _filesDirectory => getApplicationSupportDirectory() .then((Directory dir) => Directory(join(dir.absolute.path, 'logs'))) @@ -88,8 +79,13 @@ class FimberLogImpl implements AppLogService { @override void e(String message, {String? tag, dynamic ex, StackTrace? stacktrace}) { - Fimber.log('E', message, - tag: tag ?? _defaultTag, ex: ex, stacktrace: stacktrace); + Fimber.log( + 'E', + message, + tag: tag ?? _defaultTag, + ex: ex, + stacktrace: stacktrace, + ); } @override @@ -128,8 +124,10 @@ class FimberLogImpl implements AppLogService { String _getFimberLogLevel(LogLevel level) => level.fimberLevel; String get _defaultTag { - final String tag = - StackTrace.current.toString().split('\n')[4].split('.')[0]; + final String tag = StackTrace.current + .toString() + .split('\n')[4] + .split('.')[0]; // Some tags looks like "#1 some text" -> we only use "some text" if (tag.startsWith('#')) { @@ -141,8 +139,6 @@ class FimberLogImpl implements AppLogService { @override List get logFilesPaths { - return [ - _fileTree.outputFile.absolute.path, - ]; + return [_fileTree.outputFile.absolute.path]; } } diff --git a/packages/smooth_app/lib/services/logs/smooth_log_levels.dart b/packages/smooth_app/lib/services/logs/smooth_log_levels.dart index 88888d9df6..af4dac480e 100644 --- a/packages/smooth_app/lib/services/logs/smooth_log_levels.dart +++ b/packages/smooth_app/lib/services/logs/smooth_log_levels.dart @@ -1,10 +1,4 @@ -enum LogLevel { - debug, - error, - info, - verbose, - warning, -} +enum LogLevel { debug, error, info, verbose, warning } class LogLevels { static const List allLogLevels = [ @@ -12,7 +6,7 @@ class LogLevels { LogLevel.info, LogLevel.debug, LogLevel.verbose, - LogLevel.warning + LogLevel.warning, ]; static const List prodLogLevels = [ diff --git a/packages/smooth_app/lib/services/logs/smooth_logs_service.dart b/packages/smooth_app/lib/services/logs/smooth_logs_service.dart index 64d2f6ddb5..52940f8c84 100644 --- a/packages/smooth_app/lib/services/logs/smooth_logs_service.dart +++ b/packages/smooth_app/lib/services/logs/smooth_logs_service.dart @@ -19,79 +19,24 @@ class LogsService extends SmoothService { } } - void d( - String message, { - String? tag, - dynamic ex, - StackTrace? stacktrace, - }) => - log( - LogLevel.debug, - message, - tag: tag, - ex: ex, - stacktrace: stacktrace, - ); + void d(String message, {String? tag, dynamic ex, StackTrace? stacktrace}) => + log(LogLevel.debug, message, tag: tag, ex: ex, stacktrace: stacktrace); /// Write an error log - void e( - String message, { - String? tag, - dynamic ex, - StackTrace? stacktrace, - }) => - log( - LogLevel.error, - message, - tag: tag, - ex: ex, - stacktrace: stacktrace, - ); + void e(String message, {String? tag, dynamic ex, StackTrace? stacktrace}) => + log(LogLevel.error, message, tag: tag, ex: ex, stacktrace: stacktrace); /// Write an info log - void i( - String message, { - String? tag, - dynamic ex, - StackTrace? stacktrace, - }) => - log( - LogLevel.info, - message, - tag: tag, - ex: ex, - stacktrace: stacktrace, - ); + void i(String message, {String? tag, dynamic ex, StackTrace? stacktrace}) => + log(LogLevel.info, message, tag: tag, ex: ex, stacktrace: stacktrace); /// Write a verbose log - void v( - String message, { - String? tag, - dynamic ex, - StackTrace? stacktrace, - }) => - log( - LogLevel.info, - message, - tag: tag, - ex: ex, - stacktrace: stacktrace, - ); + void v(String message, {String? tag, dynamic ex, StackTrace? stacktrace}) => + log(LogLevel.info, message, tag: tag, ex: ex, stacktrace: stacktrace); /// Write a warning log - void w( - String message, { - String? tag, - dynamic ex, - StackTrace? stacktrace, - }) => - log( - LogLevel.info, - message, - tag: tag, - ex: ex, - stacktrace: stacktrace, - ); + void w(String message, {String? tag, dynamic ex, StackTrace? stacktrace}) => + log(LogLevel.info, message, tag: tag, ex: ex, stacktrace: stacktrace); List get logFilesPaths { final List files = []; diff --git a/packages/smooth_app/lib/themes/smooth_theme.dart b/packages/smooth_app/lib/themes/smooth_theme.dart index 53b332dda8..c7dccdb8de 100644 --- a/packages/smooth_app/lib/themes/smooth_theme.dart +++ b/packages/smooth_app/lib/themes/smooth_theme.dart @@ -42,9 +42,7 @@ class SmoothTheme { } final SmoothColorsThemeExtension smoothExtension = - SmoothColorsThemeExtension.defaultValues( - lightTheme, - ); + SmoothColorsThemeExtension.defaultValues(lightTheme); final TextTheme textTheme = brightness == Brightness.dark ? getTextTheme(themeProvider, textContrastProvider) @@ -75,8 +73,9 @@ class SmoothTheme { ), ), floatingActionButtonTheme: FloatingActionButtonThemeData( - backgroundColor: - lightTheme ? smoothExtension.primaryDark : myColorScheme.primary, + backgroundColor: lightTheme + ? smoothExtension.primaryDark + : myColorScheme.primary, foregroundColor: myColorScheme.onPrimary, ), textTheme: textTheme, @@ -95,9 +94,7 @@ class SmoothTheme { inputDecorationTheme: InputDecorationTheme( fillColor: myColorScheme.secondary, ), - iconTheme: IconThemeData( - color: myColorScheme.onSurface, - ), + iconTheme: IconThemeData(color: myColorScheme.onSurface), snackBarTheme: SnackBarThemeData( contentTextStyle: _TEXT_THEME.bodyMedium?.copyWith( color: Colors.white, @@ -112,8 +109,9 @@ class SmoothTheme { backgroundColor: myColorScheme.secondary, ), checkboxTheme: CheckboxThemeData( - fillColor: - WidgetStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith(( + Set states, + ) { if (states.contains(WidgetState.disabled)) { return null; } @@ -130,14 +128,13 @@ class SmoothTheme { : smoothExtension.primarySemiDark, width: 2.0, ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(3.0), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(3.0)), checkColor: const WidgetStatePropertyAll(Colors.white), ), radioTheme: RadioThemeData( - fillColor: - WidgetStateProperty.resolveWith((Set states) { + fillColor: WidgetStateProperty.resolveWith(( + Set states, + ) { if (states.contains(WidgetState.disabled)) { return null; } @@ -148,8 +145,9 @@ class SmoothTheme { }), ), switchTheme: SwitchThemeData( - thumbColor: - WidgetStateProperty.resolveWith((Set states) { + thumbColor: WidgetStateProperty.resolveWith(( + Set states, + ) { if (states.contains(WidgetState.selected)) { if (lightTheme) { return smoothExtension.primaryDark; @@ -166,8 +164,9 @@ class SmoothTheme { return null; } }), - trackColor: - WidgetStateProperty.resolveWith((Set states) { + trackColor: WidgetStateProperty.resolveWith(( + Set states, + ) { if (lightTheme) { return smoothExtension.primaryMedium; } else { @@ -188,8 +187,9 @@ class SmoothTheme { return _TEXT_THEME.copyWith( displayMedium: _TEXT_THEME.displayMedium?.copyWith(color: contrastLevel), - headlineMedium: - _TEXT_THEME.headlineMedium?.copyWith(color: contrastLevel), + headlineMedium: _TEXT_THEME.headlineMedium?.copyWith( + color: contrastLevel, + ), bodyMedium: _TEXT_THEME.bodyMedium?.copyWith(color: contrastLevel), displaySmall: _TEXT_THEME.bodySmall?.copyWith(color: contrastLevel), titleLarge: _TEXT_THEME.titleLarge?.copyWith(color: contrastLevel), @@ -199,34 +199,21 @@ class SmoothTheme { } static const TextTheme _TEXT_THEME = TextTheme( - displayLarge: TextStyle( - fontSize: 28.0, - fontWeight: FontWeight.bold, - ), + displayLarge: TextStyle(fontSize: 28.0, fontWeight: FontWeight.bold), displayMedium: TextStyle( fontSize: 24.0, fontWeight: FontWeight.bold, color: Colors.black, ), - displaySmall: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.bold, - ), + displaySmall: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), headlineMedium: TextStyle( fontSize: LARGE_SPACE, fontWeight: FontWeight.bold, color: Colors.black, ), - bodyMedium: TextStyle( - fontSize: 14, - letterSpacing: 0.5, - ), - titleMedium: TextStyle( - fontSize: 14.0, - ), - titleSmall: TextStyle( - fontSize: 12.0, - ), + bodyMedium: TextStyle(fontSize: 14, letterSpacing: 0.5), + titleMedium: TextStyle(fontSize: 14.0), + titleSmall: TextStyle(fontSize: 12.0), ); static MaterialColor getMaterialColorFromColor(Color color) { @@ -251,8 +238,11 @@ class SmoothTheme { final HSLColor hsl = HSLColor.fromColor(color); final HSLColor hslDark = hsl.withLightness( - (darker ? (hsl.lightness - value) : (hsl.lightness + value)) - .clamp(0.0, 1.0)); + (darker ? (hsl.lightness - value) : (hsl.lightness + value)).clamp( + 0.0, + 1.0, + ), + ); return hslDark.toColor(); } diff --git a/packages/smooth_app/lib/themes/smooth_theme_colors.dart b/packages/smooth_app/lib/themes/smooth_theme_colors.dart index 0679c01aef..b134481f53 100644 --- a/packages/smooth_app/lib/themes/smooth_theme_colors.dart +++ b/packages/smooth_app/lib/themes/smooth_theme_colors.dart @@ -29,31 +29,29 @@ class SmoothColorsThemeExtension }); SmoothColorsThemeExtension.defaultValues(bool lightTheme) - : primaryUltraBlack = const Color(0xFF201A17), - primaryBlack = const Color(0xFF341100), - primaryDark = const Color(0xFF483527), - primarySemiDark = const Color(0xFF52443D), - primaryTone = const Color(0xFF81756C), - primaryNormal = const Color(0xFFA08D84), - primaryMedium = const Color(0xFFEDE0DB), - primaryLight = const Color(0xFFF6F3F0), - secondaryNormal = const Color(0xFFF2994A), - secondaryVibrant = const Color(0xFFFB8229), - secondaryLight = const Color(0xFFEE8858), - success = const Color(0xFF219653), - successBackground = const Color(0xFFDEEDDB), - warning = const Color(0xFFFB8229), - warningBackground = const Color(0xFFF2E2D6), - error = const Color(0xFFEB5757), - errorBackground = const Color(0xFFF6E4E4), - greyDark = const Color(0xFF666666), - greyNormal = const Color(0xFF6C6C6C), - greyMedium = const Color(0xFF8F8F8F), - greyLight = const Color(0xFFE0E0E0), - cellOdd = - lightTheme ? const Color(0xFFFAF8F6) : const Color(0xFF2D251E), - cellEven = - lightTheme ? const Color(0xFFFFFFFF) : const Color(0xFF201A17); + : primaryUltraBlack = const Color(0xFF201A17), + primaryBlack = const Color(0xFF341100), + primaryDark = const Color(0xFF483527), + primarySemiDark = const Color(0xFF52443D), + primaryTone = const Color(0xFF81756C), + primaryNormal = const Color(0xFFA08D84), + primaryMedium = const Color(0xFFEDE0DB), + primaryLight = const Color(0xFFF6F3F0), + secondaryNormal = const Color(0xFFF2994A), + secondaryVibrant = const Color(0xFFFB8229), + secondaryLight = const Color(0xFFEE8858), + success = const Color(0xFF219653), + successBackground = const Color(0xFFDEEDDB), + warning = const Color(0xFFFB8229), + warningBackground = const Color(0xFFF2E2D6), + error = const Color(0xFFEB5757), + errorBackground = const Color(0xFFF6E4E4), + greyDark = const Color(0xFF666666), + greyNormal = const Color(0xFF6C6C6C), + greyMedium = const Color(0xFF8F8F8F), + greyLight = const Color(0xFFE0E0E0), + cellOdd = lightTheme ? const Color(0xFFFAF8F6) : const Color(0xFF2D251E), + cellEven = lightTheme ? const Color(0xFFFFFFFF) : const Color(0xFF201A17); // Ristreto final Color primaryUltraBlack; @@ -165,116 +163,40 @@ class SmoothColorsThemeExtension other.primaryUltraBlack, t, )!, - primaryBlack: Color.lerp( - primaryBlack, - other.primaryBlack, - t, - )!, - primaryDark: Color.lerp( - primaryDark, - other.primaryDark, - t, - )!, - primarySemiDark: Color.lerp( - primarySemiDark, - other.primarySemiDark, - t, - )!, - primaryTone: Color.lerp( - primaryTone, - other.primaryTone, - t, - )!, - primaryNormal: Color.lerp( - primaryNormal, - other.primaryNormal, - t, - )!, - primaryMedium: Color.lerp( - primaryMedium, - other.primaryMedium, - t, - )!, - primaryLight: Color.lerp( - primaryLight, - other.primaryLight, - t, - )!, - secondaryNormal: Color.lerp( - secondaryNormal, - other.secondaryNormal, - t, - )!, - secondaryLight: Color.lerp( - secondaryLight, - other.secondaryLight, - t, - )!, + primaryBlack: Color.lerp(primaryBlack, other.primaryBlack, t)!, + primaryDark: Color.lerp(primaryDark, other.primaryDark, t)!, + primarySemiDark: Color.lerp(primarySemiDark, other.primarySemiDark, t)!, + primaryTone: Color.lerp(primaryTone, other.primaryTone, t)!, + primaryNormal: Color.lerp(primaryNormal, other.primaryNormal, t)!, + primaryMedium: Color.lerp(primaryMedium, other.primaryMedium, t)!, + primaryLight: Color.lerp(primaryLight, other.primaryLight, t)!, + secondaryNormal: Color.lerp(secondaryNormal, other.secondaryNormal, t)!, + secondaryLight: Color.lerp(secondaryLight, other.secondaryLight, t)!, secondaryVibrant: Color.lerp( secondaryVibrant, other.secondaryVibrant, t, )!, - error: Color.lerp( - error, - other.error, - t, - )!, - errorBackground: Color.lerp( - errorBackground, - other.errorBackground, - t, - )!, - warning: Color.lerp( - warning, - other.warning, - t, - )!, + error: Color.lerp(error, other.error, t)!, + errorBackground: Color.lerp(errorBackground, other.errorBackground, t)!, + warning: Color.lerp(warning, other.warning, t)!, warningBackground: Color.lerp( warningBackground, other.warningBackground, t, )!, - success: Color.lerp( - success, - other.success, - t, - )!, + success: Color.lerp(success, other.success, t)!, successBackground: Color.lerp( successBackground, other.successBackground, t, )!, - greyDark: Color.lerp( - greyDark, - other.greyDark, - t, - )!, - greyNormal: Color.lerp( - greyNormal, - other.greyNormal, - t, - )!, - greyMedium: Color.lerp( - greyMedium, - other.greyMedium, - t, - )!, - greyLight: Color.lerp( - greyLight, - other.greyLight, - t, - )!, - cellOdd: Color.lerp( - cellOdd, - other.cellOdd, - t, - )!, - cellEven: Color.lerp( - cellEven, - other.cellEven, - t, - )!, + greyDark: Color.lerp(greyDark, other.greyDark, t)!, + greyNormal: Color.lerp(greyNormal, other.greyNormal, t)!, + greyMedium: Color.lerp(greyMedium, other.greyMedium, t)!, + greyLight: Color.lerp(greyLight, other.greyLight, t)!, + cellOdd: Color.lerp(cellOdd, other.cellOdd, t)!, + cellEven: Color.lerp(cellEven, other.cellEven, t)!, ); } } diff --git a/packages/smooth_app/lib/themes/theme_provider.dart b/packages/smooth_app/lib/themes/theme_provider.dart index aa0c46686b..95095b750b 100644 --- a/packages/smooth_app/lib/themes/theme_provider.dart +++ b/packages/smooth_app/lib/themes/theme_provider.dart @@ -9,7 +9,7 @@ const String THEME_AMOLED = 'AMOLED'; class ThemeProvider with ChangeNotifier { ThemeProvider(this._userPreferences) - : _theme = _userPreferences.currentTheme { + : _theme = _userPreferences.currentTheme { _userPreferences.addListener(_onPreferencesChanged); } @@ -64,7 +64,8 @@ class ThemeProvider with ChangeNotifier { Future setTheme(String value) async { assert( - value != THEME_LIGHT || value != THEME_DARK || value != THEME_AMOLED); + value != THEME_LIGHT || value != THEME_DARK || value != THEME_AMOLED, + ); await _userPreferences.setTheme(value); notifyListeners(); } diff --git a/packages/smooth_app/lib/widgets/attribute_button.dart b/packages/smooth_app/lib/widgets/attribute_button.dart index 73dad42f28..ebeb957fb7 100644 --- a/packages/smooth_app/lib/widgets/attribute_button.dart +++ b/packages/smooth_app/lib/widgets/attribute_button.dart @@ -46,8 +46,8 @@ class _AttributeButtonState extends State { final TextStyle style = themeData.textTheme.headlineMedium!; final String? info = widget.attribute.settingNote; final List children = []; - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); if (!editMode) { children.add( InkWell( @@ -56,8 +56,9 @@ class _AttributeButtonState extends State { currentImportanceId, ), child: ListTile( - tileColor: - context.lightTheme() ? Colors.white : extension.primaryMedium, + tileColor: context.lightTheme() + ? Colors.white + : extension.primaryMedium, shape: widget.isLast ? const RoundedRectangleBorder( borderRadius: BorderRadiusDirectional.vertical( @@ -80,12 +81,13 @@ class _AttributeButtonState extends State { ), ), trailing: GestureDetector( - child: Icon( - Icons.edit, - size: DEFAULT_ICON_SIZE, - color: extension.primaryBlack, - ), - onTap: () => setState(() => editMode = !editMode)), + child: Icon( + Icons.edit, + size: DEFAULT_ICON_SIZE, + color: extension.primaryBlack, + ), + onTap: () => setState(() => editMode = !editMode), + ), ), ), ); @@ -162,19 +164,19 @@ class _AttributeButtonState extends State { onTap: info == null ? null : () async => showDialog( - context: context, - builder: (BuildContext context) { - final AppLocalizations appLocalizations = - AppLocalizations.of(context); - return SmoothAlertDialog( - body: Text(info), - positiveAction: SmoothActionButton( - text: appLocalizations.close, - onPressed: () => Navigator.pop(context), - ), - ); - }, - ), + context: context, + builder: (BuildContext context) { + final AppLocalizations appLocalizations = + AppLocalizations.of(context); + return SmoothAlertDialog( + body: Text(info), + positiveAction: SmoothActionButton( + text: appLocalizations.close, + onPressed: () => Navigator.pop(context), + ), + ); + }, + ), ), Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/packages/smooth_app/lib/widgets/auto_scale_widget.dart b/packages/smooth_app/lib/widgets/auto_scale_widget.dart index d11adbc0c6..51f2b2f44c 100644 --- a/packages/smooth_app/lib/widgets/auto_scale_widget.dart +++ b/packages/smooth_app/lib/widgets/auto_scale_widget.dart @@ -15,10 +15,7 @@ class AutoScaleWidget extends SingleChildRenderObjectWidget { @override RenderObject createRenderObject(BuildContext context) { - return _AutoScaleRenderObject( - vsync: vsync, - duration: duration, - ); + return _AutoScaleRenderObject(vsync: vsync, duration: duration); } } @@ -28,10 +25,8 @@ class _AutoScaleRenderObject extends RenderProxyBox { required Duration duration, RenderBox? child, }) : super(child) { - _controller = AnimationController( - vsync: vsync, - duration: duration, - )..addListener(markNeedsLayout); + _controller = AnimationController(vsync: vsync, duration: duration) + ..addListener(markNeedsLayout); _animation = Tween(begin: 0.0, end: 1.0).animate(_controller); } diff --git a/packages/smooth_app/lib/widgets/ranking_floating_action_button.dart b/packages/smooth_app/lib/widgets/ranking_floating_action_button.dart index c81bbd0fca..e974a165a7 100644 --- a/packages/smooth_app/lib/widgets/ranking_floating_action_button.dart +++ b/packages/smooth_app/lib/widgets/ranking_floating_action_button.dart @@ -7,9 +7,7 @@ import 'package:smooth_app/l10n/app_localizations.dart'; // TODO(monsieurtanuki): we should probably remove that class to avoid confusion with the "compare" button /// Floating Action Button dedicated to Personal Ranking class RankingFloatingActionButton extends StatelessWidget { - const RankingFloatingActionButton({ - required this.onPressed, - }); + const RankingFloatingActionButton({required this.onPressed}); final VoidCallback onPressed; @@ -17,33 +15,32 @@ class RankingFloatingActionButton extends StatelessWidget { @override Widget build(BuildContext context) => SmoothRevealAnimation( - animationCurve: Curves.easeInOutBack, - startOffset: const Offset(0.0, 1.0), - child: Container( - height: MINIMUM_TOUCH_SIZE, - margin: - EdgeInsets.only(left: MediaQuery.sizeOf(context).width * 0.09), - alignment: Alignment.center, - child: SizedBox( - height: MINIMUM_TOUCH_SIZE, - child: ElevatedButton.icon( - onPressed: onPressed, - style: ButtonStyle( - shape: WidgetStateProperty.all( - const RoundedRectangleBorder( - borderRadius: CIRCULAR_BORDER_RADIUS, - ), - ), - ), - icon: const Icon(rankingIconData), - label: AutoSizeText( - AppLocalizations.of(context).myPersonalizedRanking, - textAlign: TextAlign.center, - maxLines: 2, - overflow: TextOverflow.ellipsis, + animationCurve: Curves.easeInOutBack, + startOffset: const Offset(0.0, 1.0), + child: Container( + height: MINIMUM_TOUCH_SIZE, + margin: EdgeInsets.only(left: MediaQuery.sizeOf(context).width * 0.09), + alignment: Alignment.center, + child: SizedBox( + height: MINIMUM_TOUCH_SIZE, + child: ElevatedButton.icon( + onPressed: onPressed, + style: ButtonStyle( + shape: WidgetStateProperty.all( + const RoundedRectangleBorder( + borderRadius: CIRCULAR_BORDER_RADIUS, ), ), ), + icon: const Icon(rankingIconData), + label: AutoSizeText( + AppLocalizations.of(context).myPersonalizedRanking, + textAlign: TextAlign.center, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), ), - ); + ), + ), + ); } diff --git a/packages/smooth_app/lib/widgets/selector_screen/smooth_screen_list_choice.dart b/packages/smooth_app/lib/widgets/selector_screen/smooth_screen_list_choice.dart index 67aa892b67..9be112b183 100644 --- a/packages/smooth_app/lib/widgets/selector_screen/smooth_screen_list_choice.dart +++ b/packages/smooth_app/lib/widgets/selector_screen/smooth_screen_list_choice.dart @@ -33,13 +33,15 @@ class SmoothSelectorScreen extends StatelessWidget { T value, bool selected, String filter, - ) itemBuilder; + ) + itemBuilder; final Iterable Function( List list, T? selectedItem, T? selectedItemOverride, String filter, - ) itemsFilter; + ) + itemsFilter; @override Widget build(BuildContext context) { @@ -52,46 +54,49 @@ class SmoothSelectorScreen extends StatelessWidget { create: (_) => TextEditingController(), ), ], - child: ValueNotifierListener, - PreferencesSelectorState>( - listenerWithValueNotifier: _onValueChanged, - child: SmoothScaffold2( - topBar: SmoothTopBar2( - title: title, - leadingAction: provider.autoValidate - ? SmoothLeadingAction.minimize - : SmoothLeadingAction.close, - elevationOnScroll: false, - ), - bottomBar: !provider.autoValidate - ? _SmoothSelectorScreenBottomBar( - onSave: () { - provider.saveSelectedItem(); - - if (provider.value is PreferencesSelectorEditingState) { - Navigator.of(context).pop( - (provider.value as PreferencesSelectorEditingState) - .selectedItemOverride, - ); - } - }, - ) - : null, - injectPaddingInBody: false, - children: [ - const _SmoothSelectorScreenSearchBar(), - const SliverPadding( - padding: EdgeInsetsDirectional.only( - top: SMALL_SPACE, + child: + ValueNotifierListener< + PreferencesSelectorProvider, + PreferencesSelectorState + >( + listenerWithValueNotifier: _onValueChanged, + child: SmoothScaffold2( + topBar: SmoothTopBar2( + title: title, + leadingAction: provider.autoValidate + ? SmoothLeadingAction.minimize + : SmoothLeadingAction.close, + elevationOnScroll: false, ), + bottomBar: !provider.autoValidate + ? _SmoothSelectorScreenBottomBar( + onSave: () { + provider.saveSelectedItem(); + + if (provider.value + is PreferencesSelectorEditingState) { + Navigator.of(context).pop( + (provider.value + as PreferencesSelectorEditingState) + .selectedItemOverride, + ); + } + }, + ) + : null, + injectPaddingInBody: false, + children: [ + const _SmoothSelectorScreenSearchBar(), + const SliverPadding( + padding: EdgeInsetsDirectional.only(top: SMALL_SPACE), + ), + _SmoothSelectorScreenList( + itemsFilter: itemsFilter, + itemBuilder: itemBuilder, + ), + ], ), - _SmoothSelectorScreenList( - itemsFilter: itemsFilter, - itemBuilder: itemBuilder, - ), - ], - ), - ), + ), ); } @@ -137,8 +142,9 @@ class _SmoothSelectorScreenSearchBarDelegate double shrinkOffset, bool overlapsContent, ) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; final bool darkMode = context.darkTheme(); return ColoredBox( @@ -152,17 +158,12 @@ class _SmoothSelectorScreenSearchBarDelegate child: TextFormField( controller: context.read(), textAlignVertical: TextAlignVertical.center, - style: const TextStyle( - fontSize: 15.0, - ), + style: const TextStyle(fontSize: 15.0), decoration: InputDecoration( hintText: AppLocalizations.of(context).search, enabledBorder: OutlineInputBorder( borderRadius: const BorderRadius.all(Radius.circular(10.0)), - borderSide: BorderSide( - color: colors.primaryNormal, - width: 2.0, - ), + borderSide: BorderSide(color: colors.primaryNormal, width: 2.0), ), focusedBorder: OutlineInputBorder( borderRadius: const BorderRadius.all(Radius.circular(15.0)), @@ -195,32 +196,28 @@ class _SmoothSelectorScreenSearchBarDelegate @override bool shouldRebuild( - covariant _SmoothSelectorScreenSearchBarDelegate oldDelegate) => - false; + covariant _SmoothSelectorScreenSearchBarDelegate oldDelegate, + ) => false; } class _SmoothSelectorScreenBottomBar extends StatelessWidget { - const _SmoothSelectorScreenBottomBar({ - required this.onSave, - }); + const _SmoothSelectorScreenBottomBar({required this.onSave}); final VoidCallback onSave; @override Widget build(BuildContext context) { - return ConsumerValueNotifierFilter, - PreferencesSelectorState>( - builder: ( - BuildContext context, - PreferencesSelectorState value, - _, - ) { + return ConsumerValueNotifierFilter< + PreferencesSelectorProvider, + PreferencesSelectorState + >( + builder: (BuildContext context, PreferencesSelectorState value, _) { if (value is! PreferencesSelectorEditingState) { return EMPTY_WIDGET; } - final SmoothColorsThemeExtension colors = - context.extension(); + final SmoothColorsThemeExtension colors = context + .extension(); return SmoothButtonsBar2( animate: true, @@ -249,13 +246,15 @@ class _SmoothSelectorScreenList extends StatefulWidget { T? selectedItem, T? selectedItemOverride, String filter, - ) itemsFilter; + ) + itemsFilter; final Widget Function( BuildContext context, T value, bool selected, String filter, - ) itemBuilder; + ) + itemBuilder; @override State<_SmoothSelectorScreenList> createState() => @@ -267,44 +266,46 @@ class _SmoothSelectorScreenListState @override Widget build(BuildContext context) { return Consumer2, TextEditingController>( - builder: ( - BuildContext context, - PreferencesSelectorProvider provider, - TextEditingController controller, - _, - ) { - final PreferencesSelectorLoadedState state = - provider.value as PreferencesSelectorLoadedState; - final T? selectedItem = state is PreferencesSelectorEditingState - ? (state as PreferencesSelectorEditingState).selectedItemOverride - : state.selectedItem; + builder: + ( + BuildContext context, + PreferencesSelectorProvider provider, + TextEditingController controller, + _, + ) { + final PreferencesSelectorLoadedState state = + provider.value as PreferencesSelectorLoadedState; + final T? selectedItem = state is PreferencesSelectorEditingState + ? (state as PreferencesSelectorEditingState) + .selectedItemOverride + : state.selectedItem; - final Iterable values = widget.itemsFilter( - state.items, - state.selectedItem, - selectedItem, - controller.text, - ); + final Iterable values = widget.itemsFilter( + state.items, + state.selectedItem, + selectedItem, + controller.text, + ); - return SliverFixedExtentList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - final T value = values.elementAt(index); - final bool selected = selectedItem == value; + return SliverFixedExtentList( + delegate: SliverChildBuilderDelegate( + (BuildContext context, int index) { + final T value = values.elementAt(index); + final bool selected = selectedItem == value; - return _SmoothSelectorScreenListItem( - builder: widget.itemBuilder, - item: value, - selected: selected, - filter: controller.text, - ); - }, - childCount: values.length, - addAutomaticKeepAlives: false, - ), - itemExtent: 60.0, - ); - }, + return _SmoothSelectorScreenListItem( + builder: widget.itemBuilder, + item: value, + selected: selected, + filter: controller.text, + ); + }, + childCount: values.length, + addAutomaticKeepAlives: false, + ), + itemExtent: 60.0, + ); + }, ); } } @@ -322,7 +323,8 @@ class _SmoothSelectorScreenListItem extends StatelessWidget { T value, bool selected, String filter, - ) builder; + ) + builder; final T item; final bool selected; @@ -330,10 +332,11 @@ class _SmoothSelectorScreenListItem extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; - final PreferencesSelectorProvider provider = - context.watch>(); + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; + final PreferencesSelectorProvider provider = context + .watch>(); return Semantics( value: item.toString(), @@ -355,8 +358,8 @@ class _SmoothSelectorScreenListItem extends StatelessWidget { ), color: selected ? context.darkTheme() - ? colors.primarySemiDark - : colors.primaryLight + ? colors.primarySemiDark + : colors.primaryLight : Colors.transparent, ), child: InkWell( diff --git a/packages/smooth_app/lib/widgets/selector_screen/smooth_screen_selector_provider.dart b/packages/smooth_app/lib/widgets/selector_screen/smooth_screen_selector_provider.dart index aefcf2d17f..b066e37ac8 100644 --- a/packages/smooth_app/lib/widgets/selector_screen/smooth_screen_selector_provider.dart +++ b/packages/smooth_app/lib/widgets/selector_screen/smooth_screen_selector_provider.dart @@ -100,11 +100,10 @@ class PreferencesSelectorLoadedState extends PreferencesSelectorState { PreferencesSelectorLoadedState copyWith({ T? selectedItem, List? items, - }) => - PreferencesSelectorLoadedState( - selectedItem: selectedItem ?? this.selectedItem, - items: items ?? this.items, - ); + }) => PreferencesSelectorLoadedState( + selectedItem: selectedItem ?? this.selectedItem, + items: items ?? this.items, + ); @override String toString() { @@ -117,10 +116,7 @@ class PreferencesSelectorEditingState PreferencesSelectorEditingState.fromLoadedState({ required this.selectedItemOverride, required PreferencesSelectorLoadedState loadedState, - }) : super( - selectedItem: loadedState.selectedItem, - items: loadedState.items, - ); + }) : super(selectedItem: loadedState.selectedItem, items: loadedState.items); final T? selectedItemOverride; diff --git a/packages/smooth_app/lib/widgets/slivers.dart b/packages/smooth_app/lib/widgets/slivers.dart index 5d41755923..18cf915fe3 100644 --- a/packages/smooth_app/lib/widgets/slivers.dart +++ b/packages/smooth_app/lib/widgets/slivers.dart @@ -13,10 +13,10 @@ class SliverGridDelegateWithFixedCrossAxisCountAndFixedHeight this.mainAxisSpacing = 0.0, this.crossAxisSpacing = 0.0, this.height = 56.0, - }) : assert(crossAxisCount > 0), - assert(mainAxisSpacing >= 0), - assert(crossAxisSpacing >= 0), - assert(height >= 0.0); + }) : assert(crossAxisCount > 0), + assert(mainAxisSpacing >= 0), + assert(crossAxisSpacing >= 0), + assert(height >= 0.0); /// The number of children in the cross axis. final int crossAxisCount; @@ -57,7 +57,8 @@ class SliverGridDelegateWithFixedCrossAxisCountAndFixedHeight @override bool shouldRelayout( - SliverGridDelegateWithFixedCrossAxisCountAndFixedHeight oldDelegate) { + SliverGridDelegateWithFixedCrossAxisCountAndFixedHeight oldDelegate, + ) { return oldDelegate.crossAxisCount != crossAxisCount || oldDelegate.mainAxisSpacing != mainAxisSpacing || oldDelegate.crossAxisSpacing != crossAxisSpacing || diff --git a/packages/smooth_app/lib/widgets/smooth_app_bar.dart b/packages/smooth_app/lib/widgets/smooth_app_bar.dart index 9fa2763e2d..b8457461b0 100644 --- a/packages/smooth_app/lib/widgets/smooth_app_bar.dart +++ b/packages/smooth_app/lib/widgets/smooth_app_bar.dart @@ -45,13 +45,15 @@ class SmoothAppBar extends StatelessWidget implements PreferredSizeWidget { this.forceMaterialTransparency = false, this.clipBehavior, super.key, - }) : assert(!actionMode || actionModeTitle != null), - assert( - elevationColor == null || elevation >= 0.0, - 'elevationColor requires a valid elevation', - ), - preferredSize = - _PreferredAppBarSize(toolbarHeight, bottom?.preferredSize.height); + }) : assert(!actionMode || actionModeTitle != null), + assert( + elevationColor == null || elevation >= 0.0, + 'elevationColor requires a valid elevation', + ), + preferredSize = _PreferredAppBarSize( + toolbarHeight, + bottom?.preferredSize.height, + ); final Widget? leading; final bool automaticallyImplyLeading; @@ -115,10 +117,7 @@ class SmoothAppBar extends StatelessWidget implements PreferredSizeWidget { duration: const Duration(milliseconds: 100), transitionBuilder: (Widget child, Animation animation) { return FadeTransition( - opacity: Tween( - begin: 0.0, - end: 1.0, - ).animate(animation), + opacity: Tween(begin: 0.0, end: 1.0).animate(animation), child: child, ); }, @@ -178,64 +177,60 @@ class SmoothAppBar extends StatelessWidget implements PreferredSizeWidget { } Widget _createActionModeAppBar(BuildContext context) => IconTheme( - data: IconThemeData(color: PopupMenuTheme.of(context).color), - child: AppBar( - leading: _ActionModeCloseButton( - tooltip: AppLocalizations.of(context).cancel, - onPressed: () { - onLeaveActionMode?.call(); - }, - ), - automaticallyImplyLeading: false, - title: actionModeTitle != null - ? _AppBarTitle( - title: actionModeTitle!, - titleTextStyle: titleTextStyle, - subTitle: actionModeSubTitle, - ignoreSemanticsForSubtitle: ignoreSemanticsForSubtitle, - ) - : null, - actions: actionModeActions, - flexibleSpace: flexibleSpace, - bottom: bottom, - scrolledUnderElevation: scrolledUnderElevation, - shadowColor: shadowColor, - surfaceTintColor: - backgroundColor ?? Theme.of(context).appBarTheme.backgroundColor, - backgroundColor: backgroundColor, - foregroundColor: foregroundColor, - iconTheme: iconTheme, - actionsIconTheme: actionsIconTheme, - primary: primary, - centerTitle: centerTitle, - excludeHeaderSemantics: excludeHeaderSemantics, - titleSpacing: titleSpacing, - shape: shape, - toolbarOpacity: toolbarOpacity, - bottomOpacity: bottomOpacity, - toolbarHeight: toolbarHeight, - leadingWidth: leadingWidth, - toolbarTextStyle: toolbarTextStyle, - titleTextStyle: titleTextStyle, - systemOverlayStyle: systemOverlayStyle, - ), - ); + data: IconThemeData(color: PopupMenuTheme.of(context).color), + child: AppBar( + leading: _ActionModeCloseButton( + tooltip: AppLocalizations.of(context).cancel, + onPressed: () { + onLeaveActionMode?.call(); + }, + ), + automaticallyImplyLeading: false, + title: actionModeTitle != null + ? _AppBarTitle( + title: actionModeTitle!, + titleTextStyle: titleTextStyle, + subTitle: actionModeSubTitle, + ignoreSemanticsForSubtitle: ignoreSemanticsForSubtitle, + ) + : null, + actions: actionModeActions, + flexibleSpace: flexibleSpace, + bottom: bottom, + scrolledUnderElevation: scrolledUnderElevation, + shadowColor: shadowColor, + surfaceTintColor: + backgroundColor ?? Theme.of(context).appBarTheme.backgroundColor, + backgroundColor: backgroundColor, + foregroundColor: foregroundColor, + iconTheme: iconTheme, + actionsIconTheme: actionsIconTheme, + primary: primary, + centerTitle: centerTitle, + excludeHeaderSemantics: excludeHeaderSemantics, + titleSpacing: titleSpacing, + shape: shape, + toolbarOpacity: toolbarOpacity, + bottomOpacity: bottomOpacity, + toolbarHeight: toolbarHeight, + leadingWidth: leadingWidth, + toolbarTextStyle: toolbarTextStyle, + titleTextStyle: titleTextStyle, + systemOverlayStyle: systemOverlayStyle, + ), + ); } class _PreferredAppBarSize extends Size { const _PreferredAppBarSize(this.toolbarHeight, this.bottomHeight) - : super.fromHeight( - (toolbarHeight ?? kToolbarHeight) + (bottomHeight ?? 0)); + : super.fromHeight((toolbarHeight ?? kToolbarHeight) + (bottomHeight ?? 0)); final double? toolbarHeight; final double? bottomHeight; } class _ActionModeCloseButton extends StatelessWidget { - const _ActionModeCloseButton({ - this.tooltip, - this.onPressed, - }); + const _ActionModeCloseButton({this.tooltip, this.onPressed}); final VoidCallback? onPressed; final String? tooltip; @@ -283,25 +278,27 @@ class _AppBarTitle extends StatelessWidget { DefaultTextStyle( maxLines: subTitle != null ? 1 : 2, overflow: TextOverflow.ellipsis, - style: (titleTextStyle ?? - AppBarTheme.of(context).titleTextStyle ?? - theme.appBarTheme.titleTextStyle?.copyWith( - fontWeight: FontWeight.w500, - ) ?? - theme.textTheme.titleLarge?.copyWith( - fontWeight: FontWeight.w500, - ) ?? - const TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.w500, - )) - .copyWith(color: color), + style: + (titleTextStyle ?? + AppBarTheme.of(context).titleTextStyle ?? + theme.appBarTheme.titleTextStyle?.copyWith( + fontWeight: FontWeight.w500, + ) ?? + theme.textTheme.titleLarge?.copyWith( + fontWeight: FontWeight.w500, + ) ?? + const TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.w500, + )) + .copyWith(color: color), child: title, ), if (subTitle != null) DefaultTextStyle( - style: (theme.textTheme.bodyMedium ?? const TextStyle()) - .copyWith(color: color), + style: (theme.textTheme.bodyMedium ?? const TextStyle()).copyWith( + color: color, + ), child: ExcludeSemantics( excluding: ignoreSemanticsForSubtitle ?? false, child: subTitle, diff --git a/packages/smooth_app/lib/widgets/smooth_banner.dart b/packages/smooth_app/lib/widgets/smooth_banner.dart index df15ef81b3..7d79f0f54c 100644 --- a/packages/smooth_app/lib/widgets/smooth_banner.dart +++ b/packages/smooth_app/lib/widgets/smooth_banner.dart @@ -51,8 +51,9 @@ class SmoothBanner extends StatelessWidget { @override Widget build(BuildContext context) { - final double bottomPadding = - addSafeArea ? MediaQuery.viewPaddingOf(context).bottom : 0.0; + final double bottomPadding = addSafeArea + ? MediaQuery.viewPaddingOf(context).bottom + : 0.0; Widget child = IntrinsicHeight( child: Row( @@ -104,12 +105,15 @@ class SmoothBanner extends StatelessWidget { Expanded( child: Text( title!, - style: (titleStyle ?? - const TextStyle( - fontSize: 16.0, - fontWeight: FontWeight.bold, - )) - .copyWith(color: titleColor ?? _titleColor), + style: + (titleStyle ?? + const TextStyle( + fontSize: 16.0, + fontWeight: FontWeight.bold, + )) + .copyWith( + color: titleColor ?? _titleColor, + ), ), ), if (onDismissClicked != null) ...[ @@ -122,8 +126,9 @@ class SmoothBanner extends StatelessWidget { crossColor: Colors.white, circleSize: 26.0, crossSize: 12.0, - tooltip: AppLocalizations.of(context) - .owner_field_info_close_button, + tooltip: AppLocalizations.of( + context, + ).owner_field_info_close_button, ), ], ], @@ -141,11 +146,12 @@ class SmoothBanner extends StatelessWidget { ), child: TextWithBoldParts( text: content, - textStyle: (contentStyle ?? - const TextStyle(fontSize: 14.0, height: 1.6)) - .copyWith( - color: contentColor ?? const Color(0xFF373737), - ), + textStyle: + (contentStyle ?? + const TextStyle(fontSize: 14.0, height: 1.6)) + .copyWith( + color: contentColor ?? const Color(0xFF373737), + ), ), ), if (bottomPadding > 0) SizedBox(height: bottomPadding), @@ -158,10 +164,7 @@ class SmoothBanner extends StatelessWidget { ); if (borderRadius != null) { - child = ClipRRect( - borderRadius: borderRadius!, - child: child, - ); + child = ClipRRect(borderRadius: borderRadius!, child: child); } if (topShadow) { @@ -199,7 +202,4 @@ class SmoothBanner extends StatelessWidget { } } -enum SmoothBannerDismissEvent { - fromSwipe, - fromButton, -} +enum SmoothBannerDismissEvent { fromSwipe, fromButton } diff --git a/packages/smooth_app/lib/widgets/smooth_barcode_widget.dart b/packages/smooth_app/lib/widgets/smooth_barcode_widget.dart index b60d91331b..577c8a164a 100644 --- a/packages/smooth_app/lib/widgets/smooth_barcode_widget.dart +++ b/packages/smooth_app/lib/widgets/smooth_barcode_widget.dart @@ -44,9 +44,7 @@ class SmoothBarcodeWidget extends StatelessWidget { data: barcode, barcode: _barcodeType, color: color ?? Colors.black, - style: TextStyle( - color: contentColor, - ), + style: TextStyle(color: contentColor), errorBuilder: (final BuildContext context, String? error) { onInvalidBarcode?.call(); diff --git a/packages/smooth_app/lib/widgets/smooth_circle.dart b/packages/smooth_app/lib/widgets/smooth_circle.dart index 477070229b..979b6f0c7e 100644 --- a/packages/smooth_app/lib/widgets/smooth_circle.dart +++ b/packages/smooth_app/lib/widgets/smooth_circle.dart @@ -16,14 +16,8 @@ class SmoothCircle extends StatelessWidget { @override Widget build(BuildContext context) { return DecoratedBox( - decoration: BoxDecoration( - color: color, - shape: BoxShape.circle, - ), - child: Padding( - padding: padding, - child: child, - ), + decoration: BoxDecoration(color: color, shape: BoxShape.circle), + child: Padding(padding: padding, child: child), ); } } diff --git a/packages/smooth_app/lib/widgets/smooth_close_button.dart b/packages/smooth_app/lib/widgets/smooth_close_button.dart index 90a8183329..9c35ca8a24 100644 --- a/packages/smooth_app/lib/widgets/smooth_close_button.dart +++ b/packages/smooth_app/lib/widgets/smooth_close_button.dart @@ -43,19 +43,14 @@ class SmoothCloseButton extends StatelessWidget { width: circleSize, height: circleSize, decoration: BoxDecoration( - shape: BoxShape.circle, - color: circleColor, - border: circleBorderColor != null - ? Border.all( - color: circleBorderColor!, - width: 1.5, - ) - : null), - padding: padding ?? const EdgeInsetsDirectional.all(7.0), - child: icons.Close( - size: crossSize, - color: crossColor, + shape: BoxShape.circle, + color: circleColor, + border: circleBorderColor != null + ? Border.all(color: circleBorderColor!, width: 1.5) + : null, ), + padding: padding ?? const EdgeInsetsDirectional.all(7.0), + child: icons.Close(size: crossSize, color: crossColor), ), ), ), diff --git a/packages/smooth_app/lib/widgets/smooth_dropdown.dart b/packages/smooth_app/lib/widgets/smooth_dropdown.dart index 7dd779d811..ac855e474b 100644 --- a/packages/smooth_app/lib/widgets/smooth_dropdown.dart +++ b/packages/smooth_app/lib/widgets/smooth_dropdown.dart @@ -58,19 +58,13 @@ class SmoothDropdownButton extends StatelessWidget { color: context.extension().primarySemiDark, borderRadius: CIRCULAR_BORDER_RADIUS, ), - child: Material( - type: MaterialType.transparency, - child: child, - ), + child: Material(type: MaterialType.transparency, child: child), ); } DropdownButton _createDropdownMenu(BuildContext context) { return DropdownButton( - icon: const icons.Chevron.down( - color: Colors.white, - size: 14.0, - ), + icon: const icons.Chevron.down(color: Colors.white, size: 14.0), elevation: 4, isDense: true, isExpanded: isExpanded, @@ -89,9 +83,7 @@ class SmoothDropdownButton extends StatelessWidget { return items .map( (SmoothDropdownItem item) => const Padding( - padding: EdgeInsetsDirectional.only( - end: MEDIUM_SPACE, - ), + padding: EdgeInsetsDirectional.only(end: MEDIUM_SPACE), child: SizedBox.square( dimension: 12.0, child: CircularProgressIndicator(), @@ -101,26 +93,26 @@ class SmoothDropdownButton extends StatelessWidget { .toList(growable: false); } - return items.map((SmoothDropdownItem item) { - return SizedBox( - child: Padding( - padding: const EdgeInsetsDirectional.only( - end: MEDIUM_SPACE, - ), - child: Center( - child: Text( - item.label, - textAlign: TextAlign.center, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 14.5, + return items + .map((SmoothDropdownItem item) { + return SizedBox( + child: Padding( + padding: const EdgeInsetsDirectional.only(end: MEDIUM_SPACE), + child: Center( + child: Text( + item.label, + textAlign: TextAlign.center, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 14.5, + ), + ), ), ), - ), - ), - ); - }).toList(growable: false); + ); + }) + .toList(growable: false); }, style: TextStyle( fontSize: 14.0, @@ -134,9 +126,7 @@ class SmoothDropdownButton extends StatelessWidget { padding: const EdgeInsetsDirectional.symmetric( horizontal: SMALL_SPACE, ), - child: Text( - item.label, - ), + child: Text(item.label), ), ), ) @@ -148,11 +138,7 @@ class SmoothDropdownButton extends StatelessWidget { } class SmoothDropdownItem { - SmoothDropdownItem({ - required this.value, - required this.label, - this.onTap, - }); + SmoothDropdownItem({required this.value, required this.label, this.onTap}); final T value; final String label; diff --git a/packages/smooth_app/lib/widgets/smooth_expandable_floating_action_button.dart b/packages/smooth_app/lib/widgets/smooth_expandable_floating_action_button.dart index 356a98e924..b2239f0ef9 100644 --- a/packages/smooth_app/lib/widgets/smooth_expandable_floating_action_button.dart +++ b/packages/smooth_app/lib/widgets/smooth_expandable_floating_action_button.dart @@ -58,10 +58,10 @@ class _SmoothExpandableFloatingActionButtonState 7.5) { final bool maxScrollReached = widget.scrollController.position.maxScrollExtent == - widget.scrollController.position.pixels; + widget.scrollController.position.pixels; final bool scrollUp = widget.scrollController.position.userScrollDirection == - ScrollDirection.forward; + ScrollDirection.forward; setState(() => _extended = maxScrollReached || scrollUp); } diff --git a/packages/smooth_app/lib/widgets/smooth_explanation_banner.dart b/packages/smooth_app/lib/widgets/smooth_explanation_banner.dart index 13b0adde2d..20fa938b81 100644 --- a/packages/smooth_app/lib/widgets/smooth_explanation_banner.dart +++ b/packages/smooth_app/lib/widgets/smooth_explanation_banner.dart @@ -17,32 +17,25 @@ class ExplanationTitleIcon extends StatelessWidget { this.margin = EdgeInsets.zero, this.padding = EdgeInsets.zero, this.safeArea = true, - }) : - // ignore: avoid_field_initializers_in_const_classes - type = null, - _child = child; + }) : // ignore: avoid_field_initializers_in_const_classes + type = null, + _child = child; - ExplanationTitleIcon.text({ - required this.title, - required String text, - }) : - // ignore: avoid_field_initializers_in_const_classes - type = null, - margin = null, - padding = null, - safeArea = true, - _child = Text(text); + ExplanationTitleIcon.text({required this.title, required String text}) + : // ignore: avoid_field_initializers_in_const_classes + type = null, + margin = null, + padding = null, + safeArea = true, + _child = Text(text); - ExplanationTitleIcon.type({ - required this.type, - required String text, - }) : - // ignore: avoid_field_initializers_in_const_classes - title = null, - margin = null, - padding = null, - safeArea = true, - _child = Text(text); + ExplanationTitleIcon.type({required this.type, required String text}) + : // ignore: avoid_field_initializers_in_const_classes + title = null, + margin = null, + padding = null, + safeArea = true, + _child = Text(text); final String? title; final String? type; @@ -53,10 +46,11 @@ class ExplanationTitleIcon extends StatelessWidget { @override Widget build(BuildContext context) { - final String title = this.title ?? + final String title = + this.title ?? AppLocalizations.of(context).edit_product_form_item_help(type!); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return SmoothCardHeaderButton( tooltip: title, @@ -90,17 +84,14 @@ class ExplanationTitleIcon extends StatelessWidget { } class ExplanationBodyTitle extends StatelessWidget { - const ExplanationBodyTitle({ - required this.label, - super.key, - }); + const ExplanationBodyTitle({required this.label, super.key}); final String label; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return Padding( @@ -158,12 +149,13 @@ class ExplanationBodyInfo extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return ColoredBox( - color: backgroundColor ?? + color: + backgroundColor ?? (lightTheme ? extension.primaryMedium : Colors.white12), child: ClipRect( child: SizedBox( @@ -203,8 +195,8 @@ class ExplanationTextContainer extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return Column( @@ -213,49 +205,50 @@ class ExplanationTextContainer extends StatelessWidget { _ExplanationContainerTitle( label: title, foregroundColor: Colors.white, - backgroundColor: - lightTheme ? extension.primarySemiDark : extension.primaryDark, + backgroundColor: lightTheme + ? extension.primarySemiDark + : extension.primaryDark, ), - ...items.mapIndexed( - (int position, ExplanationTextContainerContent item) { - return switch (item) { - ExplanationTextContainerContentText() => Padding( - padding: const EdgeInsetsDirectional.only( - start: LARGE_SPACE, - end: LARGE_SPACE, - top: MEDIUM_SPACE, - bottom: VERY_SMALL_SPACE, - ), - child: TextWithBoldParts( - text: item.text, - textStyle: TextStyle( - color: lightTheme ? extension.primaryDark : Colors.white, - ), - ), + ...items.mapIndexed(( + int position, + ExplanationTextContainerContent item, + ) { + return switch (item) { + ExplanationTextContainerContentText() => Padding( + padding: const EdgeInsetsDirectional.only( + start: LARGE_SPACE, + end: LARGE_SPACE, + top: MEDIUM_SPACE, + bottom: VERY_SMALL_SPACE, + ), + child: TextWithBoldParts( + text: item.text, + textStyle: TextStyle( + color: lightTheme ? extension.primaryDark : Colors.white, ), - ExplanationTextContainerContentItem() => Padding( - padding: item.padding ?? - const EdgeInsetsDirectional.only( - top: SMALL_SPACE, - ), - child: _ExplanationBodyListItem( - icon: icons.Arrow.right( - size: 11.0, - color: lightTheme ? null : extension.primarySemiDark, - ), - iconBackgroundColor: lightTheme - ? extension.primarySemiDark - : extension.primaryLight, - iconPadding: EdgeInsets.zero, - title: item.text, - text: item.example, - visualExample: item.visualExample, - visualExamplePosition: item.visualExamplePosition, - ), + ), + ), + ExplanationTextContainerContentItem() => Padding( + padding: + item.padding ?? + const EdgeInsetsDirectional.only(top: SMALL_SPACE), + child: _ExplanationBodyListItem( + icon: icons.Arrow.right( + size: 11.0, + color: lightTheme ? null : extension.primarySemiDark, ), - }; - }, - ), + iconBackgroundColor: lightTheme + ? extension.primarySemiDark + : extension.primaryLight, + iconPadding: EdgeInsets.zero, + title: item.text, + text: item.example, + visualExample: item.visualExample, + visualExamplePosition: item.visualExamplePosition, + ), + ), + }; + }), ], ); } @@ -288,17 +281,15 @@ class ExplanationTextContainerContentItem } class ExplanationGoodExamplesContainer extends StatelessWidget { - const ExplanationGoodExamplesContainer({ - required this.items, - super.key, - }) : assert(items.length > 0); + const ExplanationGoodExamplesContainer({required this.items, super.key}) + : assert(items.length > 0); final List items; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return Column( children: [ @@ -321,18 +312,20 @@ class ExplanationGoodExamplesContainer extends StatelessWidget { } class ExplanationBadExamplesContainer extends StatelessWidget { - const ExplanationBadExamplesContainer( - {required this.items, required this.explanations, super.key}) - : assert(items.length > 0), - assert(items.length == explanations.length); + const ExplanationBadExamplesContainer({ + required this.items, + required this.explanations, + super.key, + }) : assert(items.length > 0), + assert(items.length == explanations.length); final List items; final List explanations; @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); return Column( children: [ @@ -387,9 +380,7 @@ class _ExplanationContainerTitle extends StatelessWidget { ), child: Row( children: [ - SmoothModalSheetHeaderPrefixIndicator( - color: foregroundColor, - ), + SmoothModalSheetHeaderPrefixIndicator(color: foregroundColor), const SizedBox(width: LARGE_SPACE), Expanded( child: Text( @@ -430,8 +421,8 @@ class _ExplanationBodyListItem extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return Padding( @@ -452,10 +443,7 @@ class _ExplanationBodyListItem extends StatelessWidget { shape: const CircleBorder(), color: iconBackgroundColor, ), - child: Padding( - padding: iconPadding, - child: icon, - ), + child: Padding(padding: iconPadding, child: icon), ), ), SizedBox(width: title != null ? 11.0 : 13.0), @@ -517,11 +505,9 @@ class _ExplanationBodyListItem extends StatelessWidget { ), if (visualExample != null && visualExamplePosition == - ExplanationVisualExamplePosition - .afterExample) ...[ - const SizedBox(height: VERY_SMALL_SPACE), - visualExample!, - ], + ExplanationVisualExamplePosition.afterExample) ...< + Widget + >[const SizedBox(height: VERY_SMALL_SPACE), visualExample!], ], ), ), @@ -531,7 +517,4 @@ class _ExplanationBodyListItem extends StatelessWidget { } } -enum ExplanationVisualExamplePosition { - afterTitle, - afterExample, -} +enum ExplanationVisualExamplePosition { afterTitle, afterExample } diff --git a/packages/smooth_app/lib/widgets/smooth_floating_message.dart b/packages/smooth_app/lib/widgets/smooth_floating_message.dart index 1646f53253..cb1dc60ed7 100644 --- a/packages/smooth_app/lib/widgets/smooth_floating_message.dart +++ b/packages/smooth_app/lib/widgets/smooth_floating_message.dart @@ -20,9 +20,9 @@ class SmoothFloatingMessage { required this.message, this.type = SmoothFloatingMessageType.success, }) : header = const Padding( - padding: EdgeInsetsDirectional.only(top: SMALL_SPACE), - child: CloudUploadAnimation(size: 50.0), - ); + padding: EdgeInsetsDirectional.only(top: SMALL_SPACE), + child: CloudUploadAnimation(size: 50.0), + ); final String message; final Widget? header; @@ -44,21 +44,23 @@ class SmoothFloatingMessage { ? (Scaffold.of(context).appBarMaxHeight ?? kToolbarHeight) : MediaQuery.paddingOf(context).top; - _entry = OverlayEntry(builder: (BuildContext context) { - return _SmoothFloatingMessageView( - message: message, - header: header, - type: type, - onTap: hide, - alignment: alignment, - margin: EdgeInsetsDirectional.only( - top: appBarHeight, - start: SMALL_SPACE, - end: SMALL_SPACE, - bottom: SMALL_SPACE, - ), - ); - }); + _entry = OverlayEntry( + builder: (BuildContext context) { + return _SmoothFloatingMessageView( + message: message, + header: header, + type: type, + onTap: hide, + alignment: alignment, + margin: EdgeInsetsDirectional.only( + top: appBarHeight, + start: SMALL_SPACE, + end: SMALL_SPACE, + bottom: SMALL_SPACE, + ), + ); + }, + ); Overlay.of(context).insert(_entry!); _autoDismissMessage = Timer(duration ?? const Duration(seconds: 5), () { @@ -115,8 +117,8 @@ class _SmoothFloatingMessageViewState extends State<_SmoothFloatingMessageView> @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final SnackBarThemeData snackBarTheme = Theme.of(context).snackBarTheme; @@ -170,14 +172,10 @@ class _SmoothFloatingMessageViewState extends State<_SmoothFloatingMessageView> } Color _getColor(SmoothColorsThemeExtension theme) => switch (widget.type) { - SmoothFloatingMessageType.success => theme.success, - SmoothFloatingMessageType.error => theme.error, - SmoothFloatingMessageType.warning => theme.warning, - }; + SmoothFloatingMessageType.success => theme.success, + SmoothFloatingMessageType.error => theme.error, + SmoothFloatingMessageType.warning => theme.warning, + }; } -enum SmoothFloatingMessageType { - success, - error, - warning, -} +enum SmoothFloatingMessageType { success, error, warning } diff --git a/packages/smooth_app/lib/widgets/smooth_hero.dart b/packages/smooth_app/lib/widgets/smooth_hero.dart index aa0f33d3d1..969315fdd4 100644 --- a/packages/smooth_app/lib/widgets/smooth_hero.dart +++ b/packages/smooth_app/lib/widgets/smooth_hero.dart @@ -26,8 +26,9 @@ class SmoothHero extends StatelessWidget { enabled: enabled, child: Hero( tag: tag ?? '', - flightShuttleBuilder: - onAnimationEnded == null ? null : _flightShuttleBuilder, + flightShuttleBuilder: onAnimationEnded == null + ? null + : _flightShuttleBuilder, child: child, ), ); @@ -48,8 +49,9 @@ class SmoothHero extends StatelessWidget { final Hero toHero = toHeroContext.widget as Hero; final MediaQueryData? toMediaQueryData = MediaQuery.maybeOf(toHeroContext); - final MediaQueryData? fromMediaQueryData = - MediaQuery.maybeOf(fromHeroContext); + final MediaQueryData? fromMediaQueryData = MediaQuery.maybeOf( + fromHeroContext, + ); if (toMediaQueryData == null || fromMediaQueryData == null) { return toHero.child; @@ -59,27 +61,30 @@ class SmoothHero extends StatelessWidget { final EdgeInsets toHeroPadding = toMediaQueryData.padding; return AnimatedBuilder( - animation: animation, - builder: (BuildContext context, Widget? child) { - return MediaQuery( - data: toMediaQueryData.copyWith( - padding: (flightDirection == HeroFlightDirection.push) - ? EdgeInsetsTween( - begin: fromHeroPadding, - end: toHeroPadding, - ).evaluate(animation) - : EdgeInsetsTween( - begin: toHeroPadding, - end: fromHeroPadding, - ).evaluate(animation), - ), - child: toHero.child, - ); - }); + animation: animation, + builder: (BuildContext context, Widget? child) { + return MediaQuery( + data: toMediaQueryData.copyWith( + padding: (flightDirection == HeroFlightDirection.push) + ? EdgeInsetsTween( + begin: fromHeroPadding, + end: toHeroPadding, + ).evaluate(animation) + : EdgeInsetsTween( + begin: toHeroPadding, + end: fromHeroPadding, + ).evaluate(animation), + ), + child: toHero.child, + ); + }, + ); } void _onAnimationStatusChanged( - AnimationStatus status, HeroFlightDirection direction) { + AnimationStatus status, + HeroFlightDirection direction, + ) { if (status == AnimationStatus.completed) { onAnimationEnded?.call(direction); } diff --git a/packages/smooth_app/lib/widgets/smooth_indicator_icon.dart b/packages/smooth_app/lib/widgets/smooth_indicator_icon.dart index 74a4e7b755..3a92eed55c 100644 --- a/packages/smooth_app/lib/widgets/smooth_indicator_icon.dart +++ b/packages/smooth_app/lib/widgets/smooth_indicator_icon.dart @@ -19,10 +19,7 @@ class SmoothIndicatorIcon extends StatelessWidget { @override Widget build(BuildContext context) { return Padding( - padding: margin ?? - const EdgeInsetsDirectional.all( - VERY_SMALL_SPACE, - ), + padding: margin ?? const EdgeInsetsDirectional.all(VERY_SMALL_SPACE), child: DecoratedBox( decoration: const BoxDecoration( color: Colors.black38, @@ -31,11 +28,9 @@ class SmoothIndicatorIcon extends StatelessWidget { child: Padding( padding: padding ?? const EdgeInsetsDirectional.all(SMALL_SPACE), child: IconTheme( - data: iconTheme ?? - const IconThemeData( - color: Colors.white, - size: 15.0, - ), + data: + iconTheme ?? + const IconThemeData(color: Colors.white, size: 15.0), child: icon, ), ), diff --git a/packages/smooth_app/lib/widgets/smooth_interactive_viewer.dart b/packages/smooth_app/lib/widgets/smooth_interactive_viewer.dart index ef8bfedaa1..f33c49c25a 100644 --- a/packages/smooth_app/lib/widgets/smooth_interactive_viewer.dart +++ b/packages/smooth_app/lib/widgets/smooth_interactive_viewer.dart @@ -75,12 +75,13 @@ class _SmoothInteractiveViewerState extends State _animationController.duration = SmoothAnimationsDuration.short; } - _animation = Matrix4Tween( - begin: _transformationController.value, - end: matrix, - ).animate( - CurveTween(curve: Curves.easeInCubic).animate(_animationController), - ); + _animation = + Matrix4Tween( + begin: _transformationController.value, + end: matrix, + ).animate( + CurveTween(curve: Curves.easeInCubic).animate(_animationController), + ); _animationController.forward(from: 0); } diff --git a/packages/smooth_app/lib/widgets/smooth_list_diff.dart b/packages/smooth_app/lib/widgets/smooth_list_diff.dart index ae9781b8ee..dcdb68fe0c 100644 --- a/packages/smooth_app/lib/widgets/smooth_list_diff.dart +++ b/packages/smooth_app/lib/widgets/smooth_list_diff.dart @@ -51,8 +51,10 @@ class _SmoothAnimatedListState extends State> { _clearFloatingItems(); - final _DataDiff diff = - _DataDiff.computeDiff(oldWidget.data, widget.data); + final _DataDiff diff = _DataDiff.computeDiff( + oldWidget.data, + widget.data, + ); _oldData = oldWidget.data; for (final _DataMove move in diff.movedItems) { @@ -78,11 +80,15 @@ class _SmoothAnimatedListState extends State> { final OverlayEntry floatingItem = OverlayEntry( builder: (BuildContext context) { return _MovingOverlayItem( - widgetPosition: - widgetPosition.translate(0.0, widget.padding?.top ?? 0.0), - startTop: (_itemSizes[move.oldIndex]!.height + widget.separatorSize) * + widgetPosition: widgetPosition.translate( + 0.0, + widget.padding?.top ?? 0.0, + ), + startTop: + (_itemSizes[move.oldIndex]!.height + widget.separatorSize) * move.oldIndex, - endTop: (_itemSizes[move.oldIndex]!.height + widget.separatorSize) * + endTop: + (_itemSizes[move.oldIndex]!.height + widget.separatorSize) * move.newIndex, start: widget.padding?.start ?? 0.0, end: widget.padding?.end ?? 0.0, @@ -168,11 +174,8 @@ class _SmoothAnimatedListState extends State> { } } -typedef SmoothSliverListItemBuilder = Widget Function( - BuildContext context, - T object, - int index, -); +typedef SmoothSliverListItemBuilder = + Widget Function(BuildContext context, T object, int index); class _MovingOverlayItem extends StatefulWidget { const _MovingOverlayItem({ @@ -208,40 +211,29 @@ class _MovingOverlayItemState extends State<_MovingOverlayItem> @override void initState() { super.initState(); - _controller = AnimationController( - vsync: this, - duration: SmoothAnimationsDuration.medium, - )..addListener(() { - if (_translateAnimation.value == widget.endTop) { - widget.onAnimationEnd(); - } + _controller = + AnimationController( + vsync: this, + duration: SmoothAnimationsDuration.medium, + )..addListener(() { + if (_translateAnimation.value == widget.endTop) { + widget.onAnimationEnd(); + } - setState(() {}); - }); + setState(() {}); + }); - _translateAnimation = Tween( - begin: widget.startTop, - end: widget.endTop, - ).animate( - CurvedAnimation( - parent: _controller, - curve: const Interval( - 0.0, - 0.9, - curve: Curves.easeInOutQuint, - ), - ), - ); + _translateAnimation = + Tween(begin: widget.startTop, end: widget.endTop).animate( + CurvedAnimation( + parent: _controller, + curve: const Interval(0.0, 0.9, curve: Curves.easeInOutQuint), + ), + ); /// A subtle fade will be applied at the end of the animation - _opacityAnimation = Tween( - begin: 1.0, - end: 0.0, - ).animate( - CurvedAnimation( - parent: _controller, - curve: const Interval(0.88, 1.0), - ), + _opacityAnimation = Tween(begin: 1.0, end: 0.0).animate( + CurvedAnimation(parent: _controller, curve: const Interval(0.88, 1.0)), ); /// Start the animation immediately @@ -288,9 +280,7 @@ class _DataDiff { if (oldPosition != -1) { final int newPosition = newData.indexOf(item); if (oldPosition != newPosition) { - movedItems.add( - _DataMove(item, oldPosition, newPosition), - ); + movedItems.add(_DataMove(item, oldPosition, newPosition)); } } } diff --git a/packages/smooth_app/lib/widgets/smooth_menu_button.dart b/packages/smooth_app/lib/widgets/smooth_menu_button.dart index b2ccb04987..47bfc32faf 100644 --- a/packages/smooth_app/lib/widgets/smooth_menu_button.dart +++ b/packages/smooth_app/lib/widgets/smooth_menu_button.dart @@ -13,12 +13,12 @@ class SmoothPopupMenuButton extends StatefulWidget { this.actionsTitle, this.buttonIcon, this.buttonLabel, - }) : assert(buttonLabel == null || buttonLabel.length > 0), - assert(actionsTitle == null || actionsTitle.length > 0); + }) : assert(buttonLabel == null || buttonLabel.length > 0), + assert(actionsTitle == null || actionsTitle.length > 0); final void Function(T value) onSelected; final Iterable> Function(BuildContext context) - itemBuilder; + itemBuilder; final String? actionsTitle; final Icon? buttonIcon; final String? buttonLabel; @@ -33,7 +33,8 @@ class _SmoothPopupMenuButtonState extends State> { Widget build(BuildContext context) { return IconButton( icon: widget.buttonIcon ?? Icon(Icons.adaptive.more), - tooltip: widget.buttonLabel ?? + tooltip: + widget.buttonLabel ?? MaterialLocalizations.of(context).showMenuTooltip, onPressed: _openModalSheet, ); @@ -49,7 +50,8 @@ class _SmoothPopupMenuButtonState extends State> { .where((SmoothPopupMenuItem item) => item.enabled); return SmoothModalSheet( - title: widget.actionsTitle ?? + title: + widget.actionsTitle ?? AppLocalizations.of(context).menu_button_list_actions, prefixIndicator: true, bodyPadding: EdgeInsets.zero, diff --git a/packages/smooth_app/lib/widgets/smooth_navigation_bar.dart b/packages/smooth_app/lib/widgets/smooth_navigation_bar.dart index 54be3ef988..4aa2f5474c 100644 --- a/packages/smooth_app/lib/widgets/smooth_navigation_bar.dart +++ b/packages/smooth_app/lib/widgets/smooth_navigation_bar.dart @@ -50,49 +50,52 @@ class _SmoothNavigationBarState extends State { ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceAround, - children: widget.destinations.mapIndexed(( - int position, - SmoothNavigationDestination destination, - ) { - final int index = widget.destinations.indexOf(destination); - return Expanded( - child: Material( - type: MaterialType.transparency, - child: Listener( - onPointerDown: (PointerDownEvent event) => - _lastEvent = event, - child: InkWell( - onTap: () => widget.onDestinationSelected(index), - customBorder: RoundedRectangleBorder( - borderRadius: BorderRadius.all( - Radius.circular( - MediaQuery.sizeOf(context).width / 2, + children: widget.destinations + .mapIndexed(( + int position, + SmoothNavigationDestination destination, + ) { + final int index = widget.destinations.indexOf(destination); + return Expanded( + child: Material( + type: MaterialType.transparency, + child: Listener( + onPointerDown: (PointerDownEvent event) => + _lastEvent = event, + child: InkWell( + onTap: () => widget.onDestinationSelected(index), + customBorder: RoundedRectangleBorder( + borderRadius: BorderRadius.all( + Radius.circular( + MediaQuery.sizeOf(context).width / 2, + ), + ), + ), + child: SizedBox( + width: double.infinity, + child: _SmoothNavigationBarItem( + destination: destination, + selected: index == widget.selectedIndex, + lastPointerEvent: _lastEvent, + coordinates: _size != null + ? Rect.fromLTWH( + position * + _size!.width / + widget.destinations.length, + 0.0, + _size!.width / + widget.destinations.length, + _size!.height, + ) + : null, + ), ), ), ), - child: SizedBox( - width: double.infinity, - child: _SmoothNavigationBarItem( - destination: destination, - selected: index == widget.selectedIndex, - lastPointerEvent: _lastEvent, - coordinates: _size != null - ? Rect.fromLTWH( - position * - _size!.width / - widget.destinations.length, - 0.0, - _size!.width / widget.destinations.length, - _size!.height, - ) - : null, - ), - ), ), - ), - ), - ); - }).toList(growable: false), + ); + }) + .toList(growable: false), ), ), ), @@ -139,8 +142,8 @@ class _SmoothNavigationBarItemState extends State<_SmoothNavigationBarItem> void didChangeDependencies() { super.didChangeDependencies(); - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); _iconColorAnimation = ColorTween( @@ -172,8 +175,8 @@ class _SmoothNavigationBarItemState extends State<_SmoothNavigationBarItem> @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension extension = - context.extension(); + final SmoothColorsThemeExtension extension = context + .extension(); final bool lightTheme = context.lightTheme(); return Padding( @@ -187,10 +190,7 @@ class _SmoothNavigationBarItemState extends State<_SmoothNavigationBarItem> mainAxisSize: MainAxisSize.min, children: [ IconTheme( - data: IconThemeData( - color: _iconColorAnimation.value, - size: 24.0, - ), + data: IconThemeData(color: _iconColorAnimation.value, size: 24.0), child: SizedBox( width: 64.0, height: 32.0, @@ -340,10 +340,7 @@ class _SmoothNavigationBarIconPainter extends CustomPainter { } class SmoothNavigationDestination { - const SmoothNavigationDestination({ - required this.icon, - required this.label, - }); + const SmoothNavigationDestination({required this.icon, required this.label}); final Widget icon; final String label; diff --git a/packages/smooth_app/lib/widgets/smooth_scaffold.dart b/packages/smooth_app/lib/widgets/smooth_scaffold.dart index a488332570..f6dbde4a7a 100644 --- a/packages/smooth_app/lib/widgets/smooth_scaffold.dart +++ b/packages/smooth_app/lib/widgets/smooth_scaffold.dart @@ -38,9 +38,10 @@ class SmoothScaffold extends Scaffold { super.endDrawerEnableOpenDragGesture = true, super.restorationId, }) : super( - resizeToAvoidBottomInset: - fixKeyboard ? false : resizeToAvoidBottomInset, - ); + resizeToAvoidBottomInset: fixKeyboard + ? false + : resizeToAvoidBottomInset, + ); static Color get semiTranslucentStatusBar { if (Platform.isIOS || Platform.isMacOS) { @@ -74,8 +75,8 @@ class SmoothScaffoldState extends ScaffoldState { if (_contentBehindStatusBar) { final Color statusBarColor = (widget as SmoothScaffold).statusBarBackgroundColor ?? - AppBarTheme.of(context).backgroundColor ?? - SmoothScaffold.semiTranslucentStatusBar; + AppBarTheme.of(context).backgroundColor ?? + SmoothScaffold.semiTranslucentStatusBar; if (_spaceBehindStatusBar) { child = Column( @@ -83,16 +84,9 @@ class SmoothScaffoldState extends ScaffoldState { SizedBox( width: double.infinity, height: viewPadding.top, - child: ColoredBox( - color: statusBarColor, - ), - ), - Expanded( - child: SafeArea( - top: false, - child: child, - ), + child: ColoredBox(color: statusBarColor), ), + Expanded(child: SafeArea(top: false, child: child)), ], ); } else { @@ -102,9 +96,7 @@ class SmoothScaffoldState extends ScaffoldState { SizedBox( width: double.infinity, height: viewPadding.top, - child: ColoredBox( - color: statusBarColor, - ), + child: ColoredBox(color: statusBarColor), ), ], ); @@ -112,7 +104,8 @@ class SmoothScaffoldState extends ScaffoldState { } if ((widget as SmoothScaffold).fixKeyboard) { - final double padding = MediaQuery.viewInsetsOf(context).bottom - + final double padding = + MediaQuery.viewInsetsOf(context).bottom - MediaQuery.viewPaddingOf(context).bottom; if (padding > 0.0) { @@ -131,9 +124,9 @@ class SmoothScaffoldState extends ScaffoldState { value: _overlayStyle, child: Theme( data: Theme.of(context).copyWith( - appBarTheme: AppBarTheme.of(context).copyWith( - systemOverlayStyle: _overlayStyle, - ), + appBarTheme: AppBarTheme.of( + context, + ).copyWith(systemOverlayStyle: _overlayStyle), ), child: child, ), @@ -174,8 +167,9 @@ class SmoothScaffoldState extends ScaffoldState { return SystemUiOverlayStyle( statusBarIconBrightness: Brightness.dark, statusBarBrightness: Brightness.light, - systemNavigationBarContrastEnforced: - !Platform.isAndroid ? false : null, + systemNavigationBarContrastEnforced: !Platform.isAndroid + ? false + : null, ); case Brightness.light: @@ -183,8 +177,9 @@ class SmoothScaffoldState extends ScaffoldState { return SystemUiOverlayStyle( statusBarIconBrightness: Brightness.light, statusBarBrightness: Brightness.dark, - systemNavigationBarContrastEnforced: - !Platform.isAndroid ? false : null, + systemNavigationBarContrastEnforced: !Platform.isAndroid + ? false + : null, ); } } diff --git a/packages/smooth_app/lib/widgets/smooth_switch.dart b/packages/smooth_app/lib/widgets/smooth_switch.dart index c3c1a830a3..f0eafe8110 100644 --- a/packages/smooth_app/lib/widgets/smooth_switch.dart +++ b/packages/smooth_app/lib/widgets/smooth_switch.dart @@ -74,8 +74,8 @@ class _SmoothSwitchState extends State @override Widget build(BuildContext context) { final SwitchThemeData switchTheme = Theme.of(context).switchTheme; - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); return Semantics( toggled: widget.value, @@ -85,7 +85,8 @@ class _SmoothSwitchState extends State widget.onChanged(!widget.value); }, child: Padding( - padding: widget.padding ?? + padding: + widget.padding ?? const EdgeInsets.symmetric( horizontal: SMALL_SPACE, vertical: SMALL_SPACE, @@ -94,21 +95,29 @@ class _SmoothSwitchState extends State size: widget.size ?? const Size(52.0, 30.0), painter: _SmoothSwitchPainter( progress: _progressAnimation.value, - thumbActiveColor: widget.thumbActiveColor ?? - switchTheme.thumbColor - ?.resolve({WidgetState.selected}) ?? + thumbActiveColor: + widget.thumbActiveColor ?? + switchTheme.thumbColor?.resolve({ + WidgetState.selected, + }) ?? theme.primaryDark, - thumbInactiveColor: widget.thumbInactiveColor ?? - switchTheme.thumbColor - ?.resolve({WidgetState.disabled}) ?? + thumbInactiveColor: + widget.thumbInactiveColor ?? + switchTheme.thumbColor?.resolve({ + WidgetState.disabled, + }) ?? const Color(0xFFC2B5B0), - backgroundActiveColor: widget.backgroundActiveColor ?? - switchTheme.trackColor - ?.resolve({WidgetState.selected}) ?? + backgroundActiveColor: + widget.backgroundActiveColor ?? + switchTheme.trackColor?.resolve({ + WidgetState.selected, + }) ?? theme.primaryMedium, - backgroundInactiveColor: widget.backgroundInactiveColor ?? - switchTheme.trackColor - ?.resolve({WidgetState.disabled}) ?? + backgroundInactiveColor: + widget.backgroundInactiveColor ?? + switchTheme.trackColor?.resolve({ + WidgetState.disabled, + }) ?? theme.primaryMedium, ), ), @@ -159,11 +168,7 @@ class _SmoothSwitchPainter extends CustomPainter { canvas.drawRRect(rrect, paint); - paint.color = Color.lerp( - thumbInactiveColor, - thumbActiveColor, - progress, - )!; + paint.color = Color.lerp(thumbInactiveColor, thumbActiveColor, progress)!; canvas.drawCircle(Offset(thumbPosition, radius), thumbRadius, paint); } diff --git a/packages/smooth_app/lib/widgets/smooth_tabbar.dart b/packages/smooth_app/lib/widgets/smooth_tabbar.dart index c1093d9653..89a42e08b6 100644 --- a/packages/smooth_app/lib/widgets/smooth_tabbar.dart +++ b/packages/smooth_app/lib/widgets/smooth_tabbar.dart @@ -38,17 +38,19 @@ class _SmoothTabBarState extends State> { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension theme = - context.extension(); + final SmoothColorsThemeExtension theme = context + .extension(); final bool lightTheme = context.lightTheme(); return CustomPaint( painter: _ProductHeaderTabBarPainter( progress: _horizontalProgress, primaryColor: lightTheme ? theme.primaryLight : theme.primaryDark, - bottomSeparatorColor: - lightTheme ? theme.primaryBlack : theme.primaryNormal, - backgroundColor: AppBarTheme.of(context).backgroundColor ?? + bottomSeparatorColor: lightTheme + ? theme.primaryBlack + : theme.primaryNormal, + backgroundColor: + AppBarTheme.of(context).backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, ), child: SizedBox( @@ -101,10 +103,7 @@ class _SmoothTabBarState extends State> { dividerColor: theme.primaryDark, indicator: BoxDecoration( border: Border( - bottom: BorderSide( - color: theme.primaryDark, - width: 3.0, - ), + bottom: BorderSide(color: theme.primaryDark, width: 3.0), ), borderRadius: const BorderRadius.vertical( top: Radius.circular(5.0), @@ -122,10 +121,8 @@ class _SmoothTabBarState extends State> { } class SmoothTabBarItem { - const SmoothTabBarItem({ - required this.label, - required this.value, - }) : assert(label.length > 0); + const SmoothTabBarItem({required this.label, required this.value}) + : assert(label.length > 0); final String label; final T value; @@ -197,26 +194,15 @@ class _ProductHeaderTabBarPainter extends CustomPainter { final double gradientSize = size.width * 0.1; if (progress > 0.0) { - _paint.shader = ui.Gradient.linear( - Offset.zero, - Offset(gradientSize, 0.0), - [ - primaryColor.withValues( - alpha: progress.progressAndClamp(0.0, 0.3, 1.0), - ), - backgroundColor, - ], - ); + _paint.shader = + ui.Gradient.linear(Offset.zero, Offset(gradientSize, 0.0), [ + primaryColor.withValues( + alpha: progress.progressAndClamp(0.0, 0.3, 1.0), + ), + backgroundColor, + ]); - canvas.drawRect( - Rect.fromLTWH( - 0, - 0, - gradientSize, - size.height, - ), - _paint, - ); + canvas.drawRect(Rect.fromLTWH(0, 0, gradientSize, size.height), _paint); } if (progress < 1.0) { @@ -232,12 +218,7 @@ class _ProductHeaderTabBarPainter extends CustomPainter { ); canvas.drawRect( - Rect.fromLTWH( - size.width - gradientSize, - 0, - size.width, - size.height, - ), + Rect.fromLTWH(size.width - gradientSize, 0, size.width, size.height), _paint, ); } diff --git a/packages/smooth_app/lib/widgets/smooth_text.dart b/packages/smooth_app/lib/widgets/smooth_text.dart index c97464fd04..d2c29337b6 100644 --- a/packages/smooth_app/lib/widgets/smooth_text.dart +++ b/packages/smooth_app/lib/widgets/smooth_text.dart @@ -22,9 +22,8 @@ extension StringExtension on String { /// An extension on [TextStyle] that allows to have "well spaced" variant extension TextStyleExtension on TextStyle { - TextStyle get wellSpaced => copyWith( - height: WellSpacedTextHelper._WELL_SPACED_TEXT_HEIGHT, - ); + TextStyle get wellSpaced => + copyWith(height: WellSpacedTextHelper._WELL_SPACED_TEXT_HEIGHT); } /// An extension on [DefaultTextStyle] that allows to have "well spaced" variant @@ -37,8 +36,9 @@ class WellSpacedTextHelper { static const double _WELL_SPACED_TEXT_HEIGHT = 1.45; - static const TextStyle TEXT_STYLE_WITH_WELL_SPACED = - TextStyle(height: _WELL_SPACED_TEXT_HEIGHT); + static const TextStyle TEXT_STYLE_WITH_WELL_SPACED = TextStyle( + height: _WELL_SPACED_TEXT_HEIGHT, + ); static Widget mergeWithWellSpacedTextStyle({ Key? key, @@ -49,17 +49,16 @@ class WellSpacedTextHelper { int? maxLines, TextWidthBasis? textWidthBasis, required Widget child, - }) => - DefaultTextStyle.merge( - child: child, - key: key, - style: style ?? const TextStyle(height: _WELL_SPACED_TEXT_HEIGHT), - textAlign: textAlign, - softWrap: softWrap, - overflow: overflow, - maxLines: maxLines, - textWidthBasis: textWidthBasis, - ); + }) => DefaultTextStyle.merge( + child: child, + key: key, + style: style ?? const TextStyle(height: _WELL_SPACED_TEXT_HEIGHT), + textAlign: textAlign, + softWrap: softWrap, + overflow: overflow, + maxLines: maxLines, + textWidthBasis: textWidthBasis, + ); } class TextHighlighter extends StatelessWidget { @@ -88,8 +87,9 @@ class TextHighlighter extends StatelessWidget { parts = _getParts( defaultStyle: defaultStyle, highlightedStyle: defaultStyle.copyWith( - backgroundColor: - Theme.of(context).primaryColor.withValues(alpha: 0.2), + backgroundColor: Theme.of( + context, + ).primaryColor.withValues(alpha: 0.2), ), ); } catch (e, trace) { @@ -105,12 +105,14 @@ class TextHighlighter extends StatelessWidget { return Text.rich( TextSpan( - children: parts.map(((String, TextStyle?) part) { - return TextSpan( - text: part.$1, - style: defaultTextStyle.merge(part.$2), - ); - }).toList(growable: false), + children: parts + .map(((String, TextStyle?) part) { + return TextSpan( + text: part.$1, + style: defaultTextStyle.merge(part.$2), + ); + }) + .toList(growable: false), ), softWrap: softWrap, textAlign: textAlign, @@ -127,18 +129,19 @@ class TextHighlighter extends StatelessWidget { final String filterWithoutDiacritics = filter.getComparisonSafeString(); final String textWithoutDiacritics = text.getComparisonSafeString(); - final Iterable highlightedParts = - RegExp(RegExp.escape(filterWithoutDiacritics.trim())).allMatches( - textWithoutDiacritics, - ); + final Iterable highlightedParts = RegExp( + RegExp.escape(filterWithoutDiacritics.trim()), + ).allMatches(textWithoutDiacritics); final List<(String, TextStyle?)> parts = <(String, TextStyle?)>[]; if (highlightedParts.isEmpty) { parts.add((text, defaultStyle)); } else { - parts - .add((text.substring(0, highlightedParts.first.start), defaultStyle)); + parts.add(( + text.substring(0, highlightedParts.first.start), + defaultStyle, + )); int diff = 0; for (int i = 0; i != highlightedParts.length; i++) { @@ -153,15 +156,18 @@ class TextHighlighter extends StatelessWidget { ); diff = subPart.end - endPosition; - parts.add( - (text.substring(startPosition, endPosition), highlightedStyle), - ); + parts.add(( + text.substring(startPosition, endPosition), + highlightedStyle, + )); if (i < highlightedParts.length - 1) { parts.add(( text.substring( - endPosition, highlightedParts.elementAt(i + 1).start - diff), - defaultStyle + endPosition, + highlightedParts.elementAt(i + 1).start - diff, + ), + defaultStyle, )); } else if (endPosition < text.length) { parts.add((text.substring(endPosition, text.length), defaultStyle)); @@ -206,24 +212,19 @@ class HighlightedTextSpan extends WidgetSpan { required Color backgroundColor, required double radius, EdgeInsetsGeometry? margin, - }) : assert(radius > 0.0), - super( - alignment: PlaceholderAlignment.middle, - child: Container( - decoration: BoxDecoration( - color: backgroundColor, - borderRadius: BorderRadius.all( - Radius.circular(radius), - ), - ), - margin: margin, - padding: padding, - child: Text( - text, - style: textStyle, - ), - ), - ); + }) : assert(radius > 0.0), + super( + alignment: PlaceholderAlignment.middle, + child: Container( + decoration: BoxDecoration( + color: backgroundColor, + borderRadius: BorderRadius.all(Radius.circular(radius)), + ), + margin: margin, + padding: padding, + child: Text(text, style: textStyle), + ), + ); } /// A Text where parts between "**" are in bold @@ -254,22 +255,24 @@ class TextWithBoldParts extends StatelessWidget { textScaler: MediaQuery.textScalerOf(context), text: TextSpan( style: DefaultTextStyle.of(context).style, - children: TextHelper.getPartsBetweenSymbol( - text: text, - symbol: r'\*\*', - symbolLength: 2, - defaultStyle: defaultTextStyle, - highlightedStyle: - boldTextStyle ?? const TextStyle(fontWeight: FontWeight.bold), - ).map( - ((String, TextStyle?) part) { - return TextSpan( - text: part.$1, - style: defaultTextStyle.merge(part.$2), - semanticsLabel: '-', - ); - }, - ).toList(growable: false), + children: + TextHelper.getPartsBetweenSymbol( + text: text, + symbol: r'\*\*', + symbolLength: 2, + defaultStyle: defaultTextStyle, + highlightedStyle: + boldTextStyle ?? + const TextStyle(fontWeight: FontWeight.bold), + ) + .map(((String, TextStyle?) part) { + return TextSpan( + text: part.$1, + style: defaultTextStyle.merge(part.$2), + semanticsLabel: '-', + ); + }) + .toList(growable: false), ), textAlign: textAlign ?? TextAlign.start, overflow: overflow ?? TextOverflow.clip, @@ -308,24 +311,24 @@ class TextWithUnderlinedParts extends StatelessWidget { textScaler: MediaQuery.textScalerOf(context), text: TextSpan( style: DefaultTextStyle.of(context).style, - children: TextHelper.getPartsBetweenSymbol( - text: text, - symbol: r'\_\_', - symbolLength: 2, - defaultStyle: defaultTextStyle, - highlightedStyle: underlineTextStyle ?? - const TextStyle( - decoration: TextDecoration.underline, - ), - ).map( - ((String, TextStyle?) part) { - return TextSpan( - text: part.$1, - style: defaultTextStyle.merge(part.$2), - semanticsLabel: '-', - ); - }, - ).toList(growable: false), + children: + TextHelper.getPartsBetweenSymbol( + text: text, + symbol: r'\_\_', + symbolLength: 2, + defaultStyle: defaultTextStyle, + highlightedStyle: + underlineTextStyle ?? + const TextStyle(decoration: TextDecoration.underline), + ) + .map(((String, TextStyle?) part) { + return TextSpan( + text: part.$1, + style: defaultTextStyle.merge(part.$2), + semanticsLabel: '-', + ); + }) + .toList(growable: false), ), textAlign: textAlign ?? TextAlign.start, overflow: overflow ?? TextOverflow.clip, @@ -360,24 +363,27 @@ class TextWithBubbleParts extends StatelessWidget { @override Widget build(BuildContext context) { - final Color backgroundColor = this.backgroundColor ?? + final Color backgroundColor = + this.backgroundColor ?? context.extension().secondaryNormal; return RichText( textScaler: MediaQuery.textScalerOf(context), text: TextSpan( - children: _extractChunks().map(((String text, bool highlighted) el) { - if (el.$2) { - return _createSpan( - el.$1, - bubblePadding, - bubbleTextStyle ?? textStyle?.merge(bubbleTextStyle), - backgroundColor, - ); - } else { - return TextSpan(text: el.$1); - } - }).toList(growable: false), + children: _extractChunks() + .map(((String text, bool highlighted) el) { + if (el.$2) { + return _createSpan( + el.$1, + bubblePadding, + bubbleTextStyle ?? textStyle?.merge(bubbleTextStyle), + backgroundColor, + ); + } else { + return TextSpan(text: el.$1); + } + }) + .toList(growable: false), style: DefaultTextStyle.of(context).style.merge(textStyle), ), textAlign: textAlign ?? TextAlign.start, @@ -385,8 +391,9 @@ class TextWithBubbleParts extends StatelessWidget { } Iterable<(String, bool)> _extractChunks() { - final Iterable matches = - RegExp(r'\*\*(.*?)\*\*').allMatches(text); + final Iterable matches = RegExp( + r'\*\*(.*?)\*\*', + ).allMatches(text); if (matches.isEmpty) { return <(String, bool)>[(text, false)]; @@ -417,25 +424,23 @@ class TextWithBubbleParts extends StatelessWidget { EdgeInsetsGeometry? padding, TextStyle? textStyle, Color backgroundColor, - ) => - HighlightedTextSpan( - text: text, - textStyle: textStyle ?? - const TextStyle( - color: Colors.white, - fontWeight: FontWeight.w700, - ), - padding: padding ?? - const EdgeInsetsDirectional.only( - top: 2.0, - bottom: 2.0, - start: 15.0, - end: 15.0, - ), - margin: margin ?? const EdgeInsetsDirectional.symmetric(vertical: 2.5), - backgroundColor: backgroundColor, - radius: 30.0, - ); + ) => HighlightedTextSpan( + text: text, + textStyle: + textStyle ?? + const TextStyle(color: Colors.white, fontWeight: FontWeight.w700), + padding: + padding ?? + const EdgeInsetsDirectional.only( + top: 2.0, + bottom: 2.0, + start: 15.0, + end: 15.0, + ), + margin: margin ?? const EdgeInsetsDirectional.symmetric(vertical: 2.5), + backgroundColor: backgroundColor, + radius: 30.0, + ); } typedef TextStyleProvider = TextStyle Function(double multiplier); diff --git a/packages/smooth_app/lib/widgets/tab_navigator.dart b/packages/smooth_app/lib/widgets/tab_navigator.dart index 82aa8ed813..339d6c9ec8 100644 --- a/packages/smooth_app/lib/widgets/tab_navigator.dart +++ b/packages/smooth_app/lib/widgets/tab_navigator.dart @@ -5,10 +5,7 @@ import 'package:smooth_app/pages/preferences/user_preferences_page.dart'; import 'package:smooth_app/pages/scan/scan_page.dart'; class TabNavigator extends StatelessWidget { - const TabNavigator({ - required this.navigatorKey, - required this.tabItem, - }); + const TabNavigator({required this.navigatorKey, required this.tabItem}); final GlobalKey navigatorKey; final BottomNavigationTab tabItem; diff --git a/packages/smooth_app/lib/widgets/v2/smooth_buttons_bar.dart b/packages/smooth_app/lib/widgets/v2/smooth_buttons_bar.dart index 8e6229d11d..5c0c21742b 100644 --- a/packages/smooth_app/lib/widgets/v2/smooth_buttons_bar.dart +++ b/packages/smooth_app/lib/widgets/v2/smooth_buttons_bar.dart @@ -41,12 +41,7 @@ class _SmoothButtonsBar2State extends State vsync: this, )..addListener(() => setState(() {})); - _controller.drive( - Tween( - begin: 0.0, - end: 1.0, - ), - ); + _controller.drive(Tween(begin: 0.0, end: 1.0)); WidgetsBinding.instance.addPostFrameCallback((_) { _controller.forward(); @@ -55,26 +50,25 @@ class _SmoothButtonsBar2State extends State @override Widget build(BuildContext context) { - final double viewPadding = - widget.addViewPadding ? MediaQuery.viewPaddingOf(context).bottom : 0.0; - final SmoothColorsThemeExtension? colors = - Theme.of(context).extension(); + final double viewPadding = widget.addViewPadding + ? MediaQuery.viewPaddingOf(context).bottom + : 0.0; + final SmoothColorsThemeExtension? colors = Theme.of( + context, + ).extension(); - final Widget positiveButtonWidget = - _SmoothPositiveButton2(data: widget.positiveButton); + final Widget positiveButtonWidget = _SmoothPositiveButton2( + data: widget.positiveButton, + ); final Widget child; if (widget.negativeButton != null) { child = Row( mainAxisSize: MainAxisSize.min, children: [ - Expanded( - child: _SmoothNegativeButton2(data: widget.negativeButton!), - ), + Expanded(child: _SmoothNegativeButton2(data: widget.negativeButton!)), const SizedBox(width: SMALL_SPACE), - Expanded( - child: positiveButtonWidget, - ), + Expanded(child: positiveButtonWidget), ], ); } else { @@ -95,7 +89,8 @@ class _SmoothButtonsBar2State extends State ), width: double.infinity, decoration: BoxDecoration( - color: widget.backgroundColor ?? + color: + widget.backgroundColor ?? (context.lightTheme() ? Colors.white : colors!.primaryUltraBlack), boxShadow: const [ BoxShadow( @@ -137,11 +132,8 @@ class _SmoothButtonsBar2State extends State } class SmoothActionButton2 { - SmoothActionButton2({ - required this.text, - required this.onPressed, - this.icon, - }) : assert(text.isNotEmpty); + SmoothActionButton2({required this.text, required this.onPressed, this.icon}) + : assert(text.isNotEmpty); final String text; final Widget? icon; @@ -155,8 +147,8 @@ class _SmoothPositiveButton2 extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - context.extension(); + final SmoothColorsThemeExtension colors = context + .extension(); final bool lightTheme = context.lightTheme(); return _SmoothBaseButton2( @@ -174,8 +166,8 @@ class _SmoothNegativeButton2 extends StatelessWidget { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - context.extension(); + final SmoothColorsThemeExtension colors = context + .extension(); final bool lightTheme = context.lightTheme(); @@ -220,23 +212,15 @@ class _SmoothBaseButton2 extends StatelessWidget { children: [ AutoSizeText( data.text, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 15.0, - ), + style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 15.0), maxLines: 1, ), if (data.icon != null) ...[ const SizedBox(width: SMALL_SPACE), Padding( padding: const EdgeInsetsDirectional.only(top: 0.5), - child: SizedBox( - height: 13.0, - child: FittedBox( - child: data.icon, - ), - ), - ) + child: SizedBox(height: 13.0, child: FittedBox(child: data.icon)), + ), ], ], ), diff --git a/packages/smooth_app/lib/widgets/v2/smooth_leading_button.dart b/packages/smooth_app/lib/widgets/v2/smooth_leading_button.dart index e8294bf1ed..809e3fcaae 100644 --- a/packages/smooth_app/lib/widgets/v2/smooth_leading_button.dart +++ b/packages/smooth_app/lib/widgets/v2/smooth_leading_button.dart @@ -16,13 +16,16 @@ class SmoothLeadingButton extends StatelessWidget { @override Widget build(BuildContext context) { - final MaterialLocalizations localizations = - MaterialLocalizations.of(context); - final SmoothColorsThemeExtension colors = - Theme.of(context).extension()!; + final MaterialLocalizations localizations = MaterialLocalizations.of( + context, + ); + final SmoothColorsThemeExtension colors = Theme.of( + context, + ).extension()!; final String message = getMessage(localizations); - final Color color = foregroundColor ?? + final Color color = + foregroundColor ?? (context.darkTheme() ? colors.primaryMedium : colors.primaryBlack); return Semantics( @@ -39,18 +42,12 @@ class SmoothLeadingButton extends StatelessWidget { splashColor: Colors.white70, child: Ink( decoration: BoxDecoration( - border: Border.all( - color: color, - width: 1.0, - ), + border: Border.all(color: color, width: 1.0), shape: BoxShape.circle, ), child: SizedBox.square( dimension: size ?? 36.0, - child: appIcon( - size: 16.0, - color: color, - ), + child: appIcon(size: 16.0, color: color), ), ), ), @@ -59,19 +56,16 @@ class SmoothLeadingButton extends StatelessWidget { ); } - Widget appIcon({ - required double size, - required Color color, - }) { + Widget appIcon({required double size, required Color color}) { assert(size >= 0.0); return switch (action) { SmoothLeadingAction.close => icons.Close(size: size, color: color), SmoothLeadingAction.back => icons.Arrow.left(size: size, color: color), SmoothLeadingAction.minimize => Padding( - padding: const EdgeInsetsDirectional.only(top: 1.0), - child: icons.Chevron.down(size: size, color: color), - ), + padding: const EdgeInsetsDirectional.only(top: 1.0), + child: icons.Chevron.down(size: size, color: color), + ), }; } @@ -84,8 +78,4 @@ class SmoothLeadingButton extends StatelessWidget { } } -enum SmoothLeadingAction { - close, - back, - minimize, -} +enum SmoothLeadingAction { close, back, minimize } diff --git a/packages/smooth_app/lib/widgets/v2/smooth_scaffold2.dart b/packages/smooth_app/lib/widgets/v2/smooth_scaffold2.dart index 20c64d9c85..f46938e676 100644 --- a/packages/smooth_app/lib/widgets/v2/smooth_scaffold2.dart +++ b/packages/smooth_app/lib/widgets/v2/smooth_scaffold2.dart @@ -75,7 +75,7 @@ class _SmoothScaffold2State extends State { padding: EdgeInsetsDirectional.only( bottom: viewPadding.bottom, ), - ) + ), ], ), ), @@ -101,12 +101,7 @@ class _SmoothScaffold2State extends State { } } -enum _SmoothScaffold2Widget { - topBar, - body, - bottomBar, - floattingBottomBar, -} +enum _SmoothScaffold2Widget { topBar, body, bottomBar, floattingBottomBar } class _SmoothScaffold2Layout extends MultiChildLayoutDelegate { _SmoothScaffold2Layout({ @@ -137,9 +132,7 @@ class _SmoothScaffold2Layout extends MultiChildLayoutDelegate { if (hasChild(_SmoothScaffold2Widget.bottomBar)) { bottomBarHeight = layoutChild( _SmoothScaffold2Widget.bottomBar, - BoxConstraints.loose( - size, - ), + BoxConstraints.loose(size), ).height; } else { bottomBarHeight = 0.0; @@ -151,9 +144,7 @@ class _SmoothScaffold2Layout extends MultiChildLayoutDelegate { if (hasChild(_SmoothScaffold2Widget.floattingBottomBar)) { floatingBottomBarHeight = layoutChild( _SmoothScaffold2Widget.floattingBottomBar, - BoxConstraints.loose( - size, - ), + BoxConstraints.loose(size), ).height; } else { floatingBottomBarHeight = 0.0; diff --git a/packages/smooth_app/lib/widgets/v2/smooth_topbar2.dart b/packages/smooth_app/lib/widgets/v2/smooth_topbar2.dart index fc2ea1298b..bb599698b6 100644 --- a/packages/smooth_app/lib/widgets/v2/smooth_topbar2.dart +++ b/packages/smooth_app/lib/widgets/v2/smooth_topbar2.dart @@ -24,8 +24,8 @@ class SmoothTopBar2 extends StatefulWidget implements PreferredSizeWidget { this.backgroundColor, this.productType, super.key, - }) : assert(title.length > 0), - assert(forceMultiLines == false || subTitle == null); + }) : assert(title.length > 0), + assert(forceMultiLines == false || subTitle == null); /// Height without the top view padding static double kTopBar2Height = 100; @@ -48,8 +48,10 @@ class SmoothTopBar2 extends StatefulWidget implements PreferredSizeWidget { State createState() => _SmoothTopBar2State(); @override - Size get preferredSize => Size(double.infinity, - kTopBar2Height + (topWidget?.preferredSize.height ?? 0.0)); + Size get preferredSize => Size( + double.infinity, + kTopBar2Height + (topWidget?.preferredSize.height ?? 0.0), + ); } class _SmoothTopBar2State extends State { @@ -62,9 +64,9 @@ class _SmoothTopBar2State extends State { if (widget.elevationOnScroll || widget.reducedHeightOnScroll) { WidgetsBinding.instance.addPostFrameCallback( - (_) => PrimaryScrollController.maybeOf(context)?.addListener( - () => _onScroll(), - ), + (_) => PrimaryScrollController.maybeOf( + context, + )?.addListener(() => _onScroll()), ); } @@ -95,24 +97,28 @@ class _SmoothTopBar2State extends State { @override Widget build(BuildContext context) { - final SmoothColorsThemeExtension colors = - context.extension(); + final SmoothColorsThemeExtension colors = context + .extension(); final TextDirection textDirection = Directionality.of(context); final bool darkTheme = context.darkTheme(); final double imageWidth = MediaQuery.sizeOf(context).width * 0.22; final double imageHeight = imageWidth * 114 / 92; final BorderRadius borderRadius = BorderRadius.vertical( - bottom: - Radius.circular(HEADER_BORDER_RADIUS.topRight.x * (1 - _progress))); + bottom: Radius.circular( + HEADER_BORDER_RADIUS.topRight.x * (1 - _progress), + ), + ); - final Color backgroundColor = widget.backgroundColor ?? + final Color backgroundColor = + widget.backgroundColor ?? (darkTheme ? colors.primaryDark : colors.primaryMedium); return PhysicalModel( color: Colors.transparent, elevation: _elevation, - shadowColor: widget.elevationColor ?? + shadowColor: + widget.elevationColor ?? (darkTheme ? Colors.white10 : Colors.black12), borderRadius: borderRadius, child: ClipRRect( @@ -149,7 +155,8 @@ class _SmoothTopBar2State extends State { start: widget.leadingAction != null ? BALANCED_SPACE : VERY_LARGE_SPACE, - end: (imageWidth * 0.7) * + end: + (imageWidth * 0.7) * (1 - _progress.progressAndClamp(0.5, 0.9, 1.0)), child: Align( alignment: AlignmentDirectional.topStart, @@ -168,7 +175,7 @@ class _SmoothTopBar2State extends State { foregroundColor: widget.foregroundColor, ), ), - const SizedBox(width: BALANCED_SPACE) + const SizedBox(width: BALANCED_SPACE), ], Expanded( child: Padding( @@ -182,7 +189,7 @@ class _SmoothTopBar2State extends State { ], ), ), - ) + ), ], ), ), @@ -260,7 +267,8 @@ class _SmoothTopBar2State extends State { maxLines: widget.subTitle != null ? 1 : 2, overflow: TextOverflow.ellipsis, style: TextStyle( - color: widget.foregroundColor ?? + color: + widget.foregroundColor ?? (darkTheme ? colors.primaryMedium : colors.primaryBlack), fontSize: 20.0, height: widget.reducedHeightOnScroll ? 1.3 : 1.5, @@ -271,10 +279,7 @@ class _SmoothTopBar2State extends State { if (widget.forceMultiLines) { return SizedBox( height: (MediaQuery.textScalerOf(context).scale(20.0) * 2.0) * 1.5, - child: Align( - alignment: AlignmentDirectional.centerStart, - child: text, - ), + child: Align(alignment: AlignmentDirectional.centerStart, child: text), ); } else if (widget.subTitle == null) { return text; @@ -290,7 +295,8 @@ class _SmoothTopBar2State extends State { maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( - color: widget.foregroundColor ?? + color: + widget.foregroundColor ?? (darkTheme ? colors.primaryMedium : colors.primaryBlack), fontSize: 16.0, height: 1.5, diff --git a/packages/smooth_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/satdev.xcscheme b/packages/smooth_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/satdev.xcscheme new file mode 100644 index 0000000000..5acbe7469c --- /dev/null +++ b/packages/smooth_app/macos/Runner.xcodeproj/xcshareddata/xcschemes/satdev.xcscheme @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/smooth_app/pubspec.lock b/packages/smooth_app/pubspec.lock index adf646fa64..fd35bf523c 100644 --- a/packages/smooth_app/pubspec.lock +++ b/packages/smooth_app/pubspec.lock @@ -1929,5 +1929,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.7.0-0 <4.0.0" + dart: ">=3.8.1 <4.0.0" flutter: ">=3.27.0" diff --git a/packages/smooth_app/pubspec.yaml b/packages/smooth_app/pubspec.yaml index 218ffa173b..e65b559955 100644 --- a/packages/smooth_app/pubspec.yaml +++ b/packages/smooth_app/pubspec.yaml @@ -4,7 +4,7 @@ version: 0.0.0+734 publish_to: "none" environment: - sdk: ^3.6.1 + sdk: ^3.8.1 dependencies: flutter: diff --git a/packages/smooth_app/test/basic_test.dart b/packages/smooth_app/test/basic_test.dart index 4c05d7d90f..2d0de79f62 100644 --- a/packages/smooth_app/test/basic_test.dart +++ b/packages/smooth_app/test/basic_test.dart @@ -3,9 +3,7 @@ import 'package:smooth_app/main.dart'; void main() { testWidgets('App Starts', (WidgetTester tester) async { - await tester.pumpWidget( - const SmoothApp(), - ); + await tester.pumpWidget(const SmoothApp()); expect(find.byType(SmoothApp), findsOneWidget); }); } diff --git a/packages/smooth_app/test/dialogs/generic_lib/dialogs_test.dart b/packages/smooth_app/test/dialogs/generic_lib/dialogs_test.dart index 4c55ab6c2c..f739a91d0b 100644 --- a/packages/smooth_app/test/dialogs/generic_lib/dialogs_test.dart +++ b/packages/smooth_app/test/dialogs/generic_lib/dialogs_test.dart @@ -21,78 +21,70 @@ import '../../tests_utils/mocks.dart'; void main() { GlobalVars.appStore = const MockedAppStore(); - group( - 'Dialogs on Contribute Page looks as expected', - () { - for (final String theme in ['Light', 'Dark', 'AMOLED']) { - const List dialogTypes = [ - 'Improving', - 'Software development', - 'Translate', - // 'Contributors' - // Currently can't make real http calls from the test library and since this dialog depends on an api call - // So omitting this one for now - ]; - for (final String dialogType in dialogTypes) { - testWidgets( - '${dialogType}_Page_${theme}_Theme', - (WidgetTester tester) async { - late UserPreferences userPreferences; - late ProductPreferences productPreferences; - late ThemeProvider themeProvider; - late ColorProvider colorProvider; - late TextContrastProvider textContrastProvider; + group('Dialogs on Contribute Page looks as expected', () { + for (final String theme in ['Light', 'Dark', 'AMOLED']) { + const List dialogTypes = [ + 'Improving', + 'Software development', + 'Translate', + // 'Contributors' + // Currently can't make real http calls from the test library and since this dialog depends on an api call + // So omitting this one for now + ]; + for (final String dialogType in dialogTypes) { + testWidgets('${dialogType}_Page_${theme}_Theme', ( + WidgetTester tester, + ) async { + late UserPreferences userPreferences; + late ProductPreferences productPreferences; + late ThemeProvider themeProvider; + late ColorProvider colorProvider; + late TextContrastProvider textContrastProvider; - SharedPreferences.setMockInitialValues( - mockSharedPreferences(), - ); + SharedPreferences.setMockInitialValues(mockSharedPreferences()); - userPreferences = await UserPreferences.getUserPreferences(); - userPreferences.setTheme(theme); + userPreferences = await UserPreferences.getUserPreferences(); + userPreferences.setTheme(theme); - productPreferences = ProductPreferences( - ProductPreferencesSelection( - setImportance: userPreferences.setImportance, - getImportance: userPreferences.getImportance, - notify: () => productPreferences.notifyListeners(), - ), - ); - await productPreferences.init(PlatformAssetBundle()); - await userPreferences.init(productPreferences); - await ProductQuery.setCountry(userPreferences, 'fr'); - themeProvider = ThemeProvider(userPreferences); - colorProvider = ColorProvider(userPreferences); - textContrastProvider = TextContrastProvider(userPreferences); - - await tester.pumpWidget( - MockSmoothApp( - userPreferences, - UserManagementProvider(), - productPreferences, - themeProvider, - textContrastProvider, - colorProvider, - const UserPreferencesPage( - type: PreferencePageType.CONTRIBUTE, - ), - localDatabase: MockLocalDatabase(), - ), - ); - await tester.pumpAndSettle(); - await tester.tap(find.text(dialogType)); - await tester.pumpAndSettle(); - await expectGoldenMatches( - find.byType(SmoothAlertDialog), - 'user_preferences_page_dialogs_$dialogType-${theme.toLowerCase()}.png', - ); - expect(tester, meetsGuideline(textContrastGuideline)); - expect(tester, meetsGuideline(labeledTapTargetGuideline)); - expect(tester, meetsGuideline(iOSTapTargetGuideline)); - expect(tester, meetsGuideline(androidTapTargetGuideline)); - }, + productPreferences = ProductPreferences( + ProductPreferencesSelection( + setImportance: userPreferences.setImportance, + getImportance: userPreferences.getImportance, + notify: () => productPreferences.notifyListeners(), + ), ); - } + await productPreferences.init(PlatformAssetBundle()); + await userPreferences.init(productPreferences); + await ProductQuery.setCountry(userPreferences, 'fr'); + themeProvider = ThemeProvider(userPreferences); + colorProvider = ColorProvider(userPreferences); + textContrastProvider = TextContrastProvider(userPreferences); + + await tester.pumpWidget( + MockSmoothApp( + userPreferences, + UserManagementProvider(), + productPreferences, + themeProvider, + textContrastProvider, + colorProvider, + const UserPreferencesPage(type: PreferencePageType.CONTRIBUTE), + localDatabase: MockLocalDatabase(), + ), + ); + await tester.pumpAndSettle(); + await tester.tap(find.text(dialogType)); + await tester.pumpAndSettle(); + await expectGoldenMatches( + find.byType(SmoothAlertDialog), + 'user_preferences_page_dialogs_$dialogType-${theme.toLowerCase()}.png', + ); + expect(tester, meetsGuideline(textContrastGuideline)); + expect(tester, meetsGuideline(labeledTapTargetGuideline)); + expect(tester, meetsGuideline(iOSTapTargetGuideline)); + expect(tester, meetsGuideline(androidTapTargetGuideline)); + }); } - }, - ); + } + }); } diff --git a/packages/smooth_app/test/pages/generic_lib/widgets/smooth_error_card_test.dart b/packages/smooth_app/test/pages/generic_lib/widgets/smooth_error_card_test.dart index 26cacedadc..a2fe26a5be 100644 --- a/packages/smooth_app/test/pages/generic_lib/widgets/smooth_error_card_test.dart +++ b/packages/smooth_app/test/pages/generic_lib/widgets/smooth_error_card_test.dart @@ -47,9 +47,7 @@ void main() { }); Future pumpSmoothErrorCardOnScreen(WidgetTester tester) async { - SharedPreferences.setMockInitialValues( - mockSharedPreferences(), - ); + SharedPreferences.setMockInitialValues(mockSharedPreferences()); final UserPreferences prefs = await UserPreferences.getUserPreferences(); diff --git a/packages/smooth_app/test/pages/user_preferences_page_test.dart b/packages/smooth_app/test/pages/user_preferences_page_test.dart index 0329fc2394..b374e87b18 100644 --- a/packages/smooth_app/test/pages/user_preferences_page_test.dart +++ b/packages/smooth_app/test/pages/user_preferences_page_test.dart @@ -30,18 +30,18 @@ void main() { late ColorProvider colorProvider; late TextContrastProvider textContrastProvider; - SharedPreferences.setMockInitialValues( - mockSharedPreferences(), - ); + SharedPreferences.setMockInitialValues(mockSharedPreferences()); userPreferences = await UserPreferences.getUserPreferences(); userPreferences.setTheme(theme); - productPreferences = ProductPreferences(ProductPreferencesSelection( - setImportance: userPreferences.setImportance, - getImportance: userPreferences.getImportance, - notify: () => productPreferences.notifyListeners(), - )); + productPreferences = ProductPreferences( + ProductPreferencesSelection( + setImportance: userPreferences.setImportance, + getImportance: userPreferences.getImportance, + notify: () => productPreferences.notifyListeners(), + ), + ); await productPreferences.init(PlatformAssetBundle()); await userPreferences.init(productPreferences); themeProvider = ThemeProvider(userPreferences); diff --git a/packages/smooth_app/test/plural_translation_test.dart b/packages/smooth_app/test/plural_translation_test.dart index 5a77bc7614..794226e7fd 100644 --- a/packages/smooth_app/test/plural_translation_test.dart +++ b/packages/smooth_app/test/plural_translation_test.dart @@ -20,8 +20,9 @@ void main() { if (!delegate.isSupported(locale)) { continue; } - final AppLocalizations appLocalizations = - lookupAppLocalizations(locale); + final AppLocalizations appLocalizations = lookupAppLocalizations( + locale, + ); final List minutes = []; final List hours = []; @@ -71,32 +72,68 @@ void main() { ); expect( appLocalizations.contact_form_body_android( - crazyInt, '', '', '', '', ''), + crazyInt, + '', + '', + '', + '', + '', + ), contains(crazyInt.toString()), ); expect( appLocalizations.contact_form_body_android( - 0, crazyString, '', '', '', ''), + 0, + crazyString, + '', + '', + '', + '', + ), contains(crazyString), ); expect( appLocalizations.contact_form_body_android( - 0, '', crazyString, '', '', ''), + 0, + '', + crazyString, + '', + '', + '', + ), contains(crazyString), ); expect( appLocalizations.contact_form_body_android( - 0, '', '', crazyString, '', ''), + 0, + '', + '', + crazyString, + '', + '', + ), contains(crazyString), ); expect( appLocalizations.contact_form_body_android( - 0, '', '', '', crazyString, ''), + 0, + '', + '', + '', + crazyString, + '', + ), contains(crazyString), ); expect( appLocalizations.contact_form_body_android( - 0, '', '', '', '', crazyString), + 0, + '', + '', + '', + '', + crazyString, + ), contains(crazyString), ); expect( @@ -150,13 +187,15 @@ void main() { contains(crazyString), ); expect( - appLocalizations - .category_picker_no_category_found_message(crazyString), + appLocalizations.category_picker_no_category_found_message( + crazyString, + ), contains(crazyString), ); expect( - appLocalizations - .dev_preferences_test_environment_subtitle(crazyString), + appLocalizations.dev_preferences_test_environment_subtitle( + crazyString, + ), contains(crazyString), ); expect( @@ -169,17 +208,26 @@ void main() { ); expect( appLocalizations.product_search_button_download_more( - crazyInt, 0, 0), + crazyInt, + 0, + 0, + ), contains(crazyInt.toString()), ); expect( appLocalizations.product_search_button_download_more( - 0, crazyInt, 0), + 0, + crazyInt, + 0, + ), contains(crazyInt.toString()), ); expect( appLocalizations.product_search_button_download_more( - 0, 0, crazyInt), + 0, + 0, + crazyInt, + ), contains(crazyInt.toString()), ); expect( diff --git a/packages/smooth_app/test/smooth_ui_library/animations/smooth_reveal_animation_test.dart b/packages/smooth_app/test/smooth_ui_library/animations/smooth_reveal_animation_test.dart index 473dbe17b3..f2ea2f0f4f 100644 --- a/packages/smooth_app/test/smooth_ui_library/animations/smooth_reveal_animation_test.dart +++ b/packages/smooth_app/test/smooth_ui_library/animations/smooth_reveal_animation_test.dart @@ -4,9 +4,7 @@ import 'package:smooth_app/generic_lib/animations/smooth_reveal_animation.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; class _SwitchablePage extends StatefulWidget { - const _SwitchablePage({ - this.delay = 0, - }); + const _SwitchablePage({this.delay = 0}); final int delay; @@ -17,8 +15,10 @@ class _SwitchablePage extends StatefulWidget { class _SwitchablePageState extends State<_SwitchablePage> { int _selectedIndex = 0; - static const TextStyle optionStyle = - TextStyle(fontSize: 30, fontWeight: FontWeight.bold); + static const TextStyle optionStyle = TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + ); late final List _widgetOptions; @@ -49,18 +49,11 @@ class _SwitchablePageState extends State<_SwitchablePage> { @override Widget build(BuildContext context) { return SmoothScaffold( - appBar: AppBar( - title: const Text('Test App'), - ), - body: Center( - child: _widgetOptions.elementAt(_selectedIndex), - ), + appBar: AppBar(title: const Text('Test App')), + body: Center(child: _widgetOptions.elementAt(_selectedIndex)), bottomNavigationBar: BottomNavigationBar( items: const [ - BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Home', - ), + BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), BottomNavigationBarItem( icon: Icon(Icons.business), label: 'Business', @@ -77,28 +70,29 @@ class _SwitchablePageState extends State<_SwitchablePage> { void main() { // Regression test for https://github.com/openfoodfacts/smooth-app/issues/483 testWidgets( - "SmoothRevealAnimation doesn't use AnimationController after dispose", - (WidgetTester tester) async { - await tester.pumpWidget( - const MaterialApp( - home: _SwitchablePage( - // Set a large delay so that the AnimationController has time to be - // disposed. - delay: 1000, + "SmoothRevealAnimation doesn't use AnimationController after dispose", + (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: _SwitchablePage( + // Set a large delay so that the AnimationController has time to be + // disposed. + delay: 1000, + ), ), - ), - ); + ); - expect(find.byType(SmoothRevealAnimation), findsOneWidget); + expect(find.byType(SmoothRevealAnimation), findsOneWidget); - // Move to the page that doesn't have SmoothRevealAnimation. - await tester.tap(find.text('Business')); - await tester.pumpAndSettle(); - expect(find.byType(SmoothRevealAnimation), findsNothing); + // Move to the page that doesn't have SmoothRevealAnimation. + await tester.tap(find.text('Business')); + await tester.pumpAndSettle(); + expect(find.byType(SmoothRevealAnimation), findsNothing); - // Wait 1 second so the SmoothRevealAnimation delay expires on the previous - // page. - await tester.pump(const Duration(seconds: 1)); - expect(tester.takeException(), isNull); - }); + // Wait 1 second so the SmoothRevealAnimation delay expires on the previous + // page. + await tester.pump(const Duration(seconds: 1)); + expect(tester.takeException(), isNull); + }, + ); } diff --git a/packages/smooth_app/test/smooth_ui_library/basic_test.dart b/packages/smooth_app/test/smooth_ui_library/basic_test.dart index d416df20c0..fe4bfa823c 100644 --- a/packages/smooth_app/test/smooth_ui_library/basic_test.dart +++ b/packages/smooth_app/test/smooth_ui_library/basic_test.dart @@ -5,7 +5,8 @@ import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart'; void main() { testWidgets('Alert dialog can be created', (WidgetTester tester) async { await tester.pumpWidget( - const MaterialApp(home: SmoothAlertDialog(body: Placeholder()))); + const MaterialApp(home: SmoothAlertDialog(body: Placeholder())), + ); expect(find.byType(SmoothAlertDialog), findsOneWidget); }); } diff --git a/packages/smooth_app/test/smooth_ui_library/dialogs/smooth_category_picker_test.dart b/packages/smooth_app/test/smooth_ui_library/dialogs/smooth_category_picker_test.dart index 3901339d2a..3050674e02 100644 --- a/packages/smooth_app/test/smooth_ui_library/dialogs/smooth_category_picker_test.dart +++ b/packages/smooth_app/test/smooth_ui_library/dialogs/smooth_category_picker_test.dart @@ -6,10 +6,8 @@ import 'package:smooth_app/l10n/app_localizations.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; class TestCategory extends SmoothCategory { - TestCategory( - super.value, [ - Iterable? children, - ]) : children = children?.toSet() ?? const {}; + TestCategory(super.value, [Iterable? children]) + : children = children?.toSet() ?? const {}; Set children; @@ -35,45 +33,25 @@ class TestCategory extends SmoothCategory { Stream> getParents() async* {} } -TestCategory categories = TestCategory( - 'fruit', - { - TestCategory( - 'apple', - { - TestCategory( - 'red', - [ - TestCategory('Red Delicious'), - TestCategory('Fuji'), - TestCategory('Crispin'), - TestCategory('Pink Lady'), - ], - ), - TestCategory( - 'yellow', - [ - TestCategory('Yellow Delicious'), - TestCategory('Ginger Gold'), - ], - ), - TestCategory( - 'green', - [ - TestCategory('Granny Smith'), - ], - ), - }, - ), - TestCategory( - 'berry', - { - TestCategory('blueberry'), - TestCategory('raspberry'), - }, - ), - }, -); +TestCategory categories = TestCategory('fruit', { + TestCategory('apple', { + TestCategory('red', [ + TestCategory('Red Delicious'), + TestCategory('Fuji'), + TestCategory('Crispin'), + TestCategory('Pink Lady'), + ]), + TestCategory('yellow', [ + TestCategory('Yellow Delicious'), + TestCategory('Ginger Gold'), + ]), + TestCategory('green', [TestCategory('Granny Smith')]), + }), + TestCategory('berry', { + TestCategory('blueberry'), + TestCategory('raspberry'), + }), +}); Future getCategory(Iterable path) async { if (path.isEmpty) { @@ -181,7 +159,9 @@ void main() { await tester.tap(find.byType(Checkbox).first); expect(currentCategoryPath, equals(['fruit', 'apple', 'red'])); expect( - currentCategories, equals({'Granny Smith', 'Red Delicious'})); + currentCategories, + equals({'Granny Smith', 'Red Delicious'}), + ); expect(requestedNewCategory, isFalse); }); testWidgets('can create new categories', (WidgetTester tester) async { diff --git a/packages/smooth_app/test/tests_utils/goldens.dart b/packages/smooth_app/test/tests_utils/goldens.dart index 5b8f28ccab..5c349a1374 100644 --- a/packages/smooth_app/test/tests_utils/goldens.dart +++ b/packages/smooth_app/test/tests_utils/goldens.dart @@ -21,10 +21,12 @@ const double _kGoldenDiffTolerance = 0.10; /// golden files are stored in a goldens directory. Future expectGoldenMatches(dynamic actual, String goldenFileKey) async { final String goldenPath = path.join('goldens', goldenFileKey); - goldenFileComparator = SmoothieFileComparator(path.join( - (goldenFileComparator as LocalFileComparator).basedir.toString(), - goldenFileKey, - )); + goldenFileComparator = SmoothieFileComparator( + path.join( + (goldenFileComparator as LocalFileComparator).basedir.toString(), + goldenFileKey, + ), + ); return expectLater(actual, matchesGoldenFile(goldenPath)); } @@ -43,8 +45,10 @@ class SmoothieFileComparator extends LocalFileComparator { throw FlutterError(error); } if (!result.passed) { - log('A tolerable difference of ${result.diffPercent * 100}% was found when ' - 'comparing $golden.'); + log( + 'A tolerable difference of ${result.diffPercent * 100}% was found when ' + 'comparing $golden.', + ); } return result.passed || result.diffPercent <= _kGoldenDiffTolerance; } diff --git a/packages/smooth_app/test/tests_utils/mocks.dart b/packages/smooth_app/test/tests_utils/mocks.dart index 3cd8a2781e..96853635de 100644 --- a/packages/smooth_app/test/tests_utils/mocks.dart +++ b/packages/smooth_app/test/tests_utils/mocks.dart @@ -46,81 +46,83 @@ class MockSmoothApp extends StatelessWidget { @override Widget build(BuildContext context) { return MultiProvider( - providers: >[ - ChangeNotifierProvider.value(value: userPreferences), - ChangeNotifierProvider.value( - value: productPreferences), - ChangeNotifierProvider.value(value: themeProvider), - ChangeNotifierProvider.value( - value: userManagementProvider), - if (localDatabase != null) - ChangeNotifierProvider.value(value: localDatabase!), - ], - child: MaterialApp( - localizationsDelegates: AppLocalizations.localizationsDelegates, - supportedLocales: AppLocalizations.supportedLocales, - theme: SmoothTheme.getThemeData( - Brightness.light, - themeProvider, - () => colorProvider, - () => textContrastProvider, - ), - darkTheme: SmoothTheme.getThemeData( - Brightness.dark, - themeProvider, - () => colorProvider, - () => textContrastProvider, - ), - themeMode: themeProvider.currentThemeMode, - home: child, - )); + providers: >[ + ChangeNotifierProvider.value(value: userPreferences), + ChangeNotifierProvider.value( + value: productPreferences, + ), + ChangeNotifierProvider.value(value: themeProvider), + ChangeNotifierProvider.value( + value: userManagementProvider, + ), + if (localDatabase != null) + ChangeNotifierProvider.value(value: localDatabase!), + ], + child: MaterialApp( + localizationsDelegates: AppLocalizations.localizationsDelegates, + supportedLocales: AppLocalizations.supportedLocales, + theme: SmoothTheme.getThemeData( + Brightness.light, + themeProvider, + () => colorProvider, + () => textContrastProvider, + ), + darkTheme: SmoothTheme.getThemeData( + Brightness.dark, + themeProvider, + () => colorProvider, + () => textContrastProvider, + ), + themeMode: themeProvider.currentThemeMode, + home: child, + ), + ); } } Map mockSharedPreferences({ bool init = true, bool themeDark = false, -}) => - { - // Configured by test - 'init': init, - 'currentThemeMode': themeDark ? 'Dark' : 'Light', +}) => { + // Configured by test + 'init': init, + 'currentThemeMode': themeDark ? 'Dark' : 'Light', - // Very important by default - 'IMPORTANCE_AS_STRINGnutriscore': 'very_important', + // Very important by default + 'IMPORTANCE_AS_STRINGnutriscore': 'very_important', - // Important by default - 'IMPORTANCE_AS_STRINGecoscore': 'important', - 'IMPORTANCE_AS_STRINGnova': 'important', + // Important by default + 'IMPORTANCE_AS_STRINGecoscore': 'important', + 'IMPORTANCE_AS_STRINGnova': 'important', - // Not important by default - 'IMPORTANCE_AS_STRINGadditives': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_celery': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_crustaceans': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_eggs': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_fish': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_gluten': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_lupin': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_milk': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_molluscs': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_mustard': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_nuts': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_peanuts': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_sesame_seeds': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_soybeans': 'not_important', - 'IMPORTANCE_AS_STRINGallergens_no_sulphur_dioxide_and_sulphites': - 'not_important', - 'IMPORTANCE_AS_STRINGforest_footprint': 'not_important', - 'IMPORTANCE_AS_STRINGlabels_fair_trade': 'not_important', - 'IMPORTANCE_AS_STRINGlabels_organic': 'not_important', - 'IMPORTANCE_AS_STRINGlow_fat': 'not_important', - 'IMPORTANCE_AS_STRINGlow_salt': 'not_important', - 'IMPORTANCE_AS_STRINGlow_saturated_fat': 'not_important', - 'IMPORTANCE_AS_STRINGlow_sugars': 'not_important', - 'IMPORTANCE_AS_STRINGpalm_oil_free': 'not_important', - 'IMPORTANCE_AS_STRINGvegan': 'not_important', - 'IMPORTANCE_AS_STRINGvegetarian': 'not_important', - }; + // Not important by default + 'IMPORTANCE_AS_STRINGadditives': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_celery': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_crustaceans': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_eggs': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_fish': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_gluten': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_lupin': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_milk': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_molluscs': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_mustard': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_nuts': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_peanuts': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_sesame_seeds': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_soybeans': 'not_important', + 'IMPORTANCE_AS_STRINGallergens_no_sulphur_dioxide_and_sulphites': + 'not_important', + 'IMPORTANCE_AS_STRINGforest_footprint': 'not_important', + 'IMPORTANCE_AS_STRINGlabels_fair_trade': 'not_important', + 'IMPORTANCE_AS_STRINGlabels_organic': 'not_important', + 'IMPORTANCE_AS_STRINGlow_fat': 'not_important', + 'IMPORTANCE_AS_STRINGlow_salt': 'not_important', + 'IMPORTANCE_AS_STRINGlow_saturated_fat': 'not_important', + 'IMPORTANCE_AS_STRINGlow_sugars': 'not_important', + 'IMPORTANCE_AS_STRINGpalm_oil_free': 'not_important', + 'IMPORTANCE_AS_STRINGvegan': 'not_important', + 'IMPORTANCE_AS_STRINGvegetarian': 'not_important', +}; class MockHttpOverrides extends HttpOverrides { @override @@ -134,7 +136,8 @@ class _MockHttpClient extends Mock implements HttpClient { return Future.value(_MockHttpClientSVGRequest()); } else { throw UnimplementedError( - 'A mock for this request has not been created yet.'); + 'A mock for this request has not been created yet.', + ); } } } @@ -183,40 +186,42 @@ class _MockHttpClientSVGResponse extends Mock implements HttpClientResponse { Future mockMatomo() async { TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler( - const MethodChannel('dev.fluttercommunity.plus/device_info'), - (MethodCall call) async { - if (call.method == 'getDeviceInfo') { - return { - 'computerName': '_', - 'hostName': '_', - 'arch': '_', - 'model': '_', - 'kernelVersion': '_', - 'osRelease': '_', - 'activeCPUs': 1, - 'memorySize': 1, - 'cpuFrequency': 1, - }; - } - return null; - }); + const MethodChannel('dev.fluttercommunity.plus/device_info'), + (MethodCall call) async { + if (call.method == 'getDeviceInfo') { + return { + 'computerName': '_', + 'hostName': '_', + 'arch': '_', + 'model': '_', + 'kernelVersion': '_', + 'osRelease': '_', + 'activeCPUs': 1, + 'memorySize': 1, + 'cpuFrequency': 1, + }; + } + return null; + }, + ); TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger .setMockMethodCallHandler( - const MethodChannel('dev.fluttercommunity.plus/package_info'), - (MethodCall call) async { - if (call.method == 'getAll') { - return { - 'appName': '_', - 'packageName': '_', - 'version': '_', - 'buildNumber': '_', - 'buildSignature': '_', - 'installerStore': '_', - }; - } - return null; - }); + const MethodChannel('dev.fluttercommunity.plus/package_info'), + (MethodCall call) async { + if (call.method == 'getAll') { + return { + 'appName': '_', + 'packageName': '_', + 'version': '_', + 'buildNumber': '_', + 'buildSignature': '_', + 'installerStore': '_', + }; + } + return null; + }, + ); await AnalyticsHelper.initMatomo(false); MatomoTracker.instance.setOptOut(optOut: true); diff --git a/packages/smooth_app/test/users/forgot_password_page_layout_test.dart b/packages/smooth_app/test/users/forgot_password_page_layout_test.dart index d28891bf29..107ce77839 100644 --- a/packages/smooth_app/test/users/forgot_password_page_layout_test.dart +++ b/packages/smooth_app/test/users/forgot_password_page_layout_test.dart @@ -24,18 +24,18 @@ void main() { late ColorProvider colorProvider; late TextContrastProvider textContrastProvider; - SharedPreferences.setMockInitialValues( - mockSharedPreferences(), - ); + SharedPreferences.setMockInitialValues(mockSharedPreferences()); userPreferences = await UserPreferences.getUserPreferences(); userPreferences.setTheme(theme); - productPreferences = ProductPreferences(ProductPreferencesSelection( - setImportance: userPreferences.setImportance, - getImportance: userPreferences.getImportance, - notify: () => productPreferences.notifyListeners(), - )); + productPreferences = ProductPreferences( + ProductPreferencesSelection( + setImportance: userPreferences.setImportance, + getImportance: userPreferences.getImportance, + notify: () => productPreferences.notifyListeners(), + ), + ); await productPreferences.init(PlatformAssetBundle()); await userPreferences.init(productPreferences); diff --git a/packages/smooth_app/test/users/login_page_layout_test.dart b/packages/smooth_app/test/users/login_page_layout_test.dart index 7719b164ca..17ea0b830b 100644 --- a/packages/smooth_app/test/users/login_page_layout_test.dart +++ b/packages/smooth_app/test/users/login_page_layout_test.dart @@ -24,18 +24,18 @@ void main() { late ColorProvider colorProvider; late TextContrastProvider textContrastProvider; - SharedPreferences.setMockInitialValues( - mockSharedPreferences(), - ); + SharedPreferences.setMockInitialValues(mockSharedPreferences()); userPreferences = await UserPreferences.getUserPreferences(); userPreferences.setTheme(theme); - productPreferences = ProductPreferences(ProductPreferencesSelection( - setImportance: userPreferences.setImportance, - getImportance: userPreferences.getImportance, - notify: () => productPreferences.notifyListeners(), - )); + productPreferences = ProductPreferences( + ProductPreferencesSelection( + setImportance: userPreferences.setImportance, + getImportance: userPreferences.getImportance, + notify: () => productPreferences.notifyListeners(), + ), + ); await productPreferences.init(PlatformAssetBundle()); await userPreferences.init(productPreferences); diff --git a/packages/smooth_app/test/users/signup_page_layout_test.dart b/packages/smooth_app/test/users/signup_page_layout_test.dart index fa91ca4372..2f25a8d2d9 100644 --- a/packages/smooth_app/test/users/signup_page_layout_test.dart +++ b/packages/smooth_app/test/users/signup_page_layout_test.dart @@ -24,18 +24,18 @@ void main() { late ColorProvider colorProvider; late TextContrastProvider textContrastProvider; - SharedPreferences.setMockInitialValues( - mockSharedPreferences(), - ); + SharedPreferences.setMockInitialValues(mockSharedPreferences()); userPreferences = await UserPreferences.getUserPreferences(); userPreferences.setTheme(theme); - productPreferences = ProductPreferences(ProductPreferencesSelection( - setImportance: userPreferences.setImportance, - getImportance: userPreferences.getImportance, - notify: () => productPreferences.notifyListeners(), - )); + productPreferences = ProductPreferences( + ProductPreferencesSelection( + setImportance: userPreferences.setImportance, + getImportance: userPreferences.getImportance, + notify: () => productPreferences.notifyListeners(), + ), + ); await productPreferences.init(PlatformAssetBundle()); await userPreferences.init(productPreferences); diff --git a/packages/smooth_app/test/utils/smooth_text_test.dart b/packages/smooth_app/test/utils/smooth_text_test.dart index 1f7ed724b6..02e272a6cf 100644 --- a/packages/smooth_app/test/utils/smooth_text_test.dart +++ b/packages/smooth_app/test/utils/smooth_text_test.dart @@ -5,16 +5,10 @@ void main() { group('Smooth text', () { group('String extension', () { test('Remove diacritics (oeuf)', () { - expect( - 'œuf'.removeDiacritics(), - equals('oeuf'), - ); + expect('œuf'.removeDiacritics(), equals('oeuf')); }); test('Comparison Safe String', () { - expect( - 'œuF'.getComparisonSafeString(), - equals('oeuf'), - ); + expect('œuF'.getComparisonSafeString(), equals('oeuf')); }); }); }); diff --git a/packages/smooth_app/test/utils/string_extensions_test.dart b/packages/smooth_app/test/utils/string_extensions_test.dart index a770409d6a..9c627659c0 100644 --- a/packages/smooth_app/test/utils/string_extensions_test.dart +++ b/packages/smooth_app/test/utils/string_extensions_test.dart @@ -8,10 +8,7 @@ void main() { group('indexesOf tests', () { test( 'Multiple occurrences (with case)', - () => expect( - demoText.indexesOf('e'), - equals([1, 4, 7]), - ), + () => expect(demoText.indexesOf('e'), equals([1, 4, 7])), ); test( @@ -24,10 +21,7 @@ void main() { test( 'No occurrence (without case)', - () => expect( - demoText.indexesOf('E'), - equals([]), - ), + () => expect(demoText.indexesOf('E'), equals([])), ); test( @@ -40,94 +34,75 @@ void main() { test( 'No occurrence', - () => expect( - demoText.indexesOf('z'), - equals([]), - ), + () => expect(demoText.indexesOf('z'), equals([])), ); }); group('removeCharacterAt tests', () { test( 'Position 0', - () => expect( - demoText.removeCharacterAt(0), - equals('entence'), - ), + () => expect(demoText.removeCharacterAt(0), equals('entence')), ); test( 'Position 1', - () => expect( - demoText.removeCharacterAt(1), - equals('Sntence'), - ), + () => expect(demoText.removeCharacterAt(1), equals('Sntence')), ); test( 'Last position', - () => expect( - demoText.removeCharacterAt(7), - equals('Sentenc'), - ), + () => expect(demoText.removeCharacterAt(7), equals('Sentenc')), ); test( 'incorrect position (negative)', - () => expect( - () { - demoText.removeCharacterAt(-1); - }, - throwsAssertionError, - ), + () => expect(() { + demoText.removeCharacterAt(-1); + }, throwsAssertionError), ); test( 'incorrect position (> text length)', - () => expect( - () { - demoText.removeCharacterAt(8); - }, - throwsAssertionError, - ), + () => expect(() { + demoText.removeCharacterAt(8); + }, throwsAssertionError), ); }); group('replaceAllIgnoreFirst tests', () { test( 'No replacement (first)', - () => expect( - '123.4'.replaceAllIgnoreFirst('.', ''), - equals('123.4'), - ), + () => expect('123.4'.replaceAllIgnoreFirst('.', ''), equals('123.4')), ); test( '1 replacement', - () => expect( - '1.23.4'.replaceAllIgnoreFirst('.', ''), - equals('1.234'), - ), + () => expect('1.23.4'.replaceAllIgnoreFirst('.', ''), equals('1.234')), ); test( '2 replacements', - () => expect( - '1.2.3.4'.replaceAllIgnoreFirst('.', ''), - equals('1.234'), - ), + () => expect('1.2.3.4'.replaceAllIgnoreFirst('.', ''), equals('1.234')), ); }); group('removeEmptySpaces tests', () { test('Empty string', () => expect(''.removeSpaces(), equals(''))); - test('String with only spaces', - () => expect(' '.removeSpaces(), equals(''))); - test('String with spaces at the beginning', - () => expect(' 123'.removeSpaces(), equals('123'))); - test('String with spaces at the middle', - () => expect('1 2 3'.removeSpaces(), equals('123'))); - test('String with spaces at the end', - () => expect('123 '.removeSpaces(), equals('123'))); + test( + 'String with only spaces', + () => expect(' '.removeSpaces(), equals('')), + ); + test( + 'String with spaces at the beginning', + () => expect(' 123'.removeSpaces(), equals('123')), + ); + test( + 'String with spaces at the middle', + () => expect('1 2 3'.removeSpaces(), equals('123')), + ); + test( + 'String with spaces at the end', + () => expect('123 '.removeSpaces(), equals('123')), + ); }); } diff --git a/packages/smooth_app/test/utils/text_input_formatters_tests.dart b/packages/smooth_app/test/utils/text_input_formatters_tests.dart index 6d6c5a86c2..41bb99dba1 100644 --- a/packages/smooth_app/test/utils/text_input_formatters_tests.dart +++ b/packages/smooth_app/test/utils/text_input_formatters_tests.dart @@ -6,8 +6,9 @@ import 'package:smooth_app/helpers/text_input_formatters_helper.dart'; void main() { group('Replace separator', () { test('Enabled', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_commaDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _commaDecimalSeparator, + ); expect(rewriter.replaceSeparator('123,4'), equals('123,4')); expect(rewriter.replaceSeparator('123.4'), equals('123,4')); @@ -17,8 +18,9 @@ void main() { }); test('Disabled', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_noDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _noDecimalSeparator, + ); expect(rewriter.replaceSeparator('123,4'), equals('123,4')); expect(rewriter.replaceSeparator('123.4'), equals('123.4')); @@ -30,136 +32,150 @@ void main() { group('Move separator', () { test('Existing separator', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_commaDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _commaDecimalSeparator, + ); expect( - rewriter.moveSeparator( - '1,234', - '1,23,4', - TextSelection.fromPosition( - const TextPosition(offset: 0), - ), - ), - equals(const MoveSeparatorResult( + rewriter.moveSeparator( + '1,234', + '1,23,4', + TextSelection.fromPosition(const TextPosition(offset: 0)), + ), + equals( + const MoveSeparatorResult( newText: '123,4', newBasePosition: 0, newExtentPosition: 0, - ))); + ), + ), + ); }); test('No separator', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_commaDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _commaDecimalSeparator, + ); expect( - rewriter.moveSeparator( - '1234', - '1,234', - TextSelection.fromPosition( - const TextPosition(offset: 0), - ), - ), - equals(const MoveSeparatorResult( + rewriter.moveSeparator( + '1234', + '1,234', + TextSelection.fromPosition(const TextPosition(offset: 0)), + ), + equals( + const MoveSeparatorResult( newText: '1,234', newBasePosition: 0, newExtentPosition: 0, - ))); + ), + ), + ); }); test('Separator on first character', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_commaDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _commaDecimalSeparator, + ); expect( - rewriter.moveSeparator( - '1234', - ',1234', - TextSelection.fromPosition( - const TextPosition(offset: 0), - ), - ), - equals(const MoveSeparatorResult( + rewriter.moveSeparator( + '1234', + ',1234', + TextSelection.fromPosition(const TextPosition(offset: 0)), + ), + equals( + const MoveSeparatorResult( newText: ',1234', newBasePosition: 0, newExtentPosition: 0, - ))); + ), + ), + ); }); test('Separator on last character', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_commaDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _commaDecimalSeparator, + ); expect( - rewriter.moveSeparator( - '1234', - '1234,', - TextSelection.fromPosition( - const TextPosition(offset: 0), - ), - ), - equals(const MoveSeparatorResult( + rewriter.moveSeparator( + '1234', + '1234,', + TextSelection.fromPosition(const TextPosition(offset: 0)), + ), + equals( + const MoveSeparatorResult( newText: '1234,', newBasePosition: 0, newExtentPosition: 0, - ))); + ), + ), + ); }); test('Multiples separators', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_commaDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _commaDecimalSeparator, + ); expect( - rewriter.moveSeparator( - '1234', - '1,234,', - TextSelection.fromPosition( - const TextPosition(offset: 0), - ), - ), - equals(const MoveSeparatorResult( + rewriter.moveSeparator( + '1234', + '1,234,', + TextSelection.fromPosition(const TextPosition(offset: 0)), + ), + equals( + const MoveSeparatorResult( newText: '1,234', newBasePosition: 0, newExtentPosition: 0, - ))); + ), + ), + ); }); test('Multiples separators', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_commaDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _commaDecimalSeparator, + ); expect( - rewriter.moveSeparator( - '1,234', - '1,234,', - TextSelection.fromPosition( - const TextPosition(offset: 0), - ), - ), - equals(const MoveSeparatorResult( + rewriter.moveSeparator( + '1,234', + '1,234,', + TextSelection.fromPosition(const TextPosition(offset: 0)), + ), + equals( + const MoveSeparatorResult( newText: '1234,', newBasePosition: 0, newExtentPosition: 0, - ))); + ), + ), + ); }); test('Multiples separators', () { - final DecimalSeparatorRewriter rewriter = - DecimalSeparatorRewriter(_commaDecimalSeparator); + final DecimalSeparatorRewriter rewriter = DecimalSeparatorRewriter( + _commaDecimalSeparator, + ); expect( - rewriter.moveSeparator( - '1,234', - '1,2,34,', - TextSelection.fromPosition( - const TextPosition(offset: 0), - ), - ), - equals(const MoveSeparatorResult( + rewriter.moveSeparator( + '1,234', + '1,2,34,', + TextSelection.fromPosition(const TextPosition(offset: 0)), + ), + equals( + const MoveSeparatorResult( newText: '1,234', newBasePosition: 0, newExtentPosition: 0, - ))); + ), + ), + ); }); }); } diff --git a/packages/smooth_app/test_driver/screenshot_driver.dart b/packages/smooth_app/test_driver/screenshot_driver.dart index d625482b4f..af022db768 100644 --- a/packages/smooth_app/test_driver/screenshot_driver.dart +++ b/packages/smooth_app/test_driver/screenshot_driver.dart @@ -15,14 +15,16 @@ then flutter clean // cf. https://dev.to/mjablecnik/take-screenshot-during-flutter-integration-tests-435k /// Screenshot driver. Future main() async => integrationDriver( - onScreenshot: ( + onScreenshot: + ( String screenshotName, List screenshotBytes, [ Map? args, ]) async { - final File image = await File('screenshots/$screenshotName.png') - .create(recursive: true); + final File image = await File( + 'screenshots/$screenshotName.png', + ).create(recursive: true); image.writeAsBytesSync(screenshotBytes); return true; }, - ); +);