face method

Widget face(
  1. BuildContext context,
  2. Set<WidgetState> states, {
  3. required Widget content(
    1. MinimalStyleOf so,
    2. Color ink
    ),
  4. bool expand = false,
  5. Decoration? foregroundDecoration,
})

The face for states, its content drawn in the ink of the moment; expand fills the width.

Implementation

Widget face(
  BuildContext context,
  Set<WidgetState> states, {
  required Widget Function(MinimalStyleOf so, Color ink) content,
  bool expand = false,
  Decoration? foregroundDecoration,
}) {
  final so = MinimalStyleOf(layers, states);
  final least = so.minimumSize;
  final (fill, foreground) = colors(so);
  // The face lerps to each state (Minimal's short plain fade).
  return MinimalFace(
    ink: foreground,
    constraints: BoxConstraints(
      minWidth: least?.width ?? 0,
      minHeight:
          least?.height ??
          minimalGrownHeight(context, t.density.height(height)),
    ),
    width: expand ? double.infinity : null,
    // The label's line (16) and its padding stay under the smallest
    // height (24: a small button at compact density) with a rim or
    // without, so every variant takes the density's height and a row
    // of them shares one; a larger text scale still grows it.
    padding:
        so.paddingIn(context) ??
        t.density.padding(
          EdgeInsets.symmetric(horizontal: hPad, vertical: MinimalSpacing.s2),
        ),
    decoration: minimalFrame(
      so.shape ?? t.shapes.small,
      fill: fill,
      side: so.rim(border, t.rim),
    ),
    foregroundDecoration: foregroundDecoration,
    builder: (context, ink) => content(so, ink ?? foreground),
  );
}