pub struct FittedBox {
pub key: Option<KeyRef>,
pub fit: BoxFit,
pub alignment: AlignmentGeometry,
pub clip_behavior: Clip,
pub child: Option<WidgetRef>,
}Expand description
Scales and positions its child within itself according to fit.
See also:
Transform, which applies an arbitrary transform to its child widget at paint time.- The catalog of layout widgets.
Fields§
§key: Option<KeyRef>§fit: BoxFitHow to inscribe the child into the space allocated during layout.
alignment: AlignmentGeometryHow to align the child within its parent’s bounds.
An alignment of (-1.0, -1.0) aligns the child to the top-left corner of its parent’s bounds. An alignment of (1.0, 0.0) aligns the child to the middle of the right edge of its parent’s bounds.
Defaults to AlignmentGeometry::CENTER.
See also:
Alignment, a class with convenient constants typically used to specify anAlignmentGeometry.AlignmentDirectional, likeAlignmentfor specifying alignments relative to text direction.
clip_behavior: ClipHow to clip a child that overflows this box.
Defaults to Clip::None.
child: Option<WidgetRef>Implementations§
Source§impl FittedBox
impl FittedBox
Sourcepub fn new() -> FittedBox
pub fn new() -> FittedBox
Creates a widget that scales and positions its child within itself according to
fit; Dart’s named arguments are the setters.
Sourcepub fn alignment(self, alignment: AlignmentGeometry) -> FittedBox
pub fn alignment(self, alignment: AlignmentGeometry) -> FittedBox
Dart FittedBox(alignment:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> FittedBox
pub fn clip_behavior(self, clip_behavior: Clip) -> FittedBox
Dart FittedBox(clipBehavior:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> FittedBox
pub fn child<K>(self, child: impl IntoWidget<K>) -> FittedBox
Dart FittedBox(child:).
Trait Implementations§
Source§impl RenderObjectWidget for FittedBox
impl RenderObjectWidget for FittedBox
Source§type RenderObject = RenderFittedBox
type RenderObject = RenderFittedBox
The render object this widget creates; Dart’s
covariant RenderObject parameter type.Source§fn debug_fill_properties(
&self,
_app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
fn debug_fill_properties( &self, _app: &App, properties: &mut DiagnosticPropertiesBuilder, )
Dart’s
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 create_render_object(
&self,
app: &mut App,
context: BuildContext,
) -> AnyRenderObject
fn create_render_object( &self, app: &mut App, context: BuildContext, ) -> AnyRenderObject
Creates an instance of the
RenderObject class that this widget represents, using the
configuration described by this widget. Read moreSource§fn update_render_object(
&self,
app: &mut App,
context: BuildContext,
render_object: RenderHandle<RenderFittedBox>,
)
fn update_render_object( &self, app: &mut App, context: BuildContext, render_object: RenderHandle<RenderFittedBox>, )
Copies the configuration described by this widget to the given render object, which
will be of the same type as returned by this object’s
create_render_object. Read moreSource§fn to_string_short(&self) -> String
fn to_string_short(&self) -> String
Dart’s
toStringShort, for a widget that names itself apart from its type, as
SizedBox.expand does; see Widget::to_string_short.Source§fn debug_visit_onstage_children(
&self,
app: &App,
children: &[AnyElement],
visitor: &mut dyn FnMut(AnyElement),
)
fn debug_visit_onstage_children( &self, app: &App, children: &[AnyElement], visitor: &mut dyn FnMut(AnyElement), )
Dart’s
debugVisitOnstageChildren of the element this widget makes, for a widget whose
Dart element subclass overrides it only to hide children (_OffstageElement,
_IndexedStackElement): calls visitor for each of children, in order, that is
onstage. Waft’s generic single- and multi-child elements stand in for those subclasses
and ask their widget here; an element of a widget’s own overrides
Element::debug_visit_onstage_children instead.Source§fn did_unmount_render_object(
&self,
app: &mut App,
render_object: RenderHandle<Self::RenderObject>,
)
fn did_unmount_render_object( &self, app: &mut App, render_object: RenderHandle<Self::RenderObject>, )
A render object previously associated with this widget has been removed from the tree.
The given
RenderObject will be of the same type as returned by this object’s
create_render_object.Auto Trait Implementations§
impl !RefUnwindSafe for FittedBox
impl !Send for FittedBox
impl !Sync for FittedBox
impl !UnwindSafe for FittedBox
impl Forget for FittedBox
impl Freeze for FittedBox
impl Move for FittedBox
impl Unpin for FittedBox
impl UnsafeUnpin for FittedBoxwhere
*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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<W> IntoWidget<SingleChildRenderObjectKind> for Wwhere
W: SingleChildRenderObjectWidget,
<W as RenderObjectWidget>::RenderObject: RenderObjectWithChildMixin,
impl<W> IntoWidget<SingleChildRenderObjectKind> for Wwhere
W: SingleChildRenderObjectWidget,
<W as RenderObjectWidget>::RenderObject: RenderObjectWithChildMixin,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
The widget as a tree node, made where this is called: its
creation_location.