GlassLargeTitleController class
Coordinates the large-title + search-bar collapse animation between GlassLargeTitle and GlassAppBar.
Create one instance per screen, pass it to both widgets, and dispose it in
your State.dispose(). The controller owns the ScrollController — callers
attach it to their CustomScrollView via scrollController.
Two-phase iOS 26 collapse
Phase 1 — large title fades out over the first ~52pt of scroll.
Driven by collapseProgress.
Phase 2 — search bar (when provided to GlassLargeTitle) collapses
immediately after the title, over the next ~44pt. Driven by
searchBarCollapseProgress.
class _MyScreenState extends State<MyScreen> {
final _titleController = GlassLargeTitleController();
@override
void dispose() {
_titleController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => GlassScaffold(
appBar: GlassAppBar(
title: Text('Chats'),
largeTitleController: _titleController,
),
body: CustomScrollView(
controller: _titleController.scrollController,
slivers: [
GlassLargeTitle(
text: 'Chats',
controller: _titleController,
searchBar: GlassSearchBar(placeholder: 'Search'),
),
// ... content slivers
],
),
);
}
- Inheritance
-
- Object
- ChangeNotifier
- GlassLargeTitleController
Constructors
- GlassLargeTitleController({double collapseTitleHeight = 52.0, double searchBarHeight = 44.0})
- Creates a controller.
Properties
- collapseProgress → double
-
Title collapse progress in the range
[0.0, 1.0].no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isSearchPresented → bool
-
Whether GlassLargeTitle's search field is open in iPhone Duo's vertical
bar strip.
no setter
- rawScrollOffset → double
-
Raw scroll offset including negative values during iOS rubber-band overscroll.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scrollController → ScrollController
-
The ScrollController to attach to your CustomScrollView.
no setter
- searchBarCollapseProgress → double
-
Search bar collapse progress in the range
[0.0, 1.0].no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
reportMeasuredHeight(
double height) → void - Calibrates the title collapse distance to the actual rendered height.
-
reportSearchBarHeight(
double height) → void - Calibrates the search bar collapse distance to the actual rendered height.
-
reportSearchPresented(
bool presented) → void - Records whether the search field is open in the vertical bar strip.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited