Skip to main content

ColumnWidget

Struct ColumnWidget 

Source
pub struct ColumnWidget {
    pub spacing: f32,
    pub children: Vec<WidgetNode>,
}
Expand description

简单垂直堆叠容器(非 Flex)

Fields§

§spacing: f32§children: Vec<WidgetNode>

Implementations§

Source§

impl ColumnWidget

Source

pub fn new(spacing: f32) -> Self

Source

pub fn push(self, child: impl Widget) -> Self

Trait Implementations§

Source§

impl Debug for ColumnWidget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ColumnWidget

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Widget for ColumnWidget

Source§

fn as_any(&self) -> &dyn Any

类型擦除入口(用于 downcast 到具体 widget)。
Source§

fn create_render_object(&self) -> Box<dyn RenderObject>

创建 RenderObject(桥接到渲染子系统)
Source§

fn children(&self) -> Vec<WidgetNode>

子 widget 列表(Element 树递归用)
Source§

fn is_equivalent(&self, old: &dyn Widget) -> bool

P0-1:新旧 widget 的全部输入是否等价(不含 State)。 Read more
Source§

fn type_name(&self) -> &'static str

类型名称(调试用,Debug impl 用)
Source§

fn is_stateful(&self) -> bool

是否 stateful(true 则 Element 自动创建 State 并持久化)
Source§

fn is_focusable(&self) -> bool

是否可聚焦(Tab 焦点链 + 键盘激活)
Source§

fn wants_ime(&self) -> bool

是否需要 IME(软键盘 —— TextField/TextBox 等输入组件)
Source§

fn captures_tab(&self) -> bool

是否捕获 Tab 键(编辑器等需要 Tab 缩进的输入组件)。 true 时框架焦点遍历跳过该组件,Tab/BackTab 直接投递给焦点 element。
Source§

fn create_state(&self) -> Option<Box<dyn State>>

创建 State 实例(仅 is_stateful=true 时 Element 会调)
Source§

fn children_with_positions(&self) -> Vec<(Point, WidgetNode)>

子 widget + 各自在父内的 offset(Stack/Positioned 等需要)
Source§

fn handle_event(&self, event: &WidgetEvent, local_pos: Point)

处理事件(不可变 — Widget 是 Rc 共享的;stateful widget 通常把逻辑放在 State 里)
Source§

fn accepts_scroll(&self) -> bool

是否接受滚动事件(ScrollView/ListView 返回 true)
Source§

fn key(&self) -> Option<u64>

唯一标识(用于 ListView 复用 Element)
Source§

fn gesture_state(&self) -> Option<GestureState>

手势竞技场仲裁(返回 Some 表示参与指针竞争)
Source§

fn dynamic_signal(&self) -> Option<Signal<Point>>

返回需要订阅的 Signal(PositionedWidget 用)
Source§

fn semantics(&self) -> Option<WidgetSemantics>

返回无障碍语义(阶段 A11y)
Source§

fn as_inherited(&self) -> Option<&dyn InheritedWidget>

如果是 InheritedWidget,返回引用(主题/布局约束等传播)
Source§

fn can_update(&self, old: &dyn Widget) -> bool

Element diff 时判断新旧 widget 是否“兼容“(类型相同 + key 相同) 默认:type_id 比较
Source§

fn is_repaint_boundary(&self) -> bool

是否 RepaintBoundary(dirty 重绘边界)
Source§

fn visible_children(&self) -> Option<Vec<bool>>

逐子节点可见性(按 children() 顺序)。None = 全部可见(默认,零行为变化)。 Some(vec) 与 children() 等长;false 表示该子节点的整棵子树 (含其内部 RepaintBoundary layer)不参与合成。 Read more
Source§

fn parent_data(&self) -> Option<ParentData>

父容器在布局阶段读取的子节点元数据(如 Flex 的 grow/basis)。 默认 None(无元数据)。Expanded/Flexible 等 override 返回 ParentData::Flex。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.