waft-widgets 0.16.1

Widget framework and widgets for Waft
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
//! `State`: the logic and internal state for a [`StatefulWidget`].
//!
//! A state object is one struct in the arena, reached through `Handle<Self>`; the framework
//! bookkeeping (Dart's `_element`, `_widget`, and the debug lifecycle) is the [`StateData`]
//! bag the struct holds under the field `state`.

use std::any::TypeId;
use std::marker::PhantomData;

use waft_foundation::{
    App, DiagnosticLevel, DiagnosticPropertiesBuilder, DiagnosticableNode, DiagnosticsNode,
    DiagnosticsTreeStyle, EnumProperty, Handle, HandleId, ObjectFlagProperty, bare_type_name,
    describe_identity,
};

use super::element::{BuildContext, Element};
use super::elements::StatefulElement;
use super::widget::{StatefulWidget, WidgetRef, downcast_widget};

/// Tracks the lifecycle of [`State`] objects when asserts are enabled.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum StateLifecycle {
    /// The [`State`] object has been created. [`State::init_state`] is called at this time.
    Created,
    /// The [`State::init_state`] method has been called but the [`State`] object is not yet
    /// ready to build. [`State::did_change_dependencies`] is called at this time.
    Initialized,
    /// The [`State`] object is ready to build and [`State::dispose`] has not yet been called.
    Ready,
    /// The [`State::dispose`] method has been called and the [`State`] object is no longer
    /// able to build.
    Defunct,
}

/// The framework's part of a [`State`]: the element it belongs to and its lifecycle.
pub struct StateData<W: StatefulWidget> {
    widget: Option<WidgetRef>,
    element: Option<Handle<StatefulElement>>,
    debug_lifecycle_state: StateLifecycle,
    /// The state's widget type. The bag holds nothing of it since its element stopped being
    /// generic; it stays so a state's `state: StateData<MyWidget>` field and
    /// [`State::state_data`] keep their shape.
    widget_type: PhantomData<fn() -> W>,
}

impl<W: StatefulWidget> StateData<W> {
    /// A state that is not yet attached to an element.
    pub fn new() -> StateData<W> {
        StateData {
            widget: None,
            element: None,
            debug_lifecycle_state: StateLifecycle::Created,
            widget_type: PhantomData,
        }
    }

    /// Dart's `State._widget`, set by the element before `init_state` and on every update.
    pub(crate) fn set_widget(&mut self, widget: WidgetRef) {
        self.widget = Some(widget);
    }

    pub(crate) fn element(&self) -> Option<Handle<StatefulElement>> {
        self.element
    }

    pub(crate) fn set_element(&mut self, element: Option<Handle<StatefulElement>>) {
        self.element = element;
    }

    pub(crate) fn debug_lifecycle_state(&self) -> StateLifecycle {
        self.debug_lifecycle_state
    }

    pub(crate) fn set_debug_lifecycle_state(&mut self, state: StateLifecycle) {
        self.debug_lifecycle_state = state;
    }
}

impl<W: StatefulWidget> Default for StateData<W> {
    fn default() -> StateData<W> {
        StateData::new()
    }
}

/// A [`State`] of any type, as the one [`StatefulElement`] holds it: its handle and the hooks
/// the element calls, so the element is not copied per state type. Opaque outside the framework.
#[derive(Clone, Copy)]
pub struct AnyState {
    id: HandleId,
    vtable: &'static StateVTable,
}

/// The hooks of one [`State`] type that its element calls.
struct StateVTable {
    type_id: TypeId,
    type_name: fn() -> &'static str,
    debug_fill_properties: fn(&App, HandleId, &mut DiagnosticPropertiesBuilder),
    build: fn(&mut App, HandleId, BuildContext) -> WidgetRef,
    init_state: fn(&mut App, HandleId),
    did_change_dependencies: fn(&mut App, HandleId),
    did_update_widget: fn(&mut App, HandleId, &WidgetRef),
    activate: fn(&mut App, HandleId),
    deactivate: fn(&mut App, HandleId),
    dispose: fn(&mut App, HandleId),
    set_widget: fn(&mut App, HandleId, WidgetRef),
    element: fn(&App, HandleId) -> Option<Handle<StatefulElement>>,
    set_element: fn(&mut App, HandleId, Option<Handle<StatefulElement>>),
    debug_lifecycle_state: fn(&App, HandleId) -> StateLifecycle,
    set_debug_lifecycle_state: fn(&mut App, HandleId, StateLifecycle),
}

impl StateVTable {
    const fn of<S: State>() -> StateVTable {
        fn typed<S: State>(id: HandleId) -> Handle<S> {
            Handle::from_id(id)
        }
        StateVTable {
            type_id: TypeId::of::<S>(),
            type_name: std::any::type_name::<S>,
            debug_fill_properties: |app, id, properties| {
                typed::<S>(id).debug_fill_properties(app, properties)
            },
            build: |app, id, context| typed::<S>(id).build(app, context),
            init_state: |app, id| typed::<S>(id).init_state(app),
            did_change_dependencies: |app, id| typed::<S>(id).did_change_dependencies(app),
            did_update_widget: |app, id, old_widget| {
                let old_widget = downcast_widget::<S::Widget>(&**old_widget)
                    .expect("a StatefulElement holds its StatefulWidget");
                typed::<S>(id).did_update_widget(app, old_widget);
            },
            activate: |app, id| typed::<S>(id).activate(app),
            deactivate: |app, id| typed::<S>(id).deactivate(app),
            dispose: |app, id| typed::<S>(id).dispose(app),
            set_widget: |app, id, widget| typed::<S>(id).state_data_mut(app).set_widget(widget),
            element: |app, id| typed::<S>(id).state_data(app).element(),
            set_element: |app, id, element| typed::<S>(id).state_data_mut(app).set_element(element),
            debug_lifecycle_state: |app, id| typed::<S>(id).state_data(app).debug_lifecycle_state(),
            set_debug_lifecycle_state: |app, id, lifecycle| {
                typed::<S>(id)
                    .state_data_mut(app)
                    .set_debug_lifecycle_state(lifecycle);
            },
        }
    }
}

impl AnyState {
    pub(crate) fn of<S: State>(state: Handle<S>) -> AnyState {
        AnyState {
            id: state.id(),
            vtable: const { &StateVTable::of::<S>() },
        }
    }

    pub(crate) fn id(self) -> HandleId {
        self.id
    }

    pub(crate) fn type_id(self) -> TypeId {
        self.vtable.type_id
    }

    pub(crate) fn build(self, app: &mut App, context: BuildContext) -> WidgetRef {
        (self.vtable.build)(app, self.id, context)
    }

    pub(crate) fn init_state(self, app: &mut App) {
        (self.vtable.init_state)(app, self.id);
    }

    pub(crate) fn did_change_dependencies(self, app: &mut App) {
        (self.vtable.did_change_dependencies)(app, self.id);
    }

    pub(crate) fn did_update_widget(self, app: &mut App, old_widget: &WidgetRef) {
        (self.vtable.did_update_widget)(app, self.id, old_widget);
    }

    pub(crate) fn activate(self, app: &mut App) {
        (self.vtable.activate)(app, self.id);
    }

    pub(crate) fn deactivate(self, app: &mut App) {
        (self.vtable.deactivate)(app, self.id);
    }

    pub(crate) fn dispose(self, app: &mut App) {
        (self.vtable.dispose)(app, self.id);
    }

    pub(crate) fn set_widget(self, app: &mut App, widget: WidgetRef) {
        (self.vtable.set_widget)(app, self.id, widget);
    }

    pub(crate) fn element(self, app: &App) -> Option<Handle<StatefulElement>> {
        (self.vtable.element)(app, self.id)
    }

    pub(crate) fn set_element(self, app: &mut App, element: Option<Handle<StatefulElement>>) {
        (self.vtable.set_element)(app, self.id, element);
    }

    /// Dart's `State.toStringShort`, from `Diagnosticable`: the state's type and identity.
    pub fn to_string_short(self) -> String {
        describe_identity(
            bare_type_name((self.vtable.type_name)()),
            self.id.identity_hash(),
        )
    }

    /// Dart's `State.toString`: the short description, then the properties at the info level
    /// or above on the same line, as `ScrollableState#1a2b3(position: …)`.
    pub fn to_string(self, app: &App) -> String {
        let mut properties = DiagnosticPropertiesBuilder::new();
        self.fill_base_properties(app, &mut properties);
        (self.vtable.debug_fill_properties)(app, self.id, &mut properties);
        DiagnosticableNode::from_parts(None, self.to_string_short(), properties)
            .with_style(DiagnosticsTreeStyle::SingleLine)
            .to_string_with(None, DiagnosticLevel::Info)
    }

    /// The properties `State.debugFillProperties` adds before a state's own: the lifecycle
    /// unless it is ready, and whether the state has its widget and element.
    fn fill_base_properties(self, app: &App, properties: &mut DiagnosticPropertiesBuilder) {
        properties.add(
            EnumProperty::new("lifecycle state", self.debug_lifecycle_state(app))
                .default_value(Some(StateLifecycle::Ready)),
        );
        properties.add(
            ObjectFlagProperty::<String>::new("_widget", self.widget_description(app))
                .if_null("no widget"),
        );
        properties.add(
            ObjectFlagProperty::<String>::new(
                "_element",
                self.element(app)
                    .map(|element| element.as_element().to_string_short(app)),
            )
            .if_null("not mounted"),
        );
    }

    /// The state's widget as its element names it, while the state is attached to one.
    fn widget_description(self, app: &App) -> Option<String> {
        let element = self.element(app)?.as_element();
        element
            .mounted(app)
            .then(|| element.widget(app).to_string_short())
    }

    pub(crate) fn debug_lifecycle_state(self, app: &App) -> StateLifecycle {
        (self.vtable.debug_lifecycle_state)(app, self.id)
    }

    pub(crate) fn set_debug_lifecycle_state(self, app: &mut App, lifecycle: StateLifecycle) {
        (self.vtable.set_debug_lifecycle_state)(app, self.id, lifecycle);
    }
}

/// The accessors [`State`] asks for, for a struct whose bag is the field `state`.
#[macro_export]
macro_rules! state_accessors {
    () => {
        fn state_data(
            self: $crate::__private::foundation::Handle<Self>,
            app: &$crate::__private::foundation::App,
        ) -> &$crate::StateData<Self::Widget> {
            &app.get(self).state
        }

        fn state_data_mut(
            self: $crate::__private::foundation::Handle<Self>,
            app: &mut $crate::__private::foundation::App,
        ) -> &mut $crate::StateData<Self::Widget> {
            &mut app.get_mut(self).state
        }
    };
}

/// The logic and internal state for a [`StatefulWidget`].
///
/// State is information that (1) can be read synchronously when the widget is built and (2)
/// might change during the lifetime of the widget. It is the responsibility of the widget
/// implementer to ensure that the [`State`] is promptly notified when such state changes,
/// using [`set_state`](Self::set_state).
///
/// [`State`] objects are created by the framework by calling the
/// [`StatefulWidget::create_state`] method when inflating a [`StatefulWidget`] to insert it
/// into the tree. Because a given [`StatefulWidget`] instance can be inflated multiple times
/// (e.g., the widget is incorporated into the tree in multiple places at once), there might
/// be more than one [`State`] object associated with a given [`StatefulWidget`] instance.
/// Similarly, if a [`StatefulWidget`] is removed from the tree and later inserted in to the
/// tree again, the framework will call [`StatefulWidget::create_state`] again to create a
/// fresh [`State`] object, simplifying the lifecycle of [`State`] objects.
///
/// Methods take `self: Handle<Self>`: the state lives in the arena, and [`widget`](Self::widget)
/// / [`context`](Self::context) read the element it is attached to.
///
/// # When a widget needs one
///
/// A [`State`] is for what a widget *owns* as a Flutter object across its builds: a
/// [`TextEditingController`](crate::TextEditingController), a [`FocusNode`](crate::FocusNode), an
/// [`AnimationController`](crate::AnimationController) it drives. The app's own data is not
/// state: it lives in an [`Entity`](waft_foundation::Entity), which a
/// [`StatelessWidget`](crate::StatelessWidget) reads in `build` and is rebuilt by when it
/// notifies. A stateful widget whose only job is to hold a counter or a fetched list is app data
/// in the wrong place.
pub trait State: Sized + 'static {
    /// The widget this state belongs to; Dart's `State<T>` type argument.
    type Widget: StatefulWidget<State = Self>;

    /// The framework's bookkeeping, held under the field `state`
    /// ([`state_accessors!`](crate::state_accessors)).
    fn state_data(self: Handle<Self>, app: &App) -> &StateData<Self::Widget>;

    /// See [`state_data`](Self::state_data).
    fn state_data_mut(self: Handle<Self>, app: &mut App) -> &mut StateData<Self::Widget>;

    /// The current configuration.
    ///
    /// A [`State`] object's configuration is the corresponding [`StatefulWidget`] instance.
    /// This property is initialized by the framework before calling
    /// [`init_state`](Self::init_state). If the parent updates this location in the tree to a
    /// new widget with the same `runtimeType` and [`Widget::key`](super::Widget::key) as the
    /// current configuration, the framework will update this property to refer to the new
    /// widget and then call [`did_update_widget`](Self::did_update_widget), passing the old
    /// configuration as an argument.
    fn widget(self: Handle<Self>, app: &App) -> &Self::Widget {
        let widget = self
            .state_data(app)
            .widget
            .as_ref()
            .expect("the framework sets the widget before init_state");
        downcast_widget::<Self::Widget>(&**widget)
            .expect("a StatefulElement holds its StatefulWidget")
    }

    /// The location in the tree where this widget builds.
    ///
    /// The framework associates [`State`] objects with a [`BuildContext`] after creating them
    /// with [`StatefulWidget::create_state`] and before calling
    /// [`init_state`](Self::init_state). The association is permanent: the [`State`] object
    /// will never change its [`BuildContext`]. However, the [`BuildContext`] itself can be
    /// moved around the tree.
    ///
    /// After calling [`dispose`](Self::dispose), the framework severs the [`State`] object's
    /// connection with the [`BuildContext`].
    fn context(self: Handle<Self>, app: &App) -> BuildContext {
        use super::element::Element;
        self.state_data(app)
            .element()
            .expect(
                "This widget has been unmounted, so the State no longer has a context (and \
                 should be considered defunct). Consider canceling any active work during \
                 \"dispose\" or using the \"mounted\" getter to determine if the State is still \
                 active.",
            )
            .as_element()
    }

    /// Whether this [`State`] object is currently in a tree.
    ///
    /// After creating a [`State`] object and before calling [`init_state`](Self::init_state),
    /// the framework "mounts" the [`State`] object by associating it with a [`BuildContext`].
    /// The [`State`] object remains mounted until the framework calls
    /// [`dispose`](Self::dispose), after which time the framework will never ask the
    /// [`State`] object to [`build`](Self::build) again.
    ///
    /// It is an error to call [`set_state`](Self::set_state) unless
    /// [`mounted`](Self::mounted) is true.
    fn mounted(self: Handle<Self>, app: &App) -> bool {
        app.contains(self) && self.state_data(app).element().is_some()
    }

    /// Called when this object is inserted into the tree.
    ///
    /// The framework will call this method exactly once for each [`State`] object it creates.
    ///
    /// Override this method to perform initialization that depends on the location at which
    /// this object was inserted into the tree (i.e., [`context`](Self::context)) or on the
    /// widget used to configure this object (i.e., [`widget`](Self::widget)).
    ///
    /// You should not use `BuildContext::depend_on_inherited_widget_of_exact_type` from this
    /// method. However, [`did_change_dependencies`](Self::did_change_dependencies) will be
    /// called immediately following this method, and
    /// `BuildContext::depend_on_inherited_widget_of_exact_type` can be used there.
    fn init_state(self: Handle<Self>, app: &mut App) {
        let _ = (self, app);
    }

    /// Called whenever the widget configuration changes.
    ///
    /// If the parent widget rebuilds and requests that this location in the tree update to
    /// display a new widget with the same `runtimeType` and [`Widget::key`](super::Widget::key),
    /// the framework will update the [`widget`](Self::widget) property of this [`State`]
    /// object to refer to the new widget and then call this method with the previous widget
    /// as an argument.
    ///
    /// Override this method to respond when the [`widget`](Self::widget) changes (e.g., to
    /// start implicit animations).
    ///
    /// The framework always calls [`build`](Self::build) after calling
    /// [`did_update_widget`](Self::did_update_widget), which means any calls to
    /// [`set_state`](Self::set_state) in [`did_update_widget`](Self::did_update_widget) are
    /// redundant.
    fn did_update_widget(self: Handle<Self>, app: &mut App, old_widget: &Self::Widget) {
        let _ = (self, app, old_widget);
    }

    /// Notify the framework that the internal state of this object has changed.
    ///
    /// Whenever you change the internal state of a [`State`] object, make the change in a
    /// function that you pass to [`set_state`](Self::set_state):
    ///
    /// ```text
    /// self.set_state(app, |state| { state.my_state = new_value; });
    /// ```
    ///
    /// The provided callback is immediately called synchronously. It must not return a
    /// future (the callback cannot be `async`), since then it would be unclear when the
    /// state was actually being set.
    ///
    /// Calling [`set_state`](Self::set_state) notifies the framework that the internal state
    /// of this object has changed in a way that might impact the user interface in this
    /// subtree, which causes the framework to schedule a [`build`](Self::build) for this
    /// [`State`] object.
    ///
    /// If you just change the state directly without calling
    /// [`set_state`](Self::set_state), the framework might not schedule a
    /// [`build`](Self::build) and the user interface for this subtree might not be updated
    /// to reflect the new state.
    fn set_state(self: Handle<Self>, app: &mut App, f: impl FnOnce(&mut Self)) {
        use super::element::Element;
        if cfg!(debug_assertions) {
            let lifecycle = self.state_data(app).debug_lifecycle_state();
            assert!(
                lifecycle != StateLifecycle::Defunct,
                "setState() called after dispose(): this error happens if you call setState() \
                 on a State object for a widget that no longer appears in the widget tree \
                 (e.g., whose parent widget no longer includes the widget in its build)."
            );
            assert!(
                !(lifecycle == StateLifecycle::Created && !self.mounted(app)),
                "setState() called in constructor: this happens when you call setState() on a \
                 State object for a widget that hasn't been inserted into the widget tree yet."
            );
        }
        f(app.get_mut(self));
        let element = self
            .state_data(app)
            .element()
            .expect("set_state needs a mounted state");
        element.as_element().mark_needs_build(app);
    }

    /// Called when this object is removed from the tree.
    ///
    /// The framework calls this method whenever it removes this [`State`] object from the
    /// tree. In some cases, the framework will reinsert the [`State`] object into another
    /// part of the tree (e.g., if the subtree containing this [`State`] object is grafted
    /// from one location in the tree to another due to the use of a `GlobalKey`). If that
    /// happens, the framework will call [`activate`](Self::activate) to give the [`State`]
    /// object a chance to reacquire any resources that it released in
    /// [`deactivate`](Self::deactivate). It will then also call [`build`](Self::build) to give
    /// the [`State`] object a chance to adapt to its new location in the tree. If the
    /// framework does reinsert this subtree, it will do so before the end of the animation
    /// frame in which the subtree was removed from the tree. For this reason, [`State`]
    /// objects can defer releasing most resources until the framework calls their
    /// [`dispose`](Self::dispose) method.
    fn deactivate(self: Handle<Self>, app: &mut App) {
        let _ = (self, app);
    }

    /// Called when this object is reinserted into the tree after having been removed via
    /// [`deactivate`](Self::deactivate).
    ///
    /// In most cases, after a [`State`] object has been deactivated, it is _not_ reinserted
    /// into the tree, and its [`dispose`](Self::dispose) method will be called to signal that
    /// it is ready to be garbage collected.
    ///
    /// In some cases, however, after a [`State`] object has been deactivated, the framework
    /// will reinsert it into another part of the tree (e.g., if the subtree containing this
    /// [`State`] object is grafted from one location in the tree to another due to the use
    /// of a `GlobalKey`). If that happens, the framework will call
    /// [`activate`](Self::activate) to give the [`State`] object a chance to reacquire any
    /// resources that it released in [`deactivate`](Self::deactivate). It will then also call
    /// [`build`](Self::build) to give the object a chance to adapt to its new location in the
    /// tree.
    fn activate(self: Handle<Self>, app: &mut App) {
        let _ = (self, app);
    }

    /// Called when this object is removed from the tree permanently.
    ///
    /// The framework calls this method when this [`State`] object will never build again.
    /// After the framework calls [`dispose`](Self::dispose), the [`State`] object is
    /// considered unmounted and the [`mounted`](Self::mounted) property is false. It is an
    /// error to call [`set_state`](Self::set_state) at this point.
    ///
    /// Subclasses should override this method to release any resources retained by this
    /// object (e.g., stop any active animations).
    fn dispose(self: Handle<Self>, app: &mut App) {
        let _ = (self, app);
    }

    /// Describes the part of the user interface represented by this widget.
    ///
    /// The framework calls this method in a number of different situations. For example:
    ///
    ///  * After calling [`init_state`](Self::init_state).
    ///  * After calling [`did_update_widget`](Self::did_update_widget).
    ///  * After receiving a call to [`set_state`](Self::set_state).
    ///  * After a dependency of this [`State`] object changes (e.g., an `InheritedWidget`
    ///    referenced by the previous [`build`](Self::build) changes).
    ///  * After calling [`deactivate`](Self::deactivate) and then reinserting the [`State`]
    ///    object into the tree at another location.
    ///
    /// This method can potentially be called in every frame and should not have any side
    /// effects beyond building a widget.
    fn build(self: Handle<Self>, app: &mut App, context: BuildContext) -> WidgetRef;

    /// Called when a dependency of this [`State`] object changes.
    ///
    /// For example, if the previous call to [`build`](Self::build) referenced an
    /// `InheritedWidget` that later changed, the framework would call this method to notify
    /// this object about the change.
    ///
    /// This method is also called immediately after [`init_state`](Self::init_state). It is
    /// safe to call `BuildContext::depend_on_inherited_widget_of_exact_type` from this method.
    fn did_change_dependencies(self: Handle<Self>, app: &mut App) {
        let _ = (self, app);
    }

    /// Dart's `debugFillProperties`: the properties this state shows where its element's dump
    /// names it (`state: ScrollableState#1a2b3(offset: 0.0)`), after the lifecycle and mounting
    /// properties `State`'s base adds, which the framework adds first.
    fn debug_fill_properties(
        self: Handle<Self>,
        app: &App,
        properties: &mut DiagnosticPropertiesBuilder,
    ) {
        let _ = (self, app, properties);
    }
}