Skip to content

Commit 2e862ca

Browse files
committed
Make navigation bar and app bar nodes extend ParentReactionMixin
1 parent ba9d37f commit 2e862ca

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

lib/src/api/nodes/app_bar_node.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const double kAppBarDefaultHeight = 56;
2121
/// in Flutter for more details.
2222
@JsonSerializable()
2323
class AppBarNode extends SceneNode
24-
with CustomPropertiesMixin, VariablePropertiesMixin {
24+
with CustomPropertiesMixin, VariablePropertiesMixin, ParentReactionMixin {
2525
@override
2626
final String type = 'appBar';
2727

@@ -54,6 +54,16 @@ class AppBarNode extends SceneNode
5454
@override
5555
List<TriggerType> get triggerTypes => [TriggerType.click];
5656

57+
@override
58+
List<ReactionMixin> get reactiveChildren {
59+
final List<ReactionMixin> items = [...properties.actions];
60+
if (properties.leading.icon.show &&
61+
properties.automaticallyImplyLeading == false) {
62+
items.add(properties.leading);
63+
}
64+
return items;
65+
}
66+
5767
/// Creates a new [AppBarNode] instance from a JSON data.
5868
factory AppBarNode.fromJson(Map json) => _$AppBarNodeFromJson(json);
5969

lib/src/api/nodes/navigation_bar_node.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ const double kDefaultNavigationBarHeight = 80;
136136
/// Inspired from: https://m3.material.io/components/navigation-bar.
137137
@JsonSerializable()
138138
class NavigationBarNode extends SceneNode
139-
with CustomPropertiesMixin, VariablePropertiesMixin {
139+
with CustomPropertiesMixin, VariablePropertiesMixin, ParentReactionMixin {
140140
@override
141141
final String type = 'navigationBar';
142142

@@ -174,6 +174,9 @@ class NavigationBarNode extends SceneNode
174174
@override
175175
List<TriggerType> get triggerTypes => [TriggerType.click];
176176

177+
@override
178+
List<ReactionMixin> get reactiveChildren => properties.items;
179+
177180
/// Creates a [NavigationBarNode] from a JSON object.
178181
factory NavigationBarNode.fromJson(Map json) =>
179182
_$NavigationBarNodeFromJson(json);

0 commit comments

Comments
 (0)