Skip to content

Commit

Permalink
Language selector + ingredients text field
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Jan 9, 2025
1 parent 650d357 commit b2fa686
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class LanguageSelector extends StatelessWidget {
this.padding,
this.borderRadius,
this.product,
this.checkedIcon,
});

/// What to do when the language is selected.
Expand All @@ -37,6 +38,7 @@ class LanguageSelector extends StatelessWidget {
final Widget? icon;
final EdgeInsetsGeometry? padding;
final BorderRadius? borderRadius;
final Widget? checkedIcon;

/// Product from which we can extract the languages that matter.
final Product? product;
Expand Down Expand Up @@ -67,6 +69,7 @@ class LanguageSelector extends StatelessWidget {
context,
selectedLanguages: selectedLanguages,
languagePriority: languagePriority,
checkedIcon: checkedIcon,
);
if (language != null) {
await daoStringList.add(
Expand Down Expand Up @@ -126,6 +129,7 @@ class LanguageSelector extends StatelessWidget {
final BuildContext context, {
final Iterable<OpenFoodFactsLanguage>? selectedLanguages,
required final LanguagePriority languagePriority,
final Widget? checkedIcon,
}) async {
final ScrollController scrollController = ScrollController();
final AppLocalizations appLocalizations = AppLocalizations.of(context);
Expand Down Expand Up @@ -190,7 +194,8 @@ class LanguageSelector extends StatelessWidget {
selectedLanguages.contains(language);
return ListTile(
dense: true,
trailing: selected ? const Icon(Icons.check) : null,
trailing:
selected ? (checkedIcon ?? const Icon(Icons.check)) : null,
title: TextHighlighter(
text: _getCompleteName(language),
filter: languageSelectorController.text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class EditOCRTextField extends StatelessWidget {
),
),
),
onTapOutside: (_) =>
FocusManager.instance.primaryFocus?.unfocus(),
),
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ class _ProductImageViewerState extends State<ProductImageViewer>
displayedLanguage: widget.language,
selectedLanguages: selectedLanguages,
foregroundColor: Colors.white,
checkedIcon: const Icon(Icons.camera_alt_rounded),
padding: const EdgeInsetsDirectional.symmetric(
horizontal: 13.0,
vertical: SMALL_SPACE,
Expand Down

0 comments on commit b2fa686

Please sign in to comment.