From 44068ff36916b0dfa48982a91839db1bbe5b71fc Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Thu, 27 Nov 2025 00:14:38 +0900 Subject: [PATCH 1/4] Handle iOS 26 deprecations for `SFSafariViewController` tint colors and dismiss button style - Updated SFSafariViewController factory to avoid setting `preferredBarTintColor` and `preferredControlTintColor` on iOS 26 and later, as these properties are deprecated. - Adjusted tests to account for iOS 26 changes: checks for `dismissButtonStyle` and tint colors now use version checks. --- .../ios/RunnerTests/MockLauncher.swift | 1 + .../SFSafariViewController+FactoryTest.swift | 30 +++++++++++++------ .../SFSafariViewController+Factory.swift | 15 ++++++---- 3 files changed, 32 insertions(+), 14 deletions(-) diff --git a/flutter_custom_tabs_ios/example/ios/RunnerTests/MockLauncher.swift b/flutter_custom_tabs_ios/example/ios/RunnerTests/MockLauncher.swift index f2a823c..1b9ff5b 100644 --- a/flutter_custom_tabs_ios/example/ios/RunnerTests/MockLauncher.swift +++ b/flutter_custom_tabs_ios/example/ios/RunnerTests/MockLauncher.swift @@ -1,5 +1,6 @@ // swiftlint:disable legacy_objc_type import Foundation +import UIKit @testable import flutter_custom_tabs_ios class MockLauncher: Launcher { diff --git a/flutter_custom_tabs_ios/example/ios/RunnerTests/SFSafariViewController+FactoryTest.swift b/flutter_custom_tabs_ios/example/ios/RunnerTests/SFSafariViewController+FactoryTest.swift index 9291d07..bb939a2 100644 --- a/flutter_custom_tabs_ios/example/ios/RunnerTests/SFSafariViewController+FactoryTest.swift +++ b/flutter_custom_tabs_ios/example/ios/RunnerTests/SFSafariViewController+FactoryTest.swift @@ -16,7 +16,11 @@ final class SFSafariViewControllerFactoryTest: XCTestCase { // Validation of default values for non-null values. XCTAssertTrue(actual.configuration.barCollapsingEnabled) XCTAssertFalse(actual.configuration.entersReaderIfAvailable) - XCTAssertEqual(actual.dismissButtonStyle, .done) + if #available(iOS 26, *) { + XCTAssertEqual(actual.dismissButtonStyle, .close) + } else { + XCTAssertEqual(actual.dismissButtonStyle, .done) + } XCTAssertEqual(actual.modalPresentationStyle, .fullScreen) XCTAssertNil(actual.preferredBarTintColor) @@ -48,18 +52,26 @@ final class SFSafariViewControllerFactoryTest: XCTestCase { actual.configuration.barCollapsingEnabled, srcOptions.barCollapsingEnabled ) + XCTAssertEqual( actual.configuration.entersReaderIfAvailable, srcOptions.entersReaderIfAvailable ) - XCTAssertEqual( - actual.preferredBarTintColor, - UIColor(red: 0, green: 0, blue: 0, alpha: 1) - ) - XCTAssertEqual( - actual.preferredControlTintColor, - UIColor(red: 0, green: 0, blue: 1 / 255, alpha: 1) - ) + + if #available(iOS 26, *) { + XCTAssertNil(actual.preferredBarTintColor) + XCTAssertNil(actual.preferredControlTintColor) + } else { + XCTAssertEqual( + actual.preferredBarTintColor, + UIColor(red: 0, green: 0, blue: 0, alpha: 1) + ) + XCTAssertEqual( + actual.preferredControlTintColor, + UIColor(red: 0, green: 0, blue: 1 / 255, alpha: 1) + ) + } + XCTAssertEqual( actual.dismissButtonStyle, DismissButtonStyle(rawValue: Int(srcOptions.dismissButtonStyle!)) diff --git a/flutter_custom_tabs_ios/ios/flutter_custom_tabs_ios/Sources/flutter_custom_tabs_ios/SFSafariViewController+Factory.swift b/flutter_custom_tabs_ios/ios/flutter_custom_tabs_ios/Sources/flutter_custom_tabs_ios/SFSafariViewController+Factory.swift index 25c0f20..7f58582 100644 --- a/flutter_custom_tabs_ios/ios/flutter_custom_tabs_ios/Sources/flutter_custom_tabs_ios/SFSafariViewController+Factory.swift +++ b/flutter_custom_tabs_ios/ios/flutter_custom_tabs_ios/Sources/flutter_custom_tabs_ios/SFSafariViewController+Factory.swift @@ -20,11 +20,16 @@ extension SFSafariViewController { configuration: configuration ) - if let barTintColorHex = options.preferredBarTintColor { - viewController.preferredBarTintColor = UIColor(barTintColorHex) - } - if let controlTintColorHex = options.preferredControlTintColor { - viewController.preferredControlTintColor = UIColor(controlTintColorHex) + if #available(iOS 26, *) { + // On iOS 26 and later, `preferredBarTintColor` and + // `preferredControlTintColor` are deprecated — do not set them. + } else { + if let barTintColorHex = options.preferredBarTintColor { + viewController.preferredBarTintColor = UIColor(barTintColorHex) + } + if let controlTintColorHex = options.preferredControlTintColor { + viewController.preferredControlTintColor = UIColor(controlTintColorHex) + } } if let dismissButtonStyleRawValue = options.dismissButtonStyle, From ef919717f94e17e3d7713333b8d82a3f8cdbf649 Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Thu, 27 Nov 2025 00:16:34 +0900 Subject: [PATCH 2/4] Document that `preferredBarTintColor` and `preferredControlTintColor` are ignored on iOS 26 and later - Clarified in `SafariViewControllerOptions` that these properties have no effect on iOS 26+ due to the introduction of Liquid Glass. - Added notes to `LaunchOptions` indicating that `barColor` and `onBarColor` have no effect on iOS 26+ because of the Liquid Glass UI change. - Added links to the relevant Apple documentation for both properties. --- flutter_custom_tabs/lib/src/lite/launch_options.dart | 4 ++++ .../lib/src/types/safari_view_controller_options.dart | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/flutter_custom_tabs/lib/src/lite/launch_options.dart b/flutter_custom_tabs/lib/src/lite/launch_options.dart index e7f93e9..9374aa0 100644 --- a/flutter_custom_tabs/lib/src/lite/launch_options.dart +++ b/flutter_custom_tabs/lib/src/lite/launch_options.dart @@ -12,11 +12,15 @@ class LaunchOptions { }); /// The background color of the app bar and bottom bar. + /// + /// **Note:** On iOS 26 and later, due to the introduction of Liquid Glass, this property is ignored even if specified. final Color? barColor; /// The color to tint the control buttons on the app bar and bottom bar. /// /// - Availability: **Only for iOS** + /// + /// **Note:** On iOS 26 and later, due to the introduction of Liquid Glass, this property is ignored even if specified. final Color? onBarColor; /// The color configuration of the system navigation bar. diff --git a/flutter_custom_tabs_ios/lib/src/types/safari_view_controller_options.dart b/flutter_custom_tabs_ios/lib/src/types/safari_view_controller_options.dart index 92afc83..a25b23d 100644 --- a/flutter_custom_tabs_ios/lib/src/types/safari_view_controller_options.dart +++ b/flutter_custom_tabs_ios/lib/src/types/safari_view_controller_options.dart @@ -40,10 +40,21 @@ class SafariViewControllerOptions implements PlatformOptions { pageSheet: configuration, ); + /// The color to tint the background of the navigation bar and the toolbar. + /// + /// **Note:** On iOS 26 and later, due to the introduction of Liquid Glass, this property is ignored even if specified. + /// + /// See also: + /// - [SFSafariViewController.preferredBarTintColor](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/preferredbartintcolor) final Color? preferredBarTintColor; /// The color to tint the control buttons on the navigation bar and the toolbar. + /// + /// **Note:** On iOS 26 and later, due to the introduction of Liquid Glass, this property is ignored even if specified. + /// + /// See also: + /// - [SFSafariViewController.preferredControlTintColor](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/preferredcontroltintcolor) final Color? preferredControlTintColor; /// A Boolean value that enables the url bar to hide as the user scrolls down the page. From 04c77f757acd5e8842f1d1de66e94679b2bca3b1 Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Thu, 27 Nov 2025 00:18:49 +0900 Subject: [PATCH 3/4] Update README to document iOS 26+ Liquid Glass changes and option limitations - Clarified in the feature matrix that background and control color options are ignored on iOS 26 and later. - Added a new section explaining the impact of Liquid Glass on `SafariViewControllerOptions` and the deprecation of tint color properties. - Provided a link to Apple's official documentation for further reference. --- flutter_custom_tabs/README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/flutter_custom_tabs/README.md b/flutter_custom_tabs/README.md index 5dd51f3..1cae946 100644 --- a/flutter_custom_tabs/README.md +++ b/flutter_custom_tabs/README.md @@ -146,8 +146,8 @@ void _launchUrl(BuildContext context) async { | Option | Android (`CustomTabsOptions`) | iOS (`SafariViewControllerOptions`) | `LaunchOptions` | | --- | :---: | :---: | :---: | -| Change background color of app/bottom bar | ✅ | ✅ | ✅ | -| Change color of controls on app/bottom bar | -
(Automatically adjusted by Custom Tabs) | ✅ | ✅ | +| Change background color of app/bottom bar | ✅ | ✅
(Ignored on iOS 26+) | ✅
(Ignored on iOS 26+) | +| Change color of controls on app/bottom bar | -
(Automatically adjusted by Custom Tabs) | ✅
(Ignored on iOS 26+) | ✅
(Ignored on iOS 26+) | | Change background color of system navigation bar | ✅ | - | ✅ | | Change color of system navigation divider | ✅ | - | ✅ | | Hide(Collapse) the app bar by scrolling | ✅ | ✅ | ✅ | @@ -169,6 +169,17 @@ Support status in `flutter_custom_tabs`: - ✅: Supported. - `-`: Option not provided by Custom Tabs implementation. +### Liquid Glass and iOS 26+ Appearance Changes + +Starting with iOS 26, Apple introduced the "Liquid Glass" background effects that are applied to system bars and controls. According to Apple's documentation, "Tinting the bars interferes with background effects that the system provides." + +As a result, the following properties in `SafariViewControllerOptions` are **ignored** on iOS 26 and later: + +- `preferredBarTintColor` +- `preferredControlTintColor` + +For more details, see [here](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller). + ## Advanced Usage ### Deep Linking From 6389e7b8273436229de443ca695c60d5bee185cd Mon Sep 17 00:00:00 2001 From: Shinya Kumagai Date: Thu, 27 Nov 2025 00:26:27 +0900 Subject: [PATCH 4/4] Apply dart formatter --- .../lib/src/types/safari_view_controller_options.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/flutter_custom_tabs_ios/lib/src/types/safari_view_controller_options.dart b/flutter_custom_tabs_ios/lib/src/types/safari_view_controller_options.dart index a25b23d..92fdcdf 100644 --- a/flutter_custom_tabs_ios/lib/src/types/safari_view_controller_options.dart +++ b/flutter_custom_tabs_ios/lib/src/types/safari_view_controller_options.dart @@ -40,7 +40,6 @@ class SafariViewControllerOptions implements PlatformOptions { pageSheet: configuration, ); - /// The color to tint the background of the navigation bar and the toolbar. /// /// **Note:** On iOS 26 and later, due to the introduction of Liquid Glass, this property is ignored even if specified.