2022-12-14 17:33:38 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
2023-02-11 12:54:06 +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';
|
2022-12-18 09:03:41 +00:00
|
|
|
import 'package:lightmeter/data/models/photography_values/photography_value.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-01-21 10:37:49 +00:00
|
|
|
import 'package:provider/provider.dart';
|
2022-12-18 09:03:41 +00:00
|
|
|
|
|
|
|
import 'bloc_metering.dart';
|
|
|
|
import 'communication/bloc_communication_metering.dart';
|
2022-12-14 17:33:38 +00:00
|
|
|
import 'screen_metering.dart';
|
|
|
|
|
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-01-21 10:37:49 +00:00
|
|
|
context.read<UserPreferencesService>(),
|
2023-02-11 12:54:06 +00:00
|
|
|
context.read<CaffeineService>(),
|
2023-01-21 10:37:49 +00:00
|
|
|
context.read<HapticsService>(),
|
2023-02-10 21:49:51 +00:00
|
|
|
context.read<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>(),
|
|
|
|
context.read<UserPreferencesService>(),
|
2023-01-26 09:10:23 +00:00
|
|
|
context.read<MeteringInteractor>(),
|
2023-01-21 10:37:49 +00:00
|
|
|
context.read<StopType>(),
|
|
|
|
),
|
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
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|