2022-12-14 17:33:38 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2023-01-21 10:37:49 +00:00
|
|
|
import 'package:lightmeter/data/haptics_service.dart';
|
2022-12-18 09:03:41 +00:00
|
|
|
import 'package:lightmeter/data/models/ev_source_type.dart';
|
|
|
|
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
|
2022-12-16 08:08:12 +00:00
|
|
|
import 'package:lightmeter/data/shared_prefs_service.dart';
|
2023-01-21 10:37:49 +00:00
|
|
|
import 'package:lightmeter/interactors/haptics_interactor.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
2022-12-18 09:03:41 +00:00
|
|
|
|
|
|
|
import 'ev_source/camera/bloc_camera.dart';
|
|
|
|
import 'ev_source/random_ev/bloc_random_ev.dart';
|
|
|
|
import 'bloc_metering.dart';
|
|
|
|
import 'communication/bloc_communication_metering.dart';
|
2022-12-14 17:33:38 +00:00
|
|
|
import 'screen_metering.dart';
|
|
|
|
|
|
|
|
class MeteringFlow extends StatelessWidget {
|
|
|
|
const MeteringFlow({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-01-21 10:37:49 +00:00
|
|
|
return Provider(
|
|
|
|
create: (context) => HapticsInteractor(
|
|
|
|
context.read<UserPreferencesService>(),
|
|
|
|
context.read<HapticsService>(),
|
|
|
|
),
|
|
|
|
child: MultiBlocProvider(
|
|
|
|
providers: [
|
|
|
|
BlocProvider(create: (_) => MeteringCommunicationBloc()),
|
|
|
|
BlocProvider(
|
|
|
|
create: (context) => MeteringBloc(
|
|
|
|
context.read<MeteringCommunicationBloc>(),
|
|
|
|
context.read<UserPreferencesService>(),
|
|
|
|
context.read<HapticsInteractor>(),
|
|
|
|
context.read<StopType>(),
|
|
|
|
),
|
2022-12-14 17:33:38 +00:00
|
|
|
),
|
2022-12-15 11:00:28 +00:00
|
|
|
BlocProvider(
|
2023-01-21 10:37:49 +00:00
|
|
|
create: (context) => CameraBloc(
|
|
|
|
context.read<MeteringCommunicationBloc>(),
|
|
|
|
context.read<HapticsInteractor>(),
|
|
|
|
),
|
2022-12-15 11:00:28 +00:00
|
|
|
),
|
2023-01-21 10:37:49 +00:00
|
|
|
if (context.read<EvSourceType>() == EvSourceType.mock)
|
|
|
|
BlocProvider(
|
|
|
|
lazy: false,
|
|
|
|
create: (context) => RandomEvBloc(context.read<MeteringCommunicationBloc>()),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
child: const MeteringScreen(),
|
|
|
|
),
|
2022-12-14 17:33:38 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|