sharedBorder method

SharedBorder sharedBorder(
  1. List<int> surfaceArgbs, {
  2. Usage usage = Usage.border,
  3. ColorModel colorModel = ColorModel.kDefault,
})

One border tone for surfaces drawn together over this background, so they read at one elevation. Each border keeps its surface's hue.

surfaceArgbs has each surface's resting color; it sets that border's hue and chroma. Hovered and pressed states are deliberately excluded: the border doesn't change with state, and a pressed surface briefly meeting its border just reads as the same elevation.

A tone works if every border clears usage's contrast against every pixel (SharedBorder.clearsBackground), or else against its own surface. The first lets a surface that already stands out go without a visible border. Preferred: just darker than the darkest surface, then just lighter than the lightest, then between.

colorModel is the model the surfaces' hues are read and drawn in.

Implementation

SharedBorder sharedBorder(
  List<int> surfaceArgbs, {
  Usage usage = Usage.border,
  ColorModel colorModel = ColorModel.kDefault,
}) {
  if (surfaceArgbs.isEmpty) {
    throw ArgumentError.value(surfaceArgbs, 'surfaceArgbs', 'is empty');
  }
  return _borders.putIfAbsent(
    _BorderKey(surfaceArgbs, usage, colorModel),
    () => _solveSharedBorder(surfaceArgbs, usage, colorModel),
  );
}