NZFloatingActionButton class
NZFloatingActionButton 是一个多功能的悬浮按钮,支持:
- 拖动 (draggable)
- 图片背景 (image)
- 仅图标或图标加文字 (standard/icon)
- 滚动隐藏 (scroll to hide)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- NZFloatingActionButton
Constructors
-
NZFloatingActionButton({Key? key, required VoidCallback onPressed, Widget? icon, String? label, ImageProvider<
Object> ? image, NZFloatingActionButtonType type = NZFloatingActionButtonType.standard, bool draggable = false, Offset initialPosition = const Offset(20, 20), ScrollController? scrollController, Color? backgroundColor, Color? foregroundColor, Object? heroTag, String? tooltip}) -
const
- NZFloatingActionButton.icon({Key? key, required VoidCallback onPressed, required Widget icon, bool draggable = false, Offset initialPosition = const Offset(20, 20), ScrollController? scrollController, Color? backgroundColor, Color? foregroundColor, Object? heroTag, String? tooltip})
-
快速创建仅图标样式 FAB
factory
-
NZFloatingActionButton.image({Key? key, required VoidCallback onPressed, required ImageProvider<
Object> image, Widget? icon, bool draggable = false, Offset initialPosition = const Offset(20, 20), ScrollController? scrollController, Object? heroTag, String? tooltip}) -
快速创建图片背景样式 FAB
factory
- NZFloatingActionButton.standard({Key? key, required VoidCallback onPressed, required Widget icon, required String label, bool draggable = false, Offset initialPosition = const Offset(20, 20), ScrollController? scrollController, Color? backgroundColor, Color? foregroundColor, Object? heroTag, String? tooltip})
-
快速创建标准样式 FAB (图标 + 文字)
factory
Properties
- backgroundColor → Color?
-
背景颜色
final
- draggable → bool
-
是否可以拖动
final
- foregroundColor → Color?
-
前景颜色(图标和文字)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- heroTag → Object?
-
英雄动画标签
final
- icon → Widget?
-
图标组件
final
-
image
→ ImageProvider<
Object> ? -
背景图片(用于 image 模式)
final
- initialPosition → Offset
-
初始位置(仅在 draggable 为 true 时生效)
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
标签文本(用于 standard 模式)
final
- onPressed → VoidCallback
-
点击回调
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController?
-
滚动控制器(用于实现滚动隐藏功能)
final
- tooltip → String?
-
提示信息
final
- type → NZFloatingActionButtonType
-
按钮类型
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< NZFloatingActionButton> -
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