borderAll method

Border? borderAll({
  1. required double width,
  2. required Color color,
  3. BorderStyle? style,
})

use:

OudsBorder().borderAll(width, color)

instead of using

Border.all()

directly.

Creates a uniform border with the specified width, color, and style. If the width matches the "Hairline" value (0.0), the function returns null, which can be used to avoid applying a border.

  • width: The width of the border. If this value is considered "Hairline," no border is created.
  • color: The color of the border.
  • style: The style of the border (default: BorderStyle.solid).

Returns an instance of Border if the width is not "Hairline"; otherwise, returns null.

Implementation

Border? borderAll({
  required double width,
  required Color color,
  BorderStyle? style,
}) {

  final widthNone = width.takeUnlessHairline();
  if (widthNone == null) return null;

  return Border.all(
    color: color,
    width: width,
    style: style ?? BorderStyle.solid,
  );
}