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';
|
2022-12-11 14:04:08 +00:00
|
|
|
import 'package:lightmeter/models/photography_value.dart';
|
2022-10-29 18:02:45 +00:00
|
|
|
import 'package:lightmeter/res/dimens.dart';
|
2022-12-11 14:09:10 +00:00
|
|
|
import 'package:lightmeter/screens/settings/settings_screen.dart';
|
2022-10-24 20:25:38 +00:00
|
|
|
|
2022-10-29 11:01:15 +00:00
|
|
|
import 'components/bottom_controls/bottom_controls.dart';
|
2022-10-26 19:49:21 +00:00
|
|
|
import 'components/exposure_pairs_list/exposure_pairs_list.dart';
|
2022-10-24 20:25:38 +00:00
|
|
|
import 'components/topbar/topbar.dart';
|
2022-12-14 17:33:38 +00:00
|
|
|
import 'bloc_metering.dart';
|
|
|
|
import 'event_metering.dart';
|
|
|
|
import 'state_metering.dart';
|
2022-10-24 20:25:38 +00:00
|
|
|
|
2022-11-26 18:14:51 +00:00
|
|
|
class MeteringScreen extends StatefulWidget {
|
2022-12-11 14:09:10 +00:00
|
|
|
const MeteringScreen({super.key});
|
2022-10-24 20:25:38 +00:00
|
|
|
|
2022-11-26 18:14:51 +00:00
|
|
|
@override
|
|
|
|
State<MeteringScreen> createState() => _MeteringScreenState();
|
|
|
|
}
|
|
|
|
|
2022-11-26 19:29:00 +00:00
|
|
|
class _MeteringScreenState extends State<MeteringScreen> {
|
2022-12-11 14:04:08 +00:00
|
|
|
@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) {
|
2022-11-26 18:14:51 +00:00
|
|
|
return Stack(
|
2022-10-29 18:02:45 +00:00
|
|
|
children: [
|
2022-11-26 18:14:51 +00:00
|
|
|
Column(
|
|
|
|
children: [
|
2022-12-11 14:09:10 +00:00
|
|
|
_topBar(state),
|
2022-11-26 18:14:51 +00:00
|
|
|
Expanded(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
2022-12-11 14:09:10 +00:00
|
|
|
Expanded(child: ExposurePairsList(state.exposurePairs)),
|
2022-11-26 18:14:51 +00:00
|
|
|
],
|
2022-10-29 18:02:45 +00:00
|
|
|
),
|
2022-11-26 18:14:51 +00:00
|
|
|
),
|
2022-10-29 18:02:45 +00:00
|
|
|
),
|
2022-12-11 14:09:10 +00:00
|
|
|
_bottomBar(),
|
2022-11-26 18:14:51 +00:00
|
|
|
],
|
2022-10-29 18:02:45 +00:00
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
2022-10-24 20:25:38 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2022-11-26 18:14:51 +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)),
|
2022-12-04 19:12:52 +00:00
|
|
|
onNdChanged: (value) => context.read<MeteringBloc>().add(NdChangedEvent(value)),
|
2022-11-26 18:14:51 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _bottomBar() {
|
|
|
|
return MeteringBottomControls(
|
|
|
|
onSourceChanged: () {},
|
|
|
|
onMeasure: () => context.read<MeteringBloc>().add(const MeasureEvent()),
|
|
|
|
onSettings: () {
|
2022-12-11 14:09:10 +00:00
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => const SettingsScreen()));
|
2022-11-26 18:14:51 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
2022-10-24 20:25:38 +00:00
|
|
|
}
|