mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +00:00
48 lines
1.7 KiB
Dart
48 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lightmeter/data/analytics/analytics.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';
|
|
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
|
|
|
|
// coverage:ignore-start
|
|
class ServicesProvider extends InheritedWidget {
|
|
final LightmeterAnalytics analytics;
|
|
final CaffeineService caffeineService;
|
|
final Environment environment;
|
|
final HapticsService hapticsService;
|
|
final LightSensorService lightSensorService;
|
|
final PermissionsService permissionsService;
|
|
final UserPreferencesService userPreferencesService;
|
|
final VolumeEventsService volumeEventsService;
|
|
|
|
// IAP
|
|
final FilmsStorageService filmsStorageService;
|
|
|
|
const ServicesProvider({
|
|
required this.analytics,
|
|
required this.caffeineService,
|
|
required this.environment,
|
|
required this.hapticsService,
|
|
required this.lightSensorService,
|
|
required this.permissionsService,
|
|
required this.userPreferencesService,
|
|
required this.volumeEventsService,
|
|
required this.filmsStorageService,
|
|
required super.child,
|
|
});
|
|
|
|
static ServicesProvider of(BuildContext context) => ServicesProvider.maybeOf(context)!;
|
|
|
|
static ServicesProvider? maybeOf(BuildContext context) {
|
|
return context.findAncestorWidgetOfExactType<ServicesProvider>();
|
|
}
|
|
|
|
@override
|
|
bool updateShouldNotify(ServicesProvider oldWidget) => false;
|
|
}
|
|
// coverage:ignore-end
|