This commit is contained in:
Vadim 2023-05-11 15:01:21 +02:00
parent 9ef55be2df
commit 87fceee150
12 changed files with 116 additions and 96 deletions

View file

@ -40,7 +40,8 @@ class Application extends StatelessWidget {
providers: [
Provider.value(value: env.copyWith(hasLightSensor: snapshot.data![1] as bool)),
Provider(
create: (_) => UserPreferencesService(snapshot.data![0] as SharedPreferences),),
create: (_) => UserPreferencesService(snapshot.data![0] as SharedPreferences),
),
Provider(create: (_) => const CaffeineService()),
Provider(create: (_) => const HapticsService()),
Provider(create: (_) => PermissionsService()),

View file

@ -4,7 +4,8 @@ typedef MeteringScreenLayoutConfig = Map<MeteringScreenLayoutFeature, bool>;
extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig {
static MeteringScreenLayoutConfig fromJson(Map<String, dynamic> data) => data.map(
(key, value) => MapEntry(MeteringScreenLayoutFeature.values[int.parse(key)], value as bool),);
(key, value) => MapEntry(MeteringScreenLayoutFeature.values[int.parse(key)], value as bool),
);
Map<String, dynamic> toJson() => map((key, value) => MapEntry(key.index.toString(), value));
}

View file

@ -29,4 +29,3 @@ extension SupportedLocaleExtension on SupportedLocale {
}
}
}

View file

@ -65,14 +65,16 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
/// Creates a default equipment profile
void addProfile(String name) {
_customProfiles.add(EquipmentProfileData(
_customProfiles.add(
EquipmentProfileData(
id: const Uuid().v1(),
name: name,
apertureValues: ApertureValue.values,
ndValues: NdValue.values,
shutterSpeedValues: ShutterSpeedValue.values,
isoValues: IsoValue.values,
),);
),
);
_refreshSavedProfiles();
}

View file

@ -144,7 +144,8 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
void _emitMeasuredState(Emitter emit) {
final ev = _ev100 + log2(_iso.value / 100) - _nd.stopReduction;
emit(_isMeteringInProgress
emit(
_isMeteringInProgress
? MeteringInProgressState(
ev: ev,
film: _film,
@ -158,7 +159,8 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
iso: _iso,
nd: _nd,
exposurePairs: _buildExposureValues(ev),
),);
),
);
}
List<ExposurePair> _buildExposureValues(double ev) {
@ -199,8 +201,10 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
shutterSpeedOffset = 0;
}
final int itemsCount = min(_apertureValues.length + shutterSpeedOffset,
_shutterSpeedValues.length + apertureOffset,) -
final int itemsCount = min(
_apertureValues.length + shutterSpeedOffset,
_shutterSpeedValues.length + apertureOffset,
) -
max(apertureOffset, shutterSpeedOffset);
if (itemsCount < 0) {

View file

@ -41,9 +41,11 @@ class MeteringBottomControls extends StatelessWidget {
child: Center(
child: IconButton(
onPressed: onSwitchEvSourceType,
icon: Icon(context.watch<EvSourceType>() != EvSourceType.camera
icon: Icon(
context.watch<EvSourceType>() != EvSourceType.camera
? Icons.camera_rear
: Icons.wb_incandescent,),
: Icons.wb_incandescent,
),
),
),
)

View file

@ -161,13 +161,15 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
}
void _emitActiveState(Emitter emit) {
emit(CameraActiveState(
emit(
CameraActiveState(
zoomRange: _zoomRange!,
currentZoom: _currentZoom,
exposureOffsetRange: _exposureOffsetRange!,
exposureOffsetStep: _exposureStep,
currentExposureOffset: _currentExposureOffset,
),);
),
);
}
Future<double?> _takePhoto() async {

View file

@ -156,7 +156,8 @@ class _CameraControlsBuilder extends StatelessWidget {
context.read<CameraContainerBloc>().add(
state.error == CameraErrorType.permissionNotGranted
? const OpenAppSettingsEvent()
: const InitializeEvent(),);
: const InitializeEvent(),
);
},
);
} else {

View file

@ -64,25 +64,29 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
_closedOpacityAnimation = Tween<double>(
begin: 1,
end: 0,
).animate(CurvedAnimation(
).animate(
CurvedAnimation(
parent: _animationController,
curve: const Interval(
0,
0.8,
curve: Curves.ease,
),
),);
),
);
_openedOpacityAnimation = Tween<double>(
begin: 0,
end: 1,
).animate(CurvedAnimation(
).animate(
CurvedAnimation(
parent: _animationController,
curve: const Interval(
0.8,
1.0,
curve: Curves.easeInOut,
),
),);
),
);
WidgetsBinding.instance.addPostFrameCallback((_) {
final mediaQuery = MediaQuery.of(context);

View file

@ -36,7 +36,9 @@ class CalibrationDialogBloc extends Bloc<CalibrationDialogEvent, CalibrationDial
}
void _onLightSensorEvCalibrationChanged(
LightSensorEvCalibrationChangedEvent event, Emitter emit,) {
LightSensorEvCalibrationChangedEvent event,
Emitter emit,
) {
_lightSensorEvCalibration = event.value;
emit(CalibrationDialogState(_cameraEvCalibration, _lightSensorEvCalibration));
}

View file

@ -13,7 +13,8 @@ class EquipmentProfilesListTile extends StatelessWidget {
title: Text(S.of(context).equipmentProfiles),
onTap: () {
Navigator.of(context).push<EquipmentProfileData>(
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),);
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),
);
},
);
}

View file

@ -68,7 +68,8 @@ class _PrimaryColorDialogPickerState extends State<PrimaryColorDialogPicker> {
],
),
],
),),
),
),
actionsPadding: Dimens.dialogActionsPadding,
actions: [
TextButton(