added categories, import export, settings
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/// Grocery categories a product can be assigned to.
|
||||
library;
|
||||
|
||||
const List<String> kDefaultCategories = [
|
||||
'Fruit & vegetables',
|
||||
'Dairy & eggs',
|
||||
'Meat & fish',
|
||||
'Bread & bakery',
|
||||
'Pantry',
|
||||
'Drinks',
|
||||
'Frozen',
|
||||
'Snacks',
|
||||
'Household',
|
||||
'Personal care',
|
||||
];
|
||||
|
||||
List<String> mergeCategories(Iterable<String> used) {
|
||||
final seen = <String>{};
|
||||
final result = <String>[];
|
||||
for (final name in [...kDefaultCategories, ...used]) {
|
||||
final trimmed = name.trim();
|
||||
if (trimmed.isEmpty) continue;
|
||||
final key = trimmed.toLowerCase();
|
||||
if (seen.contains(key)) continue;
|
||||
seen.add(key);
|
||||
result.add(trimmed);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user