Skip to main content

AlignmentGeometry

Enum AlignmentGeometry 

Source
#[non_exhaustive]
pub enum AlignmentGeometry { Alignment(Alignment), Directional(AlignmentDirectional), Mixed { x: f64, start: f64, y: f64, }, }
Expand description

Base class for Alignment that allows for text-direction aware resolution.

A property or argument of this type accepts classes created either with Alignment and its variants, or AlignmentDirectional::new.

To convert an AlignmentGeometry object of indeterminate type into an Alignment object, call the resolve method.

Non-exhaustive: Flutter may add a subclass.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Alignment(Alignment)

Visual alignment — Dart’s Alignment.

§

Directional(AlignmentDirectional)

Directional alignment — Dart’s AlignmentDirectional.

§

Mixed

A visual and a directional horizontal coordinate at once — Dart’s private _MixedAlignment, what combining the two kinds produces.

Fields

§x: f64

The distance fraction in the horizontal direction.

§start: f64

The distance fraction in the horizontal direction from the start side.

§y: f64

The distance fraction in the vertical direction.

Implementations§

Source§

impl AlignmentGeometry

Source

pub const TOP_LEFT: AlignmentGeometry

The top left corner.

Source

pub const TOP_CENTER: AlignmentGeometry

The center point along the top edge.

Source

pub const TOP_RIGHT: AlignmentGeometry

The top right corner.

Source

pub const TOP_START: AlignmentGeometry

The top corner on the “start” edge.

Source

pub const TOP_END: AlignmentGeometry

The top corner on the “end” edge.

Source

pub const CENTER_LEFT: AlignmentGeometry

The center point along the left edge.

Source

pub const CENTER: AlignmentGeometry

The center point, both horizontally and vertically.

Source

pub const CENTER_RIGHT: AlignmentGeometry

The center point along the right edge.

Source

pub const CENTER_START: AlignmentGeometry

The center point along the “start” edge.

Source

pub const CENTER_END: AlignmentGeometry

The center point along the “end” edge.

Source

pub const BOTTOM_LEFT: AlignmentGeometry

The bottom left corner.

Source

pub const BOTTOM_CENTER: AlignmentGeometry

The center point along the bottom edge.

Source

pub const BOTTOM_RIGHT: AlignmentGeometry

The bottom right corner.

Source

pub const BOTTOM_START: AlignmentGeometry

The bottom corner on the “start” edge.

Source

pub const BOTTOM_END: AlignmentGeometry

The bottom corner on the “end” edge.

Source

pub const fn xy(x: f64, y: f64) -> AlignmentGeometry

Creates an Alignment.

Source

pub const fn directional(start: f64, y: f64) -> AlignmentGeometry

Creates a directional alignment, or AlignmentDirectional.

Source

pub fn add(self, other: AlignmentGeometry) -> AlignmentGeometry

Returns the sum of two AlignmentGeometry objects.

If you know you are adding two Alignment or two AlignmentDirectional objects, consider using the + operator instead, which always returns an object of the same type as the operands, and is typed accordingly.

Applied to two objects of the same kind, the result is of that kind; otherwise it is the mixed arm, which resolve turns into a concrete Alignment.

Source

pub fn truncating_div(&self, other: f64) -> AlignmentGeometry

Integer divides the AlignmentGeometry object in each dimension by the given factor.

Source

pub fn lerp( a: Option<AlignmentGeometry>, b: Option<AlignmentGeometry>, t: f64, ) -> Option<AlignmentGeometry>

Linearly interpolate between two AlignmentGeometry objects.

If either is None, this function interpolates from Alignment::CENTER, and the result is of the same kind as the non-None argument.

Applied to two objects of the same kind, the result is of that kind; otherwise it is the mixed arm, which resolve turns into a concrete Alignment.

Source

pub fn resolve(&self, direction: Option<TextDirection>) -> Alignment

Convert this instance into an Alignment, which uses literal coordinates (the x coordinate being explicitly a distance from the left).

See also:

  • Alignment, for which this is a no-op (returns itself).
  • AlignmentDirectional, which flips the horizontal direction based on the direction argument.

Trait Implementations§

Source§

impl Clone for AlignmentGeometry

Source§

fn clone(&self) -> AlignmentGeometry

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 AlignmentGeometry

Source§

impl Debug for AlignmentGeometry

Source§

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

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

impl Display for AlignmentGeometry

Dart’s AlignmentGeometry.toString, which Debug already renders.

Source§

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

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

impl Div<f64> for AlignmentGeometry

Source§

type Output = AlignmentGeometry

The resulting type after applying the / operator.
Source§

fn div(self, other: f64) -> AlignmentGeometry

Performs the / operation. Read more
Source§

impl From<Alignment> for AlignmentGeometry

Source§

fn from(alignment: Alignment) -> AlignmentGeometry

Converts to this type from the input type.
Source§

impl From<AlignmentDirectional> for AlignmentGeometry

Source§

fn from(alignment: AlignmentDirectional) -> AlignmentGeometry

Converts to this type from the input type.
Source§

impl Mul<f64> for AlignmentGeometry

Source§

type Output = AlignmentGeometry

The resulting type after applying the * operator.
Source§

fn mul(self, other: f64) -> AlignmentGeometry

Performs the * operation. Read more
Source§

impl Neg for AlignmentGeometry

Source§

type Output = AlignmentGeometry

The resulting type after applying the - operator.
Source§

fn neg(self) -> AlignmentGeometry

Performs the unary - operation. Read more
Source§

impl PartialEq for AlignmentGeometry

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Rem<f64> for AlignmentGeometry

Source§

type Output = AlignmentGeometry

The resulting type after applying the % operator.
Source§

fn rem(self, other: f64) -> AlignmentGeometry

Performs the % operation. Read more

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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,