BorderSide class

A side of a border of a box.

A Border consists of four BorderSide objects: Border.top, Border.left, Border.right, and Border.bottom.

This sample shows how BorderSide objects can be used in a Container, via a BoxDecoration and a Border, to decorate some Text. In this example, the text has a thick bar above it that is light blue, and a thick bar below it that is a darker shade of blue.
Container(
  padding: EdgeInsets.all(8.0),
  decoration: BoxDecoration(
    border: Border(
      top: BorderSide(width: 16.0, color: Colors.lightBlue.shade50),
      bottom: BorderSide(width: 16.0, color: Colors.lightBlue.shade900),
    ),
  ),
  child: Text('Flutter in the sky', textAlign: TextAlign.center),
)

See also:

Annotations
  • @immutable

Constructors

BorderSide({Color color: const Color(0xFF000000), double width: 1.0, BorderStyle style: BorderStyle.solid })
Creates the side of a border. [...]
const

Properties

color Color
The color of this side of the border.
final
hashCode int
The hash code for this object. [...]
read-only, override
style BorderStyle
The style of this side of the border. [...]
final
width double
The width of this side of the border, in logical pixels. A zero-width border is a hairline border. To omit the border entirely, set the style to BorderStyle.none.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

copyWith({Color color, double width, BorderStyle style }) BorderSide
Creates a copy of this border but with the given fields replaced with the new values.
scale(double t) BorderSide
Creates a copy of this border side description but with the width scaled by the factor t. [...]
toPaint() Paint
Create a Paint object that, if used to stroke a line, will draw the line in this border's style. [...]
toString() String
Returns a string representation of this object.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited

Operators

operator ==(dynamic other) bool
The equality operator. [...]
override

Static Methods

canMerge(BorderSide a, BorderSide b) bool
Whether the two given BorderSides can be merged using new BorderSide.merge. [...]
lerp(BorderSide a, BorderSide b, double t) BorderSide
Linearly interpolate between two border sides. [...]
merge(BorderSide a, BorderSide b) BorderSide
Creates a BorderSide that represents the addition of the two given BorderSides. [...]

Constants

none → const BorderSide
A hairline black border that is not rendered.
const BorderSide(width: 0.0, style: BorderStyle.none)