minimalFrame function

Decoration minimalFrame(
  1. OutlinedBorder shape, {
  2. Color? fill,
  3. BorderSide side = BorderSide.none,
  4. List<BoxShadow>? shadows,
})

What a framed part paints on shape: its fill, its rim (side) and shadows. A rounded rectangle paints as a BoxDecoration, the look's own path pixel for pixel; any other outline as a ShapeDecoration. A side that is BorderSide.none keeps the shape's own.

Implementation

Decoration minimalFrame(
  OutlinedBorder shape, {
  Color? fill,
  BorderSide side = BorderSide.none,
  List<BoxShadow>? shadows,
}) {
  final rim = side == BorderSide.none ? shape.side : side;
  if (shape is RoundedRectangleBorder) {
    return BoxDecoration(
      color: fill,
      borderRadius: shape.borderRadius,
      border: rim == BorderSide.none ? null : Border.fromBorderSide(rim),
      boxShadow: shadows,
    );
  }
  return ShapeDecoration(
    color: fill,
    shape: shape.copyWith(side: rim),
    shadows: shadows,
  );
}