m3_lightmeter/lib/data/models/metering_screen_layout_config.dart
Vadim fb58b6cd9f
Upgrade project to the latest stable Flutter version (#201)
* fixed fvm path typo

* Update pubspec.yaml

* version control pubspec.lock

* fixed ios build

* deleted `ExpandableSectionList`

* removed redundant default cases

* avoided async gaps

* replaced deprecated color value getter

* `WillPopScope` -> `PopScope`

* removed theme deprecations

* replaced text scale deprecation

* updated goldens

* updated flutter version across workflows

* [android] migrated to the new gradle

* upgraded dependencies

* [android] fixed build

* [ios] fixed build

* updated config

* allow release notes to fail

* updated stub pubspec

* [android] use java 17

* [ios] enable flutterfire

* added firebase.json to secrets

* typo

* update color utils

* use exact versions

* reverted color utils

* updated goldens
2025-01-20 19:32:57 +01:00

29 lines
958 B
Dart

enum MeteringScreenLayoutFeature {
extremeExposurePairs, // 0
filmPicker, // 1
equipmentProfiles, // 3
}
typedef MeteringScreenLayoutConfig = Map<MeteringScreenLayoutFeature, bool>;
extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig {
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;
}
}
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));
}