Operator profiles as list. Add simon property group.

This commit is contained in:
stopflock
2025-10-24 17:11:43 -05:00
parent 618d31d016
commit f1f145a35f
3 changed files with 44 additions and 42 deletions
+36 -18
View File
@@ -13,27 +13,45 @@ class OperatorProfile {
required this.tags,
});
/// Get all built-in default operator profiles
static List<OperatorProfile> getDefaults() => [
OperatorProfile(
id: 'builtin-lowes',
name: "Lowe's",
tags: const {
'operator': "Lowe's",
'operator:wikidata': 'Q1373493',
'operator:type': 'private',
},
),
OperatorProfile(
id: 'builtin-home-depot',
name: 'The Home Depot',
tags: const {
'operator': 'The Home Depot',
'operator:wikidata': 'Q864407',
'operator:type': 'private',
},
),
OperatorProfile(
id: 'builtin-simon-property-group',
name: 'Simon Property Group',
tags: const {
'operator': 'Simon Property Group',
'operator:wikidata': 'Q2287759',
'operator:type': 'private',
},
),
];
/// Built-in default: Lowe's operator profile
factory OperatorProfile.lowes() => OperatorProfile(
id: 'builtin-lowes',
name: "Lowe's",
tags: const {
'operator': "Lowe's",
'operator:wikidata': 'Q1373493',
'operator:type': 'private',
},
);
factory OperatorProfile.lowes() => getDefaults()[0];
/// Built-in default: The Home Depot operator profile
factory OperatorProfile.homeDepot() => OperatorProfile(
id: 'builtin-home-depot',
name: 'The Home Depot',
tags: const {
'operator': 'The Home Depot',
'operator:wikidata': 'Q864407',
'operator:type': 'private',
},
);
factory OperatorProfile.homeDepot() => getDefaults()[1];
/// Built-in default: Simon Property Group operator profile
factory OperatorProfile.simonPropertyGroup() => getDefaults()[2];
OperatorProfile copyWith({
String? id,
+1 -6
View File
@@ -13,12 +13,7 @@ class OperatorProfileState extends ChangeNotifier {
// Add default operator profiles if this is first launch
if (addDefaults) {
final defaults = [
OperatorProfile.lowes(),
OperatorProfile.homeDepot(),
];
_profiles.addAll(defaults);
_profiles.addAll(OperatorProfile.getDefaults());
await OperatorProfileService().save(_profiles);
}
}