mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
Logic & UI improvements
added inner insets to `ReadingContainer` provide bloc for `CameraView` in dialog measure on camera loaded
This commit is contained in:
parent
9b0b387514
commit
a054a55f15
3 changed files with 92 additions and 74 deletions
|
@ -67,6 +67,11 @@ class CameraBloc extends Bloc<CameraEvent, CameraState> {
|
|||
await _cameraController!.initialize();
|
||||
await _cameraController!.setFlashMode(FlashMode.off);
|
||||
emit(CameraReadyState(_cameraController!));
|
||||
_takePhoto().then((ev100) {
|
||||
if (ev100 != null) {
|
||||
_communicationBloc.add(communication_event.MeasuredEvent(ev100));
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
emit(const CameraErrorState());
|
||||
}
|
||||
|
|
|
@ -3,12 +3,20 @@ import 'package:lightmeter/res/dimens.dart';
|
|||
import 'package:lightmeter/screens/metering/components/topbar/models/reading_value.dart';
|
||||
|
||||
class ReadingContainer extends StatelessWidget {
|
||||
final List<_ReadingValueBuilder> _items;
|
||||
late final List<Widget> _items;
|
||||
|
||||
ReadingContainer({
|
||||
required List<ReadingValue> values,
|
||||
super.key,
|
||||
}) : _items = values.map((e) => _ReadingValueBuilder(e)).toList();
|
||||
}) {
|
||||
_items = [];
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
if (i > 0) {
|
||||
_items.add(const SizedBox(height: Dimens.grid8));
|
||||
}
|
||||
_items.add(_ReadingValueBuilder(values[i]));
|
||||
}
|
||||
}
|
||||
|
||||
ReadingContainer.singleValue({
|
||||
required ReadingValue value,
|
||||
|
@ -25,7 +33,7 @@ class ReadingContainer extends StatelessWidget {
|
|||
padding: const EdgeInsets.all(Dimens.paddingM),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: _items,
|
||||
),
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:lightmeter/data/ev_source/camera/bloc_camera.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/models/exposure_pair.dart';
|
||||
import 'package:lightmeter/models/iso_value.dart';
|
||||
|
@ -47,85 +49,88 @@ class MeteringTopBar extends StatelessWidget {
|
|||
bottom: false,
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ReadingContainer(
|
||||
values: [
|
||||
ReadingValue(
|
||||
label: S.of(context).fastestExposurePair,
|
||||
value: fastest != null
|
||||
? '${fastest!.aperture.toString()} - ${fastest!.shutterSpeed.toString()}'
|
||||
: 'N/A',
|
||||
),
|
||||
ReadingValue(
|
||||
label: S.of(context).slowestExposurePair,
|
||||
value: fastest != null
|
||||
? '${slowest!.aperture.toString()} - ${slowest!.shutterSpeed.toString()}'
|
||||
: 'N/A',
|
||||
),
|
||||
],
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
ReadingContainer(
|
||||
values: [
|
||||
ReadingValue(
|
||||
label: S.of(context).fastestExposurePair,
|
||||
value: fastest != null
|
||||
? '${fastest!.aperture.toString()} - ${fastest!.shutterSpeed.toString()}'
|
||||
: 'N/A',
|
||||
),
|
||||
),
|
||||
const _InnerPadding(),
|
||||
ReadingContainer.singleValue(
|
||||
value: ReadingValue(
|
||||
label: 'EV',
|
||||
value: ev.toString(),
|
||||
ReadingValue(
|
||||
label: S.of(context).slowestExposurePair,
|
||||
value: fastest != null
|
||||
? '${slowest!.aperture.toString()} - ${slowest!.shutterSpeed.toString()}'
|
||||
: 'N/A',
|
||||
),
|
||||
],
|
||||
),
|
||||
/*
|
||||
const _InnerPadding(),
|
||||
ReadingContainer.singleValue(
|
||||
value: ReadingValue(
|
||||
label: 'EV',
|
||||
value: ev.toStringAsFixed(1),
|
||||
),
|
||||
const _InnerPadding(),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _AnimatedDialogPicker(
|
||||
title: S.of(context).iso,
|
||||
subtitle: S.of(context).filmSpeed,
|
||||
selectedValue: iso,
|
||||
values: isoValues,
|
||||
itemTitleBuilder: (_, value) => Text(value.value.toString()),
|
||||
// using ascending order, because increase in film speed rises EV
|
||||
evDifferenceBuilder: (selected, other) => selected.toStringDifference(other),
|
||||
onChanged: onIsoChanged,
|
||||
),
|
||||
),
|
||||
*/
|
||||
const _InnerPadding(),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _AnimatedDialogPicker(
|
||||
title: S.of(context).iso,
|
||||
subtitle: S.of(context).filmSpeed,
|
||||
selectedValue: iso,
|
||||
values: isoValues,
|
||||
itemTitleBuilder: (_, value) => Text(value.value.toString()),
|
||||
// using ascending order, because increase in film speed rises EV
|
||||
evDifferenceBuilder: (selected, other) => selected.toStringDifference(other),
|
||||
onChanged: onIsoChanged,
|
||||
),
|
||||
const _InnerPadding(),
|
||||
Expanded(
|
||||
child: _AnimatedDialogPicker(
|
||||
title: S.of(context).nd,
|
||||
subtitle: S.of(context).ndFilterFactor,
|
||||
selectedValue: nd,
|
||||
values: ndValues,
|
||||
itemTitleBuilder: (_, value) => Text(
|
||||
value.value == 0 ? S.of(context).none : value.value.toString(),
|
||||
),
|
||||
// using descending order, because ND filter darkens image & lowers EV
|
||||
evDifferenceBuilder: (selected, other) => other.toStringDifference(selected),
|
||||
onChanged: onNdChanged,
|
||||
),
|
||||
const _InnerPadding(),
|
||||
Expanded(
|
||||
child: _AnimatedDialogPicker(
|
||||
title: S.of(context).nd,
|
||||
subtitle: S.of(context).ndFilterFactor,
|
||||
selectedValue: nd,
|
||||
values: ndValues,
|
||||
itemTitleBuilder: (_, value) => Text(
|
||||
value.value == 0 ? S.of(context).none : value.value.toString(),
|
||||
),
|
||||
// using descending order, because ND filter darkens image & lowers EV
|
||||
evDifferenceBuilder: (selected, other) => other.toStringDifference(selected),
|
||||
onChanged: onNdChanged,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const _InnerPadding(),
|
||||
Expanded(
|
||||
child: AnimatedDialog(
|
||||
openedSize: Size(
|
||||
MediaQuery.of(context).size.width - Dimens.paddingM * 2,
|
||||
(MediaQuery.of(context).size.width - Dimens.paddingM * 2) / 3 * 4,
|
||||
),
|
||||
child: BlocProvider.value(
|
||||
value: context.read<CameraBloc>(),
|
||||
child: const CameraView(),
|
||||
),
|
||||
),
|
||||
const _InnerPadding(),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
const CameraView(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue