mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
wip
This commit is contained in:
parent
3e5587a365
commit
423694a50c
4 changed files with 33 additions and 30 deletions
|
@ -135,7 +135,11 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
_meteringInteractor.quickVibration();
|
_meteringInteractor.quickVibration();
|
||||||
_communicationBloc.add(const communication_events.MeasureEvent());
|
_communicationBloc.add(const communication_events.MeasureEvent());
|
||||||
_isMeteringInProgress = true;
|
_isMeteringInProgress = true;
|
||||||
emit(const LoadingState());
|
emit(LoadingState(
|
||||||
|
film: _film,
|
||||||
|
iso: _iso,
|
||||||
|
nd: _nd,
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateMeasurements() => _handleEv100(_ev100);
|
void _updateMeasurements() => _handleEv100(_ev100);
|
||||||
|
|
|
@ -98,13 +98,6 @@ class _EvValueText extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (ev.isNaN || ev.isInfinite) {
|
|
||||||
return Icon(
|
|
||||||
Icons.error,
|
|
||||||
color: Theme.of(context).colorScheme.surface,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
return Text(
|
return Text(
|
||||||
'${ev.toStringAsFixed(1)}\n${S.of(context).ev}',
|
'${ev.toStringAsFixed(1)}\n${S.of(context).ev}',
|
||||||
|
|
|
@ -44,20 +44,17 @@ class _MeteringScreenState extends State<MeteringScreen> {
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: BlocBuilder<MeteringBloc, MeteringState>(
|
child: BlocBuilder<MeteringBloc, MeteringState>(
|
||||||
buildWhen: (_, current) => current is MeteringDataState,
|
builder: (_, state) => _MeteringContainerBuidler(
|
||||||
builder: (_, state) => state is MeteringDataState
|
fastest: state is MeteringDataState ? state.fastest : null,
|
||||||
? _MeteringContainerBuidler(
|
slowest: state is MeteringDataState ? state.slowest : null,
|
||||||
fastest: state.fastest,
|
exposurePairs: state is MeteringDataState ? state.exposurePairs : [],
|
||||||
slowest: state.slowest,
|
|
||||||
film: state.film,
|
film: state.film,
|
||||||
iso: state.iso,
|
iso: state.iso,
|
||||||
nd: state.nd,
|
nd: state.nd,
|
||||||
onFilmChanged: (value) => _bloc.add(FilmChangedEvent(value)),
|
onFilmChanged: (value) => _bloc.add(FilmChangedEvent(value)),
|
||||||
onIsoChanged: (value) => _bloc.add(IsoChangedEvent(value)),
|
onIsoChanged: (value) => _bloc.add(IsoChangedEvent(value)),
|
||||||
onNdChanged: (value) => _bloc.add(NdChangedEvent(value)),
|
onNdChanged: (value) => _bloc.add(NdChangedEvent(value)),
|
||||||
exposurePairs: state.exposurePairs,
|
),
|
||||||
)
|
|
||||||
: const SizedBox.shrink(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
BlocBuilder<MeteringBloc, MeteringState>(
|
BlocBuilder<MeteringBloc, MeteringState>(
|
||||||
|
|
|
@ -5,26 +5,35 @@ import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
|
||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
abstract class MeteringState {
|
abstract class MeteringState {
|
||||||
const MeteringState();
|
final Film film;
|
||||||
|
final IsoValue iso;
|
||||||
|
final NdValue nd;
|
||||||
|
|
||||||
|
const MeteringState({
|
||||||
|
required this.film,
|
||||||
|
required this.iso,
|
||||||
|
required this.nd,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class LoadingState extends MeteringState {
|
class LoadingState extends MeteringState {
|
||||||
const LoadingState();
|
const LoadingState({
|
||||||
|
required super.film,
|
||||||
|
required super.iso,
|
||||||
|
required super.nd,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class MeteringDataState extends MeteringState {
|
class MeteringDataState extends MeteringState {
|
||||||
final double? ev;
|
final double? ev;
|
||||||
final Film film;
|
|
||||||
final IsoValue iso;
|
|
||||||
final NdValue nd;
|
|
||||||
final List<ExposurePair> exposurePairs;
|
final List<ExposurePair> exposurePairs;
|
||||||
final bool continuousMetering;
|
final bool continuousMetering;
|
||||||
|
|
||||||
const MeteringDataState({
|
const MeteringDataState({
|
||||||
required this.ev,
|
required this.ev,
|
||||||
required this.film,
|
required super.film,
|
||||||
required this.iso,
|
required super.iso,
|
||||||
required this.nd,
|
required super.nd,
|
||||||
required this.exposurePairs,
|
required this.exposurePairs,
|
||||||
required this.continuousMetering,
|
required this.continuousMetering,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue