fixed dependencies

This commit is contained in:
Vadim 2023-04-05 22:08:13 +03:00
parent 34aceb9411
commit eb57a08874
4 changed files with 24 additions and 23 deletions

View file

@ -37,15 +37,15 @@ class UserPreferencesService {
Future<void> _migrateOldKeys() async {
final legacyIsoIndex = _sharedPreferences.getInt("curIsoIndex");
if (legacyIsoIndex != null) {
iso = isoValues[legacyIsoIndex];
iso = IsoValue.values[legacyIsoIndex];
await _sharedPreferences.remove("curIsoIndex");
}
final legacyNdIndex = _sharedPreferences.getInt("curndIndex");
if (legacyNdIndex != null) {
/// Legacy ND list has 1 extra value at the end, so this check is needed
if (legacyNdIndex < ndValues.length) {
ndFilter = ndValues[legacyNdIndex];
if (legacyNdIndex < NdValue.values.length) {
ndFilter = NdValue.values[legacyNdIndex];
}
await _sharedPreferences.remove("curndIndex");
}
@ -70,11 +70,11 @@ class UserPreferencesService {
}
IsoValue get iso =>
isoValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100));
IsoValue.values.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100));
set iso(IsoValue value) => _sharedPreferences.setInt(_isoKey, value.value);
NdValue get ndFilter =>
ndValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_ndFilterKey) ?? 0));
NdValue.values.firstWhere((v) => v.value == (_sharedPreferences.getInt(_ndFilterKey) ?? 0));
set ndFilter(NdValue value) => _sharedPreferences.setInt(_ndFilterKey, value.value);
EvSourceType get evSourceType =>
@ -95,6 +95,7 @@ class UserPreferencesService {
};
}
}
set meteringScreenLayout(MeteringScreenLayoutConfig value) =>
_sharedPreferences.setString(_meteringScreenLayoutKey, json.encode(value.toJson()));

View file

@ -21,10 +21,10 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
static const EquipmentProfileData _defaultProfile = EquipmentProfileData(
id: '',
name: '',
apertureValues: apertureValues,
ndValues: ndValues,
shutterSpeedValues: shutterSpeedValues,
isoValues: isoValues,
apertureValues: ApertureValue.values,
ndValues: NdValue.values,
shutterSpeedValues: ShutterSpeedValue.values,
isoValues: IsoValue.values,
);
List<EquipmentProfileData> _customProfiles = [];
@ -68,10 +68,10 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
_customProfiles.add(EquipmentProfileData(
id: const Uuid().v1(),
name: name,
apertureValues: apertureValues,
ndValues: ndValues,
shutterSpeedValues: shutterSpeedValues,
isoValues: isoValues,
apertureValues: ApertureValue.values,
ndValues: NdValue.values,
shutterSpeedValues: ShutterSpeedValue.values,
isoValues: IsoValue.values,
));
_refreshSavedProfiles();
}

View file

@ -106,7 +106,7 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
void _onFilmChanged(FilmChangedEvent event, Emitter emit) {
if (_iso.value != event.data.iso) {
final newIso = isoValues.firstWhere(
final newIso = IsoValue.values.firstWhere(
(e) => e.value == event.data.iso,
orElse: () => _iso,
);
@ -175,7 +175,7 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
const ShutterSpeedValue anchorShutterSpeed = ShutterSpeedValue(1, false, StopType.full);
int anchorIndex = _shutterSpeedValues.indexOf(anchorShutterSpeed);
if (anchorIndex < 0) {
final filteredFullList = shutterSpeedValues.whereStopType(stopType);
final filteredFullList = ShutterSpeedValue.values.whereStopType(stopType);
final customListStartIndex = filteredFullList.indexOf(_shutterSpeedValues.first);
final fullListAnchor = filteredFullList.indexOf(anchorShutterSpeed);
if (customListStartIndex < fullListAnchor) {

View file

@ -35,8 +35,8 @@ class EquipmentListTiles extends StatelessWidget {
icon: Icons.iso,
title: S.of(context).isoValues,
description: S.of(context).isoValuesFilterDescription,
values: isoValues,
valuesCount: selectedIsoValues.length == isoValues.length
values: IsoValue.values,
valuesCount: selectedIsoValues.length == IsoValue.values.length
? S.of(context).equipmentProfileAllValues
: selectedIsoValues.length.toString(),
selectedValues: selectedIsoValues,
@ -47,8 +47,8 @@ class EquipmentListTiles extends StatelessWidget {
icon: Icons.filter_b_and_w,
title: S.of(context).ndFilters,
description: S.of(context).ndFiltersFilterDescription,
values: ndValues,
valuesCount: selectedNdValues.length == ndValues.length
values: NdValue.values,
valuesCount: selectedNdValues.length == NdValue.values.length
? S.of(context).equipmentProfileAllValues
: selectedNdValues.length.toString(),
selectedValues: selectedNdValues,
@ -59,8 +59,8 @@ class EquipmentListTiles extends StatelessWidget {
icon: Icons.camera,
title: S.of(context).apertureValues,
description: S.of(context).apertureValuesFilterDescription,
values: apertureValues,
valuesCount: selectedApertureValues.length == apertureValues.length
values: ApertureValue.values,
valuesCount: selectedApertureValues.length == ApertureValue.values.length
? S.of(context).equipmentProfileAllValues
: selectedApertureValues.length.toString(),
selectedValues: selectedApertureValues,
@ -71,8 +71,8 @@ class EquipmentListTiles extends StatelessWidget {
icon: Icons.shutter_speed,
title: S.of(context).shutterSpeedValues,
description: S.of(context).shutterSpeedValuesFilterDescription,
values: shutterSpeedValues,
valuesCount: selectedShutterSpeedValues.length == shutterSpeedValues.length
values: ShutterSpeedValue.values,
valuesCount: selectedShutterSpeedValues.length == ShutterSpeedValue.values.length
? S.of(context).equipmentProfileAllValues
: selectedShutterSpeedValues.length.toString(),
selectedValues: selectedShutterSpeedValues,