mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 23:40:41 +00:00
Compare commits
No commits in common. "7046b06bd86284b512c9f6a76daa3be6fc4dc018" and "669457bd4fa3481f65da609755a5f7ff2f3a51f6" have entirely different histories.
7046b06bd8
...
669457bd4f
3 changed files with 81 additions and 80 deletions
|
@ -28,9 +28,7 @@ class _CameraHistogramState extends State<CameraHistogram> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
/// There is no need to stop image stream here,
|
widget.controller.stopImageStream();
|
||||||
/// because this widget will be disposed when CameraController is disposed
|
|
||||||
/// widget.controller.stopImageStream();
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:lightmeter/data/models/exposure_pair.dart';
|
import 'package:lightmeter/data/models/exposure_pair.dart';
|
||||||
|
@ -47,17 +45,34 @@ class CameraContainer extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final double meteringContainerHeight = _meteringContainerHeight(context);
|
final double cameraViewHeight =
|
||||||
final double cameraPreviewHeight = _cameraPreviewHeight(context);
|
((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
|
||||||
final double topBarOverflow = meteringContainerHeight - cameraPreviewHeight;
|
PlatformConfig.cameraPreviewAspectRatio;
|
||||||
|
|
||||||
return Stack(
|
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(
|
||||||
children: [
|
children: [
|
||||||
Positioned(
|
MeteringTopBar(
|
||||||
left: 0,
|
|
||||||
top: 0,
|
|
||||||
right: 0,
|
|
||||||
child: MeteringTopBar(
|
|
||||||
readingsContainer: ReadingsContainer(
|
readingsContainer: ReadingsContainer(
|
||||||
fastest: fastest,
|
fastest: fastest,
|
||||||
slowest: slowest,
|
slowest: slowest,
|
||||||
|
@ -71,71 +86,19 @@ class CameraContainer extends StatelessWidget {
|
||||||
appendixHeight: topBarOverflow,
|
appendixHeight: topBarOverflow,
|
||||||
preview: const _CameraViewBuilder(),
|
preview: const _CameraViewBuilder(),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
SafeArea(
|
|
||||||
bottom: false,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
height: min(meteringContainerHeight, cameraPreviewHeight) + Dimens.paddingM * 2,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
|
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
|
||||||
child: Row(
|
child: _MiddleContentWrapper(
|
||||||
children: [
|
topBarOverflow: topBarOverflow,
|
||||||
Expanded(
|
leftContent: ExposurePairsList(exposurePairs),
|
||||||
child: Padding(
|
rightContent: const _CameraControlsBuilder(),
|
||||||
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 {
|
class _CameraViewBuilder extends StatelessWidget {
|
||||||
|
@ -202,3 +165,43 @@ 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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
name: lightmeter
|
name: lightmeter
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
publish_to: "none"
|
publish_to: "none"
|
||||||
version: 0.13.0+36
|
version: 0.12.4+35
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=3.0.0 <4.0.0"
|
sdk: ">=3.0.0 <4.0.0"
|
||||||
|
|
Loading…
Reference in a new issue