2022-12-14 17:33:38 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2023-02-11 12:58:47 +00:00
|
|
|
import 'package:lightmeter/data/caffeine_service.dart';
|
2023-01-21 10:37:49 +00:00
|
|
|
import 'package:lightmeter/data/haptics_service.dart';
|
2023-01-29 16:57:47 +00:00
|
|
|
import 'package:lightmeter/data/light_sensor_service.dart';
|
2023-02-10 21:49:51 +00:00
|
|
|
import 'package:lightmeter/data/permissions_service.dart';
|
2022-12-16 08:08:12 +00:00
|
|
|
import 'package:lightmeter/data/shared_prefs_service.dart';
|
2023-01-26 09:10:23 +00:00
|
|
|
import 'package:lightmeter/interactors/metering_interactor.dart';
|
2023-05-11 13:30:18 +00:00
|
|
|
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';
|
2023-06-04 11:04:04 +00:00
|
|
|
import 'package:lightmeter/utils/inherited_generics.dart';
|
2022-12-18 09:03:41 +00:00
|
|
|
|
2023-01-29 16:57:47 +00:00
|
|
|
class MeteringFlow extends StatefulWidget {
|
2022-12-14 17:33:38 +00:00
|
|
|
const MeteringFlow({super.key});
|
|
|
|
|
2023-01-29 16:57:47 +00:00
|
|
|
@override
|
|
|
|
State<MeteringFlow> createState() => _MeteringFlowState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MeteringFlowState extends State<MeteringFlow> {
|
2022-12-14 17:33:38 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-06-04 11:04:04 +00:00
|
|
|
return InheritedWidgetBase<MeteringInteractor>(
|
|
|
|
data: MeteringInteractor(
|
|
|
|
context.get<UserPreferencesService>(),
|
|
|
|
context.get<CaffeineService>(),
|
|
|
|
context.get<HapticsService>(),
|
|
|
|
context.get<PermissionsService>(),
|
|
|
|
context.get<LightSensorService>(),
|
2023-01-21 10:37:49 +00:00
|
|
|
),
|
|
|
|
child: MultiBlocProvider(
|
|
|
|
providers: [
|
|
|
|
BlocProvider(create: (_) => MeteringCommunicationBloc()),
|
|
|
|
BlocProvider(
|
|
|
|
create: (context) => MeteringBloc(
|
|
|
|
context.read<MeteringCommunicationBloc>(),
|
2023-06-04 11:04:04 +00:00
|
|
|
context.get<MeteringInteractor>(),
|
2023-01-21 10:37:49 +00:00
|
|
|
),
|
2022-12-14 17:33:38 +00:00
|
|
|
),
|
2023-01-21 10:37:49 +00:00
|
|
|
],
|
|
|
|
child: const MeteringScreen(),
|
|
|
|
),
|
2022-12-14 17:33:38 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|