MiuixExitUntilCollapsedScrollBehavior class
"折叠到顶部为止"的滚动行为。对应 Kotlin ExitUntilCollapsedScrollBehavior。
折叠量 MiuixTopAppBarState.heightOffset 直接锚定到内容滚动位置:
heightOffset = -(pixels - minScrollExtent),再由 setter 钳到 limit, 0。
只有内容滚回顶部对应位置,大标题才逐像素恢复;中途上/下滑不跳变。
不再累积 delta、不再松手吸附——那两者会让 heightOffset 与真实滚动位置 解耦(吸附把 heightOffset 拉到端点,pixels 却停在过渡区中段),造成"稍微 下滑,居中小标题就弹回大标题"。改为按位置直接映射后此问题不复存在。
用法:
final behavior = miuixScrollBehavior();
MiuixScrollBehaviorListener(
behavior: behavior,
child: ListView(...),
);
MiuixTopAppBar(title: 'Title', scrollBehavior: behavior);
- Implemented types
Constructors
- MiuixExitUntilCollapsedScrollBehavior({MiuixTopAppBarState? state, bool canScroll()?})
Properties
- canScroll → bool Function()?
-
是否处理滚动事件。
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isPinned → bool
-
是否固定(不随滚动收起)。
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → MiuixTopAppBarState
-
final
Methods
-
handleScroll(
ScrollNotification n) → bool -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited