Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(SNP-400): Updates build badge route. #22

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Render Metrics

[![Build Status](https://shields.io/github/workflow/status/surfstudio/flutter-render-metrics/Analysis?logo=github&logoColor=white)](https://github.com/surfstudio/flutter-render-metrics)
[![Build Status](https://shields.io/github/actions/workflow/status/surfstudio/flutter-render-metrics/main.yml?logo=github&logoColor=white)](https://github.com/surfstudio/flutter-render-metrics)
[![Coverage Status](https://img.shields.io/codecov/c/github/surfstudio/flutter-render-metrics?=render_metrics&logo=codecov&logoColor=white)](https://app.codecov.io/gh/surfstudio/flutter-render-metrics)
[![Pub Version](https://img.shields.io/pub/v/render_metrics?logo=dart&logoColor=white)](https://pub.dev/packages/render_metrics)
[![Pub Likes](https://badgen.net/pub/likes/render_metrics)](https://pub.dev/packages/render_metrics)
Expand Down
29 changes: 14 additions & 15 deletions lib/src/data/comparison_diff.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ import 'package:render_metrics/src/data/coords_metrics.dart';
/// [centerLeft] - center left coordinate.
/// [centerRight] - center right coordinate.
class ComparisonDiff {
const ComparisonDiff({
required this.yTop,
required this.yBottom,
required this.yCenter,
required this.xLeft,
required this.xRight,
required this.xCenter,
required this.diffTopToBottom,
required this.diffBottomToTop,
required this.diffLeftToRight,
required this.diffRightToLeft,
required this.width,
required this.height,
});
final double yTop;
final double yBottom;
final double yCenter;
Expand Down Expand Up @@ -77,21 +91,6 @@ class ComparisonDiff {
CoordinatesMetrics get centerRight =>
CoordinatesMetrics(y: yCenter, x: xRight);

const ComparisonDiff({
required this.yTop,
required this.yBottom,
required this.yCenter,
required this.xLeft,
required this.xRight,
required this.xCenter,
required this.diffTopToBottom,
required this.diffBottomToTop,
required this.diffLeftToRight,
required this.diffRightToLeft,
required this.width,
required this.height,
});

@override
String toString() {
return 'ComparisonDiff(\n'
Expand Down
5 changes: 2 additions & 3 deletions lib/src/data/coords_metrics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

/// Defines a point representing a location in (x,y) coordinate space.
class CoordinatesMetrics {
final double x;
final double y;

const CoordinatesMetrics({
required this.x,
required this.y,
});
final double x;
final double y;
}
21 changes: 10 additions & 11 deletions lib/src/data/render_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ import 'package:render_metrics/src/data/coords_metrics.dart';
/// [centerLeft] - center left coordinate.
/// [centerRight] - center right coordinate.
class RenderData {
const RenderData({
required this.yTop,
required this.yBottom,
required this.yCenter,
required this.xLeft,
required this.xRight,
required this.xCenter,
required this.width,
required this.height,
});
final double yTop;
final double yBottom;
final double yCenter;
Expand Down Expand Up @@ -64,17 +74,6 @@ class RenderData {
CoordinatesMetrics get centerRight =>
CoordinatesMetrics(y: yCenter, x: xRight);

const RenderData({
required this.yTop,
required this.yBottom,
required this.yCenter,
required this.xLeft,
required this.xRight,
required this.xCenter,
required this.width,
required this.height,
});

@override
String toString() {
return 'RenderData(\n'
Expand Down
18 changes: 8 additions & 10 deletions lib/src/render/render_metrics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ typedef UnMountCallback<T> = void Function(T id);
/// When deleted from the tree, didUnmountRenderObject is triggered.
/// It calls onUnMount(if passed) and the removeRenderObject method.
class RenderMetricsObject<T> extends SingleChildRenderObjectWidget {
final T id;
final RenderManager manager;
final MountCallback<T>? onMount;
final MountCallback<T>? onUpdate;
final UnMountCallback<T>? onUnMount;

const RenderMetricsObject({
required this.id,
required this.manager,
Expand All @@ -53,6 +47,11 @@ class RenderMetricsObject<T> extends SingleChildRenderObjectWidget {
Key? key,
Widget? child,
}) : super(key: key, child: child);
final T id;
final RenderManager manager;
final MountCallback<T>? onMount;
final MountCallback<T>? onUpdate;
final UnMountCallback<T>? onUnMount;

@override
RenderMetricsBox createRenderObject(BuildContext context) {
Expand Down Expand Up @@ -84,6 +83,9 @@ class RenderMetricsObject<T> extends SingleChildRenderObjectWidget {
/// extends [RenderProxyBox] which extends [RenderObject].
/// [data] - getter for receiving data in the instance [RenderData].
class RenderMetricsBox extends RenderProxyBox {
RenderMetricsBox({
RenderBox? child,
}) : super(child);
RenderData get data {
final size = this.size;
final width = size.width;
Expand All @@ -103,8 +105,4 @@ class RenderMetricsBox extends RenderProxyBox {
height: height,
);
}

RenderMetricsBox({
RenderBox? child,
}) : super(child);
}
2 changes: 1 addition & 1 deletion test/render_metrics_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ void main() {
RenderMetricsObject(
id: firstId,
manager: renderManager,
child: box,
onUpdate: onUpdate,
child: box,
).updateRenderObject(context, renderObject);

verify(() => onUpdate(any<String>(), any())).called(1);
Expand Down
Loading