refined topbar height difference calculation

This commit is contained in:
Vadim 2023-04-03 19:02:51 +03:00
parent 12d44d6bab
commit f084efde5d
3 changed files with 36 additions and 22 deletions

View file

@ -30,9 +30,8 @@ class Dimens {
static const double disabledOpacity = 0.38;
// TopBar
/// Probably this is a bad practice, but with text size locked, the height is always 212
static const double readingContainerDoubleValueHeight = 128;
static const double readingContainerSingleValueHeight = 76;
static const double readingContainerDefaultHeight = 288;
// `CenteredSlider`
static const double cameraSliderTrackHeight = grid4;

View file

@ -4,6 +4,7 @@ import 'package:lightmeter/data/models/exposure_pair.dart';
import 'package:lightmeter/data/models/film.dart';
import 'package:lightmeter/features.dart';
import 'package:lightmeter/platform_config.dart';
import 'package:lightmeter/providers/features_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/metering/components/camera_container/components/camera_view/widget_camera_view.dart';
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
@ -49,11 +50,20 @@ class CameraContainer extends StatelessWidget {
((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
PlatformConfig.cameraPreviewAspectRatio;
double topBarOverflow = Dimens.readingContainerDefaultHeight - cameraViewHeight;
double topBarOverflow = Dimens.readingContainerSingleValueHeight + // ISO & ND
-cameraViewHeight;
if (FeaturesConfig.equipmentProfilesEnabled) {
topBarOverflow += Dimens.readingContainerSingleValueHeight;
topBarOverflow += Dimens.paddingS;
}
if (MeteringScreenLayout.of(context, MeteringScreenLayoutFeature.extremeExposurePairs)) {
topBarOverflow += Dimens.readingContainerDoubleValueHeight;
topBarOverflow += Dimens.paddingS;
}
if (MeteringScreenLayout.of(context, MeteringScreenLayoutFeature.reciprocity)) {
topBarOverflow += Dimens.readingContainerSingleValueHeight;
topBarOverflow += Dimens.paddingS;
}
return Column(
children: [

View file

@ -4,6 +4,7 @@ import 'package:lightmeter/data/models/film.dart';
import 'package:lightmeter/features.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/equipment_profile_provider.dart';
import 'package:lightmeter/providers/features_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart';
@ -42,25 +43,29 @@ class ReadingsContainer extends StatelessWidget {
const _EquipmentProfilePicker(),
const _InnerPadding(),
],
ReadingValueContainer(
values: [
ReadingValue(
label: S.of(context).fastestExposurePair,
value: fastest != null ? fastest!.toString() : '-',
),
ReadingValue(
label: S.of(context).slowestExposurePair,
value: fastest != null ? slowest!.toString() : '-',
),
],
),
const _InnerPadding(),
_FilmPicker(
values: Film.values,
selectedValue: film,
onChanged: onFilmChanged,
),
const _InnerPadding(),
if (MeteringScreenLayout.of(context, MeteringScreenLayoutFeature.extremeExposurePairs)) ...[
ReadingValueContainer(
values: [
ReadingValue(
label: S.of(context).fastestExposurePair,
value: fastest != null ? fastest!.toString() : '-',
),
ReadingValue(
label: S.of(context).slowestExposurePair,
value: fastest != null ? slowest!.toString() : '-',
),
],
),
const _InnerPadding(),
],
if (MeteringScreenLayout.of(context, MeteringScreenLayoutFeature.reciprocity)) ...[
_FilmPicker(
values: Film.values,
selectedValue: film,
onChanged: onFilmChanged,
),
const _InnerPadding(),
],
Row(
children: [
Expanded(