Skip to content

Commit 4e93777

Browse files
committed
Merge remote-tracking branch 'origin/master' into claude/practical-allen-vskohd
2 parents 88784ee + d876235 commit 4e93777

74 files changed

Lines changed: 672 additions & 40 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## Unreleased
2+
3+
- New `wheel` (mouse wheel / trackpad scroll, with deltas, pointer position
4+
and modifiers), `pinch` (two-finger zoom, with step and total scale and
5+
the focal point) and `keyUp` (screen key releases) triggers, for pan and
6+
zoom canvases and held keys.
7+
- `VarianceProperties.tabletMinWidth` and `desktopMinWidth` move where a
8+
responsive layout switches layouts (600 and 1024 by default);
9+
`ScreenBreakpoint.forWidth` takes them.
10+
111
## 6.3.0
212

313
This candidate includes the changes documented below for 6.2.0, which has

‎lib/src/api/models/breakpoint.dart‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,15 @@ enum ScreenBreakpoint {
7171
required this.defaultWidth,
7272
});
7373

74-
/// The breakpoint a screen or canvas [width] wide falls in.
75-
static ScreenBreakpoint forWidth(double width) {
76-
if (width >= desktop.minWidth) return desktop;
77-
if (width >= tablet.minWidth) return tablet;
74+
/// The breakpoint a screen or canvas [width] wide falls in; a responsive
75+
/// layout may move where tablet and desktop start.
76+
static ScreenBreakpoint forWidth(
77+
double width, {
78+
double? tabletMinWidth,
79+
double? desktopMinWidth,
80+
}) {
81+
if (width >= (desktopMinWidth ?? desktop.minWidth)) return desktop;
82+
if (width >= (tabletMinWidth ?? tablet.minWidth)) return tablet;
7883
return mobile;
7984
}
8085
}

‎lib/src/api/models/motion.dart‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

‎lib/src/api/models/motion.g.dart‎

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

‎lib/src/api/models/trigger.dart‎

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,30 @@ enum TriggerType {
170170
/// in logical pixels), `${result.max}` (how far it can scroll) and
171171
/// `${result.fraction}` (0 at the start, 1 at the end), so a header can
172172
/// collapse, a bar fade in or a button appear as the content scrolls.
173-
scroll;
173+
scroll,
174+
175+
/// Triggered when the mouse wheel or a trackpad scrolls over the target.
176+
/// The actions read `${result.deltaX}` and `${result.deltaY}` (how far it
177+
/// scrolled, positive down and right), `${result.x}` and `${result.y}`
178+
/// (the pointer, relative to the target's top-left) and
179+
/// `${result.ctrl}` (Control or Command held: browsers send trackpad
180+
/// pinches as Control + wheel), `${result.shift}` and `${result.trackpad}`.
181+
/// The scroll doesn't also scroll the page.
182+
wheel,
183+
184+
/// Triggered on every step of a two-finger pinch (or trackpad pinch) on
185+
/// the target. The actions read `${result.scale}` (the zoom since the
186+
/// previous step: above 1 spreads, below 1 pinches), `${result.totalScale}`
187+
/// (since the pinch started), `${result.x}`, `${result.y}` (the point
188+
/// between the fingers, relative to the target) and `${result.deltaX}`,
189+
/// `${result.deltaY}` (how far that point moved). A one-finger drag on a
190+
/// target with pinch reactions still runs its [drag] reactions.
191+
pinch,
192+
193+
/// Triggered when a key is released while the screen it is set on shows
194+
/// and no text field has focus, with the same `${result}` as [keyDown]:
195+
/// together they track a held key (Space to pan).
196+
keyUp;
174197

175198
/// The triggers for the mouse cursor entering and leaving the target.
176199
static const List<TriggerType> hovers = [
@@ -285,6 +308,12 @@ enum TriggerType {
285308
return 'Reorder';
286309
case TriggerType.scroll:
287310
return 'Scroll';
311+
case TriggerType.wheel:
312+
return 'Wheel';
313+
case TriggerType.pinch:
314+
return 'Pinch';
315+
case TriggerType.keyUp:
316+
return 'Key Up';
288317
}
289318
}
290319
}
@@ -311,7 +340,8 @@ class TriggerModel with Equatable, SerializableMixin {
311340
/// How often a [TriggerType.timer] fires, in milliseconds.
312341
final int? intervalMs;
313342

314-
/// The key a [TriggerType.keyPress] or [TriggerType.keyDown] listens for.
343+
/// The key a [TriggerType.keyPress], [TriggerType.keyDown] or
344+
/// [TriggerType.keyUp] listens for.
315345
/// Key down labels (e.g. `ArrowLeft`) are case-insensitive; null listens
316346
/// for every key.
317347
final String? key;

‎lib/src/api/models/trigger.g.dart‎

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

0 commit comments

Comments
 (0)