Skip to content

Commit b68503d

Browse files
committed
Simulator #8
1 parent 0ccdfe7 commit b68503d

File tree

5 files changed

+46
-1
lines changed

5 files changed

+46
-1
lines changed

lib/src/api/mixins.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,9 @@ enum RowColumnType {
899899
/// column.
900900
/// This contains common properties of row and columns.
901901
mixin RowColumnMixin on BaseNode {
902+
@override
903+
bool get supportsRotation => false;
904+
902905
/// Whether the node is a row/column.
903906
late RowColumnType rowColumnType;
904907

@@ -933,7 +936,10 @@ mixin RowColumnMixin on BaseNode {
933936
}
934937

935938
/// A mixin that allows node behave like a placeholder for other nodes.
936-
mixin PlaceholderMixin on BaseNode {}
939+
mixin PlaceholderMixin on BaseNode {
940+
@override
941+
bool get supportsRotation => false;
942+
}
937943

938944
/// Represents the physics for scrolling on scrollable nodes like list view.
939945
/// Corresponds to [ScrollPhysics] in Flutter.
@@ -1021,6 +1027,9 @@ enum ScrollViewKeyboardDismissBehaviorC {
10211027
/// Nodes like [ListViewNode], [RowColumnNode] and [CanvasNode] uses this to
10221028
/// provide options for its scroll behavior.
10231029
mixin ScrollableMixin on BaseNode {
1030+
@override
1031+
bool get supportsRotation => false;
1032+
10241033
/// Whether this widget enforces its scrollable behavior.
10251034
/// [CanvasNode]s do not need to be scrollable but can.
10261035
/// [ListViewNode]s, on the other hand, must be scrollable.

lib/src/api/nodes/app_bar_node.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ class AppBarNode extends SceneNode
2525
/// Holds configurable properties of the app bar.
2626
AppBarProperties properties;
2727

28+
@override
29+
bool get supportsMargin => false;
30+
31+
@override
32+
bool get supportsRotation => false;
33+
34+
@override
35+
bool get supportsConstraints => false;
36+
37+
@override
38+
bool get supportsVisibility => false;
39+
2840
/// Creates a new [AppBarNode] instance.
2941
AppBarNode({
3042
required super.id,

lib/src/api/nodes/base_node.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ abstract class BaseNode
4949
/// Whether this node is visible or not.
5050
bool visible;
5151

52+
/// Determines whether this node supports visibility or not.
53+
bool get supportsVisibility => true;
54+
5255
BoxConstraintsModel _constraints;
5356

5457
/// Constraints apply to the [middleBoxLocal].
@@ -66,6 +69,10 @@ abstract class BaseNode
6669
@JsonKey(includeFromJson: false, includeToJson: false)
6770
BoxConstraintsModel get resolvedConstraints => _resolvedConstraints;
6871

72+
/// Determines whether this node supports constraints or not.
73+
@JsonKey(includeFromJson: false, includeToJson: false)
74+
bool get supportsConstraints => true;
75+
6976
/// Edge Pins apply to the [outerBoxLocal].
7077
/// See [EdgePinsModel] for more info on how to define the edge pins.
7178
// @JsonKey(excludeIf: excludeEdgePinsIf)
@@ -325,6 +332,10 @@ abstract class BaseNode
325332
@JsonKey(includeFromJson: false, includeToJson: false)
326333
double globalRotationRadians;
327334

335+
/// Determines whether this node allows itself to be rotated or not.
336+
@JsonKey(includeFromJson: false, includeToJson: false)
337+
bool get supportsRotation => true;
338+
328339
/// A simple label for console debugging.
329340
@JsonKey(includeFromJson: false, includeToJson: false)
330341
String get debugLabel => '$name [$id]';
@@ -338,6 +349,10 @@ abstract class BaseNode
338349
@JsonKey(includeFromJson: false, includeToJson: false)
339350
bool get supportsPadding => false;
340351

352+
/// Determines whether this node supports margin.
353+
@JsonKey(includeFromJson: false, includeToJson: false)
354+
bool get supportsMargin => true;
355+
341356
/// Width of the node in fraction of the parent's width.
342357
/// [widthFactor] of [0.5] means that the node will be half the width of its
343358
/// parent.

lib/src/api/nodes/canvas_node.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ class CanvasNode extends ParentNode
2222
@override
2323
final bool supportsPadding = true;
2424

25+
@override
26+
bool get supportsMargin => false;
27+
28+
@override
29+
bool get supportsRotation => false;
30+
2531
/// Time of creation.
2632
@DateTimeConverter()
2733
late DateTime createdTimestamp;

lib/src/api/nodes/spacer_node.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class SpacerNode extends SceneNode {
1313
@override
1414
final String type = 'spacer';
1515

16+
@override
17+
bool get supportsMargin => false;
18+
1619
/// Creates a new [SpacerNode] with the given data.
1720
SpacerNode({
1821
required super.id,

0 commit comments

Comments
 (0)