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!.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,17 +49,15 @@ class MeteringTopBar extends StatelessWidget {
|
|||
bottom: false,
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ReadingContainer(
|
||||
ReadingContainer(
|
||||
values: [
|
||||
ReadingValue(
|
||||
label: S.of(context).fastestExposurePair,
|
||||
|
@ -73,14 +73,15 @@ class MeteringTopBar extends StatelessWidget {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
/*
|
||||
const _InnerPadding(),
|
||||
ReadingContainer.singleValue(
|
||||
value: ReadingValue(
|
||||
label: 'EV',
|
||||
value: ev.toString(),
|
||||
value: ev.toStringAsFixed(1),
|
||||
),
|
||||
),
|
||||
*/
|
||||
const _InnerPadding(),
|
||||
Row(
|
||||
children: [
|
||||
|
@ -118,10 +119,15 @@ class MeteringTopBar extends StatelessWidget {
|
|||
),
|
||||
const _InnerPadding(),
|
||||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
const CameraView(),
|
||||
],
|
||||
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(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -130,7 +136,6 @@ class MeteringTopBar extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue