mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +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(
|
||||||
id: const Uuid().v1(),
|
EquipmentProfileData(
|
||||||
name: name,
|
id: const Uuid().v1(),
|
||||||
apertureValues: ApertureValue.values,
|
name: name,
|
||||||
ndValues: NdValue.values,
|
apertureValues: ApertureValue.values,
|
||||||
shutterSpeedValues: ShutterSpeedValue.values,
|
ndValues: NdValue.values,
|
||||||
isoValues: IsoValue.values,
|
shutterSpeedValues: ShutterSpeedValue.values,
|
||||||
),);
|
isoValues: IsoValue.values,
|
||||||
|
),
|
||||||
|
);
|
||||||
_refreshSavedProfiles();
|
_refreshSavedProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,21 +144,23 @@ 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(
|
||||||
? MeteringInProgressState(
|
_isMeteringInProgress
|
||||||
ev: ev,
|
? MeteringInProgressState(
|
||||||
film: _film,
|
ev: ev,
|
||||||
iso: _iso,
|
film: _film,
|
||||||
nd: _nd,
|
iso: _iso,
|
||||||
exposurePairs: _buildExposureValues(ev),
|
nd: _nd,
|
||||||
)
|
exposurePairs: _buildExposureValues(ev),
|
||||||
: MeteringEndedState(
|
)
|
||||||
ev: ev,
|
: MeteringEndedState(
|
||||||
film: _film,
|
ev: ev,
|
||||||
iso: _iso,
|
film: _film,
|
||||||
nd: _nd,
|
iso: _iso,
|
||||||
exposurePairs: _buildExposureValues(ev),
|
nd: _nd,
|
||||||
),);
|
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(
|
||||||
? Icons.camera_rear
|
context.watch<EvSourceType>() != EvSourceType.camera
|
||||||
: Icons.wb_incandescent,),
|
? Icons.camera_rear
|
||||||
|
: Icons.wb_incandescent,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
@ -161,13 +161,15 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
|
||||||
}
|
}
|
||||||
|
|
||||||
void _emitActiveState(Emitter emit) {
|
void _emitActiveState(Emitter emit) {
|
||||||
emit(CameraActiveState(
|
emit(
|
||||||
zoomRange: _zoomRange!,
|
CameraActiveState(
|
||||||
currentZoom: _currentZoom,
|
zoomRange: _zoomRange!,
|
||||||
exposureOffsetRange: _exposureOffsetRange!,
|
currentZoom: _currentZoom,
|
||||||
exposureOffsetStep: _exposureStep,
|
exposureOffsetRange: _exposureOffsetRange!,
|
||||||
currentExposureOffset: _currentExposureOffset,
|
exposureOffsetStep: _exposureStep,
|
||||||
),);
|
currentExposureOffset: _currentExposureOffset,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<double?> _takePhoto() async {
|
Future<double?> _takePhoto() async {
|
||||||
|
|
|
@ -154,9 +154,10 @@ class _CameraControlsBuilder extends StatelessWidget {
|
||||||
error: state.error,
|
error: state.error,
|
||||||
onReset: () {
|
onReset: () {
|
||||||
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(
|
||||||
parent: _animationController,
|
CurvedAnimation(
|
||||||
curve: const Interval(
|
parent: _animationController,
|
||||||
0,
|
curve: const Interval(
|
||||||
0.8,
|
0,
|
||||||
curve: Curves.ease,
|
0.8,
|
||||||
|
curve: Curves.ease,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),);
|
);
|
||||||
_openedOpacityAnimation = Tween<double>(
|
_openedOpacityAnimation = Tween<double>(
|
||||||
begin: 0,
|
begin: 0,
|
||||||
end: 1,
|
end: 1,
|
||||||
).animate(CurvedAnimation(
|
).animate(
|
||||||
parent: _animationController,
|
CurvedAnimation(
|
||||||
curve: const Interval(
|
parent: _animationController,
|
||||||
0.8,
|
curve: const Interval(
|
||||||
1.0,
|
0.8,
|
||||||
curve: Curves.easeInOut,
|
1.0,
|
||||||
|
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()),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,47 +28,48 @@ class _PrimaryColorDialogPickerState extends State<PrimaryColorDialogPicker> {
|
||||||
titlePadding: Dimens.dialogIconTitlePadding,
|
titlePadding: Dimens.dialogIconTitlePadding,
|
||||||
title: Text(S.of(context).choosePrimaryColor),
|
title: Text(S.of(context).choosePrimaryColor),
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
height: Dimens.grid48,
|
height: Dimens.grid48,
|
||||||
width: double.maxFinite,
|
width: double.maxFinite,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: List.generate(
|
children: List.generate(
|
||||||
ThemeProvider.primaryColorsList.length,
|
ThemeProvider.primaryColorsList.length,
|
||||||
(index) {
|
(index) {
|
||||||
final color = ThemeProvider.primaryColorsList[index];
|
final color = ThemeProvider.primaryColorsList[index];
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.only(left: index == 0 ? 0 : Dimens.paddingS),
|
padding: EdgeInsets.only(left: index == 0 ? 0 : Dimens.paddingS),
|
||||||
child: _SelectableColorItem(
|
child: _SelectableColorItem(
|
||||||
color: color,
|
color: color,
|
||||||
selected: color.value == _selected.value,
|
selected: color.value == _selected.value,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selected = color;
|
_selected = color;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const Row(
|
),
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
const Row(
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
_Cutout(),
|
children: [
|
||||||
RotatedBox(
|
_Cutout(),
|
||||||
quarterTurns: 2,
|
RotatedBox(
|
||||||
child: _Cutout(),
|
quarterTurns: 2,
|
||||||
),
|
child: _Cutout(),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),),
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
actionsPadding: Dimens.dialogActionsPadding,
|
actionsPadding: Dimens.dialogActionsPadding,
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
|
|
Loading…
Reference in a new issue