@@ -75,86 +75,79 @@ class _MesmerizingSliverAppBarState extends ConsumerState<RemoteAlbumSliverAppBa
7575 const Shadow (offset: Offset (0 , 2 ), blurRadius: 0 , color: Colors .transparent),
7676 ];
7777
78- if (isMultiSelectEnabled) {
79- return SliverToBoxAdapter (
80- child: switch (_scrollProgress) {
81- < 0.8 => const SizedBox (height: 120 ),
82- _ => const SizedBox (height: 452 ),
83- },
84- );
85- } else {
86- return SliverAppBar (
87- expandedHeight: 400.0 ,
88- floating: false ,
89- pinned: true ,
90- snap: false ,
91- elevation: 0 ,
92- leading: IconButton (
93- icon: Icon (
94- Platform .isIOS ? Icons .arrow_back_ios_new_rounded : Icons .arrow_back,
95- color: actionIconColor,
96- shadows: actionIconShadows,
97- ),
98- onPressed: () => context.navigateTo (const TabShellRoute (children: [DriftAlbumsRoute ()])),
99- ),
100- actions: [
101- if (widget.onToggleAlbumOrder != null )
102- IconButton (
103- icon: Icon (Icons .swap_vert_rounded, color: actionIconColor, shadows: actionIconShadows),
104- onPressed: widget.onToggleAlbumOrder,
105- ),
106- if (currentAlbum.isActivityEnabled && currentAlbum.isShared)
107- IconButton (
108- icon: Icon (Icons .chat_outlined, color: actionIconColor, shadows: actionIconShadows),
109- onPressed: widget.onActivity,
78+ return SliverAppBar (
79+ expandedHeight: 400.0 ,
80+ floating: false ,
81+ pinned: true ,
82+ snap: false ,
83+ elevation: 0 ,
84+ leading: isMultiSelectEnabled
85+ ? const SizedBox .shrink ()
86+ : IconButton (
87+ icon: Icon (
88+ Platform .isIOS ? Icons .arrow_back_ios_new_rounded : Icons .arrow_back,
89+ color: actionIconColor,
90+ shadows: actionIconShadows,
91+ ),
92+ onPressed: () => context.navigateTo (const TabShellRoute (children: [DriftAlbumsRoute ()])),
11093 ),
111- if (widget.onShowOptions != null )
112- IconButton (
113- icon: Icon (Icons .more_vert, color: actionIconColor, shadows: actionIconShadows),
114- onPressed: widget.onShowOptions,
94+ actions: [
95+ if (widget.onToggleAlbumOrder != null )
96+ IconButton (
97+ icon: Icon (Icons .swap_vert_rounded, color: actionIconColor, shadows: actionIconShadows),
98+ onPressed: widget.onToggleAlbumOrder,
99+ ),
100+ if (currentAlbum.isActivityEnabled && currentAlbum.isShared)
101+ IconButton (
102+ icon: Icon (Icons .chat_outlined, color: actionIconColor, shadows: actionIconShadows),
103+ onPressed: widget.onActivity,
104+ ),
105+ if (widget.onShowOptions != null )
106+ IconButton (
107+ icon: Icon (Icons .more_vert, color: actionIconColor, shadows: actionIconShadows),
108+ onPressed: widget.onShowOptions,
109+ ),
110+ ],
111+ title: Builder (
112+ builder: (context) {
113+ final settings = context.dependOnInheritedWidgetOfExactType <FlexibleSpaceBarSettings >();
114+ final scrollProgress = _calculateScrollProgress (settings);
115+
116+ return AnimatedSwitcher (
117+ duration: const Duration (milliseconds: 200 ),
118+ child: scrollProgress > 0.95
119+ ? Text (
120+ currentAlbum.name,
121+ style: TextStyle (color: context.primaryColor, fontWeight: FontWeight .w600, fontSize: 18 ),
122+ )
123+ : null ,
124+ );
125+ },
126+ ),
127+ flexibleSpace: Builder (
128+ builder: (context) {
129+ final settings = context.dependOnInheritedWidgetOfExactType <FlexibleSpaceBarSettings >();
130+ final scrollProgress = _calculateScrollProgress (settings);
131+
132+ // Update scroll progress for the leading button
133+ WidgetsBinding .instance.addPostFrameCallback ((_) {
134+ if (mounted && _scrollProgress != scrollProgress) {
135+ setState (() {
136+ _scrollProgress = scrollProgress;
137+ });
138+ }
139+ });
140+
141+ return FlexibleSpaceBar (
142+ background: _ExpandedBackground (
143+ scrollProgress: scrollProgress,
144+ icon: widget.icon,
145+ onEditTitle: widget.onEditTitle,
115146 ),
116- ],
117- title: Builder (
118- builder: (context) {
119- final settings = context.dependOnInheritedWidgetOfExactType <FlexibleSpaceBarSettings >();
120- final scrollProgress = _calculateScrollProgress (settings);
121-
122- return AnimatedSwitcher (
123- duration: const Duration (milliseconds: 200 ),
124- child: scrollProgress > 0.95
125- ? Text (
126- currentAlbum.name,
127- style: TextStyle (color: context.primaryColor, fontWeight: FontWeight .w600, fontSize: 18 ),
128- )
129- : null ,
130- );
131- },
132- ),
133- flexibleSpace: Builder (
134- builder: (context) {
135- final settings = context.dependOnInheritedWidgetOfExactType <FlexibleSpaceBarSettings >();
136- final scrollProgress = _calculateScrollProgress (settings);
137-
138- // Update scroll progress for the leading button
139- WidgetsBinding .instance.addPostFrameCallback ((_) {
140- if (mounted && _scrollProgress != scrollProgress) {
141- setState (() {
142- _scrollProgress = scrollProgress;
143- });
144- }
145- });
146-
147- return FlexibleSpaceBar (
148- background: _ExpandedBackground (
149- scrollProgress: scrollProgress,
150- icon: widget.icon,
151- onEditTitle: widget.onEditTitle,
152- ),
153- );
154- },
155- ),
156- );
157- }
147+ );
148+ },
149+ ),
150+ );
158151 }
159152}
160153
0 commit comments