MiuixTopAppBar class

大标题可折叠的 TopAppBar。对应 Kotlin TopAppBarTopAppBarLayout)。

折叠过渡与原版一致,采用双层结构而非字号连续插值:

  • 展开态:仅显示左对齐大标题(title1 32sp);
  • 大标题住在折叠带下方的独立裁剪层里,随折叠偏移上移并在带下缘被 裁掉;从折叠第一个像素开始淡出(alpha = 1 - fraction * 3,原版 公式),折叠 1/3 处完全消失;
  • 小标题在折叠 1/3 处阈值翻转,以弹簧曲线淡入 + 上浮 20px 出现, 重新展开时更快收回——对应原版 folme 弹簧规格。

必须配合 MiuixScrollBehavior 使用才能实现折叠/展开。 不传入 scrollBehavior 时表现为静态展开状态。

Inheritance

Constructors

MiuixTopAppBar({Key? key, required String title, Color? color, Color? titleColor, String? largeTitle, Color? largeTitleColor, String subtitle = '', Color? subtitleColor, Widget? navigationIcon, List<Widget>? actions, MiuixScrollBehavior? scrollBehavior, bool defaultWindowInsetsPadding = true, double titlePadding = MiuixTopAppBarDefaults.titlePadding, double navigationIconPadding = MiuixTopAppBarDefaults.navigationIconPadding, double actionIconPadding = MiuixTopAppBarDefaults.actionIconPadding, Widget? bottomContent, bool blurred = false, double blurRadius = 24, double blurTintAlpha = 0.55})
const

Properties

actionIconPadding double
操作图标末端内边距。
final
actions List<Widget>?
操作图标(trailing)。
final
blurRadius double
毛玻璃模糊半径(dp)。仅 blurred 为 true 时生效。
final
blurred bool
是否启用毛玻璃背景(增强,非原版行为)。为 true 时顶栏背景变为对身后已绘制内容 (通常是滚动到栏下方的 body)的实时高斯模糊 + 半透明色调,实现"内容透过顶栏虚化"。
final
blurTintAlpha double
毛玻璃上叠加的背景色调不透明度 0,1。仅 blurred 为 true 时生效。 太高会盖住模糊、太低对比不足;默认 0.55。
final
bottomContent Widget?
标题区域下方的附加内容。
final
color Color?
背景色。默认 MiuixTheme.colors.surface
final
defaultWindowInsetsPadding 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
largeTitle String?
大标题,默认与 title 相同。
final
largeTitleColor Color?
大标题颜色。
final
导航图标(leading)。
final
导航图标起始内边距。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrollBehavior MiuixScrollBehavior?
控制折叠/展开的滚动行为。
final
subtitle String
副标题(展开时显示在大标题下方,折叠时显示在小标题下方)。
final
subtitleColor Color?
副标题颜色。
final
title String
final
titleColor Color?
折叠后小标题颜色。
final
titlePadding double
标题水平内边距。
final

Methods

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