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-03-30 19:24:18 +00:00
|
|
|
import 'package:lightmeter/providers/equipment_profile_provider.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-05-17 08:23:32 +00:00
|
|
|
import 'package:lightmeter/utils/inherited_generics.dart';
|
2023-03-30 19:24:18 +00:00
|
|
|
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.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-01-21 10:37:49 +00:00
|
|
|
return Provider(
|
2023-01-26 09:10:23 +00:00
|
|
|
create: (context) => MeteringInteractor(
|
2023-05-18 18:20:15 +00:00
|
|
|
context.get<UserPreferencesService>(),
|
|
|
|
context.get<CaffeineService>(),
|
|
|
|
context.get<HapticsService>(),
|
|
|
|
context.get<PermissionsService>(),
|
2023-01-29 16:57:47 +00:00
|
|
|
context.read<LightSensorService>(),
|
2023-01-21 10:37:49 +00:00
|
|
|
),
|
|
|
|
child: MultiBlocProvider(
|
|
|
|
providers: [
|
|
|
|
BlocProvider(create: (_) => MeteringCommunicationBloc()),
|
|
|
|
BlocProvider(
|
|
|
|
create: (context) => MeteringBloc(
|
|
|
|
context.read<MeteringCommunicationBloc>(),
|
2023-01-26 09:10:23 +00:00
|
|
|
context.read<MeteringInteractor>(),
|
2023-05-18 17:56:13 +00:00
|
|
|
context.get<EquipmentProfile>(),
|
2023-05-17 08:23:32 +00:00
|
|
|
context.get<StopType>(),
|
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
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|