2023-09-02 08:32:08 +00:00
|
|
|
enum MeteringScreenLayoutFeature {
|
2023-11-11 20:05:11 +00:00
|
|
|
extremeExposurePairs, // 0
|
|
|
|
filmPicker, // 1
|
|
|
|
equipmentProfiles, // 3
|
2023-09-02 08:32:08 +00:00
|
|
|
}
|
2023-04-05 19:15:11 +00:00
|
|
|
|
|
|
|
typedef MeteringScreenLayoutConfig = Map<MeteringScreenLayoutFeature, bool>;
|
|
|
|
|
|
|
|
extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig {
|
2023-11-11 20:05:11 +00:00
|
|
|
static MeteringScreenLayoutConfig fromJson(Map<String, dynamic> data) {
|
|
|
|
int? migratedIndex(MeteringScreenLayoutFeature feature) {
|
|
|
|
switch (feature) {
|
|
|
|
case MeteringScreenLayoutFeature.extremeExposurePairs:
|
|
|
|
return 0;
|
|
|
|
case MeteringScreenLayoutFeature.filmPicker:
|
|
|
|
return 1;
|
|
|
|
case MeteringScreenLayoutFeature.equipmentProfiles:
|
|
|
|
return 3;
|
|
|
|
default:
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
2023-04-05 19:15:11 +00:00
|
|
|
|
2023-11-11 20:05:11 +00:00
|
|
|
return <MeteringScreenLayoutFeature, bool>{
|
|
|
|
for (final f in MeteringScreenLayoutFeature.values)
|
|
|
|
f: (data[migratedIndex(f).toString()] ?? data[f.name]) as bool? ?? true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => map((key, value) => MapEntry(key.name, value));
|
2023-04-05 19:15:11 +00:00
|
|
|
}
|