m3_lightmeter/lib/screens/settings/flow_settings.dart

39 lines
1.1 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:lightmeter/interactors/settings_interactor.dart';
2023-08-13 19:14:32 +00:00
import 'package:lightmeter/providers/services_provider.dart';
import 'package:lightmeter/screens/settings/screen_settings.dart';
class SettingsFlow extends StatelessWidget {
const SettingsFlow({super.key});
@override
Widget build(BuildContext context) {
2023-08-13 19:59:37 +00:00
return SettingsInteractorProvider(
data: SettingsInteractor(
2023-08-13 19:14:32 +00:00
ServicesProvider.userPreferencesServiceOf(context),
ServicesProvider.caffeineServiceOf(context),
ServicesProvider.hapticsServiceOf(context),
ServicesProvider.volumeEventsServiceOf(context),
),
child: const SettingsScreen(),
);
}
}
2023-08-13 19:59:37 +00:00
class SettingsInteractorProvider extends InheritedWidget {
final SettingsInteractor data;
const SettingsInteractorProvider({
required this.data,
required super.child,
super.key,
});
static SettingsInteractor of(BuildContext context) {
return context.findAncestorWidgetOfExactType<SettingsInteractorProvider>()!.data;
}
@override
bool updateShouldNotify(SettingsInteractorProvider oldWidget) => false;
}