Badge class

Created by chell on 2019/01/17. A badge widget with free location and customizable style.

Inheritance

Constructors

Badge({Key key, @required Widget child, String text, int number, bool showExactNumber: false, TextStyle textStyle: const TextStyle(color: Colors.white, fontSize: 11), Alignment align: Alignment.topRight, double offsetX: 0.0, double offsetY: 0.0, double padding: 5.0, Color backgroundColor: Colors.red, double borderRadius: 100.0, double borderWidth: 0.0, Color borderColor, Border customBorder, bool showShadow: false, List<BoxShadow> customShadows, bool visible: true})

Properties

align Alignment
Initial location in stack.
final
backgroundColor Color
Color of badge.
final
borderColor Color
Border color of badge.
final
borderRadius double
Border radius of badge.
final
borderWidth double
Border width of badge.
final
child Widget
A child widget under the badge, it can't be null.
final
customBorder Border
Custom border, only take effect when borderWidth and borderColor are null.
final
customShadows List<BoxShadow>
Custom shadow, it will override default badge shadow.
final
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
number int
If you just want to show number, use this.
final
offsetX double
Adjust horizontal position based on align.x.
final
offsetY double
Adjust vertical position based on align.y.
final
padding double
The padding from text to its border.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
showExactNumber bool
Show number exactly if using number to display.
final
showShadow bool
Show badge shadow.
final
text String
The text display in badge, conflict with number. If you provide text and number both, only text can be effective.
final
textStyle TextStyle
Text style of badge.
final
visible bool
Hide badge if false.
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. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
inherited
isBottom() bool
isLeft() bool
isRight() bool
isTop() bool
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
Returns 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. [...]
@nonVirtual, inherited