m3_lightmeter/lib/screens/metering/flow_metering.dart
Vadim cdf7372913
ML-77 Redundant vibrations (#76)
* wip

* `MeteringScreenLayout = InheritedModelBase<MeteringScreenLayoutFeature, bool>`

* removed `Provider` from providers folder

* wip

* Update pubspec.yaml

* `context.get<MeteringInteractor>()`

* `context.get<Environment>()`

* `context.get<SettingsInteractor>()`

* typo

* fixed `MeteringScreenLayout`

* fixed redundant vibrations
2023-06-04 13:04:04 +02:00

50 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.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/interactors/metering_interactor.dart';
import 'package:lightmeter/providers/equipment_profile_provider.dart';
import 'package:lightmeter/screens/metering/bloc_metering.dart';
import 'package:lightmeter/screens/metering/communication/bloc_communication_metering.dart';
import 'package:lightmeter/screens/metering/screen_metering.dart';
import 'package:lightmeter/utils/inherited_generics.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
class MeteringFlow extends StatefulWidget {
const MeteringFlow({super.key});
@override
State<MeteringFlow> createState() => _MeteringFlowState();
}
class _MeteringFlowState extends State<MeteringFlow> {
@override
Widget build(BuildContext context) {
return InheritedWidgetBase<MeteringInteractor>(
data: MeteringInteractor(
context.get<UserPreferencesService>(),
context.get<CaffeineService>(),
context.get<HapticsService>(),
context.get<PermissionsService>(),
context.get<LightSensorService>(),
),
child: MultiBlocProvider(
providers: [
BlocProvider(create: (_) => MeteringCommunicationBloc()),
BlocProvider(
create: (context) => MeteringBloc(
context.read<MeteringCommunicationBloc>(),
context.get<MeteringInteractor>(),
context.get<EquipmentProfile>(),
context.get<StopType>(),
),
),
],
child: const MeteringScreen(),
),
);
}
}