diff --git a/lib/screens/metering/components/camera_container/widget_container_camera.dart b/lib/screens/metering/components/camera_container/widget_container_camera.dart index a222f8a..e398bb3 100644 --- a/lib/screens/metering/components/camera_container/widget_container_camera.dart +++ b/lib/screens/metering/components/camera_container/widget_container_camera.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:lightmeter/data/models/exposure_pair.dart'; import 'package:lightmeter/platform_config.dart'; +import 'package:lightmeter/providers/equipment_profile_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'; @@ -45,9 +46,16 @@ class CameraContainer extends StatelessWidget { @override Widget build(BuildContext context) { - final topBarOverflow = Dimens.readingContainerDefaultHeight - + final double cameraViewHeight = ((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) / PlatformConfig.cameraPreviewAspectRatio; + + double topBarOverflow = Dimens.readingContainerDefaultHeight - cameraViewHeight; + if (EquipmentProfiles.of(context)?.isNotEmpty ?? false) { + topBarOverflow += Dimens.readingContainerSingleValueHeight; + topBarOverflow += Dimens.paddingS; + } + return Column( children: [ MeteringTopBar( diff --git a/lib/screens/metering/components/shared/metering_top_bar/shape_top_bar_metering.dart b/lib/screens/metering/components/shared/metering_top_bar/shape_top_bar_metering.dart index 90d6718..28a9226 100644 --- a/lib/screens/metering/components/shared/metering_top_bar/shape_top_bar_metering.dart +++ b/lib/screens/metering/components/shared/metering_top_bar/shape_top_bar_metering.dart @@ -44,7 +44,7 @@ class MeteringTopBarShape extends CustomPainter { bottomRight: circularRadius, ), ); - } else { + } else if (appendixHeight < 0) { // Left side with bottom corner path.lineTo(0, size.height + appendixHeight - Dimens.borderRadiusL); path.arcToPoint( @@ -56,27 +56,16 @@ class MeteringTopBarShape extends CustomPainter { // Bottom side with step final allowedRadius = min(appendixHeight.abs() / 2, Dimens.borderRadiusL); path.lineTo(appendixWidth - allowedRadius, size.height + appendixHeight); - - final bool isCutout = appendixHeight < 0; - if (isCutout) { - path.arcToPoint( - Offset(appendixWidth, size.height + appendixHeight + allowedRadius), - radius: circularRadius, - clockwise: true, - ); - path.lineTo(appendixWidth, size.height - allowedRadius); - } else { - path.arcToPoint( - Offset(appendixWidth, size.height + appendixHeight - allowedRadius), - radius: circularRadius, - clockwise: false, - ); - path.lineTo(appendixWidth, size.height + allowedRadius); - } + path.arcToPoint( + Offset(appendixWidth, size.height + appendixHeight + allowedRadius), + radius: circularRadius, + clockwise: true, + ); + path.lineTo(appendixWidth, size.height - allowedRadius); path.arcToPoint( Offset(appendixWidth + allowedRadius, size.height), radius: circularRadius, - clockwise: !isCutout, + clockwise: false, ); // Right side with bottom corner @@ -86,9 +75,42 @@ class MeteringTopBarShape extends CustomPainter { radius: circularRadius, clockwise: false, ); - path.lineTo(size.width, 0); - path.close(); + } else { + // Left side with bottom corner + path.lineTo(0, size.height - Dimens.borderRadiusL); + path.arcToPoint( + Offset(Dimens.borderRadiusL, size.height), + radius: circularRadius, + clockwise: false, + ); + + // Bottom side with step + final allowedRadius = min(appendixHeight.abs() / 2, Dimens.borderRadiusL); + path.relativeLineTo(appendixWidth - allowedRadius * 2, 0); + path.relativeArcToPoint( + Offset(allowedRadius, -allowedRadius), + radius: Radius.circular(allowedRadius), + rotation: 90, + clockwise: false, + ); + path.relativeLineTo(0, -appendixHeight + allowedRadius * 2); + path.relativeArcToPoint( + Offset(allowedRadius, -allowedRadius), + radius: Radius.circular(allowedRadius), + rotation: 90, + clockwise: true, + ); + + // Right side with bottom corner + path.lineTo(size.width - Dimens.borderRadiusL, size.height - appendixHeight); + path.arcToPoint( + Offset(size.width, size.height - appendixHeight - Dimens.borderRadiusL), + radius: circularRadius, + clockwise: false, + ); } + path.lineTo(size.width, 0); + path.close(); canvas.drawPath(path, paint); } diff --git a/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart b/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart index c6520f4..4c9df9c 100644 --- a/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart +++ b/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart @@ -38,7 +38,8 @@ class ReadingsContainer extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - if (EquipmentProfile.of(context) != null && EquipmentProfiles.of(context) != null) ...[ + if (EquipmentProfile.of(context) != null && + (EquipmentProfiles.of(context)?.isNotEmpty ?? false)) ...[ _EquipmentProfilePicker( selectedValue: EquipmentProfile.of(context)!, values: EquipmentProfiles.of(context)!,