mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
format
This commit is contained in:
parent
9ef55be2df
commit
87fceee150
12 changed files with 116 additions and 96 deletions
|
@ -40,7 +40,8 @@ class Application extends StatelessWidget {
|
||||||
providers: [
|
providers: [
|
||||||
Provider.value(value: env.copyWith(hasLightSensor: snapshot.data![1] as bool)),
|
Provider.value(value: env.copyWith(hasLightSensor: snapshot.data![1] as bool)),
|
||||||
Provider(
|
Provider(
|
||||||
create: (_) => UserPreferencesService(snapshot.data![0] as SharedPreferences),),
|
create: (_) => UserPreferencesService(snapshot.data![0] as SharedPreferences),
|
||||||
|
),
|
||||||
Provider(create: (_) => const CaffeineService()),
|
Provider(create: (_) => const CaffeineService()),
|
||||||
Provider(create: (_) => const HapticsService()),
|
Provider(create: (_) => const HapticsService()),
|
||||||
Provider(create: (_) => PermissionsService()),
|
Provider(create: (_) => PermissionsService()),
|
||||||
|
|
|
@ -4,7 +4,8 @@ typedef MeteringScreenLayoutConfig = Map<MeteringScreenLayoutFeature, bool>;
|
||||||
|
|
||||||
extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig {
|
extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig {
|
||||||
static MeteringScreenLayoutConfig fromJson(Map<String, dynamic> data) => data.map(
|
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));
|
Map<String, dynamic> toJson() => map((key, value) => MapEntry(key.index.toString(), value));
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,4 +29,3 @@ extension SupportedLocaleExtension on SupportedLocale {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,14 +65,16 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
||||||
|
|
||||||
/// Creates a default equipment profile
|
/// Creates a default equipment profile
|
||||||
void addProfile(String name) {
|
void addProfile(String name) {
|
||||||
_customProfiles.add(EquipmentProfileData(
|
_customProfiles.add(
|
||||||
|
EquipmentProfileData(
|
||||||
id: const Uuid().v1(),
|
id: const Uuid().v1(),
|
||||||
name: name,
|
name: name,
|
||||||
apertureValues: ApertureValue.values,
|
apertureValues: ApertureValue.values,
|
||||||
ndValues: NdValue.values,
|
ndValues: NdValue.values,
|
||||||
shutterSpeedValues: ShutterSpeedValue.values,
|
shutterSpeedValues: ShutterSpeedValue.values,
|
||||||
isoValues: IsoValue.values,
|
isoValues: IsoValue.values,
|
||||||
),);
|
),
|
||||||
|
);
|
||||||
_refreshSavedProfiles();
|
_refreshSavedProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,8 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
|
|
||||||
void _emitMeasuredState(Emitter emit) {
|
void _emitMeasuredState(Emitter emit) {
|
||||||
final ev = _ev100 + log2(_iso.value / 100) - _nd.stopReduction;
|
final ev = _ev100 + log2(_iso.value / 100) - _nd.stopReduction;
|
||||||
emit(_isMeteringInProgress
|
emit(
|
||||||
|
_isMeteringInProgress
|
||||||
? MeteringInProgressState(
|
? MeteringInProgressState(
|
||||||
ev: ev,
|
ev: ev,
|
||||||
film: _film,
|
film: _film,
|
||||||
|
@ -158,7 +159,8 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
iso: _iso,
|
iso: _iso,
|
||||||
nd: _nd,
|
nd: _nd,
|
||||||
exposurePairs: _buildExposureValues(ev),
|
exposurePairs: _buildExposureValues(ev),
|
||||||
),);
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ExposurePair> _buildExposureValues(double ev) {
|
List<ExposurePair> _buildExposureValues(double ev) {
|
||||||
|
@ -199,8 +201,10 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
shutterSpeedOffset = 0;
|
shutterSpeedOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int itemsCount = min(_apertureValues.length + shutterSpeedOffset,
|
final int itemsCount = min(
|
||||||
_shutterSpeedValues.length + apertureOffset,) -
|
_apertureValues.length + shutterSpeedOffset,
|
||||||
|
_shutterSpeedValues.length + apertureOffset,
|
||||||
|
) -
|
||||||
max(apertureOffset, shutterSpeedOffset);
|
max(apertureOffset, shutterSpeedOffset);
|
||||||
|
|
||||||
if (itemsCount < 0) {
|
if (itemsCount < 0) {
|
||||||
|
|
|
@ -41,9 +41,11 @@ class MeteringBottomControls extends StatelessWidget {
|
||||||
child: Center(
|
child: Center(
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
onPressed: onSwitchEvSourceType,
|
onPressed: onSwitchEvSourceType,
|
||||||
icon: Icon(context.watch<EvSourceType>() != EvSourceType.camera
|
icon: Icon(
|
||||||
|
context.watch<EvSourceType>() != EvSourceType.camera
|
||||||
? Icons.camera_rear
|
? Icons.camera_rear
|
||||||
: Icons.wb_incandescent,),
|
: Icons.wb_incandescent,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -161,13 +161,15 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
|
||||||
}
|
}
|
||||||
|
|
||||||
void _emitActiveState(Emitter emit) {
|
void _emitActiveState(Emitter emit) {
|
||||||
emit(CameraActiveState(
|
emit(
|
||||||
|
CameraActiveState(
|
||||||
zoomRange: _zoomRange!,
|
zoomRange: _zoomRange!,
|
||||||
currentZoom: _currentZoom,
|
currentZoom: _currentZoom,
|
||||||
exposureOffsetRange: _exposureOffsetRange!,
|
exposureOffsetRange: _exposureOffsetRange!,
|
||||||
exposureOffsetStep: _exposureStep,
|
exposureOffsetStep: _exposureStep,
|
||||||
currentExposureOffset: _currentExposureOffset,
|
currentExposureOffset: _currentExposureOffset,
|
||||||
),);
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<double?> _takePhoto() async {
|
Future<double?> _takePhoto() async {
|
||||||
|
|
|
@ -156,7 +156,8 @@ class _CameraControlsBuilder extends StatelessWidget {
|
||||||
context.read<CameraContainerBloc>().add(
|
context.read<CameraContainerBloc>().add(
|
||||||
state.error == CameraErrorType.permissionNotGranted
|
state.error == CameraErrorType.permissionNotGranted
|
||||||
? const OpenAppSettingsEvent()
|
? const OpenAppSettingsEvent()
|
||||||
: const InitializeEvent(),);
|
: const InitializeEvent(),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -64,25 +64,29 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
|
||||||
_closedOpacityAnimation = Tween<double>(
|
_closedOpacityAnimation = Tween<double>(
|
||||||
begin: 1,
|
begin: 1,
|
||||||
end: 0,
|
end: 0,
|
||||||
).animate(CurvedAnimation(
|
).animate(
|
||||||
|
CurvedAnimation(
|
||||||
parent: _animationController,
|
parent: _animationController,
|
||||||
curve: const Interval(
|
curve: const Interval(
|
||||||
0,
|
0,
|
||||||
0.8,
|
0.8,
|
||||||
curve: Curves.ease,
|
curve: Curves.ease,
|
||||||
),
|
),
|
||||||
),);
|
),
|
||||||
|
);
|
||||||
_openedOpacityAnimation = Tween<double>(
|
_openedOpacityAnimation = Tween<double>(
|
||||||
begin: 0,
|
begin: 0,
|
||||||
end: 1,
|
end: 1,
|
||||||
).animate(CurvedAnimation(
|
).animate(
|
||||||
|
CurvedAnimation(
|
||||||
parent: _animationController,
|
parent: _animationController,
|
||||||
curve: const Interval(
|
curve: const Interval(
|
||||||
0.8,
|
0.8,
|
||||||
1.0,
|
1.0,
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
),
|
),
|
||||||
),);
|
),
|
||||||
|
);
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
final mediaQuery = MediaQuery.of(context);
|
final mediaQuery = MediaQuery.of(context);
|
||||||
|
|
|
@ -36,7 +36,9 @@ class CalibrationDialogBloc extends Bloc<CalibrationDialogEvent, CalibrationDial
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onLightSensorEvCalibrationChanged(
|
void _onLightSensorEvCalibrationChanged(
|
||||||
LightSensorEvCalibrationChangedEvent event, Emitter emit,) {
|
LightSensorEvCalibrationChangedEvent event,
|
||||||
|
Emitter emit,
|
||||||
|
) {
|
||||||
_lightSensorEvCalibration = event.value;
|
_lightSensorEvCalibration = event.value;
|
||||||
emit(CalibrationDialogState(_cameraEvCalibration, _lightSensorEvCalibration));
|
emit(CalibrationDialogState(_cameraEvCalibration, _lightSensorEvCalibration));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ class EquipmentProfilesListTile extends StatelessWidget {
|
||||||
title: Text(S.of(context).equipmentProfiles),
|
title: Text(S.of(context).equipmentProfiles),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).push<EquipmentProfileData>(
|
Navigator.of(context).push<EquipmentProfileData>(
|
||||||
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),);
|
MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,8 @@ class _PrimaryColorDialogPickerState extends State<PrimaryColorDialogPicker> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),),
|
),
|
||||||
|
),
|
||||||
actionsPadding: Dimens.dialogActionsPadding,
|
actionsPadding: Dimens.dialogActionsPadding,
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
|
|
Loading…
Reference in a new issue