@@ -248,6 +248,20 @@ class MotionModel with Equatable, SerializableMixin {
248248 /// Uniform scale; 1 is the node's own size.
249249 final double scale;
250250
251+ /// Horizontal offset in multiples of the node's own width, added to
252+ /// [translateX] : 1 moves it one width right. Lets a layout move by its
253+ /// own size whatever size it gets, e.g. a chess piece moved `file` squares
254+ /// across a board that stretches to the screen.
255+ ///
256+ /// Like [translateX] it moves what is painted, not the layout: taps still
257+ /// go to the place the node was laid out, so a node that must be tapped
258+ /// where it shows (a list or grid item moved off its own cell) has to be
259+ /// laid out there instead.
260+ final double shiftX;
261+
262+ /// Vertical offset in multiples of the node's own height; see [shiftX] .
263+ final double shiftY;
264+
251265 /// Horizontal scale on top of [scale] : a bar growing from its left edge
252266 /// (origin -1, 0) from 0 to 1.
253267 final double scaleX;
@@ -311,6 +325,11 @@ class MotionModel with Equatable, SerializableMixin {
311325 /// pulse, a blinking cursor.
312326 final MotionLoop loop;
313327
328+ /// How many times a [loop] runs before the node comes to rest; 0 repeats
329+ /// forever. A wrong move's shake: three runs of a reversing loop, replayed
330+ /// with [replayKey] .
331+ final int repeat;
332+
314333 /// Animates from rest (or from [enterFrom] ) to these values when the node
315334 /// first appears, over [durationMs] , instead of starting there: a record
316335 /// sliding out of its sleeve when the screen opens.
@@ -375,6 +394,8 @@ class MotionModel with Equatable, SerializableMixin {
375394 this .translateX = 0 ,
376395 this .translateY = 0 ,
377396 this .scale = 1 ,
397+ this .shiftX = 0 ,
398+ this .shiftY = 0 ,
378399 this .scaleX = 1 ,
379400 this .scaleY = 1 ,
380401 this .opacity = 1 ,
@@ -391,6 +412,7 @@ class MotionModel with Equatable, SerializableMixin {
391412 this .spin = 0 ,
392413 this .spinRampMs = 800 ,
393414 this .loop = MotionLoop .none,
415+ this .repeat = 0 ,
394416 this .enter = false ,
395417 this .enterFrom,
396418 this .replayKey,
@@ -412,6 +434,8 @@ class MotionModel with Equatable, SerializableMixin {
412434 'translateX' ,
413435 'translateY' ,
414436 'scale' ,
437+ 'shiftX' ,
438+ 'shiftY' ,
415439 'scaleX' ,
416440 'scaleY' ,
417441 'opacity' ,
@@ -455,6 +479,8 @@ class MotionModel with Equatable, SerializableMixin {
455479 translateX != 0 ||
456480 translateY != 0 ||
457481 scale != 1 ||
482+ shiftX != 0 ||
483+ shiftY != 0 ||
458484 scaleX != 1 ||
459485 scaleY != 1 ||
460486 opacity != 1 ||
@@ -503,6 +529,8 @@ class MotionModel with Equatable, SerializableMixin {
503529 'translateX' => translateX,
504530 'translateY' => translateY,
505531 'scale' => scale,
532+ 'shiftX' => shiftX,
533+ 'shiftY' => shiftY,
506534 'scaleX' => scaleX,
507535 'scaleY' => scaleY,
508536 'opacity' => opacity,
@@ -519,6 +547,8 @@ class MotionModel with Equatable, SerializableMixin {
519547 double ? translateX,
520548 double ? translateY,
521549 double ? scale,
550+ double ? shiftX,
551+ double ? shiftY,
522552 double ? scaleX,
523553 double ? scaleY,
524554 double ? opacity,
@@ -535,6 +565,7 @@ class MotionModel with Equatable, SerializableMixin {
535565 double ? spin,
536566 int ? spinRampMs,
537567 MotionLoop ? loop,
568+ int ? repeat,
538569 bool ? enter,
539570 MotionModel ? enterFrom,
540571 bool clearEnterFrom = false ,
@@ -553,6 +584,8 @@ class MotionModel with Equatable, SerializableMixin {
553584 translateX: translateX ?? this .translateX,
554585 translateY: translateY ?? this .translateY,
555586 scale: scale ?? this .scale,
587+ shiftX: shiftX ?? this .shiftX,
588+ shiftY: shiftY ?? this .shiftY,
556589 scaleX: scaleX ?? this .scaleX,
557590 scaleY: scaleY ?? this .scaleY,
558591 opacity: opacity ?? this .opacity,
@@ -569,6 +602,7 @@ class MotionModel with Equatable, SerializableMixin {
569602 spin: spin ?? this .spin,
570603 spinRampMs: spinRampMs ?? this .spinRampMs,
571604 loop: loop ?? this .loop,
605+ repeat: repeat ?? this .repeat,
572606 enter: enter ?? this .enter,
573607 enterFrom: clearEnterFrom ? null : enterFrom ?? this .enterFrom,
574608 replayKey: clearReplayKey ? null : replayKey ?? this .replayKey,
@@ -586,6 +620,8 @@ class MotionModel with Equatable, SerializableMixin {
586620 translateX: 0 ,
587621 translateY: 0 ,
588622 scale: 1 ,
623+ shiftX: 0 ,
624+ shiftY: 0 ,
589625 scaleX: 1 ,
590626 scaleY: 1 ,
591627 opacity: 1 ,
@@ -600,6 +636,8 @@ class MotionModel with Equatable, SerializableMixin {
600636 'translateX' => copyWith (translateX: value),
601637 'translateY' => copyWith (translateY: value),
602638 'scale' => copyWith (scale: value),
639+ 'shiftX' => copyWith (shiftX: value),
640+ 'shiftY' => copyWith (shiftY: value),
603641 'scaleX' => copyWith (scaleX: value),
604642 'scaleY' => copyWith (scaleY: value),
605643 'opacity' => copyWith (opacity: value.clamp (0 , 1 ).toDouble ()),
@@ -740,6 +778,8 @@ class MotionModel with Equatable, SerializableMixin {
740778 translateX,
741779 translateY,
742780 scale,
781+ shiftX,
782+ shiftY,
743783 scaleX,
744784 scaleY,
745785 opacity,
@@ -756,6 +796,7 @@ class MotionModel with Equatable, SerializableMixin {
756796 spin,
757797 spinRampMs,
758798 loop,
799+ repeat,
759800 enter,
760801 enterFrom,
761802 replayKey,
0 commit comments