MiuixFloatingActionButton class

Miuix 风格的浮动操作按钮。对应 Kotlin FloatingActionButton。

在 Surface(shape=CircleShape, color=containerColor, shadowElevation)之上 用 defaultMinSize(60,60) 的 Box 居中放置内容。Flutter 端用 DecoratedBox

  • ShapeDecoration 复刻背景与阴影,MiuixPressable 复刻按压遮罩 (overlayColor = colors.onBackground,spring enter damping1.0/response0.2, exit damping0.95/response0.35)。

内容色注意:与 Kotlin 一致,FAB 不向 Surface 传 contentColor,因此内容色 继承 Surface 默认值 colors.onSurface(而非 onPrimary),通过 MiuixContentColor 向下传递,调用方提供的 MiuixIcon 默认会被 tint 成 onSurface。

Inheritance

Constructors

MiuixFloatingActionButton({Key? key, required VoidCallback? onPressed, required Widget child, bool enabled = true, ShapeBorder shape = MiuixFloatingActionButtonDefaults.shape, Color? containerColor, double shadowElevation = MiuixFloatingActionButtonDefaults.shadowElevation, double minWidth = MiuixFloatingActionButtonDefaults.minWidth, double minHeight = MiuixFloatingActionButtonDefaults.minHeight})
const

Properties

child → Widget
子节点。
final
containerColor → Color?
容器背景色,默认 MiuixTheme.colors.primary。
final
enabled → bool
是否启用。
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minHeight → double
最小高度,默认 60。
final
minWidth → double
最小宽度,默认 60。
final
onPressed → VoidCallback?
点击回调。为 null 时视为禁用。
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shadowElevation → double
阴影高度(逻辑像素),默认 4。
final
shape → ShapeBorder
形状,默认 StadiumBorder(对应 Kotlin CircleShape)。
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