build static method

Mix build(
  1. BuildContext context, {
  2. required Style style,
  3. required Widget builder(
    1. MixData mix
    ),
})

Builds a Mix widget.

The context and style are used to create a MixData instance. The builder is a function that takes the created MixData and returns a widget.

If inherit is set to true (default is false), the method will attempt to find the nearest Mix widget up the tree from the provided context and merge its MixData with the newly created one. This allows the new Mix widget to inherit styles from its ancestors.

Returns a Mix widget with the given MixData and child widget built by the builder. If inherit is true and a Mix widget is found up the tree, the returned Mix widget's MixData will be a merge of the ancestor's and the newly created one.

Implementation

static Mix build(
  BuildContext context, {
  required Style style,
  required Widget Function(MixData mix) builder,
}) {
  MixData mixData = MixData.create(context, style);

  // Returns a Mix widget with the given data and child.
  // If `inherit` is true, the data from the nearest Mix widget in the widget tree
  // (if any) is merged with the provided data.
  return Mix(data: mixData, child: builder(mixData));
}