From 424c54e5e58879b342700a1cc63d9dbe24921aa3 Mon Sep 17 00:00:00 2001 From: Vadim Date: Tue, 30 May 2023 17:37:48 +0200 Subject: [PATCH] `context.get()` --- .../camera_container/provider_container_camera.dart | 3 ++- .../provider_container_light_sensor.dart | 3 ++- lib/screens/metering/flow_metering.dart | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/screens/metering/components/camera_container/provider_container_camera.dart b/lib/screens/metering/components/camera_container/provider_container_camera.dart index c334ecd..81357f7 100644 --- a/lib/screens/metering/components/camera_container/provider_container_camera.dart +++ b/lib/screens/metering/components/camera_container/provider_container_camera.dart @@ -6,6 +6,7 @@ import 'package:lightmeter/interactors/metering_interactor.dart'; import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart'; import 'package:lightmeter/screens/metering/components/camera_container/bloc_container_camera.dart'; import 'package:lightmeter/screens/metering/components/camera_container/widget_container_camera.dart'; +import 'package:lightmeter/utils/inherited_generics.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class CameraContainerProvider extends StatelessWidget { @@ -37,7 +38,7 @@ class CameraContainerProvider extends StatelessWidget { return BlocProvider( lazy: false, create: (context) => CameraContainerBloc( - context.read(), + context.get(), context.read(), ), child: CameraContainer( diff --git a/lib/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart b/lib/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart index ab2b626..c7423fc 100644 --- a/lib/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart +++ b/lib/screens/metering/components/light_sensor_container/provider_container_light_sensor.dart @@ -6,6 +6,7 @@ import 'package:lightmeter/interactors/metering_interactor.dart'; import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart'; import 'package:lightmeter/screens/metering/components/light_sensor_container/bloc_container_light_sensor.dart'; import 'package:lightmeter/screens/metering/components/light_sensor_container/widget_container_light_sensor.dart'; +import 'package:lightmeter/utils/inherited_generics.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class LightSensorContainerProvider extends StatelessWidget { @@ -37,7 +38,7 @@ class LightSensorContainerProvider extends StatelessWidget { return BlocProvider( lazy: false, create: (context) => LightSensorContainerBloc( - context.read(), + context.get(), context.read(), ), child: LightSensorContainer( diff --git a/lib/screens/metering/flow_metering.dart b/lib/screens/metering/flow_metering.dart index ae35f2c..2effc55 100644 --- a/lib/screens/metering/flow_metering.dart +++ b/lib/screens/metering/flow_metering.dart @@ -23,8 +23,8 @@ class MeteringFlow extends StatefulWidget { class _MeteringFlowState extends State { @override Widget build(BuildContext context) { - return Provider( - create: (context) => MeteringInteractor( + return InheritedWidgetBase( + data: MeteringInteractor( context.get(), context.get(), context.get(), @@ -37,7 +37,7 @@ class _MeteringFlowState extends State { BlocProvider( create: (context) => MeteringBloc( context.read(), - context.read(), + context.get(), context.get(), context.get(), ),