DelayedHud class Null safety

Most basic delayed start HUD. It does not use a provider to trigger the HUD. You must provide the value to when it should be shown.

var isBusy = true;

DelayedHud(
  hud: CircularProgressIndicator(),
  child: Text('DelayedHud'),
  showHud: () => _isBusy, // Update this variable when you want to show/hide the HUD
)

Show a hud with 1s delay and no provider. When you set the variable isBusy to true, the timer will start and once the timer reaches 1s, it will show the HUD. If you change the value of isBusy before 1s, the timer will be canceled.


var isBusy = true;

DelayedHud(
  hud: CircularProgressIndicator(),
  child: Text('DelayedHud'),
  delayedStart: Duration(seconds: 1),
  showHud: () => _isBusy, // Update this variable when you want to show/hide the HUD
)

Inheritance

Constructors

DelayedHud({Key? key, required Widget child, Color? color, Widget? hud, Duration? delayedStart, Widget hudWidget()?, required bool showHud()})
Constructor, only the child attribute is required.

Properties

child Widget
Widget that will be rendered by the HUD. Ideally this widget is a scaffold so when the HUD is rendered it covers the entire screen.
@requiredfinal
color Color?
This is the color used to cover the screen in between the child and the HUD control. If you don't specify this value, a translucent black color will be used.
final
delayedStart Duration?
Duration that the HUD will wait before you show it. If null, it starts automatically. Ideally, consider a duration of 250ms.
final
hashCode int
The hash code for this object.
@nonVirtualread-onlyinherited
hud Widget?
Widget that is rendered when a HUD needs to be displayed. Typically this would be a CircularProgressIndicator()
final
hudWidget → (Widget Function?()?)
This is an alternative to the hud attribute. This is a callback that lets you generate a Widget using the various providers used. This gives you additional context in case the HUD is context aware.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
showHud bool Function()
Return true and the HUD widget will be shown or if there is a delayedStart defined then the timer will start. The timer will trigger showing the HUD widget.
@requiredfinal

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _DelayedHudState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
@protectedinherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
@nonVirtualinherited