IconWithBadge class

Shows an icon with an unread badge.

Typically used as a way of indicating how many unread messages/notifications an app section has.

See also:

  • UnreadBadge, used to show the unread badge in this
  • ZdsNavItem, where this widget can be used as the icon.
Inheritance
Available Extensions

Constructors

IconWithBadge(IconData? icon, {Key? key, Color? color, double? fill, double? grade, int maximumDigits = 3, double? opticalSize, String? semanticLabel, String? semanticsLabel, List<Shadow>? shadows, double size = 24, TextDirection? textDirection, int unread = 0, double? weight, Color? iconContainerColor})
Displays an icon with an optional unread badge if the unread parameter is given. The optional semanticsLabel parameter is used by the unreadBadge child.
const

Properties

color Color?
The color to use when drawing the icon.
final
fill double?
The fill for drawing the icon.
final
grade double?
The grade (granular stroke weight) for drawing the icon.
final
hashCode int
The hash code for this object.
no setterinherited
icon IconData?
The icon to display. The available icons are described in Icons.
final
iconContainerColor Color?
The color of the surface where this icon is being drawn on. Typically, this will be the surface color. However, in cases where this widget is used in a context with a different surface color, such as in an AppBar, this value should be set to the AppBar's background color.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maximumDigits int
How many digits long the unread amount can be. For example, if set to 3, any number over 999 will be shown as 999+ or +999 depending on the locale used and the text direction.
final
opticalSize double?
The optical size for drawing the icon.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel String?
Semantic label for the icon.
final
semanticsLabel String?
Optional text to replace the default Semantics behavior of reading the number in this badge. Can be used for making Semantics read "3 unread emails" instead of just "3"
final
shadows List<Shadow>?
A list of Shadows that will be painted underneath the icon.
final
size double
The size of the icon in logical pixels.
final
textDirection TextDirection?
The text direction to use for rendering the icon.
final
unread int
The number to show in the badge. If it's equal to 0, only the icon will be shown and no badge will show.
final
weight double?
The stroke weight for drawing the icon.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent 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.
inherited