mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +00:00
fixed MeteringTopBarShape
This commit is contained in:
parent
7d23e3584a
commit
e797054233
3 changed files with 54 additions and 23 deletions
|
@ -2,6 +2,7 @@ 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';
|
||||||
import 'package:lightmeter/platform_config.dart';
|
import 'package:lightmeter/platform_config.dart';
|
||||||
|
import 'package:lightmeter/providers/equipment_profile_provider.dart';
|
||||||
import 'package:lightmeter/res/dimens.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/components/camera_view/widget_camera_view.dart';
|
||||||
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
|
import 'package:lightmeter/screens/metering/components/camera_container/models/camera_error_type.dart';
|
||||||
|
@ -45,9 +46,16 @@ class CameraContainer extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final topBarOverflow = Dimens.readingContainerDefaultHeight -
|
final double cameraViewHeight =
|
||||||
((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
|
((MediaQuery.of(context).size.width - Dimens.grid8 - 2 * Dimens.paddingM) / 2) /
|
||||||
PlatformConfig.cameraPreviewAspectRatio;
|
PlatformConfig.cameraPreviewAspectRatio;
|
||||||
|
|
||||||
|
double topBarOverflow = Dimens.readingContainerDefaultHeight - cameraViewHeight;
|
||||||
|
if (EquipmentProfiles.of(context)?.isNotEmpty ?? false) {
|
||||||
|
topBarOverflow += Dimens.readingContainerSingleValueHeight;
|
||||||
|
topBarOverflow += Dimens.paddingS;
|
||||||
|
}
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
MeteringTopBar(
|
MeteringTopBar(
|
||||||
|
|
|
@ -44,7 +44,7 @@ class MeteringTopBarShape extends CustomPainter {
|
||||||
bottomRight: circularRadius,
|
bottomRight: circularRadius,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else if (appendixHeight < 0) {
|
||||||
// Left side with bottom corner
|
// Left side with bottom corner
|
||||||
path.lineTo(0, size.height + appendixHeight - Dimens.borderRadiusL);
|
path.lineTo(0, size.height + appendixHeight - Dimens.borderRadiusL);
|
||||||
path.arcToPoint(
|
path.arcToPoint(
|
||||||
|
@ -56,27 +56,16 @@ class MeteringTopBarShape extends CustomPainter {
|
||||||
// Bottom side with step
|
// Bottom side with step
|
||||||
final allowedRadius = min(appendixHeight.abs() / 2, Dimens.borderRadiusL);
|
final allowedRadius = min(appendixHeight.abs() / 2, Dimens.borderRadiusL);
|
||||||
path.lineTo(appendixWidth - allowedRadius, size.height + appendixHeight);
|
path.lineTo(appendixWidth - allowedRadius, size.height + appendixHeight);
|
||||||
|
path.arcToPoint(
|
||||||
final bool isCutout = appendixHeight < 0;
|
Offset(appendixWidth, size.height + appendixHeight + allowedRadius),
|
||||||
if (isCutout) {
|
radius: circularRadius,
|
||||||
path.arcToPoint(
|
clockwise: true,
|
||||||
Offset(appendixWidth, size.height + appendixHeight + allowedRadius),
|
);
|
||||||
radius: circularRadius,
|
path.lineTo(appendixWidth, size.height - allowedRadius);
|
||||||
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(
|
path.arcToPoint(
|
||||||
Offset(appendixWidth + allowedRadius, size.height),
|
Offset(appendixWidth + allowedRadius, size.height),
|
||||||
radius: circularRadius,
|
radius: circularRadius,
|
||||||
clockwise: !isCutout,
|
clockwise: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Right side with bottom corner
|
// Right side with bottom corner
|
||||||
|
@ -86,9 +75,42 @@ class MeteringTopBarShape extends CustomPainter {
|
||||||
radius: circularRadius,
|
radius: circularRadius,
|
||||||
clockwise: false,
|
clockwise: false,
|
||||||
);
|
);
|
||||||
path.lineTo(size.width, 0);
|
} else {
|
||||||
path.close();
|
// 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);
|
canvas.drawPath(path, paint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,8 @@ class ReadingsContainer extends StatelessWidget {
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
if (EquipmentProfile.of(context) != null && EquipmentProfiles.of(context) != null) ...[
|
if (EquipmentProfile.of(context) != null &&
|
||||||
|
(EquipmentProfiles.of(context)?.isNotEmpty ?? false)) ...[
|
||||||
_EquipmentProfilePicker(
|
_EquipmentProfilePicker(
|
||||||
selectedValue: EquipmentProfile.of(context)!,
|
selectedValue: EquipmentProfile.of(context)!,
|
||||||
values: EquipmentProfiles.of(context)!,
|
values: EquipmentProfiles.of(context)!,
|
||||||
|
|
Loading…
Reference in a new issue