ML-70 Migrate to Dart 3 + stricter lints (#71)

* updated pub version

* added lint

* --code=always_use_package_imports

* dart fixes

* format

* other lints
This commit is contained in:
Vadim 2023-05-11 15:30:18 +02:00 committed by GitHub
parent 19a788adcb
commit 5602b1ed80
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
61 changed files with 259 additions and 260 deletions

View file

@ -1 +1,10 @@
include: package:flutter_lints/flutter.yaml
include: package:lint/strict.yaml
linter:
rules:
use_setters_to_change_properties: false
analyzer:
exclude:
- "**/generated/**"

View file

@ -5,24 +5,23 @@ import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.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/supported_locale.dart';
import 'package:lightmeter/data/permissions_service.dart';
import 'package:lightmeter/data/shared_prefs_service.dart';
import 'package:lightmeter/environment.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/equipment_profile_provider.dart';
import 'package:lightmeter/providers/ev_source_type_provider.dart';
import 'package:lightmeter/providers/metering_screen_layout_provider.dart';
import 'package:lightmeter/providers/stop_type_provider.dart';
import 'package:lightmeter/providers/supported_locale_provider.dart';
import 'package:lightmeter/providers/theme_provider.dart';
import 'package:lightmeter/screens/metering/flow_metering.dart';
import 'package:lightmeter/screens/settings/flow_settings.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'data/light_sensor_service.dart';
import 'data/permissions_service.dart';
import 'data/shared_prefs_service.dart';
import 'environment.dart';
import 'generated/l10n.dart';
import 'providers/equipment_profile_provider.dart';
import 'providers/ev_source_type_provider.dart';
import 'providers/metering_screen_layout_provider.dart';
import 'providers/theme_provider.dart';
import 'screens/metering/flow_metering.dart';
import 'screens/settings/flow_settings.dart';
import 'providers/stop_type_provider.dart';
class Application extends StatelessWidget {
final Environment env;
@ -33,7 +32,7 @@ class Application extends StatelessWidget {
return FutureBuilder(
future: Future.wait([
SharedPreferences.getInstance(),
Platform.isAndroid ? const LightSensorService().hasSensor() : Future.value(false),
if (Platform.isAndroid) const LightSensorService().hasSensor() else Future.value(false),
]),
builder: (_, snapshot) {
if (snapshot.data != null) {
@ -41,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()),

View file

@ -6,7 +6,7 @@ class CaffeineService {
const CaffeineService();
Future<bool> isKeepScreenOn() async {
return await _methodChannel.invokeMethod<bool>("isKeepScreenOn").then((value) => value!);
return _methodChannel.invokeMethod<bool>("isKeepScreenOn").then((value) => value!);
}
Future<void> keepScreenOn(bool keep) async {

View file

@ -7,5 +7,5 @@ class ExposurePair {
const ExposurePair(this.aperture, this.shutterSpeed);
@override
String toString() => '${aperture.toString()} - ${shutterSpeed.toString()}';
String toString() => '$aperture - $shutterSpeed';
}

View file

@ -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));
}

View file

@ -29,4 +29,3 @@ extension SupportedLocaleExtension on SupportedLocale {
}
}
}

View file

@ -1,7 +1,7 @@
import 'package:permission_handler/permission_handler.dart';
class PermissionsService {
Future<PermissionStatus> checkCameraPermission() async => await Permission.camera.status;
Future<PermissionStatus> checkCameraPermission() async => Permission.camera.status;
Future<PermissionStatus> requestCameraPermission() async => Permission.camera.request();
}

View file

@ -1,15 +1,14 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/ev_source_type.dart';
import 'package:lightmeter/data/models/film.dart';
import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
import 'package:lightmeter/data/models/supported_locale.dart';
import 'package:lightmeter/data/models/theme_type.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/film.dart';
import 'models/metering_screen_layout_config.dart';
import 'models/theme_type.dart';
class UserPreferencesService {
static const _isoKey = "iso";
static const _ndFilterKey = "ndFilter";
@ -87,7 +86,9 @@ class UserPreferencesService {
MeteringScreenLayoutConfig get meteringScreenLayout {
final configJson = _sharedPreferences.getString(_meteringScreenLayoutKey);
if (configJson != null) {
return MeteringScreenLayoutConfigJson.fromJson(json.decode(configJson));
return MeteringScreenLayoutConfigJson.fromJson(
json.decode(configJson) as Map<String, dynamic>,
);
} else {
return {
MeteringScreenLayoutFeature.extremeExposurePairs: true,

View file

@ -2,7 +2,7 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'firebase_options.dart';
import 'package:lightmeter/firebase_options.dart';
Future<void> initializeFirebase() async {
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);

View file

@ -58,8 +58,6 @@ class MeteringInteractor {
AppSettings.openAppSettings();
}
void enableHaptics(bool enable) => _userPreferencesService.haptics = enable;
Future<bool> hasAmbientLightSensor() async {
if (Platform.isAndroid) {
return _lightSensorService.hasSensor();

View file

@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/application.dart';
import 'package:lightmeter/environment.dart';
import 'application.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const Application(Environment.dev()));

View file

@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/application.dart';
import 'package:lightmeter/environment.dart';
import 'application.dart';
import 'firebase.dart';
import 'package:lightmeter/firebase.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();

View file

@ -1,4 +1,6 @@
class PlatformConfig {
const PlatformConfig._();
static double get cameraPreviewAspectRatio {
final rational = const String.fromEnvironment('cameraPreviewAspectRatio').split('/');
return int.parse(rational[0]) / int.parse(rational[1]);

View file

@ -65,14 +65,16 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
/// Creates a default equipment profile
void addProfile(String name) {
_customProfiles.add(EquipmentProfileData(
_customProfiles.add(
EquipmentProfileData(
id: const Uuid().v1(),
name: name,
apertureValues: ApertureValue.values,
ndValues: NdValue.values,
shutterSpeedValues: ShutterSpeedValue.values,
isoValues: IsoValue.values,
));
),
);
_refreshSavedProfiles();
}

View file

@ -6,16 +6,15 @@ import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/film.dart';
import 'package:lightmeter/data/shared_prefs_service.dart';
import 'package:lightmeter/interactors/metering_interactor.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.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/screens/metering/event_metering.dart';
import 'package:lightmeter/screens/metering/state_metering.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'communication/bloc_communication_metering.dart';
import 'event_metering.dart';
import 'state_metering.dart';
class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
final MeteringCommunicationBloc _communicationBloc;
final UserPreferencesService _userPreferencesService;
@ -145,7 +144,8 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
void _emitMeasuredState(Emitter emit) {
final ev = _ev100 + log2(_iso.value / 100) - _nd.stopReduction;
emit(_isMeteringInProgress
emit(
_isMeteringInProgress
? MeteringInProgressState(
ev: ev,
film: _film,
@ -159,12 +159,13 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
iso: _iso,
nd: _nd,
exposurePairs: _buildExposureValues(ev),
));
),
);
}
List<ExposurePair> _buildExposureValues(double ev) {
if (ev.isNaN || ev.isInfinite) {
return List.empty(growable: false);
return List.empty();
}
/// Depending on the `stopType` the exposure pairs list length is multiplied by 1,2 or 3
@ -200,12 +201,14 @@ 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) {
return List.empty(growable: false);
return List.empty();
}
return List.generate(
itemsCount,

View file

@ -1,7 +1,7 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'event_communication_metering.dart';
import 'state_communication_metering.dart';
import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart';
import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart';
class MeteringCommunicationBloc
extends Bloc<MeteringCommunicationEvent, MeteringCommunicationState> {

View file

@ -73,7 +73,6 @@ class _MeteringMeasureButtonState extends State<MeteringMeasureButton> {
/// This key is needed to make indicator start from the same point every time
key: ValueKey(widget.isMetering),
color: Theme.of(context).colorScheme.onSurface,
strokeWidth: Dimens.grid4,
value: widget.isMetering ? null : 1,
),
),

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/res/dimens.dart';
import 'widget_bottom_controls.dart';
import 'package:lightmeter/screens/metering/components/bottom_controls/widget_bottom_controls.dart';
class MeteringBottomControlsProvider extends StatelessWidget {
final double? ev;

View file

@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/ev_source_type.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart';
import 'package:provider/provider.dart';
import 'components/measure_button/widget_button_measure.dart';
class MeteringBottomControls extends StatelessWidget {
final double? ev;
final bool isMetering;
@ -42,9 +41,11 @@ class MeteringBottomControls extends StatelessWidget {
child: Center(
child: IconButton(
onPressed: onSwitchEvSourceType,
icon: Icon(context.watch<EvSourceType>() != EvSourceType.camera
icon: Icon(
context.watch<EvSourceType>() != EvSourceType.camera
? Icons.camera_rear
: Icons.wb_incandescent),
: Icons.wb_incandescent,
),
),
),
)

View file

@ -2,23 +2,23 @@ import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'package:camera/camera.dart';
import 'package:exif/exif.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/interactors/metering_interactor.dart';
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
import 'package:lightmeter/screens/metering/components/shared/ev_source_base/bloc_base_ev_source.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart'
as communication_event;
import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart'
as communication_states;
import 'package:lightmeter/screens/metering/components/camera_container/event_container_camera.dart';
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
import 'package:lightmeter/screens/metering/components/camera_container/state_container_camera.dart';
import 'package:lightmeter/screens/metering/components/shared/ev_source_base/bloc_base_ev_source.dart';
import 'package:lightmeter/utils/log_2.dart';
import 'event_container_camera.dart';
import 'state_container_camera.dart';
class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraContainerState> {
final MeteringInteractor _meteringInteractor;
late final _WidgetsBindingObserver _observer;
@ -161,13 +161,15 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
}
void _emitActiveState(Emitter emit) {
emit(CameraActiveState(
emit(
CameraActiveState(
zoomRange: _zoomRange!,
currentZoom: _currentZoom,
exposureOffsetRange: _exposureOffsetRange!,
exposureOffsetStep: _exposureStep,
currentExposureOffset: _currentExposureOffset,
));
),
);
}
Future<double?> _takePhoto() async {

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/res/dimens.dart';
import 'components/exposure_offset_slider/widget_slider_exposure_offset.dart';
import 'components/zoom_slider/widget_slider_zoom.dart';
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_controls/components/exposure_offset_slider/widget_slider_exposure_offset.dart';
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_controls/components/zoom_slider/widget_slider_zoom.dart';
class CameraControls extends StatelessWidget {
final RangeValues exposureOffsetRange;

View file

@ -5,7 +5,7 @@ import 'package:flutter/services.dart';
class CameraView extends StatelessWidget {
final CameraController controller;
const CameraView({required this.controller, Key? key}) : super(key: key);
const CameraView({required this.controller, super.key});
@override
Widget build(BuildContext context) {

View file

@ -4,11 +4,10 @@ import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/film.dart';
import 'package:lightmeter/interactors/metering_interactor.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/components/camera_container/bloc_container_camera.dart';
import 'package:lightmeter/screens/metering/components/camera_container/widget_container_camera.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'bloc_container_camera.dart';
import 'widget_container_camera.dart';
class CameraContainerProvider extends StatelessWidget {
final ExposurePair? fastest;
final ExposurePair? slowest;

View file

@ -7,20 +7,19 @@ import 'package:lightmeter/features.dart';
import 'package:lightmeter/platform_config.dart';
import 'package:lightmeter/providers/metering_screen_layout_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/camera_container/bloc_container_camera.dart';
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_controls/widget_camera_controls.dart';
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_controls_placeholder/widget_placeholder_camera_controls.dart';
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_view/widget_camera_view.dart';
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_view_placeholder/widget_placeholder_camera_view.dart';
import 'package:lightmeter/screens/metering/components/camera_container/event_container_camera.dart';
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
import 'package:lightmeter/screens/metering/components/camera_container/state_container_camera.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';
import 'components/camera_controls_placeholder/widget_placeholder_camera_controls.dart';
import 'components/camera_view_placeholder/widget_placeholder_camera_view.dart';
import 'event_container_camera.dart';
import 'state_container_camera.dart';
class CameraContainer extends StatelessWidget {
final ExposurePair? fastest;
final ExposurePair? slowest;
@ -104,7 +103,7 @@ class CameraContainer extends StatelessWidget {
}
class _CameraViewBuilder extends StatelessWidget {
const _CameraViewBuilder({Key? key}) : super(key: key);
const _CameraViewBuilder();
@override
Widget build(BuildContext context) {
@ -157,7 +156,8 @@ class _CameraControlsBuilder extends StatelessWidget {
context.read<CameraContainerBloc>().add(
state.error == CameraErrorType.permissionNotGranted
? const OpenAppSettingsEvent()
: const InitializeEvent());
: const InitializeEvent(),
);
},
);
} else {

View file

@ -1,16 +1,16 @@
import 'dart:async';
import 'package:lightmeter/interactors/metering_interactor.dart';
import 'package:lightmeter/screens/metering/components/shared/ev_source_base/bloc_base_ev_source.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/communication/event_communication_metering.dart'
as communication_event;
import 'package:lightmeter/screens/metering/communication/state_communication_metering.dart'
as communication_states;
import 'package:lightmeter/screens/metering/components/light_sensor_container/event_container_light_sensor.dart';
import 'package:lightmeter/screens/metering/components/light_sensor_container/state_container_light_sensor.dart';
import 'package:lightmeter/screens/metering/components/shared/ev_source_base/bloc_base_ev_source.dart';
import 'package:lightmeter/utils/log_2.dart';
import 'event_container_light_sensor.dart';
import 'state_container_light_sensor.dart';
class LightSensorContainerBloc
extends EvSourceBlocBase<LightSensorContainerEvent, LightSensorContainerState> {
final MeteringInteractor _meteringInteractor;

View file

@ -4,11 +4,10 @@ import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/film.dart';
import 'package:lightmeter/interactors/metering_interactor.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/components/light_sensor_container/bloc_container_light_sensor.dart';
import 'package:lightmeter/screens/metering/components/light_sensor_container/widget_container_light_sensor.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'bloc_container_light_sensor.dart';
import 'widget_container_light_sensor.dart';
class LightSensorContainerProvider extends StatelessWidget {
final ExposurePair? fastest;
final ExposurePair? slowest;

View file

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/res/dimens.dart';
import 'components/empty_exposure_pairs_list/widget_list_exposure_pairs_empty.dart';
import 'components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart';
import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/components/empty_exposure_pairs_list/widget_list_exposure_pairs_empty.dart';
import 'package:lightmeter/screens/metering/components/shared/exposure_pairs_list/components/exposure_pairs_list_item/widget_item_list_exposure_pairs.dart';
class ExposurePairsList extends StatelessWidget {
final List<ExposurePair> exposurePairs;

View file

@ -59,7 +59,6 @@ class MeteringTopBarShape extends CustomPainter {
path.arcToPoint(
Offset(appendixWidth, size.height + appendixHeight + allowedRadius),
radius: circularRadius,
clockwise: true,
);
path.lineTo(appendixWidth, size.height - allowedRadius);
path.arcToPoint(
@ -98,7 +97,6 @@ class MeteringTopBarShape extends CustomPainter {
Offset(allowedRadius, -allowedRadius),
radius: Radius.circular(allowedRadius),
rotation: 90,
clockwise: true,
);
// Right side with bottom corner

View file

@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/shared/metering_top_bar/shape_top_bar_metering.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/widget_container_readings.dart';
import 'shape_top_bar_metering.dart';
class MeteringTopBar extends StatelessWidget {
final ReadingsContainer readingsContainer;
final double appendixHeight;

View file

@ -64,25 +64,29 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
_closedOpacityAnimation = Tween<double>(
begin: 1,
end: 0,
).animate(CurvedAnimation(
).animate(
CurvedAnimation(
parent: _animationController,
curve: const Interval(
0,
0.8,
curve: Curves.ease,
),
));
),
);
_openedOpacityAnimation = Tween<double>(
begin: 0,
end: 1,
).animate(CurvedAnimation(
).animate(
CurvedAnimation(
parent: _animationController,
curve: const Interval(
0.8,
1.0,
curve: Curves.easeInOut,
),
));
),
);
WidgetsBinding.instance.addPostFrameCallback((_) {
final mediaQuery = MediaQuery.of(context);
@ -100,7 +104,7 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
);
_sizeAnimation = _sizeTween.animate(_defaultCurvedAnimation);
final renderBox = _key.currentContext!.findRenderObject() as RenderBox;
final renderBox = _key.currentContext!.findRenderObject()! as RenderBox;
_closedOffset = renderBox.localToGlobal(Offset.zero);
_offsetAnimation = SizeTween(
begin: Size(
@ -125,7 +129,7 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
_elevationAnimation = Tween<double>(
begin: 0,
end: Theme.of(context).dialogTheme.elevation!,
end: Theme.of(context).dialogTheme.elevation,
).animate(_defaultCurvedAnimation);
}

View file

@ -14,7 +14,7 @@ class DialogPicker<T> extends StatefulWidget {
final DialogPickerItemTitleBuilder<T> itemTitleBuilder;
final DialogPickerItemTrailingBuilder<T>? itemTrailingBuilder;
final VoidCallback onCancel;
final ValueChanged onSelect;
final ValueChanged<T> onSelect;
const DialogPicker({
required this.icon,
@ -60,7 +60,7 @@ class _DialogPickerState<T> extends State<DialogPicker<T>> {
padding: Dimens.dialogIconTitlePadding,
child: Text(
widget.title,
style: Theme.of(context).textTheme.headlineSmall!,
style: Theme.of(context).textTheme.headlineSmall,
textAlign: TextAlign.center,
),
),
@ -74,7 +74,7 @@ class _DialogPickerState<T> extends State<DialogPicker<T>> {
),
child: Text(
widget.subtitle!,
style: Theme.of(context).textTheme.bodyMedium!,
style: Theme.of(context).textTheme.bodyMedium,
textAlign: TextAlign.center,
),
),
@ -110,7 +110,6 @@ class _DialogPickerState<T> extends State<DialogPicker<T>> {
padding: Dimens.dialogActionsPadding,
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisSize: MainAxisSize.max,
children: [
const Spacer(),
TextButton(

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'components/animated_dialog/widget_dialog_animated.dart';
import 'components/dialog_picker/widget_picker_dialog.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/animated_dialog/widget_dialog_animated.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/animated_dialog_picker/components/dialog_picker/widget_picker_dialog.dart';
class AnimatedDialogPicker<T> extends StatelessWidget {
final _key = GlobalKey<AnimatedDialogState>();

View file

@ -42,7 +42,6 @@ class ReadingValueContainer extends StatelessWidget {
padding: const EdgeInsets.all(Dimens.paddingM),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: _items,
),

View file

@ -7,11 +7,10 @@ import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/equipment_profile_provider.dart';
import 'package:lightmeter/providers/metering_screen_layout_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/animated_dialog_picker/widget_picker_dialog_animated.dart';
import 'package:lightmeter/screens/metering/components/shared/readings_container/components/reading_value_container/widget_container_reading_value.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'components/animated_dialog_picker/widget_picker_dialog_animated.dart';
import 'components/reading_value_container/widget_container_reading_value.dart';
/// Contains a column of fastest & slowest exposure pairs + a row of ISO and ND pickers
class ReadingsContainer extends StatelessWidget {
final ExposurePair? fastest;

View file

@ -7,13 +7,12 @@ import 'package:lightmeter/data/permissions_service.dart';
import 'package:lightmeter/data/shared_prefs_service.dart';
import 'package:lightmeter/interactors/metering_interactor.dart';
import 'package:lightmeter/providers/equipment_profile_provider.dart';
import 'package:lightmeter/screens/metering/bloc_metering.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/screen_metering.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'package:provider/provider.dart';
import 'bloc_metering.dart';
import 'communication/bloc_communication_metering.dart';
import 'screen_metering.dart';
class MeteringFlow extends StatefulWidget {
const MeteringFlow({super.key});

View file

@ -8,15 +8,14 @@ import 'package:lightmeter/environment.dart';
import 'package:lightmeter/providers/equipment_profile_provider.dart';
import 'package:lightmeter/providers/ev_source_type_provider.dart';
import 'package:lightmeter/providers/metering_screen_layout_provider.dart';
import 'package:lightmeter/screens/metering/bloc_metering.dart';
import 'package:lightmeter/screens/metering/components/bottom_controls/provider_bottom_controls.dart';
import 'package:lightmeter/screens/metering/components/camera_container/provider_container_camera.dart';
import 'package:lightmeter/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart';
import 'package:lightmeter/screens/metering/event_metering.dart';
import 'package:lightmeter/screens/metering/state_metering.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';
import 'components/light_sensor_container/provider_container_light_sensor.dart';
import 'bloc_metering.dart';
import 'event_metering.dart';
import 'state_metering.dart';
class MeteringScreen extends StatefulWidget {
const MeteringScreen({super.key});

View file

@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/about/components/report_issue/widget_list_tile_report_issue.dart';
import 'package:lightmeter/screens/settings/components/about/components/source_code/widget_list_tile_source_code.dart';
import 'package:lightmeter/screens/settings/components/about/components/version/widget_list_tile_version.dart';
import 'package:lightmeter/screens/settings/components/about/components/write_email/widget_list_tile_write_email.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'components/report_issue/widget_list_tile_report_issue.dart';
import 'components/source_code/widget_list_tile_source_code.dart';
import 'components/version/widget_list_tile_version.dart';
import 'components/write_email/widget_list_tile_write_email.dart';
class AboutSettingsSection extends StatelessWidget {
const AboutSettingsSection({super.key});

View file

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/interactors/settings_interactor.dart';
import 'bloc_list_tile_caffeine.dart';
import 'widget_list_tile_caffeine.dart';
import 'package:lightmeter/screens/settings/components/general/components/caffeine/bloc_list_tile_caffeine.dart';
import 'package:lightmeter/screens/settings/components/general/components/caffeine/widget_list_tile_caffeine.dart';
class CaffeineListTileProvider extends StatelessWidget {
const CaffeineListTileProvider({super.key});

View file

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'bloc_list_tile_caffeine.dart';
import 'package:lightmeter/screens/settings/components/general/components/caffeine/bloc_list_tile_caffeine.dart';
class CaffeineListTile extends StatelessWidget {
const CaffeineListTile({super.key});

View file

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/interactors/settings_interactor.dart';
import 'bloc_list_tile_haptics.dart';
import 'widget_list_tile_haptics.dart';
import 'package:lightmeter/screens/settings/components/general/components/haptics/bloc_list_tile_haptics.dart';
import 'package:lightmeter/screens/settings/components/general/components/haptics/widget_list_tile_haptics.dart';
class HapticsListTileProvider extends StatelessWidget {
const HapticsListTileProvider({super.key});

View file

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'bloc_list_tile_haptics.dart';
import 'package:lightmeter/screens/settings/components/general/components/haptics/bloc_list_tile_haptics.dart';
class HapticsListTile extends StatelessWidget {
const HapticsListTile({super.key});

View file

@ -1,11 +1,10 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/general/components/caffeine/provider_list_tile_caffeine.dart';
import 'package:lightmeter/screens/settings/components/general/components/haptics/provider_list_tile_haptics.dart';
import 'package:lightmeter/screens/settings/components/general/components/language/widget_list_tile_language.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'components/caffeine/provider_list_tile_caffeine.dart';
import 'components/haptics/provider_list_tile_haptics.dart';
import 'components/language/widget_list_tile_language.dart';
class GeneralSettingsSection extends StatelessWidget {
const GeneralSettingsSection({super.key});

View file

@ -1,8 +1,8 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/interactors/settings_interactor.dart';
import 'event_dialog_calibration.dart';
import 'state_dialog_calibration.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/event_dialog_calibration.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/state_dialog_calibration.dart';
class CalibrationDialogBloc extends Bloc<CalibrationDialogEvent, CalibrationDialogState> {
final SettingsInteractor _settingsInteractor;
@ -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));
}

View file

@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/interactors/settings_interactor.dart';
import 'bloc_dialog_calibration.dart';
import 'widget_dialog_calibration.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/bloc_dialog_calibration.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart';
class CalibrationDialogProvider extends StatelessWidget {
const CalibrationDialogProvider({super.key});

View file

@ -3,13 +3,12 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/environment.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/bloc_dialog_calibration.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/event_dialog_calibration.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/state_dialog_calibration.dart';
import 'package:lightmeter/screens/shared/centered_slider/widget_slider_centered.dart';
import 'package:lightmeter/utils/to_string_signed.dart';
import 'bloc_dialog_calibration.dart';
import 'event_dialog_calibration.dart';
import 'state_dialog_calibration.dart';
class CalibrationDialog extends StatelessWidget {
const CalibrationDialog({super.key});

View file

@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/interactors/settings_interactor.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/provider_dialog_calibration.dart';
import 'package:provider/provider.dart';
import 'components/calibration_dialog/provider_dialog_calibration.dart';
class CalibrationListTile extends StatelessWidget {
const CalibrationListTile({super.key});

View file

@ -61,7 +61,7 @@ class _DialogFilterState<T extends PhotographyValue> extends State<DialogFilter<
controlAffinity: ListTileControlAffinity.leading,
title: Text(
widget.titleAdapter(context, widget.values[index]),
style: Theme.of(context).textTheme.bodyLarge!,
style: Theme.of(context).textTheme.bodyLarge,
),
onChanged: (value) {
if (value != null) {
@ -96,7 +96,7 @@ class _DialogFilterState<T extends PhotographyValue> extends State<DialogFilter<
TextButton(
onPressed: _hasAnySelected
? () {
List<T> selectedValues = [];
final List<T> selectedValues = [];
for (int i = 0; i < widget.values.length; i++) {
if (checkboxValues[i]) {
selectedValues.add(widget.values[i]);

View file

@ -64,7 +64,6 @@ class _DialogRangePickerState<T extends PhotographyValue> extends State<DialogRa
_start.toDouble(),
_end.toDouble(),
),
min: 0,
max: widget.values.length.toDouble() - 1,
divisions: widget.values.length - 1,
onChanged: (value) {

View file

@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/components/dialog_filter/widget_dialog_filter.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/components/dialog_range_picker/widget_dialog_picker_range.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/components/dialog_filter/widget_dialog_filter.dart';
class EquipmentListTiles extends StatelessWidget {
final List<ApertureValue> selectedApertureValues;

View file

@ -3,11 +3,10 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'components/equipment_list_tiles/widget_list_tiles_equipments.dart';
class EquipmentProfileContainer extends StatefulWidget {
final EquipmentProfileData data;
final ValueChanged<EquipmentProfileData> onUpdate;
@ -73,7 +72,6 @@ class EquipmentProfileContainerState extends State<EquipmentProfileContainer>
children: [
ListTile(
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
_AnimatedNameLeading(controller: _controller),
const SizedBox(width: Dimens.grid8),

View file

@ -2,12 +2,11 @@ import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/equipment_profile_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart';
import 'package:lightmeter/screens/shared/sliver_screen/screen_sliver.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'components/equipment_profile_container/widget_container_equipment_profile.dart';
import 'components/equipment_profile_name_dialog/widget_dialog_equipment_profile_name.dart';
class EquipmentProfilesScreen extends StatefulWidget {
const EquipmentProfilesScreen({super.key});

View file

@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'components/equipment_profile_screen/screen_equipment_profile.dart';
class EquipmentProfilesListTile extends StatelessWidget {
const EquipmentProfilesListTile({super.key});
@ -14,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()),
);
},
);
}

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/shared/dialog_picker.dart/widget_dialog_picker.dart';
import 'package:lightmeter/providers/stop_type_provider.dart';
import 'package:lightmeter/screens/settings/components/shared/dialog_picker.dart/widget_dialog_picker.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
import 'package:provider/provider.dart';

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'components/meterins_screen_layout_features_dialog/widget_dialog_metering_screen_layout_features.dart';
import 'package:lightmeter/screens/settings/components/metering/components/metering_screen_layout/components/meterins_screen_layout_features_dialog/widget_dialog_metering_screen_layout_features.dart';
class MeteringScreenLayoutListTile extends StatelessWidget {
const MeteringScreenLayoutListTile({super.key});

View file

@ -1,13 +1,12 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/features.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/metering/components/calibration/widget_list_tile_calibration.dart';
import 'package:lightmeter/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart';
import 'package:lightmeter/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart';
import 'package:lightmeter/screens/settings/components/metering/components/metering_screen_layout/widget_list_tile_metering_screen_layout.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'components/calibration/widget_list_tile_calibration.dart';
import 'components/metering_screen_layout/widget_list_tile_metering_screen_layout.dart';
import 'components/equipment_profiles/widget_list_tile_equipment_profiles.dart';
import 'components/fractional_stops/widget_list_tile_fractional_stops.dart';
class MeteringSettingsSection extends StatelessWidget {
const MeteringSettingsSection({super.key});

View file

@ -57,9 +57,9 @@ class _PrimaryColorDialogPickerState extends State<PrimaryColorDialogPicker> {
),
),
),
Row(
const Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [
children: [
_Cutout(),
RotatedBox(
quarterTurns: 2,
@ -68,7 +68,8 @@ class _PrimaryColorDialogPickerState extends State<PrimaryColorDialogPicker> {
],
),
],
)),
),
),
actionsPadding: Dimens.dialogActionsPadding,
actions: [
TextButton(

View file

@ -5,7 +5,7 @@ import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/theme_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart';
import 'package:lightmeter/screens/settings/components/theme/components/primary_color/components/primary_color_picker_dialog/widget_dialog_picker_primary_color.dart';
class PrimaryColorListTile extends StatelessWidget {
const PrimaryColorListTile({super.key});

View file

@ -4,9 +4,9 @@ import 'package:lightmeter/data/models/dynamic_colors_state.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'components/dynamic_color/widget_list_tile_dynamic_color.dart';
import 'components/primary_color/widget_list_tile_primary_color.dart';
import 'components/theme_type/widget_list_tile_theme_type.dart';
import 'package:lightmeter/screens/settings/components/theme/components/dynamic_color/widget_list_tile_dynamic_color.dart';
import 'package:lightmeter/screens/settings/components/theme/components/primary_color/widget_list_tile_primary_color.dart';
import 'package:lightmeter/screens/settings/components/theme/components/theme_type/widget_list_tile_theme_type.dart';
class ThemeSettingsSection extends StatelessWidget {
const ThemeSettingsSection({super.key});

View file

@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/about/widget_settings_section_about.dart';
import 'package:lightmeter/screens/settings/components/general/widget_settings_section_general.dart';
import 'package:lightmeter/screens/settings/components/metering/widget_settings_section_metering.dart';
import 'package:lightmeter/screens/settings/components/theme/widget_settings_section_theme.dart';
import 'package:lightmeter/screens/shared/sliver_screen/screen_sliver.dart';
import 'components/about/widget_settings_section_about.dart';
import 'components/general/widget_settings_section_general.dart';
import 'components/metering/widget_settings_section_metering.dart';
import 'components/theme/widget_settings_section_theme.dart';
class SettingsScreen extends StatelessWidget {
const SettingsScreen({super.key});

View file

@ -9,7 +9,7 @@ extension SignedString on num {
}
extension SignedStringDouble on double {
String toStringSignedAsFixed(fractionDigits) {
String toStringSignedAsFixed(int fractionDigits) {
if (this > 0) {
return "+${toStringAsFixed(fractionDigits)}";
} else {

View file

@ -4,14 +4,14 @@ publish_to: "none"
version: 0.10.0+22
environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"
dependencies:
app_settings: 4.2.0
camera: 0.10.0+4
clipboard: 0.1.3
exif: 3.1.2
dynamic_color: 1.5.4
exif: 3.1.2
firebase_core: 2.11.0
firebase_crashlytics: 3.2.0
flutter:
@ -19,14 +19,14 @@ dependencies:
flutter_bloc: 8.1.1
flutter_localizations:
sdk: flutter
intl: 0.17.0
intl_utils: 2.8.1
intl: 0.18.0
intl_utils: 2.8.2
light_sensor: 2.0.2
material_color_utilities: 0.2.0
m3_lightmeter_resources:
git:
url: "https://github.com/vodemn/m3_lightmeter_resources"
ref: main
material_color_utilities: 0.2.0
package_info_plus: 3.0.2
permission_handler: 10.2.0
provider: 6.0.4
@ -36,14 +36,11 @@ dependencies:
vibration: 1.7.6
dev_dependencies:
google_fonts: 3.0.1
flutter_launcher_icons: 0.11.0
flutter_lints: 2.0.0
flutter_native_splash: 2.2.16
test: 1.22.2
dependency_overrides:
test_api: 0.4.16
google_fonts: 3.0.1
lint: 2.1.1
test: 1.24.1
flutter:
uses-material-design: true