NZMasonry class

NZMasonry 是 NezhaUI 提供的专业瀑布流布局组件。

它支持多列等宽不等高的布局,非常适合展示图片、卡片流等内容。 提供基础列表和生成器两种模式,并内置了平滑的进入动画。

Inheritance

Constructors

NZMasonry({Key? key, required List<Widget> children, int crossAxisCount = 2, double mainAxisSpacing = 8.0, double crossAxisSpacing = 8.0, EdgeInsetsGeometry? padding, bool animate = true, Duration animationDuration = const Duration(milliseconds: 500), ScrollPhysics? physics, bool shrinkWrap = false, ScrollController? controller})
基础构造函数
const
NZMasonry.builder({Key? key, required IndexedWidgetBuilder itemBuilder, required int itemCount, int crossAxisCount = 2, double mainAxisSpacing = 8.0, double crossAxisSpacing = 8.0, EdgeInsetsGeometry? padding, bool animate = true, Duration animationDuration = const Duration(milliseconds: 500), ScrollPhysics? physics, bool shrinkWrap = false, ScrollController? controller})
生成器构造函数
const

Properties

animate bool
是否开启进入动画
final
animationDuration Duration
动画持续时间
final
children List<Widget>?
子组件列表 (仅在普通构造函数中使用)
final
controller ScrollController?
滚动控制器
final
crossAxisCount int
列数
final
crossAxisSpacing double
交叉轴间距 (左右)
final
hashCode int
The hash code for this object.
no setterinherited
itemBuilder IndexedWidgetBuilder?
子组件生成器 (仅在 builder 构造函数中使用)
final
itemCount int?
子组件数量 (仅在 builder 构造函数中使用)
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
mainAxisSpacing double
主轴间距 (上下)
final
padding EdgeInsetsGeometry?
内边距
final
physics ScrollPhysics?
滚动物理效果
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shrinkWrap bool
是否根据子组件收缩
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