Compare commits

...

5 commits

Author SHA1 Message Date
Vadim
7046b06bd8 Removed redundant stopImageStream() 2023-08-08 11:32:41 +02:00
Vadim
0e6f050213 Merge remote-tracking branch 'origin' into feature/ML-95 2023-08-08 11:32:20 +02:00
vodemn
9c11401175 Version bump 2023-08-07 14:59:47 +00:00
Vadim
737a9aa2c2
ML-98 Metering top bar cutout doesn't pass through taps (#99)
* replaced `OverflowBox` with `Stack`
2023-08-07 12:56:29 +02:00
Vadim
886188bb9e
ML-95 Live histogram (#97)
* Added histogram and separated camera view builder

* Added histogram to `MeteringScreenLayoutConfig`

* `ResolutionPreset.medium` -> `ResolutionPreset.low`

* Adjusted histogram paddings
2023-08-06 16:28:20 +02:00
3 changed files with 80 additions and 81 deletions

View file

@ -28,7 +28,9 @@ class _CameraHistogramState extends State<CameraHistogram> {
@override
void dispose() {
widget.controller.stopImageStream();
/// There is no need to stop image stream here,
/// because this widget will be disposed when CameraController is disposed
/// widget.controller.stopImageStream();
super.dispose();
}

View file

@ -1,3 +1,5 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/data/models/exposure_pair.dart';
@ -45,34 +47,17 @@ class CameraContainer extends StatelessWidget {
@override
Widget build(BuildContext context) {
final double cameraViewHeight =
((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
PlatformConfig.cameraPreviewAspectRatio;
final double meteringContainerHeight = _meteringContainerHeight(context);
final double cameraPreviewHeight = _cameraPreviewHeight(context);
final double topBarOverflow = meteringContainerHeight - cameraPreviewHeight;
double topBarOverflow = Dimens.readingContainerSingleValueHeight + // ISO & ND
-cameraViewHeight;
if (FeaturesConfig.equipmentProfilesEnabled) {
topBarOverflow += Dimens.readingContainerSingleValueHeight;
topBarOverflow += Dimens.paddingS;
}
if (MeteringScreenLayout.featureOf(
context,
MeteringScreenLayoutFeature.extremeExposurePairs,
)) {
topBarOverflow += Dimens.readingContainerDoubleValueHeight;
topBarOverflow += Dimens.paddingS;
}
if (MeteringScreenLayout.featureOf(
context,
MeteringScreenLayoutFeature.filmPicker,
)) {
topBarOverflow += Dimens.readingContainerSingleValueHeight;
topBarOverflow += Dimens.paddingS;
}
return Column(
return Stack(
children: [
MeteringTopBar(
Positioned(
left: 0,
top: 0,
right: 0,
child: MeteringTopBar(
readingsContainer: ReadingsContainer(
fastest: fastest,
slowest: slowest,
@ -86,19 +71,71 @@ class CameraContainer extends StatelessWidget {
appendixHeight: topBarOverflow,
preview: const _CameraViewBuilder(),
),
),
SafeArea(
bottom: false,
child: Column(
children: [
SizedBox(
height: min(meteringContainerHeight, cameraPreviewHeight) + Dimens.paddingM * 2,
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
child: _MiddleContentWrapper(
topBarOverflow: topBarOverflow,
leftContent: ExposurePairsList(exposurePairs),
rightContent: const _CameraControlsBuilder(),
child: Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.only(top: topBarOverflow >= 0 ? topBarOverflow : 0),
child: ExposurePairsList(exposurePairs),
),
),
const SizedBox(width: Dimens.grid8),
Expanded(
child: Padding(
padding: EdgeInsets.only(top: topBarOverflow <= 0 ? -topBarOverflow : 0),
child: const _CameraControlsBuilder(),
),
),
],
),
),
),
],
),
)
],
);
}
double _meteringContainerHeight(BuildContext context) {
double enabledFeaturesHeight = 0;
if (FeaturesConfig.equipmentProfilesEnabled) {
enabledFeaturesHeight += Dimens.readingContainerSingleValueHeight;
enabledFeaturesHeight += Dimens.paddingS;
}
if (MeteringScreenLayout.featureOf(
context,
MeteringScreenLayoutFeature.extremeExposurePairs,
)) {
enabledFeaturesHeight += Dimens.readingContainerDoubleValueHeight;
enabledFeaturesHeight += Dimens.paddingS;
}
if (MeteringScreenLayout.featureOf(
context,
MeteringScreenLayoutFeature.filmPicker,
)) {
enabledFeaturesHeight += Dimens.readingContainerSingleValueHeight;
enabledFeaturesHeight += Dimens.paddingS;
}
return enabledFeaturesHeight + Dimens.readingContainerSingleValueHeight; // ISO & ND
}
double _cameraPreviewHeight(BuildContext context) {
return ((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
PlatformConfig.cameraPreviewAspectRatio;
}
}
class _CameraViewBuilder extends StatelessWidget {
@ -165,43 +202,3 @@ class _CameraControlsBuilder extends StatelessWidget {
);
}
}
class _MiddleContentWrapper extends StatelessWidget {
final double topBarOverflow;
final Widget leftContent;
final Widget rightContent;
const _MiddleContentWrapper({
required this.topBarOverflow,
required this.leftContent,
required this.rightContent,
});
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) => OverflowBox(
alignment: Alignment.bottomCenter,
maxHeight: constraints.maxHeight + topBarOverflow.abs(),
maxWidth: constraints.maxWidth,
child: Row(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.only(top: topBarOverflow >= 0 ? topBarOverflow : 0),
child: leftContent,
),
),
const SizedBox(width: Dimens.grid8),
Expanded(
child: Padding(
padding: EdgeInsets.only(top: topBarOverflow <= 0 ? -topBarOverflow : 0),
child: rightContent,
),
),
],
),
),
);
}
}

View file

@ -1,7 +1,7 @@
name: lightmeter
description: A new Flutter project.
publish_to: "none"
version: 0.12.4+35
version: 0.13.0+36
environment:
sdk: ">=3.0.0 <4.0.0"