Skip to content

Commit

Permalink
chore: off-dart 2.3.1 and its new sorted suggestions (#3717)
Browse files Browse the repository at this point in the history
* Revert "feat: 3585 - upgrade to flutter 3.7 (#3666)"

This reverts commit ad46236.

* chore: off-dart 2.3.1 and its new sorted suggestions

Deleted file:
* `tmp_matched_product_v2.dart`: now in off-dart

Impacted files:
* `personalized_ranking_model.dart`: removed reference to now deleted file `tmp_matched_product_v2.dart`
* `personalized_ranking_page.dart`: removed reference to now deleted file `tmp_matched_product_v2.dart`
* `Podfile.lock`: wtf
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded off-dart to 2.3.1
* `simple_input_text_field.dart`: now using the new `getSuggestions` method that sorts the result
  • Loading branch information
monsieurtanuki committed Feb 21, 2023
1 parent 87ac56d commit e5bf964
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:smooth_app/data_models/product_preferences.dart';
import 'package:smooth_app/database/dao_product.dart';
import 'package:smooth_app/database/local_database.dart';
import 'package:smooth_app/pages/tmp_matched_product_v2.dart';

enum LoadingStatus {
LOADING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:smooth_app/generic_lib/duration_constants.dart';
import 'package:smooth_app/helpers/product_compatibility_helper.dart';
import 'package:smooth_app/pages/product/common/product_list_item_simple.dart';
import 'package:smooth_app/pages/product_list_user_dialog_helper.dart';
import 'package:smooth_app/pages/tmp_matched_product_v2.dart';
import 'package:smooth_app/widgets/smooth_scaffold.dart';

class PersonalizedRankingPage extends StatefulWidget {
Expand Down
14 changes: 3 additions & 11 deletions packages/smooth_app/lib/pages/product/simple_input_text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,22 @@ class SimpleInputTextField extends StatelessWidget {
focusNode: focusNode,
textEditingController: controller,
optionsBuilder: (final TextEditingValue value) async {
final List<String> result = <String>[];
final String input = value.text.trim();

if (input.isEmpty) {
return result;
return <String>[];
}

if (tagType == null) {
return result;
return <String>[];
}

// TODO(monsieurtanuki): ask off-dart to return Strings instead of dynamic?
final List<dynamic> data =
await OpenFoodAPIClient.getAutocompletedSuggestions(
return OpenFoodAPIClient.getSuggestions(
tagType!,
language: ProductQuery.getLanguage()!,
limit: 1000000, // lower max count on the server anyway
input: value.text.trim(),
);
for (final dynamic item in data) {
result.add(item.toString());
}
result.sort();
return result;
},
fieldViewBuilder: (BuildContext context,
TextEditingController textEditingController,
Expand Down
153 changes: 0 additions & 153 deletions packages/smooth_app/lib/pages/tmp_matched_product_v2.dart

This file was deleted.

2 changes: 1 addition & 1 deletion packages/smooth_app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ packages:
name: openfoodfacts
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
version: "2.3.1"
openfoodfacts_flutter_lints:
dependency: "direct dev"
description:
Expand Down
2 changes: 1 addition & 1 deletion packages/smooth_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies:
latlong2: 0.8.1
matomo_tracker: 1.5.0
modal_bottom_sheet: 2.1.2
openfoodfacts: 2.2.1
openfoodfacts: 2.3.1
# openfoodfacts:
# path: ../../../openfoodfacts-dart
package_info_plus: 1.4.3+1
Expand Down

0 comments on commit e5bf964

Please sign in to comment.