m3_lightmeter/lib/screens/metering/screen_metering.dart

96 lines
3.2 KiB
Dart
Raw Normal View History

2022-10-24 20:25:38 +00:00
import 'package:flutter/material.dart';
2022-10-29 18:02:45 +00:00
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/models/photography_values/photography_value.dart';
2022-10-29 18:02:45 +00:00
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/settings/screen_settings.dart';
2022-10-24 20:25:38 +00:00
import 'components/bottom_controls/widget_bottom_controls.dart';
import 'components/camera/widget_exposure_slider.dart';
import 'components/camera/widget_zoom_camera.dart';
import 'components/exposure_pairs_list/widget_list_exposure_pairs.dart';
import 'components/topbar/widget_topbar.dart';
import 'bloc_metering.dart';
import 'event_metering.dart';
import 'state_metering.dart';
2022-10-24 20:25:38 +00:00
class MeteringScreen extends StatefulWidget {
const MeteringScreen({super.key});
2022-10-24 20:25:38 +00:00
@override
State<MeteringScreen> createState() => _MeteringScreenState();
}
2022-11-26 19:29:00 +00:00
class _MeteringScreenState extends State<MeteringScreen> {
@override
void didChangeDependencies() {
super.didChangeDependencies();
context.read<MeteringBloc>().add(StopTypeChangedEvent(context.watch<StopType>()));
}
2022-10-24 20:25:38 +00:00
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
2022-10-29 18:02:45 +00:00
body: BlocBuilder<MeteringBloc, MeteringState>(
builder: (context, state) {
return Stack(
2022-10-29 18:02:45 +00:00
children: [
Column(
children: [
_topBar(state),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
child: Row(
children: [
Expanded(child: ExposurePairsList(state.exposurePairs)),
const SizedBox(width: Dimens.grid8),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: Dimens.paddingM),
child: Column(
children: const [
Expanded(child: CameraExposureSlider()),
SizedBox(height: Dimens.grid24),
CameraZoomSlider(),
],
),
),
),
],
2022-10-29 18:02:45 +00:00
),
),
2022-10-29 18:02:45 +00:00
),
_bottomBar(),
],
2022-10-29 18:02:45 +00:00
),
],
);
},
2022-10-24 20:25:38 +00:00
),
);
}
Widget _topBar(MeteringState state) {
return MeteringTopBar(
fastest: state.fastest,
slowest: state.slowest,
ev: state.ev,
iso: state.iso,
nd: state.nd,
2022-12-04 19:00:43 +00:00
onIsoChanged: (value) => context.read<MeteringBloc>().add(IsoChangedEvent(value)),
onNdChanged: (value) => context.read<MeteringBloc>().add(NdChangedEvent(value)),
);
}
Widget _bottomBar() {
return MeteringBottomControls(
onSourceChanged: () {},
onMeasure: () => context.read<MeteringBloc>().add(const MeasureEvent()),
onSettings: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => const SettingsScreen()));
},
);
}
2022-10-24 20:25:38 +00:00
}