pub struct Positioned {
pub key: Option<KeyRef>,
pub left: Option<f64>,
pub top: Option<f64>,
pub right: Option<f64>,
pub bottom: Option<f64>,
pub width: Option<f64>,
pub height: Option<f64>,
pub child: WidgetRef,
}Expand description
A widget that controls where a child of a Stack is positioned.
A Positioned widget must be a descendant of a Stack, and the path from the
Positioned widget to its enclosing Stack must contain only stateless or stateful
widgets (not other kinds of widgets, like render object widgets).
If a widget is wrapped in a Positioned, then it is a positioned widget in its
Stack. If the top property is non-None, the top edge of this child
will be positioned top layout units from the top of the stack widget. The
right, bottom, and left properties work
analogously.
If both the top and bottom properties are non-None, then
the child will be forced to have exactly the height required to satisfy both constraints.
Similarly, setting the right and left properties to
non-None values will force the child to have a particular width. Alternatively the
width and height properties can be used to give the
dimensions, with one corresponding position property (e.g. top and
height).
If all three values on a particular axis are None, then the Stack::alignment property
is used to position the child.
If all six values are None, the child is a non-positioned child. The Stack uses only
the non-positioned children to size itself.
Only two out of the three horizontal values (left, right,
width), and only two out of the three vertical values
(top, bottom, height), can be set. In
each case, at least one of the three must be None.
Fields§
§key: Option<KeyRef>§left: Option<f64>The distance that the child’s left edge is inset from the left of the stack.
Only two out of the three horizontal values (left,
right, width) can be set. The third must be None.
If all three are None, the Stack::alignment is used to position the child
horizontally.
top: Option<f64>The distance that the child’s top edge is inset from the top of the stack.
Only two out of the three vertical values (top, bottom,
height) can be set. The third must be None.
If all three are None, the Stack::alignment is used to position the child
vertically.
right: Option<f64>The distance that the child’s right edge is inset from the right of the stack.
See left.
bottom: Option<f64>The distance that the child’s bottom edge is inset from the bottom of the stack.
See top.
width: Option<f64>The child’s width.
See left.
height: Option<f64>The child’s height.
See top.
child: WidgetRefImplementations§
Source§impl Positioned
impl Positioned
Sourcepub fn new<K>(child: impl IntoWidget<K>) -> Positioned
pub fn new<K>(child: impl IntoWidget<K>) -> Positioned
Creates a widget that controls where a child of a Stack is positioned; Dart’s
optional named arguments are the setters.
Sourcepub fn from_rect<K>(rect: Rect, child: impl IntoWidget<K>) -> Positioned
pub fn from_rect<K>(rect: Rect, child: impl IntoWidget<K>) -> Positioned
Sourcepub fn from_relative_rect<K>(
rect: RelativeRect,
child: impl IntoWidget<K>,
) -> Positioned
pub fn from_relative_rect<K>( rect: RelativeRect, child: impl IntoWidget<K>, ) -> Positioned
Creates a Positioned object with the values from the given RelativeRect.
This sets the left, top, right, and
bottom properties from the given RelativeRect. The
height and width properties are set to None.
Sourcepub fn fill<K>(child: impl IntoWidget<K>) -> Positioned
pub fn fill<K>(child: impl IntoWidget<K>) -> Positioned
Sourcepub fn directional<K>(
text_direction: TextDirection,
start: Option<f64>,
end: Option<f64>,
child: impl IntoWidget<K>,
) -> Positioned
pub fn directional<K>( text_direction: TextDirection, start: Option<f64>, end: Option<f64>, child: impl IntoWidget<K>, ) -> Positioned
Creates a widget that controls where a child of a Stack is positioned, taking
start and end rather than left and right.
If text_direction is TextDirection::Rtl, then the start argument is used for the
right property and the end argument is used for the
left property. Otherwise, if text_direction is TextDirection::Ltr,
then the start argument is used for the left property and the end
argument is used for the right property.
Dart Positioned.directional(textDirection:, start:, end:, child:); start and end
are arguments rather than setters because resolving them needs the text direction.
Sourcepub fn key(self, key: KeyRef) -> Positioned
pub fn key(self, key: KeyRef) -> Positioned
Dart Positioned(key:).
Sourcepub fn left(self, left: f64) -> Positioned
pub fn left(self, left: f64) -> Positioned
Dart Positioned(left:).
Sourcepub fn top(self, top: f64) -> Positioned
pub fn top(self, top: f64) -> Positioned
Dart Positioned(top:).
Sourcepub fn right(self, right: f64) -> Positioned
pub fn right(self, right: f64) -> Positioned
Dart Positioned(right:).
Sourcepub fn bottom(self, bottom: f64) -> Positioned
pub fn bottom(self, bottom: f64) -> Positioned
Dart Positioned(bottom:).
Sourcepub fn width(self, width: f64) -> Positioned
pub fn width(self, width: f64) -> Positioned
Dart Positioned(width:).
Sourcepub fn height(self, height: f64) -> Positioned
pub fn height(self, height: f64) -> Positioned
Dart Positioned(height:).
Trait Implementations§
Source§impl Debug for Positioned
impl Debug for Positioned
Source§impl ParentDataWidget for Positioned
impl ParentDataWidget for Positioned
Source§type ParentData = StackParentData
type ParentData = StackParentData
T extends ParentData.Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
debugFillProperties: the properties a dump shows for this widget, in Dart’s
order. Dart’s Widget base only sets the dense tree style, which the framework does.Source§fn debug_is_valid_render_object(
&self,
app: &App,
render_object: AnyRenderObject,
) -> bool
fn debug_is_valid_render_object( &self, app: &App, render_object: AnyRenderObject, ) -> bool
debugIsValidRenderObject: whether render_object’s parent data is the one
this widget writes. Read moreSource§fn apply_parent_data(&self, app: &mut App, render_object: AnyRenderObject)
fn apply_parent_data(&self, app: &mut App, render_object: AnyRenderObject)
Source§fn debug_can_apply_out_of_turn(&self) -> bool
fn debug_can_apply_out_of_turn(&self) -> bool
ParentDataElement::apply_widget_out_of_turn method will be allowed
with this widget. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for Positioned
impl !Send for Positioned
impl !Sync for Positioned
impl !UnwindSafe for Positioned
impl Forget for Positioned
impl Freeze for Positioned
impl Move for Positioned
impl Unpin for Positioned
impl UnsafeUnpin for Positionedwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Widget> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Widget>>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<ParentDataKind> for Wwhere
W: ParentDataWidget,
impl<W> IntoWidget<ParentDataKind> for Wwhere
W: ParentDataWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.