Skip to content

Commit ca6030b

Browse files
committed
Merge branch 'wt/sdk-close' into claude/epic-dirac-pn3a5s
# Conflicts: # CHANGELOG.md
2 parents 250c3a7 + 0d4c586 commit ca6030b

10 files changed

Lines changed: 323 additions & 23 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ The render command (`tool/render`), from nine agents' reports of building multi-
5050
`saved-empty`), and `--compare-map home=index` renames.
5151
- **`unknown_screen`** is reported once per missing screen with how many links name it, not once per link.
5252

53+
- **A migrated stroke path draws itself on again.** codelessly_api's migration now writes `strokePath.drawMs` as an
54+
animation of the path op's `trimEnd` and a transition of it; the player draws it frame for frame as 30.0.0's
55+
RenderStrokePath did (`test/custom_paint/stroke_draw_on_test.dart`: the drawn share against the old formula and
56+
the pixels against the static drawing at that share). Three general fixes made that exact:
57+
- a track with no `from` or `to` on a path the player patches into the node (not `motion`, `opacity`) reads the
58+
node's own value without the track's last value (`RenderTree.resolveUnanimated`; before, it read back what it
59+
had drawn and stayed at its start), the field's declared default where the JSON omits it
60+
(`BindPaths.declaredDefault`), and an inline expression there evaluated;
61+
- a transition on such a path watches the node's own value, not the animated one, so a bound change under a
62+
settled track eases;
63+
- a node its animations patch re-applies when a binding changes even if the node as shown did not (a top-level
64+
node, or a binding change that left it equal), so its player sees the change.
65+
- **A time picker's `use24h` is `alwaysUse24HourFormat`** (codelessly_api; `TimePickerProps.alwaysUse24HourFormat`).
66+
- **State patches on `self` and `@<key>`** in schema-2 documents are migrated to the node's id (codelessly_api), so
67+
those hover, press and selection styles now apply.
68+
5369
## 30.1.0
5470

5571
Requires codelessly_api 30.1.0. **The schema stays 3**: every loader reads `"schema": 2` and `3`, migrating 2 in

‎lib/src/render/animations.dart‎

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ class RenderAnimations extends RenderPose {
462462
void configure(NodeBox? box, Node n, {required bool animates, RenderMotion? motion, RenderShimmer? shimmer}) {
463463
_box = box;
464464
final previous = _node;
465+
final previousBase = _base;
465466
_node = n;
467+
_base = _patchesOwnPaths(n) && box != null ? box.tree.resolveUnanimated(box.id, instance: box.instance) ?? n : n;
466468
_motion = motion;
467469
_shimmer = shimmer;
468470
final wasAnimating = _animates;
@@ -503,7 +505,7 @@ class RenderAnimations extends RenderPose {
503505
for (final id in cues) {
504506
unawaited(play(id));
505507
}
506-
if (previous != null && wasAnimating) _transition(previous, n);
508+
if (previous != null && wasAnimating) _transition(previousBase ?? previous, _base!);
507509
}
508510
_show();
509511
_sync();
@@ -894,6 +896,22 @@ class RenderAnimations extends RenderPose {
894896
Map<String, Map<String, Object?>> _lastPatches = const {};
895897
Map<String, Object?> _lastState = const {};
896898

899+
/// The node without what its own tracks patch into it (a path that is
900+
/// not its motion, opacity or shimmer): what an omitted end and a
901+
/// transition read. [_node] itself when nothing is patched.
902+
Node? _base;
903+
904+
/// Whether [n]'s own tracks or transitions are on paths the player
905+
/// patches into the node ([RenderTree.setAnimatedValues]).
906+
static bool _patchesOwnPaths(Node n) {
907+
bool patched(String path) =>
908+
path.isNotEmpty && path != 'opacity' && path != 'shimmer.position' && !path.startsWith('motion') && path != '*';
909+
for (final a in n.behaviors.animations) {
910+
if (a.tracks.any((t) => t.node.isEmpty && t.variable.isEmpty && patched(t.path))) return true;
911+
}
912+
return n.behaviors.transitions.any((t) => patched(t.property));
913+
}
914+
897915
/// The controller value of [clock] to draw with: its own in a running
898916
/// app; on a design canvas its `previewAt` (null: not drawn).
899917
double? _drawn(AnimationClock clock) {
@@ -997,7 +1015,7 @@ class RenderAnimations extends RenderPose {
9971015
if (t.node.isEmpty && eased(path)) continue;
9981016
// Any other path: a patch of the node (or of node [t.node]).
9991017
final target = t.node.isEmpty ? n.id : t.node;
1000-
final value = t.valueAt(v, own: _ownValue(target, path), begin: _resolved(t.from), end: _resolved(t.to));
1018+
final value = t.valueAt(v, own: _resolved(_ownValue(target, path)), begin: _resolved(t.from), end: _resolved(t.to));
10011019
if (value != null) (patches[target] ??= {})[path] = value;
10021020
}
10031021
if (dx != 0 || dy != 0 || sc != 1 || sx != 1 || sy != 1 || rot != 0) {
@@ -1034,9 +1052,10 @@ class RenderAnimations extends RenderPose {
10341052
_publish();
10351053
}
10361054

1037-
/// The node's own [path] value as stored (an omitted `from` or `to`).
1055+
/// The node's own [path] value as stored (an omitted `from` or `to`), its
1056+
/// declared default where the JSON omits it.
10381057
Object? _ownValue(String id, String path, {Node? node}) {
1039-
node ??= id == _node?.id ? _node : _box?.nodeOf(id);
1058+
node ??= id == _node?.id ? (_base ?? _node) : _box?.nodeOf(id);
10401059
if (node == null) return null;
10411060
Object? at = node.toJson();
10421061
for (final k in api.BindPaths.parse(path)) {
@@ -1049,7 +1068,8 @@ class RenderAnimations extends RenderPose {
10491068
at = api.readMap(at)?[k];
10501069
}
10511070
}
1052-
return at;
1071+
// Omitted from its JSON: the field's declared default.
1072+
return at ?? api.BindPaths.declaredDefault(node, path);
10531073
}
10541074

10551075
Object? _resolved(Object? v) => v is String && v.contains(r'${') ? _number(v) ?? (_values?.interpolate(v)) : v;

‎lib/src/render/node_tree.dart‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ class RenderTree {
500500
}
501501

502502
BoundNode _withAnimated(String id, Object? instance, BoundNode bound) {
503+
if (_unanimated) return bound;
503504
final values = _animated[(id, instance)] ?? (instance == null ? null : _animated[(id, null)]);
504505
if (values == null) return bound;
505506
var n = bound.node;
@@ -591,6 +592,22 @@ class RenderTree {
591592
/// states that style it, its bindings applied ([binder]).
592593
Node? resolve(String id, {Object? instance}) => resolveBound(id, instance: instance)?.node;
593594

595+
/// [resolve] without the values node [id]'s animations give it
596+
/// ([setAnimatedValues]): the value a track with no `from` or `to` starts
597+
/// or ends at, and what a transition watches, are the node's own, not
598+
/// what the track drew last.
599+
Node? resolveUnanimated(String id, {Object? instance}) {
600+
final was = _unanimated;
601+
_unanimated = true;
602+
try {
603+
return resolve(id, instance: instance);
604+
} finally {
605+
_unanimated = was;
606+
}
607+
}
608+
609+
bool _unanimated = false;
610+
594611
/// [resolve], with whether a binding hides the node and what it read. The
595612
/// root of a component instance is seamed with its call (bound in the
596613
/// caller's scope): the call's size and placement, the root's inside.
@@ -1014,6 +1031,9 @@ class NodeBox extends RenderProxyBox implements NodeBuilder, SkippedChildLayout
10141031
List<Listenable> _bindingWatch = const [];
10151032
Listenable? _bindingListenable;
10161033

1034+
/// Whether animations patch this node ([RenderTree.setAnimatedValues]).
1035+
bool get _animatedOver => tree._animated.containsKey((id, instance)) || (instance != null && tree._animated.containsKey((id, null)));
1036+
10171037
void _watchBindings(List<Listenable> watch) {
10181038
if (listEquals(watch, _bindingWatch)) return;
10191039
_bindingListenable?.removeListener(_bindingsChanged);
@@ -1041,7 +1061,10 @@ class NodeBox extends RenderProxyBox implements NodeBuilder, SkippedChildLayout
10411061
}
10421062
final bound = tree.resolveBound(id, instance: instance);
10431063
final n = _withTextDefault(bound?.node);
1044-
if (bound != null && n != null && bound.collapsed == _collapsed) {
1064+
// While its animations patch it, the node as shown can stay the same
1065+
// while what they draw over changed (a bound value a transition eases):
1066+
// its player must see it, so it re-applies.
1067+
if (bound != null && n != null && bound.collapsed == _collapsed && !_animatedOver) {
10451068
if (n == old) {
10461069
_watchBindings(bound.watch);
10471070
return;
@@ -1329,8 +1352,11 @@ class NodeBox extends RenderProxyBox implements NodeBuilder, SkippedChildLayout
13291352
_watchBindings(bound?.watch ?? const []);
13301353
final collapsed = bound?.collapsed ?? false;
13311354
// A top-level node that only moved: its content doesn't depend on where
1332-
// it sits (the host offsets it), so nothing re-applies or repaints.
1333-
if (collapsed == _collapsed && _slot.kind == SlotKind.root && n != null && _applied != null && _onlyMoved(_applied!, n)) {
1355+
// it sits (the host offsets it), so nothing re-applies or repaints. Not
1356+
// while its animations patch it: what they draw over can change under
1357+
// the same shown node (a bound value a transition eases).
1358+
if (collapsed == _collapsed && _slot.kind == SlotKind.root && n != null && _applied != null && _onlyMoved(_applied!, n) &&
1359+
!_animatedOver) {
13341360
_node = n;
13351361
_applied = n;
13361362
return;

‎lib/src/widgets/inputs.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1753,7 +1753,7 @@ class _TimePickerIslandState extends State<_TimePickerIsland> {
17531753
}
17541754
final time = _time(picked ?? value) ?? const TimeOfDay(hour: 0, minute: 0);
17551755
final help = n.prop(PickerFieldProps.helpText);
1756-
final use24h = n.prop(TimePickerProps.use24h);
1756+
final use24h = n.prop(TimePickerProps.alwaysUse24HourFormat);
17571757
return _pickerFace(
17581758
context,
17591759
n,

‎test/catalog_corpus_test.dart‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// event_desktop_tip, ninefold_board, strata_tabs), and strata_tabs' document
1212
// and its diagram_0 node again for its stroke path (a custom paint path op),
1313
// were taken again with them; the others are as taken before catalogs.
14+
// After 30.1.0, step `states.target` resolved the state patches that named
15+
// their node `self` (event_desktop_bound, event_desktop_tip: 8 lines, taken
16+
// again).
1417
import 'dart:convert';
1518
import 'dart:io';
1619

0 commit comments

Comments
 (0)