children<T> method

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

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

  • 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 children.
  • children: The static subtrees 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 children.

Examples

composed.drive.children<double>(
  (elapsed) => (elapsed.inMilliseconds % 500) / 500.0,
  (context, via, progress, children) => Opacity(
    opacity: progress,
    child: Row(children: children),
  ),
  children: const [BadgeWidget(), LabelWidget()],
);

Implementation

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