@@ -171,6 +171,8 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
171171 private var paneTitle : UIView ?
172172 private var titleInsetLeft : CGFloat = 0
173173 private var titleInsetRight : CGFloat = 0
174+ private var leadingTitleRowTop : CGFloat ?
175+ private var leadingTitleTopPadding : CGFloat = 24
174176 private var alignCollapsedTitleToLeading = false
175177 private var alwaysFrosted = false
176178 private var backdropOnly = false
@@ -180,6 +182,7 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
180182 private let compactTitle = UILabel ( )
181183 private let compactTitleContainer = UIStackView ( )
182184 private let compactTitleMask = CALayer ( )
185+ private var externalExpandedTitle = false
183186 private var titleColor = UIColor . label
184187 private var largeTitleOpacity : CGFloat = - 1
185188 private var measuredWidth : CGFloat = 0
@@ -241,7 +244,11 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
241244 }
242245 result ( nil )
243246 }
244- configure ( args as? [ String : Any ] ?? [ : ] )
247+ let initial = args as? [ String : Any ] ?? [ : ]
248+ if let depth = initial [ " initialScrollOffset " ] as? NSNumber , depth . doubleValue . isFinite {
249+ offset = min ( max ( 0 , depth . doubleValue ) , Self . maxTrackedDepth )
250+ }
251+ configure ( initial )
245252 #if canImport( UIKit , _version: 9127.0 . 85 )
246253 if #available( iOS 27 . 1 , * ) , standaloneControl || floatingTitle != nil || backdropOnly {
247254 container . addInteraction ( UIHingeInteraction { [ weak self ] _ , _ in
@@ -305,8 +312,8 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
305312 // controls live in the side rail. Flutter still reserves a 44-point row
306313 // plus 24 points of breathing room. Give expanded titles that same space.
307314 let compact = ( metrics ? [ " compactHeight " ] as? CGFloat ) ?? 44
308- let paneTitleClearance = alignCollapsedTitleToLeading
309- ? max ( 44 , compact ) + 24 - compact : 0
315+ let paneTitleClearance = alignCollapsedTitleToLeading && leadingTitleRowTop == nil
316+ ? max ( 44 , compact ) + leadingTitleTopPadding - compact : 0
310317 // UIKit can place controls beside Duo's corner status region. Applying
311318 // Flutter's full-width top inset here pushes them down a second row.
312319 let requiredTop = portraitHeader != nil
@@ -369,9 +376,10 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
369376 title . frame = CGRect ( x : alignCollapsedTitleToLeading
370377 ? navigation . navigationBar . layoutMargins . left
371378 : center - size . width / 2 ,
372- y : alignCollapsedTitleToLeading
373- ? flutterSafeTop + 24 + ( 44 - size . height ) / 2
374- : ( container . bounds . height - size . height ) / 2 ,
379+ y : leadingTitleRowTop . map { $0 + ( 44 - size . height ) / 2 }
380+ ?? ( alignCollapsedTitleToLeading
381+ ? flutterSafeTop + leadingTitleTopPadding + ( 44 - size . height ) / 2
382+ : ( container . bounds . height - size . height ) / 2 ) ,
375383 width : size . width , height : size . height )
376384 title . layoutIfNeeded ( )
377385 }
@@ -518,6 +526,8 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
518526 portraitTopPadding = CGFloat ( ( args [ " portraitTopPadding " ] as? NSNumber ) ? . doubleValue ?? 0 )
519527 paneTitle ? . removeFromSuperview ( )
520528 paneTitle = nil
529+ leadingTitleRowTop = args [ " leadingTitleRowTop " ] as? CGFloat
530+ leadingTitleTopPadding = ( args [ " leadingTitleTopPadding " ] as? NSNumber ) ? . doubleValue ?? 24
521531 alignCollapsedTitleToLeading = args [ " alignCollapsedTitleToLeading " ] as? Bool == true
522532 headerLeading ? . removeFromSuperview ( )
523533 headerTrailing ? . removeFromSuperview ( )
@@ -572,7 +582,9 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
572582 navigation . view . accessibilityElementsHidden = backdropOnly
573583 let largeTitle = args [ " largeTitle " ] as? Bool == true
574584 alwaysFrosted = args [ " alwaysFrosted " ] as? Bool == true
585+ let prefersSoftTopEdge = args [ " prefersSoftTopEdge " ] as? Bool == true
575586 if #available( iOS 26 . 0 , * ) {
587+ usesSystemScrollEdge = prefersSoftTopEdge
576588 if #available( iOS 27 . 0 , * ) {
577589 // All headers use the same native soft scroll edge. Custom titles
578590 // also retain material, like large titles, when embedding clips it.
@@ -586,23 +598,23 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
586598 // edge while the large-title inset is collapsing.
587599 // Keep the graduated material throughout that transition so partial
588600 // scrolling never leaves the title and status area unprotected.
589- // Explicitly positioned controls hide the navigation view, including
590- // UIKit's scroll edge. Keep our graduated blur behind those controls.
591- material . isHidden = usesSystemScrollEdge && ! largeTitle && ! inlinePortrait
592- && args [ " centerTitleInPane " ] as? Bool != true && ! backdropOnly
601+ material . isHidden = usesSystemScrollEdge && ! inlinePortrait && ( prefersSoftTopEdge ||
602+ ( ! largeTitle && args [ " centerTitleInPane " ] as? Bool != true && ! backdropOnly ) )
593603 // Let the native fade extend past the bar without enlarging its hit area.
594604 // The mirrored content is transparent and the bottom edge is hidden.
595605 container . clipsToBounds = ! usesSystemScrollEdge
596606 // Title, avatar and loading updates must not reset the blur appearance.
597- if appearanceColor != color || appearanceUsesSystemScrollEdge != usesSystemScrollEdge {
607+ let externalTitle = args [ " externalExpandedTitle " ] as? Bool == true
608+ if appearanceColor != color || appearanceUsesSystemScrollEdge != usesSystemScrollEdge || externalExpandedTitle != externalTitle {
609+ externalExpandedTitle = externalTitle
598610 let appearance = UINavigationBarAppearance ( )
599611 if usesSystemScrollEdge {
600612 appearance . configureWithDefaultBackground ( )
601613 } else {
602614 appearance . configureWithTransparentBackground ( )
603615 }
604616 appearance . titleTextAttributes = [ . foregroundColor : color ]
605- appearance . largeTitleTextAttributes = [ . foregroundColor : color ]
617+ appearance . largeTitleTextAttributes = [ . foregroundColor : externalTitle ? UIColor . clear : color ]
606618 bar . standardAppearance = appearance
607619 bar . scrollEdgeAppearance = appearance
608620 bar . compactAppearance = appearance
@@ -620,7 +632,10 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
620632 floatingTitle ? . removeFromSuperview ( )
621633 floatingTitle = nil
622634 let item = content . navigationItem
623- item . title = args [ " title " ] as? String
635+ let title = args [ " title " ] as? String
636+ // Keep the actual title for UIKit's layout and the compact label.
637+ // The external expanded label owns the visible ink while at rest.
638+ item . title = largeTitle && ( alignCollapsedTitleToLeading || leadingTitleRowTop != nil ) && titleIsCollapsed == true ? " " : title
624639 if let subtitle = args [ " subtitle " ] as? String {
625640 let button = NavigationTitleView ( title : item . title , subtitle : subtitle , color : color , maximumWidth : titleMaxWidth )
626641 button . accessibilityIdentifier = " channel-navigation-title "
@@ -660,7 +675,7 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
660675 }
661676 refreshBar . setRefreshing ( args [ " titleRefreshing " ] as? Bool == true )
662677 } else if largeTitle {
663- compactTitle . text = item . title
678+ compactTitle . text = title
664679 compactTitle . font = . preferredFont ( forTextStyle : . headline )
665680 compactTitle . adjustsFontForContentSizeCategory = true
666681 compactTitle . textColor = color
@@ -670,10 +685,22 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
670685 compactTitle . layer . mask = compactTitleMask
671686 if compactTitle . superview == nil { compactTitleContainer . addArrangedSubview ( compactTitle ) }
672687 compactTitleContainer . frame . size = compactTitle . intrinsicContentSize
673- if alignCollapsedTitleToLeading {
688+ if alignCollapsedTitleToLeading || leadingTitleRowTop != nil {
674689 // Duo's list title fades in place: the compact label uses the same
675690 // leading margin as UIKit's expanded title, rather than recentering.
676- item . titleView = UIView ( )
691+ if leadingTitleRowTop != nil {
692+ // Reserve the cover's native control row while its visible label
693+ // sits beside the Flutter actions. An empty view collapses the row.
694+ let spacer = UILabel ( )
695+ spacer . text = title
696+ spacer . font = compactTitle . font
697+ spacer . textColor = . clear
698+ spacer . isAccessibilityElement = false
699+ spacer . sizeToFit ( )
700+ item . titleView = spacer
701+ } else {
702+ item . titleView = UIView ( )
703+ }
677704 compactTitleContainer . translatesAutoresizingMaskIntoConstraints = true
678705 paneTitle = compactTitleContainer
679706 container . addSubview ( compactTitleContainer )
@@ -702,6 +729,14 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
702729 item . title = nil
703730 if let paneTitle { container . addSubview ( paneTitle ) }
704731 }
732+ if #available( iOS 26 . 0 , * ) , prefersSoftTopEdge ,
733+ let edgeTitle = floatingTitle ?? paneTitle ?? item . titleView ,
734+ ! edgeTitle . interactions . contains ( where : { $0 is UIScrollEdgeElementContainerInteraction } ) {
735+ let interaction = UIScrollEdgeElementContainerInteraction ( )
736+ interaction . scrollView = content . scrollView
737+ interaction . edge = . top
738+ edgeTitle . addInteraction ( interaction )
739+ }
705740 item . largeTitleDisplayMode = bar . prefersLargeTitles ? . always : . never
706741 trackedAvatar = nil
707742 reportedAvatarFrame = nil
@@ -828,11 +863,18 @@ private final class IosNavigationBarView: NSObject, FlutterPlatformView {
828863 titleIsCollapsed = collapsed
829864 UIView . performWithoutAnimation {
830865 if navigation . navigationBar . prefersLargeTitles {
866+ if alignCollapsedTitleToLeading || leadingTitleRowTop != nil {
867+ // UIKit can reveal its expanded label while a sheet changes the
868+ // presenting view's safe area. Keep its line height for measurement,
869+ // but give the compact label sole ownership of the collapsed text.
870+ let title = collapsed ? " " : compactTitle . text
871+ if content . navigationItem . title != title { content . navigationItem . title = title }
872+ }
831873 // Fade the actual text throughout the last part of the gesture. A
832874 // snapshot transition of the platform view gets clipped by Flutter's
833875 // shrinking header and can still look like a one-frame title switch.
834876 let progress = min ( 1 , max ( 0 , ( offset - collapseRange * 0.35 ) / ( collapseRange * 0.65 ) ) )
835- let opacity = 1 - progress
877+ let opacity : CGFloat = externalExpandedTitle ? 0 : 1 - progress
836878 if abs ( largeTitleOpacity - opacity ) > 0.001 {
837879 largeTitleOpacity = opacity
838880 for appearance in [ navigation . navigationBar . standardAppearance ,
0 commit comments