File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -509,16 +509,22 @@ class UserPreferences extends ChangeNotifier {
509509 ///
510510 /// This checks both attribute importances (i.e., attributes set to a value
511511 /// other than "not important") and unwanted ingredients.
512+ ///
513+ /// The method filters the SharedPreferences key space by the project-specific
514+ /// prefix and exits as soon as one configured preference is found.
512515 bool hasAnyPreferencesForProject (final String projectKey) {
513516 final String prefix = '${_TAG_PREFIX_IMPORTANCE }${projectKey }_' ;
514- for (final String key in _sharedPreferences.getKeys ()) {
515- if (key.startsWith (prefix)) {
516- final String ? value = _sharedPreferences.getString (key);
517- if (value != null &&
518- value != PreferenceImportance .ID_NOT_IMPORTANT ) {
519- return true ;
517+ final bool hasConfiguredAttribute = _sharedPreferences.getKeys ().any (
518+ (String key) {
519+ if (! key.startsWith (prefix)) {
520+ return false ;
520521 }
521- }
522+ final String ? value = _sharedPreferences.getString (key);
523+ return value != null && value != PreferenceImportance .ID_NOT_IMPORTANT ;
524+ },
525+ );
526+ if (hasConfiguredAttribute) {
527+ return true ;
522528 }
523529 return getUnwantedIngredientsForProject (projectKey).isNotEmpty;
524530 }
Original file line number Diff line number Diff line change @@ -292,6 +292,7 @@ class _FoodPreferencesPageState extends State<FoodPreferencesPage> {
292292 ? Colors .white.withValues (alpha: 0.3 )
293293 : lightTheme
294294 ? extension .primaryLight
295+ // Semi-transparent track so the dark header shows through
295296 : extension .primarySemiDark.withValues (alpha: 0.5 ),
296297 currentValue: _controller.progress,
297298 maxValue: 1 ,
You can’t perform that action at this time.
0 commit comments