mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +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!.initialize();
|
||||||
await _cameraController!.setFlashMode(FlashMode.off);
|
await _cameraController!.setFlashMode(FlashMode.off);
|
||||||
emit(CameraReadyState(_cameraController!));
|
emit(CameraReadyState(_cameraController!));
|
||||||
|
_takePhoto().then((ev100) {
|
||||||
|
if (ev100 != null) {
|
||||||
|
_communicationBloc.add(communication_event.MeasuredEvent(ev100));
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
emit(const CameraErrorState());
|
emit(const CameraErrorState());
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,12 +3,20 @@ import 'package:lightmeter/res/dimens.dart';
|
||||||
import 'package:lightmeter/screens/metering/components/topbar/models/reading_value.dart';
|
import 'package:lightmeter/screens/metering/components/topbar/models/reading_value.dart';
|
||||||
|
|
||||||
class ReadingContainer extends StatelessWidget {
|
class ReadingContainer extends StatelessWidget {
|
||||||
final List<_ReadingValueBuilder> _items;
|
late final List<Widget> _items;
|
||||||
|
|
||||||
ReadingContainer({
|
ReadingContainer({
|
||||||
required List<ReadingValue> values,
|
required List<ReadingValue> values,
|
||||||
super.key,
|
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({
|
ReadingContainer.singleValue({
|
||||||
required ReadingValue value,
|
required ReadingValue value,
|
||||||
|
@ -25,7 +33,7 @@ class ReadingContainer extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(Dimens.paddingM),
|
padding: const EdgeInsets.all(Dimens.paddingM),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: _items,
|
children: _items,
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
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/generated/l10n.dart';
|
||||||
import 'package:lightmeter/models/exposure_pair.dart';
|
import 'package:lightmeter/models/exposure_pair.dart';
|
||||||
import 'package:lightmeter/models/iso_value.dart';
|
import 'package:lightmeter/models/iso_value.dart';
|
||||||
|
@ -47,17 +49,15 @@ class MeteringTopBar extends StatelessWidget {
|
||||||
bottom: false,
|
bottom: false,
|
||||||
child: MediaQuery(
|
child: MediaQuery(
|
||||||
data: MediaQuery.of(context),
|
data: MediaQuery.of(context),
|
||||||
child: IntrinsicHeight(
|
|
||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
ReadingContainer(
|
||||||
child: ReadingContainer(
|
|
||||||
values: [
|
values: [
|
||||||
ReadingValue(
|
ReadingValue(
|
||||||
label: S.of(context).fastestExposurePair,
|
label: S.of(context).fastestExposurePair,
|
||||||
|
@ -73,14 +73,15 @@ class MeteringTopBar extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
/*
|
||||||
const _InnerPadding(),
|
const _InnerPadding(),
|
||||||
ReadingContainer.singleValue(
|
ReadingContainer.singleValue(
|
||||||
value: ReadingValue(
|
value: ReadingValue(
|
||||||
label: 'EV',
|
label: 'EV',
|
||||||
value: ev.toString(),
|
value: ev.toStringAsFixed(1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
*/
|
||||||
const _InnerPadding(),
|
const _InnerPadding(),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
@ -118,10 +119,15 @@ class MeteringTopBar extends StatelessWidget {
|
||||||
),
|
),
|
||||||
const _InnerPadding(),
|
const _InnerPadding(),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: AnimatedDialog(
|
||||||
children: [
|
openedSize: Size(
|
||||||
const CameraView(),
|
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(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -130,7 +136,6 @@ class MeteringTopBar extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue