OudsBadge class

An OUDS badge widget.

A custom Badge widget for user interface, allowing display of various statuses, sizes, icons, or labels. This component is designed to adapt to different visual contexts based on its parameters.

parameters :

  • status : The badge's status, influencing its color and style (e.g., negative, positive, warning).
  • size : The size of the badge, such as medium, large, etc., to fit various visual needs.
  • label : An optional text to display inside the badge, often used for numbers or status texts.
  • icon : An optional SVG asset name to display an icon within the badge, complementing or replacing the label.
  • child : A custom widget to insert inside the badge for advanced customization.

Styling details :

  • The background color is determined by the status, using OudsBadgeStatus.
  • The size and margins are adjusted according to the badge size via OudsBadgeSize.

You can use the above example to implement the Badge component in your project, customizing parameters as needed.

Usage example :

OudsBadge(
  status: OudsBadgeStatus.negative,
  size: OudsBadgeSize.large,
  label: '120',
  icon: 'assets/ic_heart_badge.svg',
  child: Icon(Icons.favorite), // Replace with your child widget";
);
Inheritance

Constructors

OudsBadge.new({Key? key, required OudsBadgeStatus status, OudsBadgeSize? size = OudsBadgeSize.medium, String? label, String? icon, Widget? child})
const

Properties

child Widget?
final
hashCode int
The hash code for this object.
no setterinherited
icon String?
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size → OudsBadgeSize?
final
status → OudsBadgeStatus
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<OudsBadge>
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.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
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, int wrapWidth = 65}) 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