mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
ML-98 Metering top bar cutout doesn't pass through taps (#99)
* replaced `OverflowBox` with `Stack`
This commit is contained in:
parent
886188bb9e
commit
737a9aa2c2
1 changed files with 76 additions and 79 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
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';
|
||||||
|
@ -45,59 +47,94 @@ class CameraContainer extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final double cameraViewHeight =
|
final double meteringContainerHeight = _meteringContainerHeight(context);
|
||||||
((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
|
final double cameraPreviewHeight = _cameraPreviewHeight(context);
|
||||||
PlatformConfig.cameraPreviewAspectRatio;
|
final double topBarOverflow = meteringContainerHeight - cameraPreviewHeight;
|
||||||
|
|
||||||
double topBarOverflow = Dimens.readingContainerSingleValueHeight + // ISO & ND
|
return Stack(
|
||||||
-cameraViewHeight;
|
children: [
|
||||||
|
Positioned(
|
||||||
|
left: 0,
|
||||||
|
top: 0,
|
||||||
|
right: 0,
|
||||||
|
child: MeteringTopBar(
|
||||||
|
readingsContainer: ReadingsContainer(
|
||||||
|
fastest: fastest,
|
||||||
|
slowest: slowest,
|
||||||
|
film: film,
|
||||||
|
iso: iso,
|
||||||
|
nd: nd,
|
||||||
|
onFilmChanged: onFilmChanged,
|
||||||
|
onIsoChanged: onIsoChanged,
|
||||||
|
onNdChanged: onNdChanged,
|
||||||
|
),
|
||||||
|
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: 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) {
|
if (FeaturesConfig.equipmentProfilesEnabled) {
|
||||||
topBarOverflow += Dimens.readingContainerSingleValueHeight;
|
enabledFeaturesHeight += Dimens.readingContainerSingleValueHeight;
|
||||||
topBarOverflow += Dimens.paddingS;
|
enabledFeaturesHeight += Dimens.paddingS;
|
||||||
}
|
}
|
||||||
if (MeteringScreenLayout.featureOf(
|
if (MeteringScreenLayout.featureOf(
|
||||||
context,
|
context,
|
||||||
MeteringScreenLayoutFeature.extremeExposurePairs,
|
MeteringScreenLayoutFeature.extremeExposurePairs,
|
||||||
)) {
|
)) {
|
||||||
topBarOverflow += Dimens.readingContainerDoubleValueHeight;
|
enabledFeaturesHeight += Dimens.readingContainerDoubleValueHeight;
|
||||||
topBarOverflow += Dimens.paddingS;
|
enabledFeaturesHeight += Dimens.paddingS;
|
||||||
}
|
}
|
||||||
if (MeteringScreenLayout.featureOf(
|
if (MeteringScreenLayout.featureOf(
|
||||||
context,
|
context,
|
||||||
MeteringScreenLayoutFeature.filmPicker,
|
MeteringScreenLayoutFeature.filmPicker,
|
||||||
)) {
|
)) {
|
||||||
topBarOverflow += Dimens.readingContainerSingleValueHeight;
|
enabledFeaturesHeight += Dimens.readingContainerSingleValueHeight;
|
||||||
topBarOverflow += Dimens.paddingS;
|
enabledFeaturesHeight += Dimens.paddingS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Column(
|
return enabledFeaturesHeight + Dimens.readingContainerSingleValueHeight; // ISO & ND
|
||||||
children: [
|
}
|
||||||
MeteringTopBar(
|
|
||||||
readingsContainer: ReadingsContainer(
|
double _cameraPreviewHeight(BuildContext context) {
|
||||||
fastest: fastest,
|
return ((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
|
||||||
slowest: slowest,
|
PlatformConfig.cameraPreviewAspectRatio;
|
||||||
film: film,
|
|
||||||
iso: iso,
|
|
||||||
nd: nd,
|
|
||||||
onFilmChanged: onFilmChanged,
|
|
||||||
onIsoChanged: onIsoChanged,
|
|
||||||
onNdChanged: onNdChanged,
|
|
||||||
),
|
|
||||||
appendixHeight: topBarOverflow,
|
|
||||||
preview: const _CameraViewBuilder(),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
|
|
||||||
child: _MiddleContentWrapper(
|
|
||||||
topBarOverflow: topBarOverflow,
|
|
||||||
leftContent: ExposurePairsList(exposurePairs),
|
|
||||||
rightContent: const _CameraControlsBuilder(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue