diff --git a/README.md b/README.md index 957dda4b4c4..17824989419 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ Full list of features on the wiki: https://wiki.openfoodfacts.org/Mobile_App/Fea - Make sure you have installed flutter and all the requirements - [Official flutter installation guide](https://docs.flutter.dev/get-started/install) -- Currently, the app uses the following version of Flutter (3.22.x). +- Currently, the app uses the following version of Flutter (3.24.x). We have predefined run configurations for Android Studio and Visual Studio Code diff --git a/flutter-version.txt b/flutter-version.txt index dbc9520ba41..ffba2c8db92 100644 --- a/flutter-version.txt +++ b/flutter-version.txt @@ -1 +1 @@ -3.22.2 \ No newline at end of file +3.24.3 \ No newline at end of file diff --git a/packages/app_store/apple_app_store/pubspec.yaml b/packages/app_store/apple_app_store/pubspec.yaml index 0a6b0494448..97423969116 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.4.0 <4.0.0' + sdk: ^3.5.3 dependencies: flutter: @@ -18,6 +18,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: 2.0.3 + flutter_lints: 4.0.0 openfoodfacts_flutter_lints: git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git \ No newline at end of file diff --git a/packages/app_store/google_play/pubspec.yaml b/packages/app_store/google_play/pubspec.yaml index 54161b2443e..e3b73a6181e 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.4.0 <4.0.0' + sdk: ^3.5.3 dependencies: flutter: @@ -18,7 +18,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: 2.0.3 + flutter_lints: 4.0.0 openfoodfacts_flutter_lints: git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git diff --git a/packages/app_store/shared/pubspec.yaml b/packages/app_store/shared/pubspec.yaml index 86fec92bc7f..29d79b705fc 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.4.0 <4.0.0' + sdk: ^3.5.3 dependencies: flutter: @@ -13,7 +13,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: 2.0.3 + flutter_lints: 4.0.0 openfoodfacts_flutter_lints: git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git diff --git a/packages/app_store/uri_store/pubspec.yaml b/packages/app_store/uri_store/pubspec.yaml index ef0e35cefff..24bf8717346 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.4.0 <4.0.0' + sdk: ^3.5.3 dependencies: flutter: @@ -18,6 +18,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: 2.0.3 + flutter_lints: 4.0.0 openfoodfacts_flutter_lints: git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git \ No newline at end of file diff --git a/packages/scanner/ml_kit/pubspec.yaml b/packages/scanner/ml_kit/pubspec.yaml index 4dca15bc983..cd3b8f91293 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.4.0 <4.0.0' + sdk: ^3.5.3 dependencies: flutter: @@ -20,6 +20,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: 2.0.2 + flutter_lints: 4.0.0 openfoodfacts_flutter_lints: git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git \ No newline at end of file diff --git a/packages/scanner/shared/pubspec.yaml b/packages/scanner/shared/pubspec.yaml index 7fa9a28d1f0..31a4b877580 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.4.0 <4.0.0' + sdk: ^3.5.3 dependencies: flutter: @@ -16,7 +16,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: 2.0.3 + flutter_lints: 4.0.0 openfoodfacts_flutter_lints: git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git diff --git a/packages/scanner/zxing/pubspec.yaml b/packages/scanner/zxing/pubspec.yaml index 0e32939a7b4..ba3c43099b4 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.4.0 <4.0.0' + sdk: ^3.5.3 dependencies: flutter: @@ -18,6 +18,6 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter - flutter_lints: 2.0.3 + flutter_lints: 4.0.0 openfoodfacts_flutter_lints: git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git \ No newline at end of file diff --git a/packages/smooth_app/android/Gemfile.lock b/packages/smooth_app/android/Gemfile.lock index b3b1360fdc4..e4c808f5cc6 100644 --- a/packages/smooth_app/android/Gemfile.lock +++ b/packages/smooth_app/android/Gemfile.lock @@ -16,20 +16,20 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.958.0) - aws-sdk-core (3.201.3) + aws-partitions (1.980.0) + aws-sdk-core (3.209.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.8) + aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.88.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-kms (1.94.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.156.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-s3 (1.166.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.9.0) + aws-sigv4 (1.10.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) base64 (0.2.0) @@ -45,7 +45,7 @@ GEM dotenv (2.8.1) emoji_regex (3.2.3) excon (0.111.0) - faraday (1.10.3) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -71,10 +71,10 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) fastimage (2.3.1) - fastlane (2.222.0) + fastlane (2.223.1) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -134,7 +134,7 @@ GEM google-apis-core (>= 0.11.0, < 2.a) google-apis-storage_v1 (0.31.0) google-apis-core (>= 0.11.0, < 2.a) - google-cloud-core (1.7.0) + google-cloud-core (1.7.1) google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) @@ -155,12 +155,12 @@ GEM os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.6) + http-cookie (1.0.7) domain_name (~> 0.5) httpclient (2.8.3) jmespath (1.6.2) json (2.7.2) - jwt (2.8.2) + jwt (2.9.1) base64 mini_magick (4.13.2) mini_mime (1.1.5) @@ -179,8 +179,7 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.3.6) - strscan + rexml (3.3.7) rouge (2.0.7) ruby2_keywords (0.0.5) rubyzip (2.3.2) @@ -193,7 +192,6 @@ GEM simctl (1.6.10) CFPropertyList naturally - strscan (3.1.0) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) @@ -203,14 +201,15 @@ GEM tty-spinner (0.9.3) tty-cursor (~> 0.7) uber (0.1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) word_wrap (1.0.0) - xcodeproj (1.19.0) + xcodeproj (1.25.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (>= 3.3.2, < 4.0) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) diff --git a/packages/smooth_app/ios/Gemfile.lock b/packages/smooth_app/ios/Gemfile.lock index e694d9e259d..a0622316070 100644 --- a/packages/smooth_app/ios/Gemfile.lock +++ b/packages/smooth_app/ios/Gemfile.lock @@ -16,20 +16,20 @@ GEM artifactory (3.0.17) atomos (0.1.3) aws-eventstream (1.3.0) - aws-partitions (1.958.0) - aws-sdk-core (3.201.3) + aws-partitions (1.980.0) + aws-sdk-core (3.209.1) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.651.0) - aws-sigv4 (~> 1.8) + aws-sigv4 (~> 1.9) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.88.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-kms (1.94.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.156.0) - aws-sdk-core (~> 3, >= 3.201.0) + aws-sdk-s3 (1.166.0) + aws-sdk-core (~> 3, >= 3.207.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) - aws-sigv4 (1.9.0) + aws-sigv4 (1.10.0) aws-eventstream (~> 1, >= 1.0.2) babosa (1.0.4) base64 (0.2.0) @@ -46,7 +46,7 @@ GEM dotenv (2.8.1) emoji_regex (3.2.3) excon (0.111.0) - faraday (1.10.3) + faraday (1.10.4) faraday-em_http (~> 1.0) faraday-em_synchrony (~> 1.0) faraday-excon (~> 1.1) @@ -72,10 +72,10 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) faraday-retry (1.0.3) - faraday_middleware (1.2.0) + faraday_middleware (1.2.1) faraday (~> 1.0) fastimage (2.3.1) - fastlane (2.222.0) + fastlane (2.223.1) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.8, < 3.0.0) artifactory (~> 3.0) @@ -135,7 +135,7 @@ GEM google-apis-core (>= 0.11.0, < 2.a) google-apis-storage_v1 (0.31.0) google-apis-core (>= 0.11.0, < 2.a) - google-cloud-core (1.7.0) + google-cloud-core (1.7.1) google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) google-cloud-env (1.6.0) @@ -156,12 +156,12 @@ GEM os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) highline (2.0.3) - http-cookie (1.0.6) + http-cookie (1.0.7) domain_name (~> 0.5) httpclient (2.8.3) jmespath (1.6.2) json (2.7.2) - jwt (2.8.2) + jwt (2.9.1) base64 mini_magick (4.13.2) mini_mime (1.1.5) @@ -180,8 +180,7 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.3.6) - strscan + rexml (3.3.7) rouge (2.0.7) ruby2_keywords (0.0.5) rubyzip (2.3.2) @@ -194,7 +193,6 @@ GEM simctl (1.6.10) CFPropertyList naturally - strscan (3.1.0) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) @@ -204,19 +202,20 @@ GEM tty-spinner (0.9.3) tty-cursor (~> 0.7) uber (0.1.0) - unicode-display_width (2.5.0) + unicode-display_width (2.6.0) versionomy (0.5.0) blockenspiel (~> 0.5) word_wrap (1.0.0) xcode-install (2.8.1) claide (>= 0.9.1) fastlane (>= 2.1.0, < 3.0.0) - xcodeproj (1.19.0) + xcodeproj (1.25.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (>= 3.3.2, < 4.0) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) diff --git a/packages/smooth_app/ios/Podfile b/packages/smooth_app/ios/Podfile index 88e2e54a0cd..92a6702908d 100644 --- a/packages/smooth_app/ios/Podfile +++ b/packages/smooth_app/ios/Podfile @@ -32,20 +32,13 @@ target 'Runner' do use_modular_headers! flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) +# target 'RunnerTests' do +# inherit! :search_paths +# end end post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) - - target.build_configurations.each do |config| - config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0' - - config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ - '$(inherited)', - 'PERMISSION_CAMERA=1', - 'PERMISSION_PHOTOS=1', - ] - end end end diff --git a/packages/smooth_app/ios/Podfile.lock b/packages/smooth_app/ios/Podfile.lock new file mode 100644 index 00000000000..c2373332d6c --- /dev/null +++ b/packages/smooth_app/ios/Podfile.lock @@ -0,0 +1,312 @@ +PODS: + - app_settings (5.1.1): + - Flutter + - audioplayers_darwin (0.0.1): + - Flutter + - camera_avfoundation (0.0.1): + - Flutter + - connectivity_plus (0.0.1): + - Flutter + - ReachabilitySwift + - device_info_plus (0.0.1): + - Flutter + - Flutter (1.0.0) + - flutter_custom_tabs_ios (2.0.0): + - Flutter + - flutter_email_sender (0.0.1): + - Flutter + - flutter_icmp_ping (0.0.1): + - Flutter + - flutter_image_compress_common (1.0.0): + - Flutter + - Mantle + - SDWebImage + - SDWebImageWebPCoder + - flutter_native_splash (0.0.1): + - Flutter + - flutter_secure_storage (6.0.0): + - Flutter + - GoogleDataTransport (9.4.1): + - GoogleUtilities/Environment (~> 7.7) + - nanopb (< 2.30911.0, >= 2.30908.0) + - PromisesObjC (< 3.0, >= 1.2) + - GoogleMLKit/BarcodeScanning (4.0.0): + - GoogleMLKit/MLKitCore + - MLKitBarcodeScanning (~> 3.0.0) + - GoogleMLKit/MLKitCore (4.0.0): + - MLKitCommon (~> 9.0.0) + - GoogleToolboxForMac/DebugUtils (2.3.2): + - GoogleToolboxForMac/Defines (= 2.3.2) + - GoogleToolboxForMac/Defines (2.3.2) + - GoogleToolboxForMac/Logger (2.3.2): + - GoogleToolboxForMac/Defines (= 2.3.2) + - "GoogleToolboxForMac/NSData+zlib (2.3.2)": + - GoogleToolboxForMac/Defines (= 2.3.2) + - "GoogleToolboxForMac/NSDictionary+URLArguments (2.3.2)": + - GoogleToolboxForMac/DebugUtils (= 2.3.2) + - GoogleToolboxForMac/Defines (= 2.3.2) + - "GoogleToolboxForMac/NSString+URLArguments (= 2.3.2)" + - "GoogleToolboxForMac/NSString+URLArguments (2.3.2)" + - GoogleUtilities/Environment (7.13.3): + - GoogleUtilities/Privacy + - PromisesObjC (< 3.0, >= 1.2) + - GoogleUtilities/Logger (7.13.3): + - GoogleUtilities/Environment + - GoogleUtilities/Privacy + - GoogleUtilities/Privacy (7.13.3) + - GoogleUtilities/UserDefaults (7.13.3): + - GoogleUtilities/Logger + - GoogleUtilities/Privacy + - GoogleUtilitiesComponents (1.1.0): + - GoogleUtilities/Logger + - GTMSessionFetcher/Core (2.3.0) + - image_picker_ios (0.0.1): + - Flutter + - in_app_review (0.2.0): + - Flutter + - integration_test (0.0.1): + - Flutter + - iso_countries (0.0.1): + - Flutter + - libwebp (1.3.2): + - libwebp/demux (= 1.3.2) + - libwebp/mux (= 1.3.2) + - libwebp/sharpyuv (= 1.3.2) + - libwebp/webp (= 1.3.2) + - libwebp/demux (1.3.2): + - libwebp/webp + - libwebp/mux (1.3.2): + - libwebp/demux + - libwebp/sharpyuv (1.3.2) + - libwebp/webp (1.3.2): + - libwebp/sharpyuv + - Mantle (2.2.0): + - Mantle/extobjc (= 2.2.0) + - Mantle/extobjc (2.2.0) + - MLImage (1.0.0-beta4) + - MLKitBarcodeScanning (3.0.0): + - MLKitCommon (~> 9.0) + - MLKitVision (~> 5.0) + - MLKitCommon (9.0.0): + - GoogleDataTransport (~> 9.0) + - GoogleToolboxForMac/Logger (~> 2.1) + - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" + - "GoogleToolboxForMac/NSDictionary+URLArguments (~> 2.1)" + - GoogleUtilities/UserDefaults (~> 7.0) + - GoogleUtilitiesComponents (~> 1.0) + - GTMSessionFetcher/Core (< 3.0, >= 1.1) + - MLKitVision (5.0.0): + - GoogleToolboxForMac/Logger (~> 2.1) + - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" + - GTMSessionFetcher/Core (< 3.0, >= 1.1) + - MLImage (= 1.0.0-beta4) + - MLKitCommon (~> 9.0) + - mobile_scanner (3.5.6): + - Flutter + - GoogleMLKit/BarcodeScanning (~> 4.0.0) + - MTBBarcodeScanner (5.0.11) + - nanopb (2.30910.0): + - nanopb/decode (= 2.30910.0) + - nanopb/encode (= 2.30910.0) + - nanopb/decode (2.30910.0) + - nanopb/encode (2.30910.0) + - package_info_plus (0.4.5): + - Flutter + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - permission_handler_apple (9.3.0): + - Flutter + - PromisesObjC (2.4.0) + - qr_code_scanner (0.2.0): + - Flutter + - MTBBarcodeScanner + - ReachabilitySwift (5.2.3) + - rive_common (0.0.1): + - Flutter + - SDWebImage (5.19.7): + - SDWebImage/Core (= 5.19.7) + - SDWebImage/Core (5.19.7) + - SDWebImageWebPCoder (0.14.6): + - libwebp (~> 1.0) + - SDWebImage/Core (~> 5.17) + - Sentry/HybridSDK (8.36.0) + - sentry_flutter (8.9.0): + - Flutter + - FlutterMacOS + - Sentry/HybridSDK (= 8.36.0) + - share_plus (0.0.1): + - Flutter + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - sqflite (0.0.3): + - Flutter + - FlutterMacOS + - url_launcher_ios (0.0.1): + - Flutter + - webview_flutter_wkwebview (0.0.1): + - Flutter + +DEPENDENCIES: + - app_settings (from `.symlinks/plugins/app_settings/ios`) + - audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/ios`) + - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) + - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) + - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) + - Flutter (from `Flutter`) + - flutter_custom_tabs_ios (from `.symlinks/plugins/flutter_custom_tabs_ios/ios`) + - flutter_email_sender (from `.symlinks/plugins/flutter_email_sender/ios`) + - flutter_icmp_ping (from `.symlinks/plugins/flutter_icmp_ping/ios`) + - flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`) + - flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`) + - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) + - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) + - in_app_review (from `.symlinks/plugins/in_app_review/ios`) + - integration_test (from `.symlinks/plugins/integration_test/ios`) + - iso_countries (from `.symlinks/plugins/iso_countries/ios`) + - mobile_scanner (from `.symlinks/plugins/mobile_scanner/ios`) + - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) + - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) + - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) + - rive_common (from `.symlinks/plugins/rive_common/ios`) + - sentry_flutter (from `.symlinks/plugins/sentry_flutter/ios`) + - share_plus (from `.symlinks/plugins/share_plus/ios`) + - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite (from `.symlinks/plugins/sqflite/darwin`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) + - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) + +SPEC REPOS: + trunk: + - GoogleDataTransport + - GoogleMLKit + - GoogleToolboxForMac + - GoogleUtilities + - GoogleUtilitiesComponents + - GTMSessionFetcher + - libwebp + - Mantle + - MLImage + - MLKitBarcodeScanning + - MLKitCommon + - MLKitVision + - MTBBarcodeScanner + - nanopb + - PromisesObjC + - ReachabilitySwift + - SDWebImage + - SDWebImageWebPCoder + - Sentry + +EXTERNAL SOURCES: + app_settings: + :path: ".symlinks/plugins/app_settings/ios" + audioplayers_darwin: + :path: ".symlinks/plugins/audioplayers_darwin/ios" + camera_avfoundation: + :path: ".symlinks/plugins/camera_avfoundation/ios" + connectivity_plus: + :path: ".symlinks/plugins/connectivity_plus/ios" + device_info_plus: + :path: ".symlinks/plugins/device_info_plus/ios" + Flutter: + :path: Flutter + flutter_custom_tabs_ios: + :path: ".symlinks/plugins/flutter_custom_tabs_ios/ios" + flutter_email_sender: + :path: ".symlinks/plugins/flutter_email_sender/ios" + flutter_icmp_ping: + :path: ".symlinks/plugins/flutter_icmp_ping/ios" + flutter_image_compress_common: + :path: ".symlinks/plugins/flutter_image_compress_common/ios" + flutter_native_splash: + :path: ".symlinks/plugins/flutter_native_splash/ios" + flutter_secure_storage: + :path: ".symlinks/plugins/flutter_secure_storage/ios" + image_picker_ios: + :path: ".symlinks/plugins/image_picker_ios/ios" + in_app_review: + :path: ".symlinks/plugins/in_app_review/ios" + integration_test: + :path: ".symlinks/plugins/integration_test/ios" + iso_countries: + :path: ".symlinks/plugins/iso_countries/ios" + mobile_scanner: + :path: ".symlinks/plugins/mobile_scanner/ios" + package_info_plus: + :path: ".symlinks/plugins/package_info_plus/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/darwin" + permission_handler_apple: + :path: ".symlinks/plugins/permission_handler_apple/ios" + qr_code_scanner: + :path: ".symlinks/plugins/qr_code_scanner/ios" + rive_common: + :path: ".symlinks/plugins/rive_common/ios" + sentry_flutter: + :path: ".symlinks/plugins/sentry_flutter/ios" + share_plus: + :path: ".symlinks/plugins/share_plus/ios" + shared_preferences_foundation: + :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + sqflite: + :path: ".symlinks/plugins/sqflite/darwin" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" + webview_flutter_wkwebview: + :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" + +SPEC CHECKSUMS: + app_settings: 017320c6a680cdc94c799949d95b84cb69389ebc + audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 + camera_avfoundation: dd002b0330f4981e1bbcb46ae9b62829237459a4 + connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d + device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + flutter_custom_tabs_ios: a651b18786388923b62de8c0537607de87c2eccf + flutter_email_sender: 10a22605f92809a11ef52b2f412db806c6082d40 + flutter_icmp_ping: 2b159955eee0c487c766ad83fec224ae35e7c935 + flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e + flutter_native_splash: edf599c81f74d093a4daf8e17bd7a018854bc778 + flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12 + GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a + GoogleMLKit: 2bd0dc6253c4d4f227aad460f69215a504b2980e + GoogleToolboxForMac: 8bef7c7c5cf7291c687cf5354f39f9db6399ad34 + GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15 + GoogleUtilitiesComponents: 679b2c881db3b615a2777504623df6122dd20afe + GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2 + image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 + in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d + integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573 + iso_countries: eb09d40f388e4c65e291e0bb36a701dfe7de6c74 + libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009 + Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d + MLImage: 7bb7c4264164ade9bf64f679b40fb29c8f33ee9b + MLKitBarcodeScanning: 04e264482c5f3810cb89ebc134ef6b61e67db505 + MLKitCommon: c1b791c3e667091918d91bda4bba69a91011e390 + MLKitVision: 8baa5f46ee3352614169b85250574fde38c36f49 + mobile_scanner: 38dcd8a49d7d485f632b7de65e4900010187aef2 + MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb + nanopb: 438bc412db1928dac798aa6fd75726007be04262 + package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2 + PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 + qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e + ReachabilitySwift: 7f151ff156cea1481a8411701195ac6a984f4979 + rive_common: cbbac3192af00d7341f19dae2f26298e9e37d99e + SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3 + SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380 + Sentry: f8374b5415bc38dfb5645941b3ae31230fbeae57 + sentry_flutter: 0eb93e5279eb41e2392212afe1ccd2fecb4f8cbe + share_plus: 8875f4f2500512ea181eef553c3e27dba5135aad + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe + webview_flutter_wkwebview: 2a23822e9039b7b1bc52e5add778e5d89ad488d1 + +PODFILE CHECKSUM: e840dd57ba2b03bcb6fdba293a27c5f82151a80a + +COCOAPODS: 1.15.2 diff --git a/packages/smooth_app/ios/Runner/AppDelegate.swift b/packages/smooth_app/ios/Runner/AppDelegate.swift index 70693e4a8c1..b6363034812 100644 --- a/packages/smooth_app/ios/Runner/AppDelegate.swift +++ b/packages/smooth_app/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, 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 cc99c2084b3..f7bcad2d5e1 100644 --- a/packages/smooth_app/lib/background/background_task_add_price.dart +++ b/packages/smooth_app/lib/background/background_task_add_price.dart @@ -44,7 +44,7 @@ class BackgroundTaskAddPrice extends BackgroundTask { required this.pricesWithoutDiscount, }); - BackgroundTaskAddPrice.fromJson(Map json) + BackgroundTaskAddPrice.fromJson(super.json) : fullPath = json[_jsonTagImagePath] as String, rotationDegrees = json[_jsonTagRotation] as int? ?? 0, cropX1 = json[_jsonTagX1] as int? ?? 0, @@ -71,7 +71,7 @@ class BackgroundTaskAddPrice extends BackgroundTask { pricesWithoutDiscount = json.containsKey(_jsonTagPriceWithoutDiscount) ? [json[_jsonTagPriceWithoutDiscount] as double?] : _fromJsonListNullableDouble(json[_jsonTagPricesWithoutDiscount])!, - super.fromJson(json); + super.fromJson(); static List? _fromJsonListDouble(final List? input) { if (input == null) { @@ -158,6 +158,7 @@ class BackgroundTaskAddPrice extends BackgroundTask { final int locationOSMId; final LocationOSMType locationOSMType; final List? eraserCoordinates; + // per line final List barcodes; final List pricesAreDiscounted; diff --git a/packages/smooth_app/lib/background/background_task_barcode.dart b/packages/smooth_app/lib/background/background_task_barcode.dart index 5036cdd528c..4a70933d400 100644 --- a/packages/smooth_app/lib/background/background_task_barcode.dart +++ b/packages/smooth_app/lib/background/background_task_barcode.dart @@ -13,9 +13,9 @@ abstract class BackgroundTaskBarcode extends BackgroundTask { required this.barcode, }); - BackgroundTaskBarcode.fromJson(Map json) + BackgroundTaskBarcode.fromJson(super.json) : barcode = json[_jsonTagBarcode] as String, - super.fromJson(json); + super.fromJson(); final String barcode; diff --git a/packages/smooth_app/lib/background/background_task_crop.dart b/packages/smooth_app/lib/background/background_task_crop.dart index 9e7a4e30888..ed3327dc9ff 100644 --- a/packages/smooth_app/lib/background/background_task_crop.dart +++ b/packages/smooth_app/lib/background/background_task_crop.dart @@ -28,9 +28,9 @@ class BackgroundTaskCrop extends BackgroundTaskUpload { required this.imageId, }); - BackgroundTaskCrop.fromJson(Map json) + BackgroundTaskCrop.fromJson(super.json) : imageId = json[_jsonTagImageId] as int, - super.fromJson(json); + super.fromJson(); static const String _jsonTagImageId = 'imageId'; diff --git a/packages/smooth_app/lib/background/background_task_details.dart b/packages/smooth_app/lib/background/background_task_details.dart index 7025653e999..dcfc0bf8c4e 100644 --- a/packages/smooth_app/lib/background/background_task_details.dart +++ b/packages/smooth_app/lib/background/background_task_details.dart @@ -42,9 +42,9 @@ class BackgroundTaskDetails extends BackgroundTaskBarcode required this.inputMap, }); - BackgroundTaskDetails.fromJson(Map json) + BackgroundTaskDetails.fromJson(super.json) : inputMap = json[_jsonTagInputMap] as String, - super.fromJson(json); + super.fromJson(); static const String _jsonTagInputMap = 'inputMap'; 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 a600eadf314..99244ed3cd8 100644 --- a/packages/smooth_app/lib/background/background_task_download_products.dart +++ b/packages/smooth_app/lib/background/background_task_download_products.dart @@ -21,9 +21,9 @@ class BackgroundTaskDownloadProducts extends BackgroundTaskProgressing { required this.downloadFlag, }); - BackgroundTaskDownloadProducts.fromJson(Map json) + BackgroundTaskDownloadProducts.fromJson(super.json) : downloadFlag = json[_jsonTagDownloadFlag] as int, - super.fromJson(json); + super.fromJson(); /// Download flag. Normal case: 0, meaning all fields are downloaded. final int downloadFlag; 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 0742104eca6..b11ddd1c030 100644 --- a/packages/smooth_app/lib/background/background_task_full_refresh.dart +++ b/packages/smooth_app/lib/background/background_task_full_refresh.dart @@ -20,8 +20,7 @@ class BackgroundTaskFullRefresh extends BackgroundTaskPaged { required super.pageSize, }); - BackgroundTaskFullRefresh.fromJson(Map json) - : super.fromJson(json); + BackgroundTaskFullRefresh.fromJson(super.json) : super.fromJson(); static const OperationType _operationType = OperationType.fullRefresh; 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 433c96fe731..283297599ac 100644 --- a/packages/smooth_app/lib/background/background_task_hunger_games.dart +++ b/packages/smooth_app/lib/background/background_task_hunger_games.dart @@ -18,10 +18,10 @@ class BackgroundTaskHungerGames extends BackgroundTaskBarcode { required this.insightAnnotation, }); - BackgroundTaskHungerGames.fromJson(Map json) + BackgroundTaskHungerGames.fromJson(super.json) : insightId = json[_jsonTagInsightId] as String, insightAnnotation = json[_jsonTagInsightAnnotation] as int, - super.fromJson(json); + super.fromJson(); static const String _jsonTagInsightId = 'insightId'; static const String _jsonTagInsightAnnotation = 'insightAnnotation'; diff --git a/packages/smooth_app/lib/background/background_task_image.dart b/packages/smooth_app/lib/background/background_task_image.dart index be4bcb5b207..9c5ebbf221c 100644 --- a/packages/smooth_app/lib/background/background_task_image.dart +++ b/packages/smooth_app/lib/background/background_task_image.dart @@ -34,9 +34,9 @@ class BackgroundTaskImage extends BackgroundTaskUpload { required this.fullPath, }); - BackgroundTaskImage.fromJson(Map json) + BackgroundTaskImage.fromJson(super.json) : fullPath = json[_jsonTagImagePath] as String, - super.fromJson(json); + super.fromJson(); static const String _jsonTagImagePath = 'imagePath'; 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 1c30de9aee0..cec03a1f8aa 100644 --- a/packages/smooth_app/lib/background/background_task_language_refresh.dart +++ b/packages/smooth_app/lib/background/background_task_language_refresh.dart @@ -16,9 +16,9 @@ class BackgroundTaskLanguageRefresh extends BackgroundTask { required this.excludeBarcodes, }); - BackgroundTaskLanguageRefresh.fromJson(Map json) + BackgroundTaskLanguageRefresh.fromJson(super.json) : excludeBarcodes = _getStringList(json, _jsonTagExcludeBarcodes), - super.fromJson(json); + super.fromJson(); static List _getStringList( final Map json, final String tag) { diff --git a/packages/smooth_app/lib/background/background_task_offline.dart b/packages/smooth_app/lib/background/background_task_offline.dart index 0e345f8c8e4..a8e2b03929f 100644 --- a/packages/smooth_app/lib/background/background_task_offline.dart +++ b/packages/smooth_app/lib/background/background_task_offline.dart @@ -19,8 +19,7 @@ class BackgroundTaskOffline extends BackgroundTaskProgressing { required super.totalSize, }); - BackgroundTaskOffline.fromJson(Map json) - : super.fromJson(json); + BackgroundTaskOffline.fromJson(super.json) : super.fromJson(); static const OperationType _operationType = OperationType.offline; diff --git a/packages/smooth_app/lib/background/background_task_paged.dart b/packages/smooth_app/lib/background/background_task_paged.dart index b51fa0e0efc..a4844202cc7 100644 --- a/packages/smooth_app/lib/background/background_task_paged.dart +++ b/packages/smooth_app/lib/background/background_task_paged.dart @@ -9,9 +9,9 @@ abstract class BackgroundTaskPaged extends BackgroundTask { required this.pageSize, }); - BackgroundTaskPaged.fromJson(Map json) + BackgroundTaskPaged.fromJson(super.json) : pageSize = json[_jsonTagPageSize] as int, - super.fromJson(json); + super.fromJson(); final int pageSize; diff --git a/packages/smooth_app/lib/background/background_task_progressing.dart b/packages/smooth_app/lib/background/background_task_progressing.dart index 74d9985c7e3..dca7c12b3ac 100644 --- a/packages/smooth_app/lib/background/background_task_progressing.dart +++ b/packages/smooth_app/lib/background/background_task_progressing.dart @@ -11,10 +11,10 @@ abstract class BackgroundTaskProgressing extends BackgroundTaskPaged { required this.totalSize, }); - BackgroundTaskProgressing.fromJson(Map json) + BackgroundTaskProgressing.fromJson(super.json) : work = json[_jsonTagWork] as String, totalSize = json[_jsonTagTotalSize] as int, - super.fromJson(json); + super.fromJson(); final String work; final int totalSize; 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 c2f7176d3ea..cf21b6792a4 100644 --- a/packages/smooth_app/lib/background/background_task_refresh_later.dart +++ b/packages/smooth_app/lib/background/background_task_refresh_later.dart @@ -18,9 +18,9 @@ class BackgroundTaskRefreshLater extends BackgroundTaskBarcode { required this.timestamp, }); - BackgroundTaskRefreshLater.fromJson(Map json) + BackgroundTaskRefreshLater.fromJson(super.json) : timestamp = json[_jsonTagTimestamp] as int, - super.fromJson(json); + super.fromJson(); static const String _jsonTagTimestamp = 'timestamp'; 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 4b0a5eda80a..bf00f099e56 100644 --- a/packages/smooth_app/lib/background/background_task_top_barcodes.dart +++ b/packages/smooth_app/lib/background/background_task_top_barcodes.dart @@ -21,9 +21,9 @@ class BackgroundTaskTopBarcodes extends BackgroundTaskProgressing { required this.pageNumber, }); - BackgroundTaskTopBarcodes.fromJson(Map json) + BackgroundTaskTopBarcodes.fromJson(super.json) : pageNumber = json[_jsonTagPageNumber] as int? ?? 1, - super.fromJson(json); + super.fromJson(); final int pageNumber; diff --git a/packages/smooth_app/lib/background/background_task_unselect.dart b/packages/smooth_app/lib/background/background_task_unselect.dart index f952babbdd5..689d0d23583 100644 --- a/packages/smooth_app/lib/background/background_task_unselect.dart +++ b/packages/smooth_app/lib/background/background_task_unselect.dart @@ -23,9 +23,9 @@ class BackgroundTaskUnselect extends BackgroundTaskBarcode required this.imageField, }); - BackgroundTaskUnselect.fromJson(Map json) + BackgroundTaskUnselect.fromJson(super.json) : imageField = json[_jsonTagImageField] as String, - super.fromJson(json); + super.fromJson(); static const String _jsonTagImageField = 'imageField'; diff --git a/packages/smooth_app/lib/background/background_task_upload.dart b/packages/smooth_app/lib/background/background_task_upload.dart index 7d069f0f71c..112446f49fb 100644 --- a/packages/smooth_app/lib/background/background_task_upload.dart +++ b/packages/smooth_app/lib/background/background_task_upload.dart @@ -1,5 +1,6 @@ import 'dart:async'; import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:path_provider/path_provider.dart'; @@ -26,7 +27,7 @@ abstract class BackgroundTaskUpload extends BackgroundTaskBarcode required this.cropY2, }); - BackgroundTaskUpload.fromJson(Map json) + BackgroundTaskUpload.fromJson(super.json) : imageField = json[_jsonTagImageField] as String, croppedPath = json[_jsonTagCroppedPath] as String, rotationDegrees = json[_jsonTagRotation] as int? ?? 0, @@ -34,7 +35,7 @@ abstract class BackgroundTaskUpload extends BackgroundTaskBarcode cropY1 = json[_jsonTagY1] as int? ?? 0, cropX2 = json[_jsonTagX2] as int? ?? 0, cropY2 = json[_jsonTagY2] as int? ?? 0, - super.fromJson(json); + super.fromJson(); final String imageField; final String croppedPath; 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 6fa2c4f6947..cf201e5ab75 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 @@ -140,12 +140,13 @@ class SmoothProductCardFound extends StatelessWidget { padding: EdgeInsetsDirectional.only(start: VERY_SMALL_SPACE), ), - Padding( - padding: const EdgeInsets.all(VERY_SMALL_SPACE), - child: Column( - children: scores, + if (scores.isNotEmpty) + Padding( + padding: const EdgeInsets.all(VERY_SMALL_SPACE), + child: Column( + children: scores, + ), ), - ), ], ), ), diff --git a/packages/smooth_app/lib/data_models/database_product_list_supplier.dart b/packages/smooth_app/lib/data_models/database_product_list_supplier.dart index 5472ae8fb13..cd2fe750f93 100644 --- a/packages/smooth_app/lib/data_models/database_product_list_supplier.dart +++ b/packages/smooth_app/lib/data_models/database_product_list_supplier.dart @@ -2,16 +2,14 @@ import 'package:smooth_app/data_models/product_list.dart'; import 'package:smooth_app/data_models/product_list_supplier.dart'; import 'package:smooth_app/data_models/query_product_list_supplier.dart'; import 'package:smooth_app/database/dao_product_list.dart'; -import 'package:smooth_app/database/local_database.dart'; -import 'package:smooth_app/query/paged_product_query.dart'; /// Supplier of previous back-end results now stored in the local database. class DatabaseProductListSupplier extends ProductListSupplier { DatabaseProductListSupplier( - final PagedProductQuery pagedProductQuery, - final LocalDatabase localDatabase, + super.pagedProductQuery, + super.localDatabase, final int timestamp, - ) : super(pagedProductQuery, localDatabase, timestamp: timestamp); + ) : super(timestamp: timestamp); /// Loads all results page after page. @override 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 936c0f3e199..c8cf21d8d60 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 @@ -209,13 +209,13 @@ class _TagLineItemNewsTranslation { } class _TagLineItemNewsTranslationDefault extends _TagLineItemNewsTranslation { - _TagLineItemNewsTranslationDefault.fromJson(Map json) + _TagLineItemNewsTranslationDefault.fromJson(super.json) : assert((json['title'] as String).isNotEmpty), assert((json['message'] as String).isNotEmpty), assert(json['image'] == null || ((json['image'] as Map)['url'] as String) .isNotEmpty), - super.fromJson(json); + super.fromJson(); } class _TagLineNewsImage { 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 13f4f29cff8..c66a77b4a1e 100644 --- a/packages/smooth_app/lib/data_models/onboarding_data_product.dart +++ b/packages/smooth_app/lib/data_models/onboarding_data_product.dart @@ -11,9 +11,9 @@ import 'package:smooth_app/query/product_query.dart'; /// Helper around a product we download, store and reuse at onboarding. class OnboardingDataProduct extends AbstractOnboardingData { OnboardingDataProduct( - final LocalDatabase localDatabase, + super.localDatabase, this.assetPath, - ) : super(localDatabase); + ); /// Was computed from [downloadDataString] in en_US /// diff --git a/packages/smooth_app/lib/data_models/product_list.dart b/packages/smooth_app/lib/data_models/product_list.dart index 6e155d6db98..b0df3db6912 100644 --- a/packages/smooth_app/lib/data_models/product_list.dart +++ b/packages/smooth_app/lib/data_models/product_list.dart @@ -47,6 +47,7 @@ class ProductList { this.pageNumber = 0, this.language, this.country, + this.productType, }); ProductList.keywordSearch( @@ -55,6 +56,7 @@ class ProductList { required int pageNumber, required OpenFoodFactsLanguage language, required OpenFoodFactsCountry? country, + required ProductType productType, }) : this._( listType: ProductListType.HTTP_SEARCH_KEYWORDS, parameters: keywords, @@ -62,6 +64,7 @@ class ProductList { pageNumber: pageNumber, language: language, country: country, + productType: productType, ); ProductList.categorySearch( @@ -70,6 +73,7 @@ class ProductList { required int pageNumber, required OpenFoodFactsLanguage language, required OpenFoodFactsCountry? country, + required ProductType productType, }) : this._( listType: ProductListType.HTTP_SEARCH_CATEGORY, parameters: category, @@ -77,6 +81,7 @@ class ProductList { pageNumber: pageNumber, language: language, country: country, + productType: productType, ); ProductList.contributor( @@ -84,12 +89,14 @@ class ProductList { required int pageSize, required int pageNumber, required OpenFoodFactsLanguage language, + required ProductType productType, }) : this._( listType: ProductListType.HTTP_USER_CONTRIBUTOR, parameters: userId, pageSize: pageSize, pageNumber: pageNumber, language: language, + productType: productType, ); ProductList.informer( @@ -97,12 +104,14 @@ class ProductList { required int pageSize, required int pageNumber, required OpenFoodFactsLanguage language, + required ProductType productType, }) : this._( listType: ProductListType.HTTP_USER_INFORMER, parameters: userId, pageSize: pageSize, pageNumber: pageNumber, language: language, + productType: productType, ); ProductList.photographer( @@ -110,12 +119,14 @@ class ProductList { required int pageSize, required int pageNumber, required OpenFoodFactsLanguage language, + required ProductType productType, }) : this._( listType: ProductListType.HTTP_USER_PHOTOGRAPHER, parameters: userId, pageSize: pageSize, pageNumber: pageNumber, language: language, + productType: productType, ); ProductList.toBeCompleted( @@ -123,12 +134,14 @@ class ProductList { required int pageSize, required int pageNumber, required OpenFoodFactsLanguage language, + required ProductType productType, }) : this._( listType: ProductListType.HTTP_USER_TO_BE_COMPLETED, parameters: userId, pageSize: pageSize, pageNumber: pageNumber, language: language, + productType: productType, ); ProductList.allToBeCompleted({ @@ -136,12 +149,14 @@ class ProductList { required int pageNumber, required OpenFoodFactsLanguage language, required OpenFoodFactsCountry? country, + required ProductType productType, }) : this._( listType: ProductListType.HTTP_ALL_TO_BE_COMPLETED, pageSize: pageSize, pageNumber: pageNumber, language: language, country: country, + productType: productType, ); ProductList.history() : this._(listType: ProductListType.HISTORY); @@ -171,6 +186,9 @@ class ProductList { /// Country at query time. final OpenFoodFactsCountry? country; + /// ProductType at query time. + final ProductType? productType; + /// "Total size" returned by the query. int totalSize = 0; @@ -251,7 +269,8 @@ class ProductList { ',$pageSize' ',$pageNumber' ',${language?.code ?? ''}' - ',${country?.offTag ?? ''}'; + ',${country?.offTag ?? ''}' + '${productType == null || productType == ProductType.food ? '' : ',${productType!.offTag}'}'; } } diff --git a/packages/smooth_app/lib/data_models/product_preferences.dart b/packages/smooth_app/lib/data_models/product_preferences.dart index 242b39d555b..346e6c54f36 100644 --- a/packages/smooth_app/lib/data_models/product_preferences.dart +++ b/packages/smooth_app/lib/data_models/product_preferences.dart @@ -9,9 +9,9 @@ import 'package:smooth_app/query/product_query.dart'; class ProductPreferences extends ProductPreferencesManager with ChangeNotifier { ProductPreferences( - final ProductPreferencesSelection productPreferencesSelection, { + super.productPreferencesSelection, { this.daoString, - }) : super(productPreferencesSelection); + }); final DaoString? daoString; 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 8d624b2058e..c089faf0d4b 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 @@ -3,15 +3,13 @@ import 'package:smooth_app/data_models/product_list.dart'; import 'package:smooth_app/data_models/product_list_supplier.dart'; import 'package:smooth_app/database/dao_product.dart'; import 'package:smooth_app/database/dao_product_list.dart'; -import 'package:smooth_app/database/local_database.dart'; -import 'package:smooth_app/query/paged_product_query.dart'; /// [ProductListSupplier] with a server query flavor class QueryProductListSupplier extends ProductListSupplier { QueryProductListSupplier( - final PagedProductQuery productQuery, - final LocalDatabase localDatabase, - ) : super(productQuery, localDatabase); + super.productQuery, + super.localDatabase, + ); @override Future asyncLoad() async { diff --git a/packages/smooth_app/lib/database/dao_hive_product.dart b/packages/smooth_app/lib/database/dao_hive_product.dart index 40aee8a6515..66639af5649 100644 --- a/packages/smooth_app/lib/database/dao_hive_product.dart +++ b/packages/smooth_app/lib/database/dao_hive_product.dart @@ -1,9 +1,9 @@ import 'dart:async'; import 'dart:convert'; + import 'package:hive/hive.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:smooth_app/database/abstract_dao.dart'; -import 'package:smooth_app/database/local_database.dart'; /// Hive type adapter for [Product] class _ProductAdapter extends TypeAdapter { @@ -25,7 +25,7 @@ class _ProductAdapter extends TypeAdapter { @Deprecated('use [DaoProduct] instead') class DaoHiveProduct extends AbstractDao { @Deprecated('use [DaoProduct] instead') - DaoHiveProduct(final LocalDatabase localDatabase) : super(localDatabase); + DaoHiveProduct(super.localDatabase); static const String _hiveBoxName = 'products'; diff --git a/packages/smooth_app/lib/database/dao_instant_string.dart b/packages/smooth_app/lib/database/dao_instant_string.dart index caf08b36795..406414f4ec8 100644 --- a/packages/smooth_app/lib/database/dao_instant_string.dart +++ b/packages/smooth_app/lib/database/dao_instant_string.dart @@ -1,10 +1,9 @@ import 'package:hive_flutter/hive_flutter.dart'; import 'package:smooth_app/database/abstract_dao.dart'; -import 'package:smooth_app/database/local_database.dart'; /// Where we store strings that need INSTANT access (= not lazy, no await). class DaoInstantString extends AbstractDao { - DaoInstantString(final LocalDatabase localDatabase) : super(localDatabase); + DaoInstantString(super.localDatabase); static const String _hiveBoxName = 'instantString'; diff --git a/packages/smooth_app/lib/database/dao_int.dart b/packages/smooth_app/lib/database/dao_int.dart index 8cec1f50679..dc2db1ed2f3 100644 --- a/packages/smooth_app/lib/database/dao_int.dart +++ b/packages/smooth_app/lib/database/dao_int.dart @@ -1,10 +1,9 @@ import 'package:hive_flutter/hive_flutter.dart'; import 'package:smooth_app/database/abstract_dao.dart'; -import 'package:smooth_app/database/local_database.dart'; /// Where we store ints. class DaoInt extends AbstractDao { - DaoInt(final LocalDatabase localDatabase) : super(localDatabase); + DaoInt(super.localDatabase); static const String _hiveBoxName = 'int'; diff --git a/packages/smooth_app/lib/database/dao_product_list.dart b/packages/smooth_app/lib/database/dao_product_list.dart index b851c657a83..2ce0883b9ce 100644 --- a/packages/smooth_app/lib/database/dao_product_list.dart +++ b/packages/smooth_app/lib/database/dao_product_list.dart @@ -71,7 +71,7 @@ class _BarcodeListAdapter extends TypeAdapter<_BarcodeList> { } class DaoProductList extends AbstractDao { - DaoProductList(final LocalDatabase localDatabase) : super(localDatabase); + DaoProductList(super.localDatabase); static const String _hiveBoxName = 'barcodeLists'; static const String _keySeparator = '::'; diff --git a/packages/smooth_app/lib/database/dao_string.dart b/packages/smooth_app/lib/database/dao_string.dart index ac092a9ffe5..c5d27a7d08a 100644 --- a/packages/smooth_app/lib/database/dao_string.dart +++ b/packages/smooth_app/lib/database/dao_string.dart @@ -1,6 +1,5 @@ import 'package:hive_flutter/hive_flutter.dart'; import 'package:smooth_app/database/abstract_dao.dart'; -import 'package:smooth_app/database/local_database.dart'; /// Where we store strings. /// @@ -9,7 +8,7 @@ import 'package:smooth_app/database/local_database.dart'; /// we're talking about large data (several 10Kb) that we almost never need, /// and that should not make the app boot slower. class DaoString extends AbstractDao { - DaoString(final LocalDatabase localDatabase) : super(localDatabase); + DaoString(super.localDatabase); static const String _hiveBoxName = 'string'; diff --git a/packages/smooth_app/lib/database/dao_string_list.dart b/packages/smooth_app/lib/database/dao_string_list.dart index 57be9377a3f..7a07ed1419e 100644 --- a/packages/smooth_app/lib/database/dao_string_list.dart +++ b/packages/smooth_app/lib/database/dao_string_list.dart @@ -1,10 +1,9 @@ import 'package:hive_flutter/hive_flutter.dart'; import 'package:smooth_app/database/abstract_dao.dart'; -import 'package:smooth_app/database/local_database.dart'; /// Where we store string lists with unique items. class DaoStringList extends AbstractDao { - DaoStringList(final LocalDatabase localDatabase) : super(localDatabase); + DaoStringList(super.localDatabase); static const String _hiveBoxName = 'stringList'; diff --git a/packages/smooth_app/lib/database/dao_string_list_map.dart b/packages/smooth_app/lib/database/dao_string_list_map.dart index c97354d80b9..57b60ea2e32 100644 --- a/packages/smooth_app/lib/database/dao_string_list_map.dart +++ b/packages/smooth_app/lib/database/dao_string_list_map.dart @@ -1,9 +1,8 @@ import 'package:hive_flutter/hive_flutter.dart'; import 'package:smooth_app/database/abstract_dao.dart'; -import 'package:smooth_app/database/local_database.dart'; class DaoStringListMap extends AbstractDao { - DaoStringListMap(final LocalDatabase localDatabase) : super(localDatabase); + DaoStringListMap(super.localDatabase); static const String _hiveBoxName = 'robotoffMap'; static const String _key = 'votedHistory'; diff --git a/packages/smooth_app/lib/database/dao_transient_operation.dart b/packages/smooth_app/lib/database/dao_transient_operation.dart index b0d9d16c861..44660aa029b 100644 --- a/packages/smooth_app/lib/database/dao_transient_operation.dart +++ b/packages/smooth_app/lib/database/dao_transient_operation.dart @@ -1,9 +1,9 @@ import 'dart:async'; import 'dart:convert'; + import 'package:hive/hive.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:smooth_app/database/abstract_dao.dart'; -import 'package:smooth_app/database/local_database.dart'; /// Transient operation: a minimalist [product] with a [key]. /// @@ -54,8 +54,7 @@ class _ProductAdapter extends TypeAdapter { /// * it's supposed to be little anyway, so we can load it at startup /// * the way we use it may sometimes require instant access (no `await`) class DaoTransientOperation extends AbstractDao { - DaoTransientOperation(final LocalDatabase localDatabase) - : super(localDatabase); + DaoTransientOperation(super.localDatabase); static const String _hiveBoxName = 'transientOperations'; 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 4b33885c2f8..d23491686d3 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 @@ -3,7 +3,7 @@ import 'package:flutter/rendering.dart'; class SmoothDraggableBottomSheet extends StatefulWidget { const SmoothDraggableBottomSheet({ - Key? key, + super.key, required this.headerBuilder, required this.headerHeight, required this.bodyBuilder, @@ -13,8 +13,7 @@ class SmoothDraggableBottomSheet extends StatefulWidget { this.animationController, this.bottomSheetColor, this.draggableScrollableController, - }) : assert(maxHeightFraction > 0.0 && maxHeightFraction <= 1.0), - super(key: key); + }) : assert(maxHeightFraction > 0.0 && maxHeightFraction <= 1.0); final double initHeightFraction; final double maxHeightFraction; @@ -152,8 +151,7 @@ class _SmoothDraggableContent extends StatefulWidget { required this.headerHeight, required this.headerBuilder, required this.bodyBuilder, - Key? key, - }) : super(key: key); + }); final WidgetBuilder headerBuilder; final double headerHeight; 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 8a20253362e..3609f74faf5 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 @@ -40,8 +40,8 @@ class _FlexibleBottomSheetRoute extends PopupRoute { required this.borderRadius, this.barrierLabel, this.bottomSheetBackgroundColor, - RouteSettings? settings, - }) : super(settings: settings); + super.settings, + }); final WidgetBuilder headerBuilder; final double headerHeight; 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 ca4e99636d1..74df9bd1671 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 @@ -9,8 +9,8 @@ class SmoothBackButton extends StatelessWidget { const SmoothBackButton({ this.onPressed, this.iconColor, - Key? key, - }) : super(key: key); + super.key, + }); final VoidCallback? onPressed; final Color? iconColor; 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 68184d88247..0b1c5b60f7e 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 @@ -10,8 +10,8 @@ class SmoothListTileCard extends StatelessWidget { this.subtitle, this.onTap, this.leading, - Key? key, - }) : super(key: key); + super.key, + }); /// Displays a [ListTile] inside a [SmoothCard] with a leading [Column] /// containing the specified [icon] diff --git a/packages/smooth_app/lib/helpers/physics.dart b/packages/smooth_app/lib/helpers/physics.dart index 8a3b0e30bed..9a9e47ec60d 100644 --- a/packages/smooth_app/lib/helpers/physics.dart +++ b/packages/smooth_app/lib/helpers/physics.dart @@ -85,11 +85,14 @@ class _VerticalClampScrollState extends State { if (scrollTo != null) { Future.delayed(Duration.zero, () { - context.read().animateTo( - scrollTo!, - curve: Curves.easeOutCubic, - duration: const Duration(milliseconds: 500), - ); + if (context.mounted) { + // ignore: use_build_context_synchronously + context.read().animateTo( + scrollTo!, + curve: Curves.easeOutCubic, + duration: const Duration(milliseconds: 500), + ); + } }); } } diff --git a/packages/smooth_app/lib/helpers/ui_helpers.dart b/packages/smooth_app/lib/helpers/ui_helpers.dart index ca03682d7fb..72d85bdc576 100644 --- a/packages/smooth_app/lib/helpers/ui_helpers.dart +++ b/packages/smooth_app/lib/helpers/ui_helpers.dart @@ -1,8 +1,9 @@ -/// Contains UI related constant that are shared across the entire app. import 'package:flutter/material.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:smooth_app/generic_lib/design_constants.dart'; +/// Contains UI related constant that are shared across the entire app. + /// Main attributes, to be displayed on top const List SCORE_ATTRIBUTE_IDS = [ Attribute.ATTRIBUTE_NUTRISCORE, 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 e1ee8172f20..b0f26c9437a 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 @@ -14,9 +14,9 @@ const Color _maybeTextColor = Colors.black; class QuestionAnswersOptions extends StatelessWidget { const QuestionAnswersOptions( this.question, { - Key? key, + super.key, required this.onAnswer, - }) : super(key: key); + }); final RobotoffQuestion question; final Function(InsightAnnotation) onAnswer; diff --git a/packages/smooth_app/lib/pages/navigator/app_navigator.dart b/packages/smooth_app/lib/pages/navigator/app_navigator.dart index 44c9086a5f7..e28f03f64e2 100644 --- a/packages/smooth_app/lib/pages/navigator/app_navigator.dart +++ b/packages/smooth_app/lib/pages/navigator/app_navigator.dart @@ -37,13 +37,12 @@ import 'package:smooth_app/query/product_query.dart'; /// /!\ [GoRouter] doesn't support [maybePop] or returning a result from a push. class AppNavigator extends InheritedWidget { AppNavigator({ - Key? key, + super.key, List? observers, - required Widget child, - }) : _router = _SmoothGoRouter( + required super.child, + }) : _router = _SmoothGoRouter( observers: observers, - ), - super(key: key, child: child); + ); // GoRouter is never accessible directly final _SmoothGoRouter _router; diff --git a/packages/smooth_app/lib/pages/navigator/error_page.dart b/packages/smooth_app/lib/pages/navigator/error_page.dart index 69a9d869293..caa11a39e01 100644 --- a/packages/smooth_app/lib/pages/navigator/error_page.dart +++ b/packages/smooth_app/lib/pages/navigator/error_page.dart @@ -9,8 +9,8 @@ import 'package:smooth_app/pages/navigator/app_navigator.dart'; class ErrorPage extends StatelessWidget { const ErrorPage({ required this.url, - Key? key, - }) : super(key: key); + super.key, + }); final String url; diff --git a/packages/smooth_app/lib/pages/navigator/external_page.dart b/packages/smooth_app/lib/pages/navigator/external_page.dart index d28bd9bb2b0..ed725da3de4 100644 --- a/packages/smooth_app/lib/pages/navigator/external_page.dart +++ b/packages/smooth_app/lib/pages/navigator/external_page.dart @@ -18,9 +18,10 @@ import 'package:smooth_app/services/smooth_services.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, Key? key}) - : assert(path != ''), - super(key: key); + const ExternalPage({ + required this.path, + super.key, + }) : assert(path != ''); final String path; diff --git a/packages/smooth_app/lib/pages/offline_data_page.dart b/packages/smooth_app/lib/pages/offline_data_page.dart index 5cc440ffe93..ee3a26d37e8 100644 --- a/packages/smooth_app/lib/pages/offline_data_page.dart +++ b/packages/smooth_app/lib/pages/offline_data_page.dart @@ -14,7 +14,7 @@ import 'package:smooth_app/widgets/smooth_app_bar.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; class OfflineDataPage extends StatefulWidget { - const OfflineDataPage({Key? key}) : super(key: key); + const OfflineDataPage({super.key}); @override State createState() => _OfflineDataPageState(); @@ -117,9 +117,9 @@ class _OfflineDataPageState extends State { // in the database and the size of the database class _StatsWidget extends StatelessWidget { const _StatsWidget({ - Key? key, required this.daoProduct, - }) : super(key: key); + }); + final DaoProduct daoProduct; @override @@ -164,12 +164,12 @@ class _StatsWidget extends StatelessWidget { // and a trailing widget and an onTap callback for OfflineDataPage class _OfflinePageListTile extends StatelessWidget { const _OfflinePageListTile({ - Key? key, required this.title, required this.subtitle, required this.trailing, required this.onTap, - }) : super(key: key); + }); + final String title; final String subtitle; final Widget trailing; 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 72e31af9874..2418130f07d 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_account.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_account.dart @@ -1,9 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:provider/provider.dart'; -import 'package:smooth_app/data_models/preferences/user_preferences.dart'; import 'package:smooth_app/data_models/user_management_provider.dart'; import 'package:smooth_app/database/local_database.dart'; import 'package:smooth_app/generic_lib/buttons/smooth_simple_button.dart'; @@ -34,16 +32,11 @@ import 'package:smooth_app/query/product_query.dart'; class UserPreferencesAccount extends AbstractUserPreferences { UserPreferencesAccount({ - required final BuildContext context, - required final UserPreferences userPreferences, - required final AppLocalizations appLocalizations, - required final ThemeData themeData, - }) : super( - context: context, - userPreferences: userPreferences, - appLocalizations: appLocalizations, - themeData: themeData, - ); + required super.context, + required super.userPreferences, + required super.appLocalizations, + required super.themeData, + }); @override PreferencePageType getPreferencePageType() => PreferencePageType.ACCOUNT; @@ -178,6 +171,8 @@ class UserPreferencesAccount extends AbstractUserPreferences { productQuery: PagedUserProductQuery( userId: userId, type: UserSearchType.CONTRIBUTOR, + // TODO(monsieurtanuki): only food? + productType: ProductType.food, ), title: appLocalizations.user_search_contributor_title, iconData: Icons.add_circle_outline, @@ -189,6 +184,7 @@ class UserPreferencesAccount extends AbstractUserPreferences { productQuery: PagedUserProductQuery( userId: userId, type: UserSearchType.INFORMER, + productType: ProductType.food, ), title: appLocalizations.user_search_informer_title, iconData: Icons.edit, @@ -200,6 +196,7 @@ class UserPreferencesAccount extends AbstractUserPreferences { productQuery: PagedUserProductQuery( userId: userId, type: UserSearchType.PHOTOGRAPHER, + productType: ProductType.food, ), title: appLocalizations.user_search_photographer_title, iconData: Icons.add_a_photo, @@ -211,6 +208,7 @@ class UserPreferencesAccount extends AbstractUserPreferences { productQuery: PagedUserProductQuery( userId: userId, type: UserSearchType.TO_BE_COMPLETED, + productType: ProductType.food, ), title: appLocalizations.user_search_to_be_completed_title, iconData: Icons.more_horiz, @@ -303,7 +301,9 @@ class UserPreferencesAccount extends AbstractUserPreferences { 'app/products', ), _buildProductQueryTile( - productQuery: PagedToBeCompletedProductQuery(), + productQuery: PagedToBeCompletedProductQuery( + productType: ProductType.food, + ), title: appLocalizations.all_search_to_be_completed_title, iconData: Icons.more_outlined, context: context, 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 1e4e0f169f5..2ed22a33945 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_connect.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_connect.dart @@ -5,11 +5,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_email_sender/flutter_email_sender.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:package_info_plus/package_info_plus.dart'; -import 'package:smooth_app/data_models/preferences/user_preferences.dart'; import 'package:smooth_app/generic_lib/design_constants.dart'; import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart'; import 'package:smooth_app/helpers/app_helper.dart'; @@ -24,16 +22,11 @@ import 'package:smooth_app/services/smooth_services.dart'; /// Display of "Connect" for the preferences page. class UserPreferencesConnect extends AbstractUserPreferences { UserPreferencesConnect({ - required final BuildContext context, - required final UserPreferences userPreferences, - required final AppLocalizations appLocalizations, - required final ThemeData themeData, - }) : super( - context: context, - userPreferences: userPreferences, - appLocalizations: appLocalizations, - themeData: themeData, - ); + required super.context, + required super.userPreferences, + required super.appLocalizations, + required super.themeData, + }); @override PreferencePageType getPreferencePageType() => PreferencePageType.CONNECT; 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 12ca3580a73..d0e438e2c1c 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_contribute.dart @@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:http/http.dart' as http; +import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:provider/provider.dart'; import 'package:share_plus/share_plus.dart'; import 'package:smooth_app/data_models/github_contributors_model.dart'; @@ -27,16 +28,11 @@ import 'package:smooth_app/query/product_query.dart'; /// Display of "Contribute" for the preferences page. class UserPreferencesContribute extends AbstractUserPreferences { UserPreferencesContribute({ - required final BuildContext context, - required final UserPreferences userPreferences, - required final AppLocalizations appLocalizations, - required final ThemeData themeData, - }) : super( - context: context, - userPreferences: userPreferences, - appLocalizations: appLocalizations, - themeData: themeData, - ); + required super.context, + required super.userPreferences, + required super.appLocalizations, + required super.themeData, + }); @override PreferencePageType getPreferencePageType() => PreferencePageType.CONTRIBUTE; @@ -175,7 +171,10 @@ class UserPreferencesContribute extends AbstractUserPreferences { ProductQueryPageHelper.openBestChoice( name: appLocalizations.all_search_to_be_completed_title, localDatabase: localDatabase, - productQuery: PagedToBeCompletedProductQuery(), + productQuery: PagedToBeCompletedProductQuery( + // TODO(monsieurtanuki): only food? + productType: ProductType.food, + ), // the other "context"s being popped context: this.context, editableAppBarTitle: false, @@ -288,6 +287,7 @@ class UserPreferencesContribute extends AbstractUserPreferences { context: context, builder: (BuildContext context) => _ContributorsDialog(), ); + Future _hungerGames() async { // Track the hunger game analytics event AnalyticsHelper.trackEvent( 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 07d846001da..38507150fa9 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 @@ -12,7 +12,9 @@ import 'package:smooth_app/widgets/smooth_app_bar.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; class UserPreferencesDebugInfo extends StatefulWidget { - const UserPreferencesDebugInfo({Key? key}) : super(key: key); + const UserPreferencesDebugInfo({ + super.key, + }); @override State createState() => 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 5e65b3ff776..b74813c7f75 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 @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:intl/intl.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; @@ -9,7 +8,6 @@ import 'package:smooth_app/background/background_task_badge.dart'; import 'package:smooth_app/background/background_task_language_refresh.dart'; import 'package:smooth_app/data_models/continuous_scan_model.dart'; import 'package:smooth_app/data_models/news_feed/newsfeed_provider.dart'; -import 'package:smooth_app/data_models/preferences/user_preferences.dart'; import 'package:smooth_app/data_models/product_list.dart'; import 'package:smooth_app/database/dao_osm_location.dart'; import 'package:smooth_app/database/dao_product.dart'; @@ -36,16 +34,11 @@ import 'package:smooth_app/query/product_query.dart'; /// Settings => FAQ => Develop => Clicking switch class UserPreferencesDevMode extends AbstractUserPreferences { UserPreferencesDevMode({ - required final BuildContext context, - required final UserPreferences userPreferences, - required final AppLocalizations appLocalizations, - required final ThemeData themeData, - }) : super( - context: context, - userPreferences: userPreferences, - appLocalizations: appLocalizations, - themeData: themeData, - ); + required super.context, + required super.userPreferences, + required super.appLocalizations, + required super.themeData, + }); static const String userPreferencesFlagProd = '__devWorkingOnProd'; static const String userPreferencesFlagPriceProd = '__devWorkingOnPricesProd'; 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 7263e39e9e2..cd5a0af5f72 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_faq.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_faq.dart @@ -1,11 +1,9 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:smooth_app/cards/category_cards/svg_cache.dart'; -import 'package:smooth_app/data_models/preferences/user_preferences.dart'; import 'package:smooth_app/generic_lib/design_constants.dart'; import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart'; import 'package:smooth_app/helpers/app_helper.dart'; @@ -22,16 +20,11 @@ import 'package:smooth_app/query/product_query.dart'; /// Display of "FAQ" for the preferences page. class UserPreferencesFaq extends AbstractUserPreferences { UserPreferencesFaq({ - required final BuildContext context, - required final UserPreferences userPreferences, - required final AppLocalizations appLocalizations, - required final ThemeData themeData, - }) : super( - context: context, - userPreferences: userPreferences, - appLocalizations: appLocalizations, - themeData: themeData, - ); + required super.context, + required super.userPreferences, + required super.appLocalizations, + required super.themeData, + }); @override PreferencePageType getPreferencePageType() => PreferencePageType.FAQ; 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 75d0d4b1517..bab5e81624f 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_food.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_food.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:provider/provider.dart'; -import 'package:smooth_app/data_models/preferences/user_preferences.dart'; import 'package:smooth_app/data_models/product_preferences.dart'; import 'package:smooth_app/generic_lib/design_constants.dart'; import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart'; @@ -18,16 +17,11 @@ import 'package:smooth_app/widgets/smooth_text.dart'; class UserPreferencesFood extends AbstractUserPreferences { UserPreferencesFood({ required this.productPreferences, - required final BuildContext context, - required final UserPreferences userPreferences, - required final AppLocalizations appLocalizations, - required final ThemeData themeData, - }) : super( - context: context, - userPreferences: userPreferences, - appLocalizations: appLocalizations, - themeData: themeData, - ); + required super.context, + required super.userPreferences, + required super.appLocalizations, + required super.themeData, + }); final ProductPreferences productPreferences; 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 8488f03e269..5634b59a52f 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_settings.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:provider/provider.dart'; import 'package:smooth_app/data_models/preferences/user_preferences.dart'; import 'package:smooth_app/generic_lib/design_constants.dart'; @@ -24,17 +23,12 @@ import 'package:smooth_app/themes/theme_provider.dart'; /// Collapsed/expanded display of settings for the preferences page. class UserPreferencesSettings extends AbstractUserPreferences { UserPreferencesSettings({ - required final BuildContext context, - required final UserPreferences userPreferences, - required final AppLocalizations appLocalizations, - required final ThemeData themeData, + required super.context, + required super.userPreferences, + required super.appLocalizations, + required super.themeData, required this.themeProvider, - }) : super( - context: context, - userPreferences: userPreferences, - appLocalizations: appLocalizations, - themeData: themeData, - ); + }); final ThemeProvider themeProvider; 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 735c70731a4..a5cdbdf33cd 100644 --- a/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart +++ b/packages/smooth_app/lib/pages/preferences/user_preferences_widgets.dart @@ -11,8 +11,8 @@ import 'package:smooth_app/themes/smooth_theme_colors.dart'; class UserPreferencesListItemDivider extends StatelessWidget { const UserPreferencesListItemDivider({ this.margin, - Key? key, - }) : super(key: key); + super.key, + }); final EdgeInsetsGeometry? margin; @@ -261,12 +261,11 @@ class UserPreferencesMultipleChoicesItem extends StatelessWidget { this.leadingBuilder, this.descriptions, this.dialogHeight, - Key? key, + super.key, }) : assert(labels.length > 0), assert(values.length == labels.length), assert(descriptions == null || descriptions.length == labels.length), - assert(dialogHeight == null || dialogHeight > 0.0), - super(key: key); + assert(dialogHeight == null || dialogHeight > 0.0); final String title; final IconData? leading; 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 34f7e970238..fd1930d32d4 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 @@ -36,50 +36,20 @@ class _PriceAddProductCardState extends State { ), ), SmoothLargeButtonWithIcon( - text: appLocalizations.prices_barcode_enter, - icon: Icons.text_fields, + text: appLocalizations.prices_barcode_reader_action, + icon: Icons.barcode_reader, onPressed: () async { - final TextEditingController controller = TextEditingController(); - final String? barcode = await 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(), - ), + final String? barcode = await Navigator.of(context).push( + MaterialPageRoute( + builder: (BuildContext context) => PriceScanPage( + latestScannedBarcode: _latestScannedBarcode, ), ), ); if (barcode == null) { return; } + _latestScannedBarcode = barcode; if (!context.mounted) { return; } @@ -87,20 +57,13 @@ class _PriceAddProductCardState extends State { }, ), SmoothLargeButtonWithIcon( - text: appLocalizations.prices_barcode_reader_action, - icon: Icons.barcode_reader, + text: appLocalizations.prices_barcode_enter, + icon: Icons.text_fields, onPressed: () async { - final String? barcode = await Navigator.of(context).push( - MaterialPageRoute( - builder: (BuildContext context) => PriceScanPage( - latestScannedBarcode: _latestScannedBarcode, - ), - ), - ); + final String? barcode = await _textInput(context); if (barcode == null) { return; } - _latestScannedBarcode = barcode; if (!context.mounted) { return; } @@ -149,6 +112,48 @@ class _PriceAddProductCardState extends State { priceModel.notifyListeners(); } + Future _textInput(final BuildContext context) async { + final TextEditingController controller = TextEditingController(); + final AppLocalizations appLocalizations = AppLocalizations.of(context); + 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(), + ), + ), + ), + ); + } + bool _isValidBarcode(final String barcode) => barcode.length >= 8; // Probably there's a regexp for that, but at least it's readable code. diff --git a/packages/smooth_app/lib/pages/product/autocomplete.dart b/packages/smooth_app/lib/pages/product/autocomplete.dart index b3f5d69f7c7..6b20995ad69 100644 --- a/packages/smooth_app/lib/pages/product/autocomplete.dart +++ b/packages/smooth_app/lib/pages/product/autocomplete.dart @@ -10,7 +10,7 @@ import 'package:smooth_app/widgets/smooth_text.dart'; /// Inspiration was found in https://stackoverflow.com/questions/66935362 class AutocompleteOptions extends StatelessWidget { const AutocompleteOptions({ - Key? key, + super.key, required this.displayStringForOption, required this.onSelected, required this.options, @@ -18,8 +18,7 @@ class AutocompleteOptions extends StatelessWidget { required this.maxOptionsWidth, this.search, }) : assert(maxOptionsHeight >= 0), - assert(maxOptionsWidth >= 0), - super(key: key); + assert(maxOptionsWidth >= 0); final AutocompleteOptionToString displayStringForOption; final AutocompleteOnSelected onSelected; @@ -78,8 +77,8 @@ class _AutocompleteOptionsItem extends StatelessWidget { required this.displayStringForOption, required this.onSelected, this.search, - Key? key, - }) : super(key: key); + super.key, + }); final T option; final String? search; 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 ecafb80ca15..2a133bf9843 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 @@ -7,8 +7,8 @@ class SearchAppBarTitle extends StatelessWidget { required this.title, this.multiLines = true, required this.editableAppBarTitle, - Key? key, - }) : super(key: key); + super.key, + }); final String title; final bool multiLines; 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 98dbf68f7ad..2849331ec99 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 @@ -9,8 +9,8 @@ class SearchEmptyScreen extends StatelessWidget { required this.emptiness, this.actions, this.includeAppBar = true, - Key? key, - }) : super(key: key); + super.key, + }); final String name; final Widget emptiness; 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 fb171d7779a..872ff254cfc 100644 --- a/packages/smooth_app/lib/pages/product/common/search_helper.dart +++ b/packages/smooth_app/lib/pages/product/common/search_helper.dart @@ -26,6 +26,8 @@ abstract class SearchHelper extends ValueNotifier { /// Hint text for the search field. String getHintText(final AppLocalizations appLocalizations); + Widget? getAdditionalFilter() => null; + /// Returns all the previous queries, in reverse order. List getAllQueries(final LocalDatabase localDatabase) => DaoStringList(localDatabase).getAll(historyKey).reversed.toList(); diff --git a/packages/smooth_app/lib/pages/product/edit_product_page.dart b/packages/smooth_app/lib/pages/product/edit_product_page.dart index d9bc6e58495..6ce68086de5 100644 --- a/packages/smooth_app/lib/pages/product/edit_product_page.dart +++ b/packages/smooth_app/lib/pages/product/edit_product_page.dart @@ -355,8 +355,7 @@ class _ListTitleItem extends SmoothListTileCard { Widget? leading, String? title, String? subtitle, - void Function()? onTap, - Key? key, + super.onTap, }) : super.icon( title: title == null ? null @@ -364,8 +363,6 @@ class _ListTitleItem extends SmoothListTileCard { title, style: const TextStyle(fontWeight: FontWeight.bold), ), - onTap: onTap, - key: key, icon: leading, subtitle: subtitle == null ? null : Text(subtitle), ); @@ -373,10 +370,9 @@ class _ListTitleItem extends SmoothListTileCard { /// Barcodes only allowed have a length of 7, 8, 12 or 13 characters class _ProductBarcode extends StatefulWidget { - _ProductBarcode({required this.product, Key? key}) + _ProductBarcode({required this.product}) : assert(product.barcode?.isNotEmpty == true), - assert(isAValidBarcode(product.barcode)), - super(key: key); + assert(isAValidBarcode(product.barcode)); static const double _barcodeHeight = 120.0; diff --git a/packages/smooth_app/lib/pages/product/hideable_container.dart b/packages/smooth_app/lib/pages/product/hideable_container.dart index 6247c9b5c40..cc784f62933 100644 --- a/packages/smooth_app/lib/pages/product/hideable_container.dart +++ b/packages/smooth_app/lib/pages/product/hideable_container.dart @@ -5,8 +5,8 @@ import 'package:smooth_app/generic_lib/duration_constants.dart'; class HideableContainer extends StatefulWidget { const HideableContainer({ required this.child, - Key? key, - }) : super(key: key); + super.key, + }); final Widget child; 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 c60c7897639..9b9468f4029 100644 --- a/packages/smooth_app/lib/pages/product/product_incomplete_card.dart +++ b/packages/smooth_app/lib/pages/product/product_incomplete_card.dart @@ -21,6 +21,10 @@ class ProductIncompleteCard extends StatelessWidget { final bool isLoggedInMandatory; static bool isProductIncomplete(final Product product) { + if (product.productType != null && + product.productType != ProductType.food) { + return false; + } bool checkScores = true; if (_isNutriscoreNotApplicable(product)) { AnalyticsHelper.trackEvent( 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 29805b61ee7..462ceb41e92 100644 --- a/packages/smooth_app/lib/pages/product/product_loader_page.dart +++ b/packages/smooth_app/lib/pages/product/product_loader_page.dart @@ -16,9 +16,8 @@ class ProductLoaderPage extends StatefulWidget { const ProductLoaderPage({ required this.barcode, required this.mode, - Key? key, - }) : assert(barcode != ''), - super(key: key); + super.key, + }) : assert(barcode != ''); final String barcode; final ProductLoaderMode mode; @@ -111,7 +110,7 @@ class _ProductLoaderPageState extends State { } class _ProductLoaderLoadingState extends StatelessWidget { - const _ProductLoaderLoadingState({Key? key}) : super(key: key); + const _ProductLoaderLoadingState(); @override Widget build(BuildContext context) { @@ -122,8 +121,7 @@ class _ProductLoaderLoadingState extends StatelessWidget { class _ProductLoaderNotFoundState extends StatelessWidget { const _ProductLoaderNotFoundState({ required this.barcode, - Key? key, - }) : super(key: key); + }); final String barcode; @@ -168,8 +166,7 @@ class _ProductLoaderNotFoundState extends StatelessWidget { class _ProductLoaderNetworkErrorState extends StatelessWidget { const _ProductLoaderNetworkErrorState({ required this.onRetry, - Key? key, - }) : super(key: key); + }); final VoidCallback onRetry; diff --git a/packages/smooth_app/lib/pages/product/product_question_answers_options.dart b/packages/smooth_app/lib/pages/product/product_question_answers_options.dart index d9e1c31e72a..1b8c0509f0f 100644 --- a/packages/smooth_app/lib/pages/product/product_question_answers_options.dart +++ b/packages/smooth_app/lib/pages/product/product_question_answers_options.dart @@ -7,9 +7,9 @@ import 'package:smooth_app/generic_lib/design_constants.dart'; class ProductQuestionAnswersOptions extends StatelessWidget { const ProductQuestionAnswersOptions( this.question, { - Key? key, + super.key, required this.onAnswer, - }) : super(key: key); + }); final RobotoffQuestion question; final Function(InsightAnnotation) onAnswer; 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 8e0a5b0a7aa..675dff6676a 100644 --- a/packages/smooth_app/lib/pages/product/product_questions_widget.dart +++ b/packages/smooth_app/lib/pages/product/product_questions_widget.dart @@ -442,8 +442,8 @@ class KeepQuestionWidgetAlive extends InheritedWidget { const KeepQuestionWidgetAlive({ super.key, required this.keepWidgetAlive, - required Widget child, - }) : super(child: child); + required super.child, + }); final bool keepWidgetAlive; diff --git a/packages/smooth_app/lib/pages/product/summary_card.dart b/packages/smooth_app/lib/pages/product/summary_card.dart index df54b727673..e11021e2a68 100644 --- a/packages/smooth_app/lib/pages/product/summary_card.dart +++ b/packages/smooth_app/lib/pages/product/summary_card.dart @@ -301,7 +301,10 @@ class _SummaryCardState extends State with UpToDateMixin { onPressed: () async => ProductQueryPageHelper.openBestChoice( name: categoryLabel!, localDatabase: context.read(), - productQuery: CategoryProductQuery(categoryTag!), + productQuery: CategoryProductQuery( + categoryTag!, + productType: upToDateProduct.productType ?? ProductType.food, + ), context: context, searchResult: false, ), 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 534a97143de..37a50315ce9 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 @@ -261,11 +261,10 @@ class ProductListUserDialogHelper { /// Handles click rebuilds class _UserLists extends StatefulWidget { const _UserLists({ - Key? key, required this.lists, required this.selectedLists, required this.onListsSubmitted, - }) : super(key: key); + }); final Set lists; final Set selectedLists; @@ -326,7 +325,9 @@ 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, {Key? key}) : super(key: key); + const _UserEmptyLists( + this.daoProductList, + ); final DaoProductList daoProductList; 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 85181b9c3fe..f19003055cf 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 @@ -84,10 +84,9 @@ class ExternalScanCarouselManagerState class _InheritedCarouselManager extends InheritedWidget { const _InheritedCarouselManager({ - required Widget child, + required super.child, required this.state, - Key? key, - }) : super(key: key, child: child); + }); final ExternalScanCarouselManagerState state; diff --git a/packages/smooth_app/lib/pages/scan/scan_page.dart b/packages/smooth_app/lib/pages/scan/scan_page.dart index 01185002a79..4f467cf54c9 100644 --- a/packages/smooth_app/lib/pages/scan/scan_page.dart +++ b/packages/smooth_app/lib/pages/scan/scan_page.dart @@ -169,7 +169,7 @@ class _ScanPageState extends State { } class _PermissionDeniedCard extends StatelessWidget { - const _PermissionDeniedCard({Key? key}) : super(key: key); + const _PermissionDeniedCard(); @override Widget build(BuildContext context) { 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 c80677d6753..4a5ebf08f91 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,7 +2,9 @@ import 'package:flutter/material.dart'; /// Fake barcode scanner, for tests. class SmoothBarcodeScannerMocked extends StatelessWidget { - const SmoothBarcodeScannerMocked({Key? key}) : super(key: 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 baefe1ab293..dee1658d520 100644 --- a/packages/smooth_app/lib/pages/search/search_field.dart +++ b/packages/smooth_app/lib/pages/search/search_field.dart @@ -73,6 +73,7 @@ class _SearchFieldState extends State { final TextStyle textStyle = SearchFieldUIHelper.textStyle(context); + final Widget? additionalFilter = widget.searchHelper.getAdditionalFilter(); return ChangeNotifierProvider.value( value: _controller!, child: SmoothHero( @@ -90,19 +91,24 @@ class _SearchFieldState extends State { : null, child: Material( // ↑ Needed by the Hero Widget - child: TextField( - controller: _controller, - focusNode: _focusNode, - onSubmitted: (String query) => _performSearch(context, query), - textInputAction: TextInputAction.search, - enableSuggestions: widget.enableSuggestions, - autocorrect: widget.autocorrect, - style: textStyle, - decoration: _getInputDecoration( - context, - localizations, - ), - cursorColor: textStyle.color, + child: Column( + children: [ + TextField( + controller: _controller, + focusNode: _focusNode, + onSubmitted: (String query) => _performSearch(context, query), + textInputAction: TextInputAction.search, + enableSuggestions: widget.enableSuggestions, + autocorrect: widget.autocorrect, + style: textStyle, + decoration: _getInputDecoration( + context, + localizations, + ), + cursorColor: textStyle.color, + ), + if (additionalFilter != null) additionalFilter, + ], ), ), ), diff --git a/packages/smooth_app/lib/pages/search/search_page.dart b/packages/smooth_app/lib/pages/search/search_page.dart index cda42435bbd..5717eb8e416 100644 --- a/packages/smooth_app/lib/pages/search/search_page.dart +++ b/packages/smooth_app/lib/pages/search/search_page.dart @@ -7,6 +7,7 @@ import 'package:smooth_app/pages/product/common/search_preloaded_item.dart'; import 'package:smooth_app/pages/search/search_field.dart'; import 'package:smooth_app/pages/search/search_history_view.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; +import 'package:smooth_app/widgets/will_pop_scope.dart'; /// The [SearchPage] screen. /// It can opened directly with the [SearchPageExtra] constructor. @@ -61,81 +62,90 @@ class _SearchPageState extends State { @override Widget build(BuildContext context) { - return MultiProvider( - providers: >[ - ChangeNotifierProvider.value( - value: _searchTextController, - ), - ChangeNotifierProvider.value( - value: widget.searchHelper, - ), - ], - child: SmoothScaffold( - body: Column( - children: [ - ValueNotifierListener( - listener: _onSearchChanged, - child: SafeArea( - bottom: false, - child: Padding( - padding: const EdgeInsetsDirectional.symmetric( - vertical: SMALL_SPACE, - horizontal: BALANCED_SPACE, - ), - child: SearchField( - autofocus: widget.autofocus, - focusNode: _searchFocusNode, - searchHelper: widget.searchHelper, - heroTag: widget.heroTag, + return WillPopScope2( + onWillPop: () async { + /// For the world view, we need to intercept the back button from here + /// See below for the custom [Navigator] + if (widget.searchHelper.value != null) { + setState(() => widget.searchHelper.value = null); + return (false, null); + } + return (true, null); + }, + child: MultiProvider( + providers: >[ + ChangeNotifierProvider.value( + value: _searchTextController, + ), + ChangeNotifierProvider.value( + value: widget.searchHelper, + ), + ], + child: SmoothScaffold( + body: Column( + children: [ + ValueNotifierListener( + listener: _onSearchChanged, + child: SafeArea( + bottom: false, + child: Padding( + padding: const EdgeInsetsDirectional.symmetric( + vertical: SMALL_SPACE, + horizontal: BALANCED_SPACE, + ), + child: SearchField( + autofocus: widget.autofocus, + focusNode: _searchFocusNode, + searchHelper: widget.searchHelper, + heroTag: widget.heroTag, + ), ), ), ), - ), - Expanded( - child: Consumer( - 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, - ), - searchHelper: widget.searchHelper, - preloadedList: - widget.preloadedList ?? [], - ); - } else { - /// A custom [Navigator] is used to intercept the World - /// results to be embedded in this part of the screen and - /// not on a new one. - return Navigator( - key: _navigatorKey, - pages: >[ - MaterialPage( - child: searchHelper.value!.widget, + Expanded( + child: Consumer( + 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, ), - ], - onPopPage: (Route route, dynamic result) { - if (!route.didPop(result)) { - return false; - } - return true; - }, - ); - } - }, + searchHelper: widget.searchHelper, + preloadedList: + widget.preloadedList ?? [], + ); + } else { + /// A custom [Navigator] is used to intercept the World + /// results to be embedded in this part of the screen and + /// not on a new one. + return Navigator( + key: _navigatorKey, + pages: >[ + MaterialPage( + child: searchHelper.value!.widget, + ), + ], + onDidRemovePage: (_) { + /// Mandatory to provide this method + /// The event is intercepted by the [WillPopScope2] + }, + ); + } + }, + ), ), - ), - ], + ], + ), ), ), ); 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 d2f6b3a71dd..91e0a87ced3 100644 --- a/packages/smooth_app/lib/pages/search/search_product_helper.dart +++ b/packages/smooth_app/lib/pages/search/search_product_helper.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:provider/provider.dart'; import 'package:smooth_app/data_models/fetched_product.dart'; import 'package:smooth_app/database/dao_string_list.dart'; @@ -12,11 +13,15 @@ import 'package:smooth_app/pages/product/common/product_dialog_helper.dart'; import 'package:smooth_app/pages/product/common/product_query_page_helper.dart'; import 'package:smooth_app/pages/product/common/search_helper.dart'; import 'package:smooth_app/query/keywords_product_query.dart'; +import 'package:smooth_app/query/product_query.dart'; /// Search helper dedicated to product search. class SearchProductHelper extends SearchHelper { SearchProductHelper(); + // TODO(monsieurtanuki): maybe reinit it with latest value + ProductType _productType = ProductType.food; + @override String get historyKey => DaoStringList.keySearchProductHistory; @@ -24,6 +29,9 @@ class SearchProductHelper extends SearchHelper { String getHintText(final AppLocalizations appLocalizations) => appLocalizations.search; + @override + Widget getAdditionalFilter() => _ProductTypeFilter(this); + @override void search( BuildContext context, @@ -71,6 +79,7 @@ class SearchProductHelper extends SearchHelper { final FetchedProduct fetchedProduct = await productDialogHelper.openBestChoice(); if (fetchedProduct.status == FetchedProductStatus.ok) { + // TODO(monsieurtanuki): add OxF to Matomo data? AnalyticsHelper.trackSearch( search: value, searchCategory: 'barcode', @@ -95,7 +104,6 @@ class SearchProductHelper extends SearchHelper { } } -// used to be in now defunct `ChoosePage` Future _onSubmittedText( final String value, final BuildContext context, @@ -107,7 +115,10 @@ class SearchProductHelper extends SearchHelper { widget: await ProductQueryPageHelper.getBestChoiceWidget( name: value, localDatabase: localDatabase, - productQuery: KeywordsProductQuery(value), + productQuery: KeywordsProductQuery( + value, + productType: _productType, + ), context: context, editableAppBarTitle: false, ), @@ -115,3 +126,36 @@ class SearchProductHelper extends SearchHelper { ); } } + +class _ProductTypeFilter extends StatefulWidget { + const _ProductTypeFilter(this.searchProductHelper); + + final SearchProductHelper searchProductHelper; + + @override + State<_ProductTypeFilter> createState() => _ProductTypeFilterState(); +} + +class _ProductTypeFilterState extends State<_ProductTypeFilter> { + @override + Widget build(BuildContext context) { + final AppLocalizations appLocalizations = AppLocalizations.of(context); + final List> segments = + >[]; + for (final ProductType productType in ProductType.values) { + segments.add( + ButtonSegment( + value: productType, + label: Text(productType.getLabel(appLocalizations)), + ), + ); + } + return SegmentedButton( + segments: segments, + selected: {widget.searchProductHelper._productType}, + onSelectionChanged: (Set newSelection) => setState( + () => widget.searchProductHelper._productType = newSelection.first, + ), + ); + } +} diff --git a/packages/smooth_app/lib/pages/text_field_helper.dart b/packages/smooth_app/lib/pages/text_field_helper.dart index d297ed9662a..f0ab08310bd 100644 --- a/packages/smooth_app/lib/pages/text_field_helper.dart +++ b/packages/smooth_app/lib/pages/text_field_helper.dart @@ -3,10 +3,9 @@ import 'package:flutter/material.dart'; /// A [TextEditingController] that saves the value passed to the constructor /// and persists the previous value. class TextEditingControllerWithHistory extends TextEditingController { - TextEditingControllerWithHistory({String? text}) + TextEditingControllerWithHistory({super.text}) : _initialValue = text, - _previousValue = text, - super(text: text); + _previousValue = text; final String? _initialValue; String? _previousValue; 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 57ef4ab196f..3d5b01c70ef 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 @@ -442,8 +442,7 @@ class _TermsOfUseCheckbox extends StatelessWidget { required this.disagree, required this.onCheckboxChanged, required this.checkboxColorResolver, - Key? key, - }) : super(key: key); + }); final bool agree; final bool disagree; diff --git a/packages/smooth_app/lib/query/category_product_query.dart b/packages/smooth_app/lib/query/category_product_query.dart index 9b11249bfbe..9b996d42f84 100644 --- a/packages/smooth_app/lib/query/category_product_query.dart +++ b/packages/smooth_app/lib/query/category_product_query.dart @@ -5,7 +5,11 @@ import 'package:smooth_app/query/paged_search_product_query.dart'; /// Back-end query about a category. class CategoryProductQuery extends PagedSearchProductQuery { - CategoryProductQuery(this.categoryTag, {super.world}); + CategoryProductQuery( + this.categoryTag, { + required super.productType, + super.world, + }); // e.g. 'en:unsweetened-natural-soy-milks' final String categoryTag; @@ -24,6 +28,7 @@ class CategoryProductQuery extends PagedSearchProductQuery { pageNumber: pageNumber, language: language, country: country, + productType: productType, ); @override @@ -33,11 +38,17 @@ class CategoryProductQuery extends PagedSearchProductQuery { ', $pageNumber' ', $language' ', $country' + ', $productType' ')'; @override - PagedProductQuery? getWorldQuery() => - world ? null : CategoryProductQuery(categoryTag, world: true); + PagedProductQuery? getWorldQuery() => world + ? null + : CategoryProductQuery( + categoryTag, + world: true, + productType: productType, + ); @override bool hasDifferentCountryWorldData() => true; diff --git a/packages/smooth_app/lib/query/keywords_product_query.dart b/packages/smooth_app/lib/query/keywords_product_query.dart index 1fae1e7e867..d2cde92f448 100644 --- a/packages/smooth_app/lib/query/keywords_product_query.dart +++ b/packages/smooth_app/lib/query/keywords_product_query.dart @@ -5,7 +5,11 @@ import 'package:smooth_app/query/paged_search_product_query.dart'; /// Back-end query around user-entered keywords. class KeywordsProductQuery extends PagedSearchProductQuery { - KeywordsProductQuery(this.keywords, {super.world}); + KeywordsProductQuery( + this.keywords, { + required super.productType, + super.world, + }); final String keywords; @@ -19,6 +23,7 @@ class KeywordsProductQuery extends PagedSearchProductQuery { pageNumber: pageNumber, language: language, country: country, + productType: productType, ); @override @@ -28,11 +33,17 @@ class KeywordsProductQuery extends PagedSearchProductQuery { ', $pageNumber' ', $language' ', $country' + ', $productType' ')'; @override - PagedProductQuery? getWorldQuery() => - world ? null : KeywordsProductQuery(keywords, world: true); + PagedProductQuery? getWorldQuery() => world + ? null + : 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 4ef51cd4abc..978a588f7ee 100644 --- a/packages/smooth_app/lib/query/paged_product_query.dart +++ b/packages/smooth_app/lib/query/paged_product_query.dart @@ -4,8 +4,12 @@ import 'package:smooth_app/query/product_query.dart'; /// Paged product query (with [pageSize] and [pageNumber]). abstract class PagedProductQuery { - PagedProductQuery({this.world = false}); + PagedProductQuery({ + required this.productType, + this.world = false, + }); + final ProductType productType; final int pageSize = _typicalPageSize; /// Likely to change: to next page, and back to top. @@ -38,7 +42,7 @@ abstract class PagedProductQuery { OpenFoodAPIClient.searchProducts( ProductQuery.getReadUser(), getQueryConfiguration(), - uriHelper: ProductQuery.getUriProductHelper(), + uriHelper: ProductQuery.getUriProductHelper(productType: productType), ); AbstractQueryConfiguration getQueryConfiguration(); 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 d983c32997f..b4973bd752a 100644 --- a/packages/smooth_app/lib/query/paged_search_product_query.dart +++ b/packages/smooth_app/lib/query/paged_search_product_query.dart @@ -4,7 +4,10 @@ import 'package:smooth_app/query/product_query.dart'; /// Back-end paged queries around search. abstract class PagedSearchProductQuery extends PagedProductQuery { - PagedSearchProductQuery({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 574b519abea..8115feeed31 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,7 +5,10 @@ import 'package:smooth_app/query/product_query.dart'; /// Back-end paged query for all "to-be-completed" products. class PagedToBeCompletedProductQuery extends PagedProductQuery { - PagedToBeCompletedProductQuery({super.world}); + PagedToBeCompletedProductQuery({ + required super.productType, + super.world, + }); @override AbstractQueryConfiguration getQueryConfiguration() => @@ -32,6 +35,7 @@ class PagedToBeCompletedProductQuery extends PagedProductQuery { pageNumber: pageNumber, language: language, country: country, + productType: productType, ); @override @@ -40,11 +44,16 @@ class PagedToBeCompletedProductQuery extends PagedProductQuery { ', $pageNumber' ', $language' ', $country' + ', $productType' ')'; @override - PagedProductQuery? getWorldQuery() => - world ? null : PagedToBeCompletedProductQuery(world: true); + PagedProductQuery? getWorldQuery() => world + ? null + : 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 fe9e22b0bf0..7d4e48b107b 100644 --- a/packages/smooth_app/lib/query/paged_user_product_query.dart +++ b/packages/smooth_app/lib/query/paged_user_product_query.dart @@ -55,6 +55,7 @@ class PagedUserProductQuery extends PagedProductQuery { PagedUserProductQuery({ required this.userId, required this.type, + required super.productType, }); final String userId; @@ -78,6 +79,7 @@ class PagedUserProductQuery extends PagedProductQuery { pageSize: pageSize, pageNumber: pageNumber, language: language, + productType: productType, ); case UserSearchType.INFORMER: return ProductList.informer( @@ -85,6 +87,7 @@ class PagedUserProductQuery extends PagedProductQuery { pageSize: pageSize, pageNumber: pageNumber, language: language, + productType: productType, ); case UserSearchType.PHOTOGRAPHER: return ProductList.photographer( @@ -92,6 +95,7 @@ class PagedUserProductQuery extends PagedProductQuery { pageSize: pageSize, pageNumber: pageNumber, language: language, + productType: productType, ); case UserSearchType.TO_BE_COMPLETED: return ProductList.toBeCompleted( @@ -99,6 +103,7 @@ class PagedUserProductQuery extends PagedProductQuery { pageSize: pageSize, pageNumber: pageNumber, language: language, + productType: productType, ); } } @@ -110,5 +115,6 @@ class PagedUserProductQuery extends PagedProductQuery { ', $pageSize' ', $pageNumber' ', $language' + ', $productType' ')'; } diff --git a/packages/smooth_app/lib/query/product_query.dart b/packages/smooth_app/lib/query/product_query.dart index a9046bd1011..af0902ec1e6 100644 --- a/packages/smooth_app/lib/query/product_query.dart +++ b/packages/smooth_app/lib/query/product_query.dart @@ -1,6 +1,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:openfoodfacts/openfoodfacts.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:smooth_app/data_models/preferences/user_preferences.dart'; @@ -299,4 +300,7 @@ extension ProductTypeExtension on ProductType { ProductType.petFood => 'openpetfoodfacts', ProductType.product => 'openproductsfacts', }; + + // TODO(monsieurtanuki): localize with very short names, or use icons instead + String getLabel(final AppLocalizations appLocalizations) => name; } 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 67612adc73b..bbfe6507299 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 @@ -3,15 +3,14 @@ import 'dart:io'; import 'package:fimber/fimber.dart'; import 'package:intl/intl.dart'; import 'package:smooth_app/services/logs/fimber/trees/base_fimber_tree.dart'; -import 'package:smooth_app/services/logs/smooth_log_levels.dart'; /// Single file fimber implementation /// When the maxDataSize is reached, half of the content is removed class FileFimberTree extends BaseFimberTree { FileFimberTree({ - required List logLevels, + required super.logLevels, required this.outputFile, - }) : super(logLevels: logLevels) { + }) { outputFile.createSync(); } 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 cd8c3cce293..99256d0fe34 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 @@ -1,13 +1,12 @@ import 'package:fimber/fimber.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; import 'package:smooth_app/services/logs/fimber/trees/base_fimber_tree.dart'; -import 'package:smooth_app/services/logs/smooth_log_levels.dart'; /// Custom Fimber [LogTree] that send logs to Sentry class SentryFimberTree extends BaseFimberTree { SentryFimberTree({ - required List logLevels, - }) : super(logLevels: logLevels); + required super.logLevels, + }); @override void log( 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 904e44cb7c3..64d2f6ddb5c 100644 --- a/packages/smooth_app/lib/services/logs/smooth_logs_service.dart +++ b/packages/smooth_app/lib/services/logs/smooth_logs_service.dart @@ -1,8 +1,9 @@ -/// Please use this file for import statements, as it allows to easily change -/// the logging solution import 'package:smooth_app/services/logs/smooth_log_levels.dart'; import 'package:smooth_app/services/smooth_service.dart'; +/// Please use this file for import statements, as it allows to easily change +/// the logging solution + class LogsService extends SmoothService { LogsService() : super(); diff --git a/packages/smooth_app/lib/widgets/smooth_app_bar.dart b/packages/smooth_app/lib/widgets/smooth_app_bar.dart index c63aabb0a0e..a08bc81e44b 100644 --- a/packages/smooth_app/lib/widgets/smooth_app_bar.dart +++ b/packages/smooth_app/lib/widgets/smooth_app_bar.dart @@ -41,11 +41,10 @@ class SmoothAppBar extends StatelessWidget implements PreferredSizeWidget { this.actionModeCloseTooltip, this.onLeaveActionMode, this.ignoreSemanticsForSubtitle = false, - Key? key, + super.key, }) : assert(!actionMode || actionModeTitle != null), preferredSize = - _PreferredAppBarSize(toolbarHeight, bottom?.preferredSize.height), - super(key: key); + _PreferredAppBarSize(toolbarHeight, bottom?.preferredSize.height); final Widget? leading; final bool automaticallyImplyLeading; @@ -234,8 +233,7 @@ class _AppBarTitle extends StatelessWidget { required this.title, required this.subTitle, this.ignoreSemanticsForSubtitle, - Key? key, - }) : super(key: key); + }); final Widget title; final Widget? subTitle; diff --git a/packages/smooth_app/lib/widgets/smooth_scaffold.dart b/packages/smooth_app/lib/widgets/smooth_scaffold.dart index 9dff0baf264..6fc2ff67060 100644 --- a/packages/smooth_app/lib/widgets/smooth_scaffold.dart +++ b/packages/smooth_app/lib/widgets/smooth_scaffold.dart @@ -185,10 +185,10 @@ class SmoothScaffoldState extends ScaffoldState { /// a [SmoothScaffold]. class SmoothBrightnessOverride extends InheritedWidget { const SmoothBrightnessOverride({ - required Widget child, - Key? key, + required super.child, + super.key, this.brightness, - }) : super(key: key, child: child); + }); final Brightness? brightness; diff --git a/packages/smooth_app/lib/widgets/widget_height.dart b/packages/smooth_app/lib/widgets/widget_height.dart index 68a9924d712..72f301ecf28 100644 --- a/packages/smooth_app/lib/widgets/widget_height.dart +++ b/packages/smooth_app/lib/widgets/widget_height.dart @@ -3,10 +3,11 @@ import 'package:flutter/widgets.dart'; class MeasureSize extends SingleChildRenderObjectWidget { const MeasureSize({ - Key? key, + super.key, required this.onChange, - required Widget child, - }) : super(key: key, child: child); + required Widget super.child, + }); + final OnWidgetSizeChange onChange; @override diff --git a/packages/smooth_app/lib/widgets/will_pop_scope.dart b/packages/smooth_app/lib/widgets/will_pop_scope.dart index d7ce206d70e..c50a8856d5c 100644 --- a/packages/smooth_app/lib/widgets/will_pop_scope.dart +++ b/packages/smooth_app/lib/widgets/will_pop_scope.dart @@ -19,7 +19,7 @@ class WillPopScope2 extends StatelessWidget { Widget build(BuildContext context) { return PopScope( canPop: false, - onPopInvoked: (bool didPop) async { + onPopInvokedWithResult: (bool didPop, dynamic result) async { if (didPop) { return; } diff --git a/packages/smooth_app/macos/Podfile.lock b/packages/smooth_app/macos/Podfile.lock new file mode 100644 index 00000000000..836d5fd5893 --- /dev/null +++ b/packages/smooth_app/macos/Podfile.lock @@ -0,0 +1,127 @@ +PODS: + - audioplayers_darwin (0.0.1): + - FlutterMacOS + - connectivity_plus (0.0.1): + - FlutterMacOS + - ReachabilitySwift + - device_info_plus (0.0.1): + - FlutterMacOS + - file_selector_macos (0.0.1): + - FlutterMacOS + - flutter_image_compress_macos (1.0.0): + - FlutterMacOS + - flutter_secure_storage_macos (6.1.1): + - FlutterMacOS + - FlutterMacOS (1.0.0) + - in_app_review (0.2.0): + - FlutterMacOS + - mobile_scanner (3.5.6): + - FlutterMacOS + - package_info_plus (0.0.1): + - FlutterMacOS + - path_provider_foundation (0.0.1): + - Flutter + - FlutterMacOS + - ReachabilitySwift (5.2.3) + - rive_common (0.0.1): + - FlutterMacOS + - Sentry/HybridSDK (8.36.0) + - sentry_flutter (8.9.0): + - Flutter + - FlutterMacOS + - Sentry/HybridSDK (= 8.36.0) + - share_plus (0.0.1): + - FlutterMacOS + - shared_preferences_foundation (0.0.1): + - Flutter + - FlutterMacOS + - sqflite (0.0.3): + - Flutter + - FlutterMacOS + - url_launcher_macos (0.0.1): + - FlutterMacOS + +DEPENDENCIES: + - audioplayers_darwin (from `Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos`) + - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) + - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) + - file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`) + - flutter_image_compress_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos`) + - flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`) + - FlutterMacOS (from `Flutter/ephemeral`) + - in_app_review (from `Flutter/ephemeral/.symlinks/plugins/in_app_review/macos`) + - mobile_scanner (from `Flutter/ephemeral/.symlinks/plugins/mobile_scanner/macos`) + - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) + - rive_common (from `Flutter/ephemeral/.symlinks/plugins/rive_common/macos`) + - sentry_flutter (from `Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos`) + - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) + - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) + - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/darwin`) + - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) + +SPEC REPOS: + trunk: + - ReachabilitySwift + - Sentry + +EXTERNAL SOURCES: + audioplayers_darwin: + :path: Flutter/ephemeral/.symlinks/plugins/audioplayers_darwin/macos + connectivity_plus: + :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos + device_info_plus: + :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos + file_selector_macos: + :path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos + flutter_image_compress_macos: + :path: Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos + flutter_secure_storage_macos: + :path: Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos + FlutterMacOS: + :path: Flutter/ephemeral + in_app_review: + :path: Flutter/ephemeral/.symlinks/plugins/in_app_review/macos + mobile_scanner: + :path: Flutter/ephemeral/.symlinks/plugins/mobile_scanner/macos + package_info_plus: + :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos + path_provider_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin + rive_common: + :path: Flutter/ephemeral/.symlinks/plugins/rive_common/macos + sentry_flutter: + :path: Flutter/ephemeral/.symlinks/plugins/sentry_flutter/macos + share_plus: + :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos + shared_preferences_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin + sqflite: + :path: Flutter/ephemeral/.symlinks/plugins/sqflite/darwin + url_launcher_macos: + :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos + +SPEC CHECKSUMS: + audioplayers_darwin: dcad41de4fbd0099cb3749f7ab3b0cb8f70b810c + connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747 + device_info_plus: ce1b7762849d3ec103d0e0517299f2db7ad60720 + file_selector_macos: 54fdab7caa3ac3fc43c9fac4d7d8d231277f8cf2 + flutter_image_compress_macos: c26c3c13ea0f28ae6dea4e139b3292e7729f99f1 + flutter_secure_storage_macos: 59459653abe1adb92abbc8ea747d79f8d19866c9 + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 + in_app_review: a850789fad746e89bce03d4aeee8078b45a53fd0 + mobile_scanner: 54ceceae0c8da2457e26a362a6be5c61154b1829 + package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c + path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 + ReachabilitySwift: 7f151ff156cea1481a8411701195ac6a984f4979 + rive_common: cf5ab646aa576b2d742d0e2d528126fbf032c856 + Sentry: f8374b5415bc38dfb5645941b3ae31230fbeae57 + sentry_flutter: 0eb93e5279eb41e2392212afe1ccd2fecb4f8cbe + share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf + shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 + sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec + url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399 + +PODFILE CHECKSUM: 0d3963a09fc94f580682bd88480486da345dc3f0 + +COCOAPODS: 1.14.3 diff --git a/packages/smooth_app/macos/Runner/AppDelegate.swift b/packages/smooth_app/macos/Runner/AppDelegate.swift index d53ef643772..8e02df28883 100644 --- a/packages/smooth_app/macos/Runner/AppDelegate.swift +++ b/packages/smooth_app/macos/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import Cocoa import FlutterMacOS -@NSApplicationMain +@main class AppDelegate: FlutterAppDelegate { override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { return true diff --git a/packages/smooth_app/pubspec.lock b/packages/smooth_app/pubspec.lock index 6b5df999ee7..f167490e81c 100644 --- a/packages/smooth_app/pubspec.lock +++ b/packages/smooth_app/pubspec.lock @@ -635,10 +635,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "4.0.0" flutter_localizations: dependency: "direct main" description: flutter @@ -988,10 +988,10 @@ packages: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "4.0.0" lists: dependency: transitive description: @@ -1109,7 +1109,7 @@ packages: description: path: "." ref: HEAD - resolved-ref: e91bc71bccc317948dc769b8c5d55052d949ec2e + resolved-ref: "151205f097aad11e78d56c4735aef44157c04f34" url: "https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git" source: git version: "1.0.0" @@ -1852,5 +1852,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.4.0 <4.0.0" + dart: ">=3.5.3 <4.0.0" flutter: ">=3.22.0" diff --git a/packages/smooth_app/pubspec.yaml b/packages/smooth_app/pubspec.yaml index 4c911fd3a67..f0be63d82f9 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.4.0 <4.0.0' + sdk: ^3.5.3 dependencies: flutter: @@ -114,7 +114,7 @@ dev_dependencies: mockito: 5.4.4 path_provider_platform_interface: 2.1.2 plugin_platform_interface: 2.1.8 - flutter_lints: 2.0.3 + flutter_lints: 4.0.0 openfoodfacts_flutter_lints: git: https://github.com/openfoodfacts/openfoodfacts_flutter_lints.git 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 98ae1a8eee4..473dbe17b36 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 @@ -5,9 +5,8 @@ import 'package:smooth_app/widgets/smooth_scaffold.dart'; class _SwitchablePage extends StatefulWidget { const _SwitchablePage({ - Key? key, this.delay = 0, - }) : super(key: key); + }); final int delay; 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 86b985e6378..d20fbab3200 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,9 +6,10 @@ import 'package:smooth_app/generic_lib/dialogs/smooth_category_picker.dart'; import 'package:smooth_app/widgets/smooth_scaffold.dart'; class TestCategory extends SmoothCategory { - TestCategory(String value, [Iterable? children]) - : children = children?.toSet() ?? const {}, - super(value); + TestCategory( + super.value, [ + Iterable? children, + ]) : children = children?.toSet() ?? const {}; Set children; diff --git a/packages/smooth_app/windows/flutter/generated_plugin_registrant.cc b/packages/smooth_app/windows/flutter/generated_plugin_registrant.cc index a871a1bf3bd..c67ac76fbe2 100644 --- a/packages/smooth_app/windows/flutter/generated_plugin_registrant.cc +++ b/packages/smooth_app/windows/flutter/generated_plugin_registrant.cc @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -29,8 +28,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); RivePluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("RivePlugin")); - SentryFlutterPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("SentryFlutterPlugin")); SharePlusWindowsPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); UrlLauncherWindowsRegisterWithRegistrar( diff --git a/packages/smooth_app/windows/flutter/generated_plugins.cmake b/packages/smooth_app/windows/flutter/generated_plugins.cmake index ff0af32c54e..b7d63f3af8a 100644 --- a/packages/smooth_app/windows/flutter/generated_plugins.cmake +++ b/packages/smooth_app/windows/flutter/generated_plugins.cmake @@ -9,12 +9,12 @@ list(APPEND FLUTTER_PLUGIN_LIST flutter_secure_storage_windows permission_handler_windows rive_common - sentry_flutter share_plus url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST + sentry_flutter ) set(PLUGIN_BUNDLED_LIBRARIES)