mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-26 01:10:39 +00:00
Added ServiceProviders
widget
This commit is contained in:
parent
4917ee8aef
commit
0c58597a8e
15 changed files with 128 additions and 86 deletions
|
@ -9,10 +9,10 @@ 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/providers/service_providers.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/utils/inherited_generics.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
|
@ -31,20 +31,14 @@ class LightmeterProviders extends StatelessWidget {
|
|||
]),
|
||||
builder: (_, snapshot) {
|
||||
if (snapshot.data != null) {
|
||||
return InheritedWidgetBase<Environment>(
|
||||
data: env.copyWith(hasLightSensor: snapshot.data![1] as bool),
|
||||
child: InheritedWidgetBase<UserPreferencesService>(
|
||||
data: UserPreferencesService(snapshot.data![0] as SharedPreferences),
|
||||
child: InheritedWidgetBase<LightSensorService>(
|
||||
data: const LightSensorService(LocalPlatform()),
|
||||
child: InheritedWidgetBase<CaffeineService>(
|
||||
data: const CaffeineService(),
|
||||
child: InheritedWidgetBase<HapticsService>(
|
||||
data: const HapticsService(),
|
||||
child: InheritedWidgetBase<VolumeEventsService>(
|
||||
data: const VolumeEventsService(LocalPlatform()),
|
||||
child: InheritedWidgetBase<PermissionsService>(
|
||||
data: const PermissionsService(),
|
||||
return ServiceProviders(
|
||||
caffeineService: const CaffeineService(),
|
||||
environment: env.copyWith(hasLightSensor: snapshot.data![1] as bool),
|
||||
hapticsService: const HapticsService(),
|
||||
lightSensorService: const LightSensorService(LocalPlatform()),
|
||||
permissionsService: const PermissionsService(),
|
||||
userPreferencesService: UserPreferencesService(snapshot.data![0] as SharedPreferences),
|
||||
volumeEventsService: const VolumeEventsService(LocalPlatform()),
|
||||
child: MeteringScreenLayoutProvider(
|
||||
child: StopTypeProvider(
|
||||
child: EquipmentProfileProvider(
|
||||
|
@ -60,12 +54,6 @@ class LightmeterProviders extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (snapshot.error != null) {
|
||||
return Center(child: Text(snapshot.error!.toString()));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
@ -35,7 +35,8 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
EquipmentProfile get _selectedProfile => _customProfiles.firstWhere(
|
||||
(e) => e.id == _selectedId,
|
||||
orElse: () {
|
||||
context.get<UserPreferencesService>().selectedEquipmentProfileId = _defaultProfile.id;
|
||||
ServiceProviders.userPreferencesServiceOf(context).selectedEquipmentProfileId =
|
||||
_defaultProfile.id;
|
||||
return _defaultProfile;
|
||||
},
|
||||
);
|
||||
|
@ -43,8 +44,8 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selectedId = context.get<UserPreferencesService>().selectedEquipmentProfileId;
|
||||
_customProfiles = context.get<UserPreferencesService>().equipmentProfiles;
|
||||
_selectedId = ServiceProviders.userPreferencesServiceOf(context).selectedEquipmentProfileId;
|
||||
_customProfiles = ServiceProviders.userPreferencesServiceOf(context).equipmentProfiles;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -62,7 +63,8 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
setState(() {
|
||||
_selectedId = data.id;
|
||||
});
|
||||
context.get<UserPreferencesService>().selectedEquipmentProfileId = _selectedProfile.id;
|
||||
ServiceProviders.userPreferencesServiceOf(context).selectedEquipmentProfileId =
|
||||
_selectedProfile.id;
|
||||
}
|
||||
|
||||
/// Creates a default equipment profile
|
||||
|
@ -94,7 +96,7 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
|
|||
}
|
||||
|
||||
void _refreshSavedProfiles() {
|
||||
context.get<UserPreferencesService>().equipmentProfiles = _customProfiles;
|
||||
ServiceProviders.userPreferencesServiceOf(context).equipmentProfiles = _customProfiles;
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/data/models/ev_source_type.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
|
||||
class EvSourceTypeProvider extends StatefulWidget {
|
||||
|
@ -23,9 +22,9 @@ class EvSourceTypeProviderState extends State<EvSourceTypeProvider> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final evSourceType = context.get<UserPreferencesService>().evSourceType;
|
||||
final evSourceType = ServiceProviders.userPreferencesServiceOf(context).evSourceType;
|
||||
valueListenable = ValueNotifier(
|
||||
evSourceType == EvSourceType.sensor && !context.get<Environment>().hasLightSensor
|
||||
evSourceType == EvSourceType.sensor && !ServiceProviders.environmentOf(context).hasLightSensor
|
||||
? EvSourceType.camera
|
||||
: evSourceType,
|
||||
);
|
||||
|
@ -52,12 +51,12 @@ class EvSourceTypeProviderState extends State<EvSourceTypeProvider> {
|
|||
void toggleType() {
|
||||
switch (valueListenable.value) {
|
||||
case EvSourceType.camera:
|
||||
if (context.get<Environment>().hasLightSensor) {
|
||||
if (ServiceProviders.environmentOf(context).hasLightSensor) {
|
||||
valueListenable.value = EvSourceType.sensor;
|
||||
}
|
||||
case EvSourceType.sensor:
|
||||
valueListenable.value = EvSourceType.camera;
|
||||
}
|
||||
context.get<UserPreferencesService>().evSourceType = valueListenable.value;
|
||||
ServiceProviders.userPreferencesServiceOf(context).evSourceType = valueListenable.value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
|
||||
class MeteringScreenLayoutProvider extends StatefulWidget {
|
||||
|
@ -18,7 +18,7 @@ class MeteringScreenLayoutProvider extends StatefulWidget {
|
|||
|
||||
class MeteringScreenLayoutProviderState extends State<MeteringScreenLayoutProvider> {
|
||||
late final MeteringScreenLayoutConfig _config =
|
||||
context.get<UserPreferencesService>().meteringScreenLayout;
|
||||
ServiceProviders.userPreferencesServiceOf(context).meteringScreenLayout;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -38,7 +38,7 @@ class MeteringScreenLayoutProviderState extends State<MeteringScreenLayoutProvid
|
|||
);
|
||||
});
|
||||
});
|
||||
context.get<UserPreferencesService>().meteringScreenLayout = _config;
|
||||
ServiceProviders.userPreferencesServiceOf(context).meteringScreenLayout = _config;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
64
lib/providers/service_providers.dart
Normal file
64
lib/providers/service_providers.dart
Normal file
|
@ -0,0 +1,64 @@
|
|||
import 'package:flutter/material.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/permissions_service.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/data/volume_events_service.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
|
||||
class ServiceProviders extends InheritedWidget {
|
||||
final CaffeineService caffeineService;
|
||||
final Environment environment;
|
||||
final HapticsService hapticsService;
|
||||
final LightSensorService lightSensorService;
|
||||
final PermissionsService permissionsService;
|
||||
final UserPreferencesService userPreferencesService;
|
||||
final VolumeEventsService volumeEventsService;
|
||||
|
||||
const ServiceProviders({
|
||||
required this.caffeineService,
|
||||
required this.environment,
|
||||
required this.hapticsService,
|
||||
required this.lightSensorService,
|
||||
required this.permissionsService,
|
||||
required this.userPreferencesService,
|
||||
required this.volumeEventsService,
|
||||
required super.child,
|
||||
});
|
||||
|
||||
static CaffeineService caffeineServiceOf(BuildContext context) {
|
||||
return ServiceProviders._of(context).caffeineService;
|
||||
}
|
||||
|
||||
static Environment environmentOf(BuildContext context) {
|
||||
return ServiceProviders._of(context).environment;
|
||||
}
|
||||
|
||||
static HapticsService hapticsServiceOf(BuildContext context) {
|
||||
return ServiceProviders._of(context).hapticsService;
|
||||
}
|
||||
|
||||
static LightSensorService lightSensorServiceOf(BuildContext context) {
|
||||
return ServiceProviders._of(context).lightSensorService;
|
||||
}
|
||||
|
||||
static PermissionsService permissionsServiceOf(BuildContext context) {
|
||||
return ServiceProviders._of(context).permissionsService;
|
||||
}
|
||||
|
||||
static UserPreferencesService userPreferencesServiceOf(BuildContext context) {
|
||||
return ServiceProviders._of(context).userPreferencesService;
|
||||
}
|
||||
|
||||
static VolumeEventsService volumeEventsServiceOf(BuildContext context) {
|
||||
return ServiceProviders._of(context).volumeEventsService;
|
||||
}
|
||||
|
||||
static ServiceProviders _of(BuildContext context) {
|
||||
return context.findAncestorWidgetOfExactType<ServiceProviders>()!;
|
||||
}
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(ServiceProviders oldWidget) => false;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||
|
||||
|
@ -22,7 +22,7 @@ class StopTypeProviderState extends State<StopTypeProvider> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_stopType = context.get<UserPreferencesService>().stopType;
|
||||
_stopType = ServiceProviders.userPreferencesServiceOf(context).stopType;
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -37,6 +37,6 @@ class StopTypeProviderState extends State<StopTypeProvider> {
|
|||
setState(() {
|
||||
_stopType = type;
|
||||
});
|
||||
context.get<UserPreferencesService>().stopType = type;
|
||||
ServiceProviders.userPreferencesServiceOf(context).stopType = type;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/data/models/supported_locale.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
|
||||
class SupportedLocaleProvider extends StatefulWidget {
|
||||
|
@ -23,7 +23,7 @@ class SupportedLocaleProviderState extends State<SupportedLocaleProvider> {
|
|||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
valueListenable = ValueNotifier(context.get<UserPreferencesService>().locale);
|
||||
valueListenable = ValueNotifier(ServiceProviders.userPreferencesServiceOf(context).locale);
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -47,7 +47,7 @@ class SupportedLocaleProviderState extends State<SupportedLocaleProvider> {
|
|||
void setLocale(SupportedLocale locale) {
|
||||
S.load(Locale(locale.intlName)).then((value) {
|
||||
valueListenable.value = locale;
|
||||
context.get<UserPreferencesService>().locale = locale;
|
||||
ServiceProviders.userPreferencesServiceOf(context).locale = locale;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:flutter/scheduler.dart';
|
|||
import 'package:lightmeter/data/models/dynamic_colors_state.dart';
|
||||
import 'package:lightmeter/data/models/theme_type.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
import 'package:material_color_utilities/material_color_utilities.dart';
|
||||
|
@ -44,7 +45,7 @@ class ThemeProvider extends StatefulWidget {
|
|||
}
|
||||
|
||||
class ThemeProviderState extends State<ThemeProvider> with WidgetsBindingObserver {
|
||||
UserPreferencesService get _prefs => context.get<UserPreferencesService>();
|
||||
UserPreferencesService get _prefs => ServiceProviders.userPreferencesServiceOf(context);
|
||||
|
||||
late final _themeTypeNotifier = ValueNotifier<ThemeType>(_prefs.themeType);
|
||||
late final _dynamicColorNotifier = ValueNotifier<bool>(_prefs.dynamicColor);
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
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/permissions_service.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/data/volume_events_service.dart';
|
||||
import 'package:lightmeter/interactors/metering_interactor.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:lightmeter/screens/metering/bloc_metering.dart';
|
||||
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
|
||||
import 'package:lightmeter/screens/metering/components/shared/volume_keys_notifier/notifier_volume_keys.dart';
|
||||
|
@ -25,15 +20,15 @@ class _MeteringFlowState extends State<MeteringFlow> {
|
|||
Widget build(BuildContext context) {
|
||||
return InheritedWidgetBase<MeteringInteractor>(
|
||||
data: MeteringInteractor(
|
||||
context.get<UserPreferencesService>(),
|
||||
context.get<CaffeineService>(),
|
||||
context.get<HapticsService>(),
|
||||
context.get<PermissionsService>(),
|
||||
context.get<LightSensorService>(),
|
||||
context.get<VolumeEventsService>(),
|
||||
ServiceProviders.userPreferencesServiceOf(context),
|
||||
ServiceProviders.caffeineServiceOf(context),
|
||||
ServiceProviders.hapticsServiceOf(context),
|
||||
ServiceProviders.permissionsServiceOf(context),
|
||||
ServiceProviders.lightSensorServiceOf(context),
|
||||
ServiceProviders.volumeEventsServiceOf(context),
|
||||
)..initialize(),
|
||||
child: InheritedWidgetBase<VolumeKeysNotifier>(
|
||||
data: VolumeKeysNotifier(context.get<VolumeEventsService>()),
|
||||
data: VolumeKeysNotifier(ServiceProviders.volumeEventsServiceOf(context)),
|
||||
child: MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider(create: (_) => MeteringCommunicationBloc()),
|
||||
|
|
|
@ -6,8 +6,8 @@ import 'package:lightmeter/data/models/ev_source_type.dart';
|
|||
import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||
import 'package:lightmeter/data/models/film.dart';
|
||||
import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
import 'package:lightmeter/providers/ev_source_type_provider.dart';
|
||||
import 'package:lightmeter/providers/service_providers.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';
|
||||
|
@ -45,7 +45,7 @@ class MeteringScreen extends StatelessWidget {
|
|||
builder: (context, state) => MeteringBottomControlsProvider(
|
||||
ev: state is MeteringDataState ? state.ev : null,
|
||||
isMetering: state.isMetering,
|
||||
onSwitchEvSourceType: context.get<Environment>().hasLightSensor
|
||||
onSwitchEvSourceType: ServiceProviders.environmentOf(context).hasLightSensor
|
||||
? EvSourceTypeProvider.of(context).toggleType
|
||||
: null,
|
||||
onMeasure: () => context.read<MeteringBloc>().add(const MeasureEvent()),
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ReportIssueListTile extends StatelessWidget {
|
||||
|
@ -14,7 +13,7 @@ class ReportIssueListTile extends StatelessWidget {
|
|||
title: Text(S.of(context).reportIssue),
|
||||
onTap: () {
|
||||
launchUrl(
|
||||
Uri.parse(context.get<Environment>().issuesReportUrl),
|
||||
Uri.parse(ServiceProviders.environmentOf(context).issuesReportUrl),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class SourceCodeListTile extends StatelessWidget {
|
||||
|
@ -14,7 +13,7 @@ class SourceCodeListTile extends StatelessWidget {
|
|||
title: Text(S.of(context).sourceCode),
|
||||
onTap: () {
|
||||
launchUrl(
|
||||
Uri.parse(context.get<Environment>().sourceCodeUrl),
|
||||
Uri.parse(ServiceProviders.environmentOf(context).sourceCodeUrl),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import 'package:clipboard/clipboard.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class WriteEmailListTile extends StatelessWidget {
|
||||
|
@ -14,7 +13,7 @@ class WriteEmailListTile extends StatelessWidget {
|
|||
leading: const Icon(Icons.email),
|
||||
title: Text(S.of(context).writeEmail),
|
||||
onTap: () {
|
||||
final email = context.get<Environment>().contactEmail;
|
||||
final email = ServiceProviders.environmentOf(context).contactEmail;
|
||||
final mailToUrl = Uri.parse('mailto:$email?subject=M3 Lightmeter');
|
||||
canLaunchUrl(mailToUrl).then((canLaunch) {
|
||||
if (canLaunch) {
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/providers/service_providers.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/inherited_generics.dart';
|
||||
import 'package:lightmeter/utils/to_string_signed.dart';
|
||||
|
||||
class CalibrationDialog extends StatelessWidget {
|
||||
|
@ -15,7 +14,7 @@ class CalibrationDialog extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool hasLightSensor = context.get<Environment>().hasLightSensor;
|
||||
final bool hasLightSensor = ServiceProviders.environmentOf(context).hasLightSensor;
|
||||
return AlertDialog(
|
||||
icon: const Icon(Icons.settings_brightness),
|
||||
titlePadding: Dimens.dialogIconTitlePadding,
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/data/caffeine_service.dart';
|
||||
import 'package:lightmeter/data/haptics_service.dart';
|
||||
import 'package:lightmeter/data/shared_prefs_service.dart';
|
||||
import 'package:lightmeter/data/volume_events_service.dart';
|
||||
import 'package:lightmeter/interactors/settings_interactor.dart';
|
||||
import 'package:lightmeter/providers/service_providers.dart';
|
||||
import 'package:lightmeter/screens/settings/screen_settings.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
|
||||
|
@ -14,10 +11,10 @@ class SettingsFlow extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return InheritedWidgetBase<SettingsInteractor>(
|
||||
data: SettingsInteractor(
|
||||
context.get<UserPreferencesService>(),
|
||||
context.get<CaffeineService>(),
|
||||
context.get<HapticsService>(),
|
||||
context.get<VolumeEventsService>(),
|
||||
ServiceProviders.userPreferencesServiceOf(context),
|
||||
ServiceProviders.caffeineServiceOf(context),
|
||||
ServiceProviders.hapticsServiceOf(context),
|
||||
ServiceProviders.volumeEventsServiceOf(context),
|
||||
),
|
||||
child: const SettingsScreen(),
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue