Skip to main content

LinearBorder

Struct LinearBorder 

Source
pub struct LinearBorder {
    pub side: BorderSide,
    pub start: Option<LinearBorderEdge>,
    pub end: Option<LinearBorderEdge>,
    pub top: Option<LinearBorderEdge>,
    pub bottom: Option<LinearBorderEdge>,
}
Expand description

An OutlinedBorder like BoxBorder that allows one to define a rectangular (box) border in terms of zero to four LinearBorderEdges, each of which is rendered as a single line.

This class resolves itself against the current TextDirection. Start and end values resolve to left and right for TextDirection::Ltr and to right and left for TextDirection::Rtl.

Fields§

§side: BorderSide

The border outline’s color and weight.

§start: Option<LinearBorderEdge>

Defines the left edge for TextDirection::Ltr or the right for TextDirection::Rtl.

§end: Option<LinearBorderEdge>

Defines the right edge for TextDirection::Ltr or the left for TextDirection::Rtl.

§top: Option<LinearBorderEdge>

Defines the top edge.

§bottom: Option<LinearBorderEdge>

Defines the bottom edge.

Implementations§

Source§

impl LinearBorder

Source

pub const NONE: LinearBorder

No border.

Source

pub fn new() -> LinearBorder

Creates a rectangular box border that’s rendered as zero to four lines.

Source

pub fn side(self, side: BorderSide) -> LinearBorder

The color and width of each line.

Source

pub fn start(self, start: LinearBorderEdge) -> LinearBorder

Defines the left edge for TextDirection::Ltr or the right for TextDirection::Rtl.

Source

pub fn end(self, end: LinearBorderEdge) -> LinearBorder

Defines the right edge for TextDirection::Ltr or the left for TextDirection::Rtl.

Source

pub fn top(self, top: LinearBorderEdge) -> LinearBorder

Defines the top edge.

Source

pub fn bottom(self, bottom: LinearBorderEdge) -> LinearBorder

Defines the bottom edge.

Source

pub fn start_side(side: BorderSide, alignment: f64, size: f64) -> LinearBorder

Creates a rectangular box border with an edge on the left for TextDirection::Ltr or on the right for TextDirection::Rtl.

Source

pub fn end_side(side: BorderSide, alignment: f64, size: f64) -> LinearBorder

Creates a rectangular box border with an edge on the right for TextDirection::Ltr or on the left for TextDirection::Rtl.

Source

pub fn top_side(side: BorderSide, alignment: f64, size: f64) -> LinearBorder

Creates a rectangular box border with an edge on the top.

Source

pub fn bottom_side(side: BorderSide, alignment: f64, size: f64) -> LinearBorder

Creates a rectangular box border with an edge on the bottom.

Source

pub fn scale(&self, t: f64) -> LinearBorder

Creates a copy of this border, scaled by the factor t.

Source

pub fn copy_with(&self) -> LinearBorder

Creates a copy of this object. Chain setters to replace fields (border.copy_with().side(s).start(e)).

Trait Implementations§

Source§

impl Clone for LinearBorder

Source§

fn clone(&self) -> LinearBorder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for LinearBorder

Source§

impl Debug for LinearBorder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for LinearBorder

Source§

fn default() -> LinearBorder

Returns the “default value” for a type. Read more
Source§

impl OutlinedBorder for LinearBorder

Source§

fn side(&self) -> BorderSide

The border outline’s color and weight.
Source§

fn copy_with(&self, side: Option<BorderSide>) -> OutlinedBorderRef

Returns a copy of this OutlinedBorder that draws its outline with the specified side, if side is Some.
Source§

impl PartialEq for LinearBorder

Source§

fn eq(&self, other: &LinearBorder) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl ShapeBorder for LinearBorder

Source§

fn dimensions(&self) -> EdgeInsetsGeometry

The widths of the sides of this border represented as an EdgeInsetsGeometry.
Source§

fn scale(&self, t: f64) -> ShapeBorderRef

Creates a copy of this border, scaled by the factor t.
Source§

fn lerp_from( &self, a: Option<&(dyn ShapeBorder + 'static)>, t: f64, ) -> Option<ShapeBorderRef>

Linearly interpolates from another ShapeBorder (possibly of another class) to this. Read more
Source§

fn lerp_to( &self, b: Option<&(dyn ShapeBorder + 'static)>, t: f64, ) -> Option<ShapeBorderRef>

Linearly interpolates from this to another ShapeBorder (possibly of another class). Read more
Source§

fn get_inner_path( &self, rect: Rect, text_direction: Option<TextDirection>, ) -> Path

Create a Path that describes the inner edge of the border.
Source§

fn get_outer_path( &self, rect: Rect, _text_direction: Option<TextDirection>, ) -> Path

Create a Path that describes the outer edge of the border.
Source§

fn paint( &self, canvas: &mut DisplayListBuilder, rect: Rect, text_direction: Option<TextDirection>, )

Paints the border within the given Rect on the given Canvas.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Downcast support for is / as in Dart.
Source§

fn as_outlined_border(&self) -> Option<&(dyn OutlinedBorder + 'static)>

OutlinedBorder downcast for Dart’s is OutlinedBorder.
Source§

fn into_outlined_border( self: Rc<LinearBorder>, ) -> Option<Rc<dyn OutlinedBorder>>

OutlinedBorder downcast of the shared border, for Dart’s as OutlinedBorder (ShapeBorderRef::as_outlined_border_ref). An OutlinedBorder answers Some(self), as it answers as_outlined_border.
Source§

fn eq_shape(&self, other: &(dyn ShapeBorder + 'static)) -> bool

Field equality. Dart’s default == is identity; subclasses that override == implement this.
Source§

fn add(&self, other: &ShapeBorderRef, reversed: bool) -> Option<ShapeBorderRef>

Attempts to create a new object that represents the amalgamation of this border and the other border. Read more
Source§

fn hit_test( &self, rect: Rect, position: Offset, text_direction: Option<TextDirection>, ) -> bool

Tests whether the outer boundary of this border contains position.
Source§

fn paint_interior( &self, canvas: &mut DisplayListBuilder, rect: Rect, paint: &Paint, text_direction: Option<TextDirection>, )

Paint a canvas with the appropriate shape. Read more
Source§

fn prefer_paint_interior(&self) -> bool

Reports whether paint_interior is implemented.
Source§

fn as_box_border(&self) -> Option<&(dyn BoxBorder + 'static)>

BoxBorder downcast for BoxBorderRef::lerp.
Source§

fn into_box_border(self: Rc<Self>) -> Option<Rc<dyn BoxBorder>>

BoxBorder downcast of the shared border (ShapeBorderRef::as_box_border_ref). A box border answers Some(self), as it answers as_box_border.
Source§

impl StructuralPartialEq for LinearBorder

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,