m3_lightmeter/lib/providers/services_provider.dart
Vadim 5adcee00dd
ML-105 Hide providers from the widget tree (#106)
* Added `ServiceProviders` widget

* Added `EnumProviders` widget for enum values

* Moved `ThemeProvider` functionality to `EnumProviders`

* Style

* `EnumProviders` -> `UserPreferencesProvider`

* `ServiceProviders` -> `ServiceProvider`

* Moved `MeteringScreenLayoutProvider` functionality to `UserPreferencesProvider`

* typo

* Removed `InheritedModelAspectListener`

* TODO

* Removed Inherited Generics

* Removed redundant `LightmeterProviders`

* Removed redundant methods from `ServicesProvider`

* `_inheritFrom` -> `_inheritFromEnumsModel`

* Fixed `MeteringScreenLayoutConfig` updates

* Separated `_ThemeModel`

* typo

* `_EnumsModel` -> `_UserPreferencesModel`
2023-08-14 12:25:37 +02:00

36 lines
1.3 KiB
Dart

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 ServicesProvider extends InheritedWidget {
final CaffeineService caffeineService;
final Environment environment;
final HapticsService hapticsService;
final LightSensorService lightSensorService;
final PermissionsService permissionsService;
final UserPreferencesService userPreferencesService;
final VolumeEventsService volumeEventsService;
const ServicesProvider({
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 ServicesProvider of(BuildContext context) {
return context.findAncestorWidgetOfExactType<ServicesProvider>()!;
}
@override
bool updateShouldNotify(ServicesProvider oldWidget) => false;
}