ElasticDialog class

ElasticDialog

弹性动画弹出对话框组件,支持自定义出现弹性动效、圆角、背景及初始偏移位置。

调用方式示例:

Get.dialog(
  ElasticDialog(
    offset: const Offset(0, -100),
    backgroundColor: Colors.red,
    radius: 20,
    child: YourWidget(),
  ),
  barrierDismissible: false,
  barrierColor: Colors.black.withOpacity(0.3),
);

构造参数说明:

  • child (必填):对话框内容Widget。
  • offset:弹出初始偏移量,默认为 Offset(0, -50)。
  • backgroundColor:对话框背景色,默认为白色。
  • radius:圆角半径,默认为 15。

返回值说明: 返回一个带弹性放大动画的 Dialog 组件。若用在 Get.dialog 等弹窗场景,可实现带弹出特效的自定义对话框体验。

Inheritance

Constructors

ElasticDialog({Key? key, required Widget child, Offset offset = const Offset(0, -50), Color backgroundColor = Colors.white, double radius = 15})
创建一个弹性动画对话框
const

Properties

backgroundColor Color
对话框背景色
final
child Widget
弹窗内容
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
offset Offset
对话框弹出时的偏移量
final
radius double
圆角半径
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() ElasticDialogState
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