Skip to content

Commit b0ffe6b

Browse files
committed
SCROLLING OVERHAUL #1
1 parent 078c51f commit b0ffe6b

File tree

5 files changed

+130
-20
lines changed

5 files changed

+130
-20
lines changed

lib/src/api/models/axis.dart

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ enum AxisC {
2020
/// Whether this axis is vertical.
2121
bool get isVertical => this == AxisC.vertical;
2222

23-
/// String representation of this axis.
24-
String get adjective {
25-
switch (this) {
26-
case AxisC.horizontal:
27-
return 'horizontally';
28-
case AxisC.vertical:
29-
return 'vertically';
30-
}
31-
}
23+
/// String representation of this axis as an adjective.
24+
String get adjective => switch (this) {
25+
AxisC.horizontal => 'horizontally',
26+
AxisC.vertical => 'vertically'
27+
};
28+
29+
/// String representation of this axis's dimension.
30+
String get dimension =>
31+
switch (this) { AxisC.horizontal => 'width', AxisC.vertical => 'height' };
3232
}

lib/src/api/nodes/frame_node.dart

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ part 'frame_node.g.dart';
1212
/// A node that represents a frame that behaves like a stack.
1313
@JsonSerializable()
1414
class FrameNode extends DefaultShapeNode
15-
with CornerMixin, ClipMixin, ChildrenMixin {
15+
with CornerMixin, ClipMixin, ChildrenMixin, ScrollableMixin {
1616
@override
1717
final String type = 'frame';
1818

@@ -56,16 +56,34 @@ class FrameNode extends DefaultShapeNode
5656
super.positioningMode,
5757
// [ClipMixin] properties.
5858
bool clipsContent = true,
59-
// [ScrollLinkableMixin] properties.
60-
String? scrollableCanvasId,
61-
bool scrollLinkEnabled = false,
59+
// [ScrollableMixin] properties.
60+
bool isScrollable = false,
61+
AxisC scrollDirection = AxisC.vertical,
62+
bool reverse = false,
63+
ScrollPhysicsC physics = ScrollPhysicsC.alwaysScrollableScrollPhysics,
64+
bool primary = true,
65+
bool shrinkWrap = false,
66+
ScrollViewKeyboardDismissBehaviorC keyboardDismissBehavior =
67+
ScrollViewKeyboardDismissBehaviorC.manual,
68+
bool useFlutterListView = false,
6269
}) {
6370
setCornerMixin(
6471
cornerRadius: cornerRadius, cornerSmoothing: cornerSmoothing);
6572

6673
setClipMixin(clipsContent: clipsContent);
6774

6875
setChildrenMixin(children: children);
76+
77+
setScrollableMixin(
78+
isScrollable: isScrollable,
79+
scrollDirection: scrollDirection,
80+
reverse: reverse,
81+
physics: physics,
82+
primary: primary,
83+
shrinkWrap: shrinkWrap,
84+
keyboardDismissBehavior: keyboardDismissBehavior,
85+
useFlutterListView: useFlutterListView,
86+
);
6987
}
7088

7189
/// Creates a [FrameNode] from a JSON data.

lib/src/api/nodes/frame_node.g.dart

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/src/api/nodes/row_column_node.dart

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,20 @@ part 'row_column_node.g.dart';
1212
/// A node that can lay out its children in a row or column.
1313
/// Typically referred to [Row] and [Column] widgets in Flutter.
1414
@JsonSerializable()
15-
class RowColumnNode extends ParentNode with RowColumnMixin {
15+
class RowColumnNode extends ParentNode with RowColumnMixin, ScrollableMixin {
1616
@override
1717
final String type = 'rowColumn';
1818

1919
@override
2020
final bool supportsPadding = true;
2121

22-
/// ID of the canvas this node belongs to.
23-
String? belongsToCanvas;
22+
@JsonKey(includeFromJson: false)
23+
@override
24+
AxisC get scrollDirection =>
25+
rowColumnType == RowColumnType.row ? AxisC.horizontal : AxisC.vertical;
26+
27+
@override
28+
set scrollDirection(AxisC value) {}
2429

2530
/// Creates a [RowColumnNode] with the given data.
2631
RowColumnNode({
@@ -60,12 +65,32 @@ class RowColumnNode extends ParentNode with RowColumnMixin {
6065
super.reactions,
6166
super.parentID,
6267
super.clipsContent = false,
68+
// [ScrollableMixin] properties.
69+
bool isScrollable = false,
70+
bool reverse = false,
71+
ScrollPhysicsC physics = ScrollPhysicsC.alwaysScrollableScrollPhysics,
72+
bool primary = true,
73+
bool shrinkWrap = false,
74+
ScrollViewKeyboardDismissBehaviorC keyboardDismissBehavior =
75+
ScrollViewKeyboardDismissBehaviorC.manual,
76+
bool useFlutterListView = false,
6377
}) {
6478
setRowColumnMixin(
6579
rowColumnType: rowColumnType,
6680
mainAxisAlignment: mainAxisAlignment,
6781
crossAxisAlignment: crossAxisAlignment,
6882
);
83+
84+
setScrollableMixin(
85+
isScrollable: isScrollable,
86+
scrollDirection: scrollDirection,
87+
reverse: reverse,
88+
physics: physics,
89+
primary: primary,
90+
shrinkWrap: shrinkWrap,
91+
keyboardDismissBehavior: keyboardDismissBehavior,
92+
useFlutterListView: useFlutterListView,
93+
);
6994
}
7095

7196
/// Creates a [RowColumnNode] from a JSON data.

lib/src/api/nodes/row_column_node.g.dart

Lines changed: 32 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)