pub struct UnconstrainedBox {
pub key: Option<KeyRef>,
pub text_direction: Option<TextDirection>,
pub alignment: AlignmentGeometry,
pub constrained_axis: Option<Axis>,
pub clip_behavior: Clip,
pub child: Option<WidgetRef>,
}Expand description
A widget that imposes no constraints on its child, allowing it to render at its “natural” size.
This allows a child to render at the size it would render if it were alone
on an infinite canvas with no constraints. This container will then attempt
to adopt the same size, within the limits of its own constraints. If it ends
up with a different size, it will align the child based on
alignment. If the box cannot expand enough to accommodate the entire
child, the child will be clipped.
See also:
ConstrainedBox, for a box which imposes constraints on its child.Align, which loosens the constraints given to the child rather than removing them entirely.Container, a convenience widget that combines common painting, positioning, and sizing widgets.OverflowBox, a widget that imposes different constraints on its child than it gets from its parent, possibly allowing the child to overflow the parent.ConstraintsTransformBox, a widget that sizes its child using a transformedBoxConstraints.
Fields§
§key: Option<KeyRef>§text_direction: Option<TextDirection>The text direction to use when interpreting the alignment if it is
an AlignmentDirectional.
alignment: AlignmentGeometryThe alignment to use when laying out the child.
If this is an AlignmentDirectional, then
text_direction must not be None.
See also:
Alignmentfor non-Directionality-aware alignments.AlignmentDirectionalforDirectionality-aware alignments.
constrained_axis: Option<Axis>The axis to retain constraints on, if any.
If not set, or set to None (the default), neither axis will retain its
constraints. If set to Axis::Vertical, then vertical constraints will
be retained, and if set to Axis::Horizontal, then horizontal constraints
will be retained.
clip_behavior: ClipHow to clip a child that overflows this box.
Defaults to Clip::None.
child: Option<WidgetRef>Implementations§
Source§impl UnconstrainedBox
impl UnconstrainedBox
Sourcepub fn new() -> UnconstrainedBox
pub fn new() -> UnconstrainedBox
Creates a widget that imposes no constraints on its child, allowing it to render at its “natural” size; Dart’s named arguments are the setters.
Sourcepub fn key(self, key: KeyRef) -> UnconstrainedBox
pub fn key(self, key: KeyRef) -> UnconstrainedBox
Dart UnconstrainedBox(key:).
Sourcepub fn text_direction(self, text_direction: TextDirection) -> UnconstrainedBox
pub fn text_direction(self, text_direction: TextDirection) -> UnconstrainedBox
Dart UnconstrainedBox(textDirection:).
Sourcepub fn alignment(self, alignment: AlignmentGeometry) -> UnconstrainedBox
pub fn alignment(self, alignment: AlignmentGeometry) -> UnconstrainedBox
Dart UnconstrainedBox(alignment:).
Sourcepub fn constrained_axis(self, constrained_axis: Axis) -> UnconstrainedBox
pub fn constrained_axis(self, constrained_axis: Axis) -> UnconstrainedBox
Dart UnconstrainedBox(constrainedAxis:).
Sourcepub fn clip_behavior(self, clip_behavior: Clip) -> UnconstrainedBox
pub fn clip_behavior(self, clip_behavior: Clip) -> UnconstrainedBox
Dart UnconstrainedBox(clipBehavior:).
Sourcepub fn child<K>(self, child: impl IntoWidget<K>) -> UnconstrainedBox
pub fn child<K>(self, child: impl IntoWidget<K>) -> UnconstrainedBox
Dart UnconstrainedBox(child:).
Trait Implementations§
Source§impl Debug for UnconstrainedBox
impl Debug for UnconstrainedBox
Source§impl Default for UnconstrainedBox
impl Default for UnconstrainedBox
Source§fn default() -> UnconstrainedBox
fn default() -> UnconstrainedBox
Source§impl StatelessWidget for UnconstrainedBox
impl StatelessWidget for UnconstrainedBox
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 build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
fn build(&self, _app: &mut App, _context: BuildContext) -> WidgetRef
Source§fn debug_check_constructor(&self)
fn debug_check_constructor(&self)
Source§fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
this is PreferredSizeWidget: a widget that implements PreferredSizeWidget
answers with itself, which is what a parent asking an erased child for its preferred
size reads.Auto Trait Implementations§
impl !RefUnwindSafe for UnconstrainedBox
impl !Send for UnconstrainedBox
impl !Sync for UnconstrainedBox
impl !UnwindSafe for UnconstrainedBox
impl Forget for UnconstrainedBox
impl Freeze for UnconstrainedBox
impl Move for UnconstrainedBox
impl Unpin for UnconstrainedBox
impl UnsafeUnpin for UnconstrainedBoxwhere
*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<StatelessKind> for Wwhere
W: StatelessWidget,
impl<W> IntoWidget<StatelessKind> for Wwhere
W: StatelessWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.