pub struct TableBorder {
pub top: BorderSide,
pub right: BorderSide,
pub bottom: BorderSide,
pub left: BorderSide,
pub horizontal_inside: BorderSide,
pub vertical_inside: BorderSide,
pub border_radius: BorderRadius,
}Expand description
Border specification for Table widgets.
This is like Border, with the addition of two sides: the inner horizontal borders between
rows and the inner vertical borders between columns.
The sides are represented by BorderSide objects.
Fields§
§top: BorderSideThe top side of this border.
right: BorderSideThe right side of this border.
bottom: BorderSideThe bottom side of this border.
left: BorderSideThe left side of this border.
horizontal_inside: BorderSideThe horizontal interior sides of this border.
vertical_inside: BorderSideThe vertical interior sides of this border.
border_radius: BorderRadiusThe BorderRadius to use when painting the corners of this border.
It is also applied to DataTable’s Material.
Implementations§
Source§impl TableBorder
impl TableBorder
Sourcepub const fn new() -> TableBorder
pub const fn new() -> TableBorder
Creates a border for a table.
All the sides of the border default to BorderSide::NONE; Dart’s named arguments are
the setters.
Sourcepub fn top(self, top: BorderSide) -> TableBorder
pub fn top(self, top: BorderSide) -> TableBorder
Dart TableBorder(top:).
Sourcepub fn right(self, right: BorderSide) -> TableBorder
pub fn right(self, right: BorderSide) -> TableBorder
Dart TableBorder(right:).
Sourcepub fn bottom(self, bottom: BorderSide) -> TableBorder
pub fn bottom(self, bottom: BorderSide) -> TableBorder
Dart TableBorder(bottom:).
Sourcepub fn left(self, left: BorderSide) -> TableBorder
pub fn left(self, left: BorderSide) -> TableBorder
Dart TableBorder(left:).
Sourcepub fn horizontal_inside(self, horizontal_inside: BorderSide) -> TableBorder
pub fn horizontal_inside(self, horizontal_inside: BorderSide) -> TableBorder
Dart TableBorder(horizontalInside:).
Sourcepub fn vertical_inside(self, vertical_inside: BorderSide) -> TableBorder
pub fn vertical_inside(self, vertical_inside: BorderSide) -> TableBorder
Dart TableBorder(verticalInside:).
Sourcepub fn border_radius(self, border_radius: BorderRadius) -> TableBorder
pub fn border_radius(self, border_radius: BorderRadius) -> TableBorder
Dart TableBorder(borderRadius:).
Sourcepub fn all(
color: Color,
width: f64,
style: BorderStyle,
border_radius: BorderRadius,
) -> TableBorder
pub fn all( color: Color, width: f64, style: BorderStyle, border_radius: BorderRadius, ) -> TableBorder
A uniform border with all sides the same color and width.
Dart’s TableBorder.all defaults the sides to black solid borders, one logical pixel
wide, with no radius.
Sourcepub fn symmetric(
inside: BorderSide,
outside: BorderSide,
border_radius: BorderRadius,
) -> TableBorder
pub fn symmetric( inside: BorderSide, outside: BorderSide, border_radius: BorderRadius, ) -> TableBorder
Creates a border for a table where all the interior sides use the same styling and all the exterior sides use the same styling.
Sourcepub fn dimensions(&self) -> EdgeInsets
pub fn dimensions(&self) -> EdgeInsets
The widths of the sides of this border represented as an EdgeInsets.
This can be used, for example, with a Padding widget to inset a box by the size of
these borders.
Sourcepub fn is_uniform(&self) -> bool
pub fn is_uniform(&self) -> bool
Whether all the sides of the border (outside and inside) are identical. Uniform borders are typically more efficient to paint.
Sourcepub fn scale(&self, t: f64) -> TableBorder
pub fn scale(&self, t: f64) -> TableBorder
Creates a copy of this border but with the widths scaled by the factor t.
The t argument represents the multiplicand, or the position on the timeline for an
interpolation from nothing to self, with 0.0 meaning that the object returned should
be the nil variant of this object, 1.0 meaning that no change should be applied,
returning self (or something equivalent to self), and other values meaning that the
object should be multiplied by t. Negative values are treated like zero.
Values for t are usually obtained from an Animation<f64>, such as an
AnimationController.
See also:
BorderSide::scale, which is used to implement this method.
Sourcepub fn lerp(
a: Option<TableBorder>,
b: Option<TableBorder>,
t: f64,
) -> Option<TableBorder>
pub fn lerp( a: Option<TableBorder>, b: Option<TableBorder>, t: f64, ) -> Option<TableBorder>
Linearly interpolate between two table borders.
If a border is None, it is treated as having only BorderSide::NONE borders.
The t argument represents position on the timeline, with 0.0 meaning that the
interpolation has not started, returning a (or something equivalent to a), 1.0
meaning that the interpolation has finished, returning b (or something equivalent to
b), and values in between meaning that the interpolation is at the relevant point on
the timeline between a and b.
Sourcepub fn paint(
&self,
canvas: &mut Canvas,
rect: Rect,
rows: &[f64],
columns: &[f64],
)
pub fn paint( &self, canvas: &mut Canvas, rect: Rect, rows: &[f64], columns: &[f64], )
Paints the border around the given Rect on the given Canvas, with the given
rows and columns.
Uniform borders are more efficient to paint than more complex borders.
The rows argument specifies the vertical positions between the rows, relative to the
given rectangle. For example, if the table contained two rows of height 100.0 each,
then rows would contain a single value, 100.0, which is the vertical position between
the two rows (relative to the top edge of rect).
The columns argument specifies the horizontal positions between the columns, relative
to the given rectangle. For example, if the table contained two columns of height 100.0
each, then columns would contain a single value, 100.0, which is the vertical position
between the two columns (relative to the left edge of rect).
The vertical_inside border is only drawn if there are at
least two columns. The horizontal_inside border is only
drawn if there are at least two rows. The horizontal borders are drawn after the
vertical borders.
The outer borders (in the order top, right,
bottom, left, with left above the
others) are painted after the inner borders.
The paint order is particularly notable in the case of partially-transparent borders.