From bac2fe9135e35ac80d676c34d49dc1c2aa1493c5 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Sat, 4 Mar 2023 00:04:28 +0300 Subject: [PATCH] use photography values from remote repo --- lib/data/models/equipment_profile_data.dart | 22 ----- lib/data/models/exposure_pair.dart | 3 +- .../photography_values/aperture_value.dart | 64 -------------- .../models/photography_values/iso_value.dart | 45 ---------- .../models/photography_values/nd_value.dart | 34 -------- .../photography_values/photography_value.dart | 51 ----------- .../shutter_speed_value.dart | 87 ------------------- lib/data/shared_prefs_service.dart | 21 +++-- lib/screens/metering/bloc_metering.dart | 7 +- .../provider_container_camera.dart | 5 +- .../widget_container_camera.dart | 4 +- .../provider_container_light_sensor.dart | 5 +- .../widget_container_light_sensor.dart | 4 +- .../widget_item_list_exposure_pairs.dart | 3 +- ...idget_dialog_picker_photography_value.dart | 3 +- .../widget_dialog_animated_picker.dart | 2 +- .../widget_container_readings.dart | 4 +- lib/screens/metering/event_metering.dart | 4 +- lib/screens/metering/flow_metering.dart | 2 +- lib/screens/metering/screen_metering.dart | 4 +- lib/screens/metering/state_metering.dart | 3 +- .../widget_list_tile_fractional_stops.dart | 2 +- lib/utils/stop_type_provider.dart | 2 +- pubspec.yaml | 10 ++- test/photograpy_values_test.dart | 41 --------- 25 files changed, 40 insertions(+), 392 deletions(-) delete mode 100644 lib/data/models/equipment_profile_data.dart delete mode 100644 lib/data/models/photography_values/aperture_value.dart delete mode 100644 lib/data/models/photography_values/iso_value.dart delete mode 100644 lib/data/models/photography_values/nd_value.dart delete mode 100644 lib/data/models/photography_values/photography_value.dart delete mode 100644 lib/data/models/photography_values/shutter_speed_value.dart delete mode 100644 test/photograpy_values_test.dart diff --git a/lib/data/models/equipment_profile_data.dart b/lib/data/models/equipment_profile_data.dart deleted file mode 100644 index dede472..0000000 --- a/lib/data/models/equipment_profile_data.dart +++ /dev/null @@ -1,22 +0,0 @@ -import 'package:lightmeter/data/models/photography_values/aperture_value.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; -import 'package:lightmeter/data/models/photography_values/shutter_speed_value.dart'; - -class EquipmentProfileData { - final String id; - final String name; - final List apertureValues; - final List ndValues; - final List shutterSpeedValues; - final List isoValues; - - const EquipmentProfileData({ - required this.id, - required this.name, - required this.apertureValues, - required this.ndValues, - required this.shutterSpeedValues, - required this.isoValues, - }); -} diff --git a/lib/data/models/exposure_pair.dart b/lib/data/models/exposure_pair.dart index bff3112..d1907a0 100644 --- a/lib/data/models/exposure_pair.dart +++ b/lib/data/models/exposure_pair.dart @@ -1,5 +1,4 @@ -import 'photography_values/aperture_value.dart'; -import 'photography_values/shutter_speed_value.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class ExposurePair { final ApertureValue aperture; diff --git a/lib/data/models/photography_values/aperture_value.dart b/lib/data/models/photography_values/aperture_value.dart deleted file mode 100644 index d790001..0000000 --- a/lib/data/models/photography_values/aperture_value.dart +++ /dev/null @@ -1,64 +0,0 @@ -import 'photography_value.dart'; - -class ApertureValue extends PhotographyStopValue { - const ApertureValue(super.rawValue, super.stopType); - - @override - String toString() { - final buffer = StringBuffer("f/"); - if (rawValue - rawValue.floor() == 0 && rawValue >= 8) { - buffer.write(rawValue.toInt().toString()); - } else { - buffer.write(rawValue.toStringAsFixed(1)); - } - return buffer.toString(); - } -} - -const List apertureValues = [ - ApertureValue(1.0, StopType.full), - ApertureValue(1.1, StopType.third), - ApertureValue(1.2, StopType.half), - ApertureValue(1.2, StopType.third), - ApertureValue(1.4, StopType.full), - ApertureValue(1.6, StopType.third), - ApertureValue(1.7, StopType.half), - ApertureValue(1.8, StopType.third), - ApertureValue(2.0, StopType.full), - ApertureValue(2.2, StopType.third), - ApertureValue(2.4, StopType.half), - ApertureValue(2.4, StopType.third), - ApertureValue(2.8, StopType.full), - ApertureValue(3.2, StopType.third), - ApertureValue(3.3, StopType.half), - ApertureValue(3.5, StopType.third), - ApertureValue(4.0, StopType.full), - ApertureValue(4.5, StopType.third), - ApertureValue(4.8, StopType.half), - ApertureValue(5.0, StopType.third), - ApertureValue(5.6, StopType.full), - ApertureValue(6.3, StopType.third), - ApertureValue(6.7, StopType.half), - ApertureValue(7.1, StopType.third), - ApertureValue(8, StopType.full), - ApertureValue(9, StopType.third), - ApertureValue(9.5, StopType.half), - ApertureValue(10, StopType.third), - ApertureValue(11, StopType.full), - ApertureValue(13, StopType.third), - ApertureValue(13, StopType.half), - ApertureValue(14, StopType.third), - ApertureValue(16, StopType.full), - ApertureValue(18, StopType.third), - ApertureValue(19, StopType.half), - ApertureValue(20, StopType.third), - ApertureValue(22, StopType.full), - ApertureValue(25, StopType.third), - ApertureValue(27, StopType.half), - ApertureValue(29, StopType.third), - ApertureValue(32, StopType.full), - ApertureValue(36, StopType.third), - ApertureValue(38, StopType.half), - ApertureValue(42, StopType.third), - ApertureValue(45, StopType.full), -]; diff --git a/lib/data/models/photography_values/iso_value.dart b/lib/data/models/photography_values/iso_value.dart deleted file mode 100644 index 536cda6..0000000 --- a/lib/data/models/photography_values/iso_value.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'photography_value.dart'; - -class IsoValue extends PhotographyStopValue { - const IsoValue(super.rawValue, super.stopType); - - @override - String toString() => value.toString(); -} - -const List isoValues = [ - IsoValue(3, StopType.full), - IsoValue(4, StopType.third), - IsoValue(5, StopType.third), - IsoValue(6, StopType.full), - IsoValue(8, StopType.third), - IsoValue(10, StopType.third), - IsoValue(12, StopType.full), - IsoValue(16, StopType.third), - IsoValue(20, StopType.third), - IsoValue(25, StopType.full), - IsoValue(32, StopType.third), - IsoValue(40, StopType.third), - IsoValue(50, StopType.full), - IsoValue(64, StopType.third), - IsoValue(80, StopType.third), - IsoValue(100, StopType.full), - IsoValue(125, StopType.third), - IsoValue(160, StopType.third), - IsoValue(200, StopType.full), - IsoValue(250, StopType.third), - IsoValue(320, StopType.third), - IsoValue(400, StopType.full), - IsoValue(500, StopType.third), - IsoValue(640, StopType.third), - IsoValue(800, StopType.full), - IsoValue(1000, StopType.third), - IsoValue(1250, StopType.third), - IsoValue(1600, StopType.full), - IsoValue(2000, StopType.third), - IsoValue(2500, StopType.third), - IsoValue(3200, StopType.full), - IsoValue(4000, StopType.third), - IsoValue(5000, StopType.third), - IsoValue(6400, StopType.full), -]; diff --git a/lib/data/models/photography_values/nd_value.dart b/lib/data/models/photography_values/nd_value.dart deleted file mode 100644 index 6c19f7c..0000000 --- a/lib/data/models/photography_values/nd_value.dart +++ /dev/null @@ -1,34 +0,0 @@ -import 'package:lightmeter/utils/log_2.dart'; - -import 'photography_value.dart'; - -class NdValue extends PhotographyValue { - const NdValue(super.rawValue); - - double get stopReduction => value == 0 ? 0.0 : log2(value); - - @override - String toString() => 'ND$value'; -} - -/// https://shuttermuse.com/neutral-density-filter-numbers-names/ -const List ndValues = [ - NdValue(0), - NdValue(2), - NdValue(4), - NdValue(8), - NdValue(16), - NdValue(32), - NdValue(64), - NdValue(100), - NdValue(128), - NdValue(256), - NdValue(400), - NdValue(512), - NdValue(1024), - NdValue(2048), - NdValue(4096), - NdValue(6310), - NdValue(8192), - NdValue(10000), -]; diff --git a/lib/data/models/photography_values/photography_value.dart b/lib/data/models/photography_values/photography_value.dart deleted file mode 100644 index 45da5f9..0000000 --- a/lib/data/models/photography_values/photography_value.dart +++ /dev/null @@ -1,51 +0,0 @@ -import 'dart:math'; - -import 'package:lightmeter/utils/log_2.dart'; - -enum StopType { full, half, third } - -abstract class PhotographyValue { - final T rawValue; - - const PhotographyValue(this.rawValue); - - T get value => rawValue; - - /// EV difference between `this` and `other` - double evDifference(PhotographyValue other) => log2(max(1, other.value) / max(1, value)); - - String toStringDifference(PhotographyValue other) { - final ev = log2(max(1, other.value) / max(1, value)); - final buffer = StringBuffer(); - if (ev > 0) { - buffer.write('+'); - } - buffer.write(ev.toStringAsFixed(1)); - return buffer.toString(); - } -} - -abstract class PhotographyStopValue extends PhotographyValue { - final StopType stopType; - - const PhotographyStopValue(super.rawValue, this.stopType); -} - -extension PhotographyStopValues on List { - List whereStopType(StopType stopType) { - switch (stopType) { - case StopType.full: - return where((e) => e.stopType == StopType.full).toList(); - case StopType.half: - return where((e) => e.stopType == StopType.full || e.stopType == StopType.half).toList(); - case StopType.third: - return where((e) => e.stopType == StopType.full || e.stopType == StopType.third).toList(); - } - } - - List fullStops() => whereStopType(StopType.full); - - List halfStops() => whereStopType(StopType.half); - - List thirdStops() => whereStopType(StopType.third); -} diff --git a/lib/data/models/photography_values/shutter_speed_value.dart b/lib/data/models/photography_values/shutter_speed_value.dart deleted file mode 100644 index 9e18c9b..0000000 --- a/lib/data/models/photography_values/shutter_speed_value.dart +++ /dev/null @@ -1,87 +0,0 @@ -import 'photography_value.dart'; - -class ShutterSpeedValue extends PhotographyStopValue { - final bool isFraction; - - const ShutterSpeedValue(super.rawValue, this.isFraction, super.stopType); - - @override - double get value => isFraction ? 1 / rawValue : rawValue; - - @override - String toString() { - final buffer = StringBuffer(); - if (isFraction) buffer.write("1/"); - if (rawValue - rawValue.floor() == 0) { - buffer.write(rawValue.toInt().toString()); - } else { - buffer.write(rawValue.toStringAsFixed(1)); - } - if (!isFraction) buffer.write("\""); - return buffer.toString(); - } -} - -const List shutterSpeedValues = [ - ShutterSpeedValue(2000, true, StopType.full), - ShutterSpeedValue(1600, true, StopType.third), - ShutterSpeedValue(1500, true, StopType.half), - ShutterSpeedValue(1250, true, StopType.third), - ShutterSpeedValue(1000, true, StopType.full), - ShutterSpeedValue(800, true, StopType.third), - ShutterSpeedValue(750, true, StopType.half), - ShutterSpeedValue(640, true, StopType.third), - ShutterSpeedValue(500, true, StopType.full), - ShutterSpeedValue(400, true, StopType.third), - ShutterSpeedValue(350, true, StopType.half), - ShutterSpeedValue(320, true, StopType.third), - ShutterSpeedValue(250, true, StopType.full), - ShutterSpeedValue(200, true, StopType.third), - ShutterSpeedValue(180, true, StopType.half), - ShutterSpeedValue(160, true, StopType.third), - ShutterSpeedValue(125, true, StopType.full), - ShutterSpeedValue(100, true, StopType.third), - ShutterSpeedValue(90, true, StopType.half), - ShutterSpeedValue(80, true, StopType.third), - ShutterSpeedValue(60, true, StopType.full), - ShutterSpeedValue(50, true, StopType.third), - ShutterSpeedValue(45, true, StopType.half), - ShutterSpeedValue(40, true, StopType.third), - ShutterSpeedValue(30, true, StopType.full), - ShutterSpeedValue(25, true, StopType.third), - ShutterSpeedValue(20, true, StopType.half), - ShutterSpeedValue(20, true, StopType.third), - ShutterSpeedValue(15, true, StopType.full), - ShutterSpeedValue(13, true, StopType.third), - ShutterSpeedValue(10, true, StopType.half), - ShutterSpeedValue(10, true, StopType.third), - ShutterSpeedValue(8, true, StopType.full), - ShutterSpeedValue(6, true, StopType.third), - ShutterSpeedValue(6, true, StopType.half), - ShutterSpeedValue(5, true, StopType.third), - ShutterSpeedValue(4, true, StopType.full), - ShutterSpeedValue(3, true, StopType.third), - ShutterSpeedValue(3, true, StopType.half), - ShutterSpeedValue(2.5, true, StopType.third), - ShutterSpeedValue(2, true, StopType.full), - ShutterSpeedValue(1.6, true, StopType.third), - ShutterSpeedValue(1.5, true, StopType.half), - ShutterSpeedValue(1.3, true, StopType.third), - ShutterSpeedValue(1, false, StopType.full), - ShutterSpeedValue(1.3, false, StopType.third), - ShutterSpeedValue(1.5, false, StopType.half), - ShutterSpeedValue(1.6, false, StopType.third), - ShutterSpeedValue(2, false, StopType.full), - ShutterSpeedValue(2.5, false, StopType.third), - ShutterSpeedValue(3, false, StopType.half), - ShutterSpeedValue(3, false, StopType.third), - ShutterSpeedValue(4, false, StopType.full), - ShutterSpeedValue(5, false, StopType.third), - ShutterSpeedValue(6, false, StopType.half), - ShutterSpeedValue(6, false, StopType.third), - ShutterSpeedValue(8, false, StopType.full), - ShutterSpeedValue(10, false, StopType.third), - ShutterSpeedValue(12, false, StopType.half), - ShutterSpeedValue(13, false, StopType.third), - ShutterSpeedValue(16, false, StopType.full), -]; diff --git a/lib/data/shared_prefs_service.dart b/lib/data/shared_prefs_service.dart index 6c76e76..7d877cf 100644 --- a/lib/data/shared_prefs_service.dart +++ b/lib/data/shared_prefs_service.dart @@ -1,10 +1,9 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/data/models/supported_locale.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'models/ev_source_type.dart'; -import 'models/photography_values/iso_value.dart'; -import 'models/photography_values/nd_value.dart'; import 'models/theme_type.dart'; class UserPreferencesService { @@ -64,13 +63,16 @@ class UserPreferencesService { } } - IsoValue get iso => isoValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100)); + IsoValue get iso => + isoValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100)); set iso(IsoValue value) => _sharedPreferences.setInt(_isoKey, value.value); - NdValue get ndFilter => ndValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_ndFilterKey) ?? 0)); + NdValue get ndFilter => + ndValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_ndFilterKey) ?? 0)); set ndFilter(NdValue value) => _sharedPreferences.setInt(_ndFilterKey, value.value); - EvSourceType get evSourceType => EvSourceType.values[_sharedPreferences.getInt(_evSourceTypeKey) ?? 0]; + EvSourceType get evSourceType => + EvSourceType.values[_sharedPreferences.getInt(_evSourceTypeKey) ?? 0]; set evSourceType(EvSourceType value) => _sharedPreferences.setInt(_evSourceTypeKey, value.index); bool get caffeine => _sharedPreferences.getBool(_caffeineKey) ?? false; @@ -86,10 +88,13 @@ class UserPreferencesService { set locale(SupportedLocale value) => _sharedPreferences.setString(_localeKey, value.toString()); double get cameraEvCalibration => _sharedPreferences.getDouble(_cameraEvCalibrationKey) ?? 0.0; - set cameraEvCalibration(double value) => _sharedPreferences.setDouble(_cameraEvCalibrationKey, value); + set cameraEvCalibration(double value) => + _sharedPreferences.setDouble(_cameraEvCalibrationKey, value); - double get lightSensorEvCalibration => _sharedPreferences.getDouble(_lightSensorEvCalibrationKey) ?? 0.0; - set lightSensorEvCalibration(double value) => _sharedPreferences.setDouble(_lightSensorEvCalibrationKey, value); + double get lightSensorEvCalibration => + _sharedPreferences.getDouble(_lightSensorEvCalibrationKey) ?? 0.0; + set lightSensorEvCalibration(double value) => + _sharedPreferences.setDouble(_lightSensorEvCalibrationKey, value); ThemeType get themeType => ThemeType.values[_sharedPreferences.getInt(_themeTypeKey) ?? 0]; set themeType(ThemeType value) => _sharedPreferences.setInt(_themeTypeKey, value.index); diff --git a/lib/screens/metering/bloc_metering.dart b/lib/screens/metering/bloc_metering.dart index 9f122cc..ac38249 100644 --- a/lib/screens/metering/bloc_metering.dart +++ b/lib/screens/metering/bloc_metering.dart @@ -2,19 +2,14 @@ import 'dart:async'; import 'dart:math'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:lightmeter/data/models/photography_values/aperture_value.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; -import 'package:lightmeter/data/models/photography_values/shutter_speed_value.dart'; import 'package:lightmeter/data/shared_prefs_service.dart'; import 'package:lightmeter/interactors/metering_interactor.dart'; import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart' as communication_events; import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart' as communication_states; -import 'package:lightmeter/utils/log_2.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'communication/bloc_communication_metering.dart'; import 'event_metering.dart'; diff --git a/lib/screens/metering/components/camera_container/provider_container_camera.dart b/lib/screens/metering/components/camera_container/provider_container_camera.dart index 3365622..8afa4a6 100644 --- a/lib/screens/metering/components/camera_container/provider_container_camera.dart +++ b/lib/screens/metering/components/camera_container/provider_container_camera.dart @@ -1,11 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; import 'package:lightmeter/interactors/metering_interactor.dart'; -import 'package:lightmeter/providers/equipment_profile_provider.dart'; import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart'; +import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'bloc_container_camera.dart'; import 'widget_container_camera.dart'; 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 998c4df..394e253 100644 --- a/lib/screens/metering/components/camera_container/widget_container_camera.dart +++ b/lib/screens/metering/components/camera_container/widget_container_camera.dart @@ -1,15 +1,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; import 'package:lightmeter/platform_config.dart'; -import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/screens/metering/components/camera_container/components/camera_view/widget_camera_view.dart'; import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart'; import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/widget_list_exposure_pairs.dart'; import 'package:lightmeter/screens/metering/components/shared/metering_top_bar/widget_top_bar_metering.dart'; import 'package:lightmeter/screens/metering/components/shared/readings_container/widget_container_readings.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'bloc_container_camera.dart'; import 'components/camera_controls/widget_camera_controls.dart'; diff --git a/lib/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart b/lib/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart index 8734233..ddcea71 100644 --- a/lib/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart +++ b/lib/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart @@ -1,11 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; import 'package:lightmeter/interactors/metering_interactor.dart'; -import 'package:lightmeter/providers/equipment_profile_provider.dart'; import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart'; +import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'bloc_container_light_sensor.dart'; import 'widget_container_light_sensor.dart'; diff --git a/lib/screens/metering/components/light_sensor_container/widget_container_light_sensor.dart b/lib/screens/metering/components/light_sensor_container/widget_container_light_sensor.dart index bd1cc95..be9f516 100644 --- a/lib/screens/metering/components/light_sensor_container/widget_container_light_sensor.dart +++ b/lib/screens/metering/components/light_sensor_container/widget_container_light_sensor.dart @@ -1,11 +1,9 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; -import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/widget_list_exposure_pairs.dart'; import 'package:lightmeter/screens/metering/components/shared/metering_top_bar/widget_top_bar_metering.dart'; import 'package:lightmeter/screens/metering/components/shared/readings_container/widget_container_readings.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class LightSensorContainer extends StatelessWidget { final ExposurePair? fastest; diff --git a/lib/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart b/lib/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart index 1b0fc02..c7fb384 100644 --- a/lib/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart +++ b/lib/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; -import 'package:lightmeter/res/dimens.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class ExposurePairsListItem extends StatelessWidget { final T value; diff --git a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart index acf9663..211b22f 100644 --- a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart +++ b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/generated/l10n.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; -import 'package:lightmeter/res/dimens.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; typedef DialogPickerItemBuilder = Widget Function(BuildContext, T); typedef DialogPickerEvDifferenceBuilder = String Function( diff --git a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_dialog_animated_picker.dart b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_dialog_animated_picker.dart index 0d729a7..2d5cf17 100644 --- a/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_dialog_animated_picker.dart +++ b/lib/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_dialog_animated_picker.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'components/animated_dialog/widget_dialog_animated.dart'; import 'components/photography_value_picker_dialog/widget_dialog_picker_photography_value.dart'; diff --git a/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart b/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart index a24d2a7..d3ad211 100644 --- a/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart +++ b/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart @@ -1,9 +1,7 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; import 'package:lightmeter/generated/l10n.dart'; -import 'package:lightmeter/res/dimens.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'components/animated_dialog_picker/widget_dialog_animated_picker.dart'; import 'components/reading_value_container/widget_container_reading_value.dart'; diff --git a/lib/screens/metering/event_metering.dart b/lib/screens/metering/event_metering.dart index f1fd5c4..98f4727 100644 --- a/lib/screens/metering/event_metering.dart +++ b/lib/screens/metering/event_metering.dart @@ -1,6 +1,4 @@ -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; abstract class MeteringEvent { const MeteringEvent(); diff --git a/lib/screens/metering/flow_metering.dart b/lib/screens/metering/flow_metering.dart index 7dbb05c..c064391 100644 --- a/lib/screens/metering/flow_metering.dart +++ b/lib/screens/metering/flow_metering.dart @@ -3,10 +3,10 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:lightmeter/data/caffeine_service.dart'; import 'package:lightmeter/data/haptics_service.dart'; import 'package:lightmeter/data/light_sensor_service.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; import 'package:lightmeter/data/permissions_service.dart'; import 'package:lightmeter/data/shared_prefs_service.dart'; import 'package:lightmeter/interactors/metering_interactor.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'package:provider/provider.dart'; import 'bloc_metering.dart'; diff --git a/lib/screens/metering/screen_metering.dart b/lib/screens/metering/screen_metering.dart index 8abf2fc..12c1596 100644 --- a/lib/screens/metering/screen_metering.dart +++ b/lib/screens/metering/screen_metering.dart @@ -2,11 +2,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:lightmeter/data/models/ev_source_type.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; import 'package:lightmeter/environment.dart'; import 'package:lightmeter/providers/ev_source_type_provider.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'components/bottom_controls/provider_bottom_controls.dart'; import 'components/camera_container/provider_container_camera.dart'; diff --git a/lib/screens/metering/state_metering.dart b/lib/screens/metering/state_metering.dart index cde6b13..7a103b8 100644 --- a/lib/screens/metering/state_metering.dart +++ b/lib/screens/metering/state_metering.dart @@ -1,6 +1,5 @@ import 'package:lightmeter/data/models/exposure_pair.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; abstract class MeteringState { const MeteringState(); diff --git a/lib/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart b/lib/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart index b02149a..d164430 100644 --- a/lib/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart +++ b/lib/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/screens/settings/components/shared/dialog_picker.dart/widget_dialog_picker.dart'; import 'package:lightmeter/utils/stop_type_provider.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'package:provider/provider.dart'; class StopTypeListTile extends StatelessWidget { diff --git a/lib/utils/stop_type_provider.dart b/lib/utils/stop_type_provider.dart index caff28e..a6bbe1a 100644 --- a/lib/utils/stop_type_provider.dart +++ b/lib/utils/stop_type_provider.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; +import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'package:provider/provider.dart'; class StopTypeProvider extends StatefulWidget { diff --git a/pubspec.yaml b/pubspec.yaml index e3d1f81..413a4fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: lightmeter description: A new Flutter project. publish_to: "none" -version: 0.8.1+13 +version: 0.8.2+14 environment: sdk: ">=2.18.0 <3.0.0" @@ -20,6 +20,14 @@ dependencies: intl_utils: 2.8.1 light_sensor: 2.0.2 material_color_utilities: 0.2.0 + m3_lightmeter_iap: + git: + url: "https://github.com/vodemn/m3_lightmeter_iap" + ref: main + m3_lightmeter_resources: + git: + url: "https://github.com/vodemn/m3_lightmeter_resources" + ref: main package_info_plus: 3.0.2 permission_handler: 10.2.0 provider: 6.0.4 diff --git a/test/photograpy_values_test.dart b/test/photograpy_values_test.dart deleted file mode 100644 index 106754b..0000000 --- a/test/photograpy_values_test.dart +++ /dev/null @@ -1,41 +0,0 @@ -import 'package:lightmeter/data/models/photography_values/aperture_value.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/photography_value.dart'; -import 'package:lightmeter/data/models/photography_values/shutter_speed_value.dart'; -import 'package:test/test.dart'; - -void main() { - // Stringify - test('Stringify aperture values', () { - expect(apertureValues.first.toString(), "f/1.0"); - expect(apertureValues.last.toString(), "f/45"); - }); - - test('Stringify iso values', () { - expect(isoValues.first.toString(), "3"); - expect(isoValues.last.toString(), "6400"); - }); - - test('Stringify shutter speed values', () { - expect(shutterSpeedValues.first.toString(), "1/2000"); - expect(shutterSpeedValues.last.toString(), "16\""); - }); - - // Stops - test('Aperture values stops lists', () { - expect(apertureValues.fullStops().length, 12); - expect(apertureValues.halfStops().length, 12 + 11); - expect(apertureValues.thirdStops().length, 12 + 22); - }); - - test('Iso values stops lists', () { - expect(isoValues.fullStops().length, 12); - expect(isoValues.thirdStops().length, 12 + 22); - }); - - test('Shutter speed values stops lists', () { - expect(shutterSpeedValues.fullStops().length, 16); - expect(shutterSpeedValues.halfStops().length, 16 + 15); - expect(shutterSpeedValues.thirdStops().length, 16 + 30); - }); -}