From 87fceee150908ccceec97a35fb896b8c954f0de2 Mon Sep 17 00:00:00 2001 From: Vadim Date: Thu, 11 May 2023 15:01:21 +0200 Subject: [PATCH] format --- lib/application.dart | 3 +- .../models/metering_screen_layout_config.dart | 3 +- lib/data/models/supported_locale.dart | 1 - lib/providers/equipment_profile_provider.dart | 18 +++-- lib/screens/metering/bloc_metering.dart | 38 +++++---- .../widget_bottom_controls.dart | 8 +- .../bloc_container_camera.dart | 16 ++-- .../widget_container_camera.dart | 7 +- .../widget_dialog_animated.dart | 32 ++++---- .../bloc_dialog_calibration.dart | 4 +- .../widget_list_tile_equipment_profiles.dart | 3 +- .../widget_dialog_picker_primary_color.dart | 79 ++++++++++--------- 12 files changed, 116 insertions(+), 96 deletions(-) diff --git a/lib/application.dart b/lib/application.dart index cfe00ae..39b2de2 100644 --- a/lib/application.dart +++ b/lib/application.dart @@ -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()), diff --git a/lib/data/models/metering_screen_layout_config.dart b/lib/data/models/metering_screen_layout_config.dart index 04b0b82..3410632 100644 --- a/lib/data/models/metering_screen_layout_config.dart +++ b/lib/data/models/metering_screen_layout_config.dart @@ -4,7 +4,8 @@ typedef MeteringScreenLayoutConfig = Map; extension MeteringScreenLayoutConfigJson on MeteringScreenLayoutConfig { static MeteringScreenLayoutConfig fromJson(Map 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 toJson() => map((key, value) => MapEntry(key.index.toString(), value)); } diff --git a/lib/data/models/supported_locale.dart b/lib/data/models/supported_locale.dart index 6cdf299..d06046f 100644 --- a/lib/data/models/supported_locale.dart +++ b/lib/data/models/supported_locale.dart @@ -29,4 +29,3 @@ extension SupportedLocaleExtension on SupportedLocale { } } } - diff --git a/lib/providers/equipment_profile_provider.dart b/lib/providers/equipment_profile_provider.dart index c55b7d5..fea496e 100644 --- a/lib/providers/equipment_profile_provider.dart +++ b/lib/providers/equipment_profile_provider.dart @@ -65,14 +65,16 @@ class EquipmentProfileProviderState extends State { /// 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(); } diff --git a/lib/screens/metering/bloc_metering.dart b/lib/screens/metering/bloc_metering.dart index 573e0e5..902f6af 100644 --- a/lib/screens/metering/bloc_metering.dart +++ b/lib/screens/metering/bloc_metering.dart @@ -144,21 +144,23 @@ class MeteringBloc extends Bloc { 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 _buildExposureValues(double ev) { @@ -199,8 +201,10 @@ class MeteringBloc extends Bloc { 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) { diff --git a/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart b/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart index ed7207d..f059b8f 100644 --- a/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart +++ b/lib/screens/metering/components/bottom_controls/widget_bottom_controls.dart @@ -41,9 +41,11 @@ class MeteringBottomControls extends StatelessWidget { child: Center( child: IconButton( onPressed: onSwitchEvSourceType, - icon: Icon(context.watch() != EvSourceType.camera - ? Icons.camera_rear - : Icons.wb_incandescent,), + icon: Icon( + context.watch() != EvSourceType.camera + ? Icons.camera_rear + : Icons.wb_incandescent, + ), ), ), ) diff --git a/lib/screens/metering/components/camera_container/bloc_container_camera.dart b/lib/screens/metering/components/camera_container/bloc_container_camera.dart index 7a588fa..6d0f88a 100644 --- a/lib/screens/metering/components/camera_container/bloc_container_camera.dart +++ b/lib/screens/metering/components/camera_container/bloc_container_camera.dart @@ -161,13 +161,15 @@ class CameraContainerBloc extends EvSourceBlocBase _takePhoto() async { diff --git a/lib/screens/metering/components/camera_container/widget_container_camera.dart b/lib/screens/metering/components/camera_container/widget_container_camera.dart index fa2ff63..d107ebd 100644 --- a/lib/screens/metering/components/camera_container/widget_container_camera.dart +++ b/lib/screens/metering/components/camera_container/widget_container_camera.dart @@ -154,9 +154,10 @@ class _CameraControlsBuilder extends StatelessWidget { error: state.error, onReset: () { context.read().add( - state.error == CameraErrorType.permissionNotGranted - ? const OpenAppSettingsEvent() - : const InitializeEvent(),); + state.error == CameraErrorType.permissionNotGranted + ? const OpenAppSettingsEvent() + : const InitializeEvent(), + ); }, ); } else { diff --git a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart index 7e19557..78baf07 100644 --- a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart +++ b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart @@ -64,25 +64,29 @@ class AnimatedDialogState extends State with SingleTickerProvide _closedOpacityAnimation = Tween( 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( 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); diff --git a/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/bloc_dialog_calibration.dart b/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/bloc_dialog_calibration.dart index 0c819fd..e36f24a 100644 --- a/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/bloc_dialog_calibration.dart +++ b/lib/screens/settings/components/metering/components/calibration/components/calibration_dialog/bloc_dialog_calibration.dart @@ -36,7 +36,9 @@ class CalibrationDialogBloc extends Bloc( - MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()),); + MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()), + ); }, ); } diff --git a/lib/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart b/lib/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart index 85c897d..434336a 100644 --- a/lib/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart +++ b/lib/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart @@ -28,47 +28,48 @@ class _PrimaryColorDialogPickerState extends State { 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(