pub struct Expanded {
pub key: Option<KeyRef>,
pub flex: i32,
pub child: WidgetRef,
}Expand description
A widget that expands a child of a Row, Column, or Flex so that the child fills
the available space.
Using an Expanded widget makes a child of a Row, Column, or Flex expand to
fill the available space along the main axis (e.g., horizontally for a Row or vertically
for a Column). If multiple children are expanded, the available space is divided among
them according to the flex factor.
An Expanded widget must be a descendant of a Row, Column, or Flex, and the
path from the Expanded widget to its enclosing Row, Column, or Flex must
contain only stateless or stateful widgets (not other kinds of widgets, like render object
widgets).
See also:
Flexible, which does not force the child to fill the available space.Spacer, a widget that takes up space proportional to its flex value.- The catalog of layout widgets.
Dart’s class Expanded extends Flexible: a distinct widget type whose behaviour is
Flexible’s with the fit fixed at FlexFit::Tight.
Fields§
§key: Option<KeyRef>§flex: i32See Flexible::flex.
child: WidgetRefImplementations§
Source§impl Expanded
impl Expanded
Sourcepub fn new<K>(child: impl IntoWidget<K>) -> Expanded
pub fn new<K>(child: impl IntoWidget<K>) -> Expanded
Sourcepub fn fit(&self) -> FlexFit
pub fn fit(&self) -> FlexFit
How the child is inscribed into the available space: always FlexFit::Tight (the
inherited Flexible::fit).
Trait Implementations§
Source§impl ParentDataWidget for Expanded
impl ParentDataWidget for Expanded
Source§type ParentData = FlexParentData
type ParentData = FlexParentData
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 apply_parent_data(&self, app: &mut App, render_object: AnyRenderObject)
fn apply_parent_data(&self, app: &mut App, render_object: AnyRenderObject)
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 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 Expanded
impl !Send for Expanded
impl !Sync for Expanded
impl !UnwindSafe for Expanded
impl Forget for Expanded
impl Freeze for Expanded
impl Move for Expanded
impl Unpin for Expanded
impl UnsafeUnpin for Expandedwhere
*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.