pub struct StatefulBuilder {
pub key: Option<KeyRef>,
pub builder: StatefulWidgetBuilder,
}Expand description
A platonic widget that both has state and calls a closure to obtain its child widget.
The StateSetter function passed to the builder is used to invoke a
rebuild instead of a typical State’s set_state.
Since the builder is re-invoked when the StateSetter is called, any
variables that represents state should be kept outside the builder
function.
See also:
Builder, the platonic stateless widget.
Fields§
§key: Option<KeyRef>§builder: StatefulWidgetBuilderCalled to obtain the child widget.
This function is called whenever this widget is included in its parent’s build and the old widget (if any) that it synchronizes with has a distinct object identity. Typically the parent’s build method will construct a new tree of widgets and so a new Builder child will not be identical to the corresponding old one.
Implementations§
Source§impl StatefulBuilder
impl StatefulBuilder
Sourcepub fn new(
builder: impl Fn(&mut App, BuildContext, StateSetter) -> WidgetRef + 'static,
) -> StatefulBuilder
pub fn new( builder: impl Fn(&mut App, BuildContext, StateSetter) -> WidgetRef + 'static, ) -> StatefulBuilder
Creates a widget that both has state and delegates its build to a callback; Dart’s optional named arguments are the setters.
Sourcepub fn key(self, key: KeyRef) -> StatefulBuilder
pub fn key(self, key: KeyRef) -> StatefulBuilder
Dart StatefulBuilder(key:).
Trait Implementations§
Source§impl Debug for StatefulBuilder
impl Debug for StatefulBuilder
Source§impl StatefulWidget for StatefulBuilder
impl StatefulWidget for StatefulBuilder
Source§type State = StatefulBuilderState
type State = StatefulBuilderState
Source§fn create_state(&self) -> StatefulBuilderState
fn create_state(&self) -> StatefulBuilderState
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 as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
fn as_preferred_size_widget(&self) -> Option<&dyn PreferredSizeWidget>
Source§fn type_name(&self) -> &'static str
fn type_name(&self) -> &'static str
Widget::type_name. A stateful form another widget kind becomes (an animated or
status transition widget) names the widget it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for StatefulBuilder
impl !Send for StatefulBuilder
impl !Sync for StatefulBuilder
impl !UnwindSafe for StatefulBuilder
impl Forget for StatefulBuilder
impl Freeze for StatefulBuilderwhere
*const RcInner<dyn Key> is !null: Freeze,
PhantomData<RcInner<dyn Key>>: Freeze,
*const RcInner<dyn Fn(&mut App, AnyElement, Rc<dyn Fn(&mut App, &mut dyn FnMut(&mut App))>) -> Rc<dyn Widget>> is !null: Freeze,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Rc<dyn Fn(&mut App, &mut dyn FnMut(&mut App))>) -> Rc<dyn Widget>>>: Freeze,
impl Move for StatefulBuilder
impl Unpin for StatefulBuilder
impl UnsafeUnpin for StatefulBuilderwhere
*const RcInner<dyn Key> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Key>>: UnsafeUnpin,
*const RcInner<dyn Fn(&mut App, AnyElement, Rc<dyn Fn(&mut App, &mut dyn FnMut(&mut App))>) -> Rc<dyn Widget>> is !null: UnsafeUnpin,
PhantomData<RcInner<dyn Fn(&mut App, AnyElement, Rc<dyn Fn(&mut App, &mut dyn FnMut(&mut App))>) -> Rc<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<StatefulKind> for Wwhere
W: StatefulWidget,
impl<W> IntoWidget<StatefulKind> for Wwhere
W: StatefulWidget,
Source§fn into_widget(self) -> Rc<dyn Widget>
fn into_widget(self) -> Rc<dyn Widget>
creation_location.