child<T> method

Widget child<T>(
  1. T onTick(
    1. Duration elapsed
    ),
  2. Widget builder(
    1. BuildContext context,
    2. BloomVia via,
    3. T value,
    4. Widget child,
    ), {
  3. required Widget child,
  4. Key? key,
})

Creates an inline reactive widget driven by a continuous frame ticker with an isolated static child.

  • onTick: Callback converting frame elapsed duration to state of type T. Evaluated synchronously with Duration.zero to seed initial state, and subsequently on frame ticks.
  • builder: Reactive builder callback receiving BuildContext, BloomVia, current driven value T, and child.
  • child: The static subtree to preserve across frame ticks.
  • key: Optional widget key.

Requires:

  • onTick must be a pure conversion function.

Ensures:

  • Returns an inline reactive Widget driven by frame ticks while isolating child.

Examples

composed.drive.child<double>(
  (elapsed) => (elapsed.inMicroseconds % 1000000) / 1000000.0,
  (context, via, progress, child) => Transform.rotate(
    angle: progress * 2 * math.pi,
    child: child,
  ),
  child: const HeavyDialGraphic(),
);

Implementation

@pragma('vm:prefer-inline')
Widget child<T>(
  T Function(Duration elapsed) onTick,
  Widget Function(BuildContext context, BloomVia via, T value, Widget child)
      builder, {
  required Widget child,
  Key? key,
}) =>
    _ComposedDriveWithChildWidget<T>(
      onTick: onTick,
      builder: builder,
      key: key,
      child: child,
    );