BreathBox class

使用示例:

BreathBox(
  minScale: 0.8,
  maxScale: 1.3,
  size: 150,
  glowColor: Colors.blue,
  onBreathing: (scale) {
    print('当前缩放比例: $scale');
  },
  onScaleUp: () {
    print('放大中');
  },
  onScaleDown: () {
    print('缩小中');
  },
  child: Image.asset('assets/images/icon.png'),
)

呼吸灯动画组件 通过缩放动画实现呼吸灯效果 child - 需要添加呼吸效果的子组件 minScale - 最小缩放比例,默认0.6 maxScale - 最大缩放比例,默认1.6 size - 组件大小,默认180 glowColor - 发光背景颜色,默认浅蓝色 onScaleUp - 放大时的回调 onScaleDown - 缩小时的回调 onBreathing - 呼吸过程中的回调,参数为当前缩放比例

Inheritance

Constructors

BreathBox({Key? key, required Widget child, double minScale = 0.6, double maxScale = 1.6, double size = 180, Color glowColor = Colors.lightBlue, VoidCallback? onScaleUp, VoidCallback? onScaleDown, void onBreathing(double scale)?})
const

Properties

child Widget
final
glowColor Color
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxScale double
final
minScale double
final
onBreathing → void Function(double scale)?
final
onScaleDown VoidCallback?
final
onScaleUp VoidCallback?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size double
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.
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