2023-01-26 09:10:23 +00:00
|
|
|
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';
|
2023-01-26 09:10:23 +00:00
|
|
|
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(
|
2023-06-04 11:04:04 +00:00
|
|
|
data: SettingsInteractor(
|
2023-08-13 20:19:14 +00:00
|
|
|
ServicesProvider.of(context).userPreferencesService,
|
|
|
|
ServicesProvider.of(context).caffeineService,
|
|
|
|
ServicesProvider.of(context).hapticsService,
|
|
|
|
ServicesProvider.of(context).volumeEventsService,
|
2023-01-26 09:10:23 +00:00
|
|
|
),
|
|
|
|
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;
|
|
|
|
}
|