import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:lightmeter/models/photography_value.dart'; import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/screens/settings/settings_screen.dart'; import 'components/bottom_controls/bottom_controls.dart'; import 'components/exposure_pairs_list/exposure_pairs_list.dart'; import 'components/topbar/topbar.dart'; import 'bloc_metering.dart'; import 'event_metering.dart'; import 'state_metering.dart'; class MeteringScreen extends StatefulWidget { const MeteringScreen({super.key}); @override State createState() => _MeteringScreenState(); } class _MeteringScreenState extends State { @override void didChangeDependencies() { super.didChangeDependencies(); context.read().add(StopTypeChangedEvent(context.watch())); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Theme.of(context).colorScheme.background, body: BlocBuilder( builder: (context, state) { return Stack( children: [ Column( children: [ _topBar(state), Expanded( child: Padding( padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM), child: Row( children: [ Expanded(child: ExposurePairsList(state.exposurePairs)), ], ), ), ), _bottomBar(), ], ), ], ); }, ), ); } Widget _topBar(MeteringState state) { return MeteringTopBar( fastest: state.fastest, slowest: state.slowest, ev: state.ev, iso: state.iso, nd: state.nd, onIsoChanged: (value) => context.read().add(IsoChangedEvent(value)), onNdChanged: (value) => context.read().add(NdChangedEvent(value)), ); } Widget _bottomBar() { return MeteringBottomControls( onSourceChanged: () {}, onMeasure: () => context.read().add(const MeasureEvent()), onSettings: () { Navigator.push(context, MaterialPageRoute(builder: (context) => const SettingsScreen())); }, ); } }