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: [
|
||||
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()),
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -29,4 +29,3 @@ extension SupportedLocaleExtension on SupportedLocale {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,14 +65,16 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
|
||||
/// Creates a default equipment profile
|
||||
void addProfile(String name) {
|
||||
_customProfiles.add(EquipmentProfileData(
|
||||
id: const Uuid().v1(),
|
||||
name: name,
|
||||
apertureValues: ApertureValue.values,
|
||||
ndValues: NdValue.values,
|
||||
shutterSpeedValues: ShutterSpeedValue.values,
|
||||
isoValues: IsoValue.values,
|
||||
),);
|
||||
_customProfiles.add(
|
||||
EquipmentProfileData(
|
||||
id: const Uuid().v1(),
|
||||
name: name,
|
||||
apertureValues: ApertureValue.values,
|
||||
ndValues: NdValue.values,
|
||||
shutterSpeedValues: ShutterSpeedValue.values,
|
||||
isoValues: IsoValue.values,
|
||||
),
|
||||
);
|
||||
_refreshSavedProfiles();
|
||||
}
|
||||
|
||||
|
|
|
@ -144,21 +144,23 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
|||
|
||||
void _emitMeasuredState(Emitter emit) {
|
||||
final ev = _ev100 + log2(_iso.value / 100) - _nd.stopReduction;
|
||||
emit(_isMeteringInProgress
|
||||
? MeteringInProgressState(
|
||||
ev: ev,
|
||||
film: _film,
|
||||
iso: _iso,
|
||||
nd: _nd,
|
||||
exposurePairs: _buildExposureValues(ev),
|
||||
)
|
||||
: MeteringEndedState(
|
||||
ev: ev,
|
||||
film: _film,
|
||||
iso: _iso,
|
||||
nd: _nd,
|
||||
exposurePairs: _buildExposureValues(ev),
|
||||
),);
|
||||
emit(
|
||||
_isMeteringInProgress
|
||||
? MeteringInProgressState(
|
||||
ev: ev,
|
||||
film: _film,
|
||||
iso: _iso,
|
||||
nd: _nd,
|
||||
exposurePairs: _buildExposureValues(ev),
|
||||
)
|
||||
: MeteringEndedState(
|
||||
ev: ev,
|
||||
film: _film,
|
||||
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) {
|
||||
|
|
|
@ -41,9 +41,11 @@ class MeteringBottomControls extends StatelessWidget {
|
|||
child: Center(
|
||||
child: IconButton(
|
||||
onPressed: onSwitchEvSourceType,
|
||||
icon: Icon(context.watch<EvSourceType>() != EvSourceType.camera
|
||||
? Icons.camera_rear
|
||||
: Icons.wb_incandescent,),
|
||||
icon: Icon(
|
||||
context.watch<EvSourceType>() != EvSourceType.camera
|
||||
? Icons.camera_rear
|
||||
: Icons.wb_incandescent,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
@ -161,13 +161,15 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
|
|||
}
|
||||
|
||||
void _emitActiveState(Emitter emit) {
|
||||
emit(CameraActiveState(
|
||||
zoomRange: _zoomRange!,
|
||||
currentZoom: _currentZoom,
|
||||
exposureOffsetRange: _exposureOffsetRange!,
|
||||
exposureOffsetStep: _exposureStep,
|
||||
currentExposureOffset: _currentExposureOffset,
|
||||
),);
|
||||
emit(
|
||||
CameraActiveState(
|
||||
zoomRange: _zoomRange!,
|
||||
currentZoom: _currentZoom,
|
||||
exposureOffsetRange: _exposureOffsetRange!,
|
||||
exposureOffsetStep: _exposureStep,
|
||||
currentExposureOffset: _currentExposureOffset,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<double?> _takePhoto() async {
|
||||
|
|
|
@ -154,9 +154,10 @@ class _CameraControlsBuilder extends StatelessWidget {
|
|||
error: state.error,
|
||||
onReset: () {
|
||||
context.read<CameraContainerBloc>().add(
|
||||
state.error == CameraErrorType.permissionNotGranted
|
||||
? const OpenAppSettingsEvent()
|
||||
: const InitializeEvent(),);
|
||||
state.error == CameraErrorType.permissionNotGranted
|
||||
? const OpenAppSettingsEvent()
|
||||
: const InitializeEvent(),
|
||||
);
|
||||
},
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -64,25 +64,29 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
|
|||
_closedOpacityAnimation = Tween<double>(
|
||||
begin: 1,
|
||||
end: 0,
|
||||
).animate(CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: const Interval(
|
||||
0,
|
||||
0.8,
|
||||
curve: Curves.ease,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: const Interval(
|
||||
0,
|
||||
0.8,
|
||||
curve: Curves.ease,
|
||||
),
|
||||
),
|
||||
),);
|
||||
);
|
||||
_openedOpacityAnimation = Tween<double>(
|
||||
begin: 0,
|
||||
end: 1,
|
||||
).animate(CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: const Interval(
|
||||
0.8,
|
||||
1.0,
|
||||
curve: Curves.easeInOut,
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: const Interval(
|
||||
0.8,
|
||||
1.0,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
),
|
||||
),);
|
||||
);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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()),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -28,47 +28,48 @@ class _PrimaryColorDialogPickerState extends State<PrimaryColorDialogPicker> {
|
|||
titlePadding: Dimens.dialogIconTitlePadding,
|
||||
title: Text(S.of(context).choosePrimaryColor),
|
||||
content: SizedBox(
|
||||
height: Dimens.grid48,
|
||||
width: double.maxFinite,
|
||||
child: Stack(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: EdgeInsets.zero,
|
||||
child: Row(
|
||||
children: List.generate(
|
||||
ThemeProvider.primaryColorsList.length,
|
||||
(index) {
|
||||
final color = ThemeProvider.primaryColorsList[index];
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: index == 0 ? 0 : Dimens.paddingS),
|
||||
child: _SelectableColorItem(
|
||||
color: color,
|
||||
selected: color.value == _selected.value,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selected = color;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
height: Dimens.grid48,
|
||||
width: double.maxFinite,
|
||||
child: Stack(
|
||||
children: [
|
||||
SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: EdgeInsets.zero,
|
||||
child: Row(
|
||||
children: List.generate(
|
||||
ThemeProvider.primaryColorsList.length,
|
||||
(index) {
|
||||
final color = ThemeProvider.primaryColorsList[index];
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: index == 0 ? 0 : Dimens.paddingS),
|
||||
child: _SelectableColorItem(
|
||||
color: color,
|
||||
selected: color.value == _selected.value,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selected = color;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
_Cutout(),
|
||||
RotatedBox(
|
||||
quarterTurns: 2,
|
||||
child: _Cutout(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),),
|
||||
),
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
_Cutout(),
|
||||
RotatedBox(
|
||||
quarterTurns: 2,
|
||||
child: _Cutout(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
actionsPadding: Dimens.dialogActionsPadding,
|
||||
actions: [
|
||||
TextButton(
|
||||
|
|
Loading…
Reference in a new issue