pub struct BorderRadiusDirectional {
pub top_start: f32,
pub top_end: f32,
pub bottom_end: f32,
pub bottom_start: f32,
}Expand description
A corner radius named by the reading direction rather than by the wall
(border_radius.dart:621).
A BorderRadius says top left. This says top start — the corner where the text
begins, which is the left one in English and the right one in Arabic. resolve turns
one into the other once the direction is known.
The distinction is not decorative. A drawer rounds its inner edge, the one facing the page: for a leading drawer that is the end side in either direction, and a radius written as right is correct in English and wrong in Arabic. Every asymmetric radius in an interface that mirrors has this question, and answering it by hand at each site is how one of them ends up answered differently.
The reference has one type hierarchy for this (BorderRadiusGeometry, with a resolved
and an unresolved subclass); this is two plain types and a resolve, because a widget
here is handed a &Theme and so always has a direction available when it needs one.
Fields§
§top_start: f32The corner at the top of the line’s beginning.
top_end: f32The corner at the top of the line’s end.
bottom_end: f32The corner at the bottom of the line’s end.
bottom_start: f32The corner at the bottom of the line’s beginning.
Implementations§
Source§impl BorderRadiusDirectional
impl BorderRadiusDirectional
Sourcepub const fn uniform(radius: f32) -> Self
pub const fn uniform(radius: f32) -> Self
The same radius on all four corners — which needs no direction, and is here so a caller can write one without changing type halfway through an expression.
Sourcepub const fn start(radius: f32) -> Self
pub const fn start(radius: f32) -> Self
The two corners at the line’s beginning — the left pair in English, the right pair in Arabic.
Sourcepub const fn horizontal(start: f32, end: f32) -> Self
pub const fn horizontal(start: f32, end: f32) -> Self
Both sides at once, each with its own radius — the reference’s
BorderRadiusDirectional.horizontal.
Sourcepub const fn vertical(top: f32, bottom: f32) -> Self
pub const fn vertical(top: f32, bottom: f32) -> Self
The top pair and the bottom pair. Neither depends on the direction, so this is the
same as BorderRadius’s — and is here for the same reason as
uniform.
Sourcepub const fn resolve(self, direction: TextDirection) -> BorderRadius
pub const fn resolve(self, direction: TextDirection) -> BorderRadius
The concrete radius, once the direction is known: start becomes left where
the text runs left to right, and right where it does not.