mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-24 00:10:47 +00:00
context.get<SettingsInteractor>()
This commit is contained in:
parent
0d5ce84683
commit
ed28d2d9fc
5 changed files with 11 additions and 7 deletions
|
@ -4,6 +4,7 @@ import 'package:lightmeter/interactors/settings_interactor.dart';
|
|||
|
||||
import 'package:lightmeter/screens/settings/components/general/components/caffeine/bloc_list_tile_caffeine.dart';
|
||||
import 'package:lightmeter/screens/settings/components/general/components/caffeine/widget_list_tile_caffeine.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
|
||||
class CaffeineListTileProvider extends StatelessWidget {
|
||||
const CaffeineListTileProvider({super.key});
|
||||
|
@ -11,7 +12,7 @@ class CaffeineListTileProvider extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => CaffeineListTileBloc(context.read<SettingsInteractor>()),
|
||||
create: (context) => CaffeineListTileBloc(context.get<SettingsInteractor>()),
|
||||
child: const CaffeineListTile(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:lightmeter/interactors/settings_interactor.dart';
|
|||
|
||||
import 'package:lightmeter/screens/settings/components/general/components/haptics/bloc_list_tile_haptics.dart';
|
||||
import 'package:lightmeter/screens/settings/components/general/components/haptics/widget_list_tile_haptics.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
|
||||
class HapticsListTileProvider extends StatelessWidget {
|
||||
const HapticsListTileProvider({super.key});
|
||||
|
@ -11,7 +12,7 @@ class HapticsListTileProvider extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => HapticsListTileBloc(context.read<SettingsInteractor>()),
|
||||
create: (context) => HapticsListTileBloc(context.get<SettingsInteractor>()),
|
||||
child: const HapticsListTile(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:lightmeter/interactors/settings_interactor.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/widget_dialog_calibration.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
|
||||
class CalibrationDialogProvider extends StatelessWidget {
|
||||
const CalibrationDialogProvider({super.key});
|
||||
|
@ -11,7 +12,7 @@ class CalibrationDialogProvider extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => CalibrationDialogBloc(context.read<SettingsInteractor>()),
|
||||
create: (context) => CalibrationDialogBloc(context.get<SettingsInteractor>()),
|
||||
child: const CalibrationDialog(),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/interactors/settings_interactor.dart';
|
||||
import 'package:lightmeter/screens/settings/components/metering/components/calibration/components/calibration_dialog/provider_dialog_calibration.dart';
|
||||
import 'package:lightmeter/utils/inherited_generics.dart';
|
||||
|
||||
class CalibrationListTile extends StatelessWidget {
|
||||
const CalibrationListTile({super.key});
|
||||
|
@ -14,8 +15,8 @@ class CalibrationListTile extends StatelessWidget {
|
|||
onTap: () {
|
||||
showDialog<double>(
|
||||
context: context,
|
||||
builder: (_) => Provider.value(
|
||||
value: context.read<SettingsInteractor>(),
|
||||
builder: (_) => InheritedWidgetBase(
|
||||
data: context.get<SettingsInteractor>(),
|
||||
child: const CalibrationDialogProvider(),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -11,8 +11,8 @@ class SettingsFlow extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Provider(
|
||||
create: (context) => SettingsInteractor(
|
||||
return InheritedWidgetBase<SettingsInteractor>(
|
||||
data: SettingsInteractor(
|
||||
context.get<UserPreferencesService>(),
|
||||
context.get<CaffeineService>(),
|
||||
context.get<HapticsService>(),
|
||||
|
|
Loading…
Reference in a new issue