Expose missing InAppBrowserSettings.menuButtonColor option in constructor platform interface, Fixed iOS InAppBrowserMenuItem.iconColor not working

This commit is contained in:
Lorenzo Pichilli 2023-11-30 15:05:51 +01:00
parent a86c5d1e43
commit d23f7fd41b
11 changed files with 24 additions and 43 deletions

View File

@ -12,7 +12,7 @@ version: 1.0.0+1
publish_to: none publish_to: none
environment: environment:
sdk: ">=2.15.0 <4.0.0" sdk: ">=2.17.0 <4.0.0"
flutter: ">=3.0.0" flutter: ">=3.0.0"
dependencies: dependencies:

View File

@ -1,3 +1,7 @@
## 1.0.3
- Fixed `InAppBrowserMenuItem.iconColor` not working
## 1.0.2 ## 1.0.2
- Added `PlatformPrintJobController.onComplete` setter - Added `PlatformPrintJobController.onComplete` setter

View File

@ -325,9 +325,9 @@ public class InAppBrowserWebViewController: UIViewController, InAppBrowserDelega
if !menuItem.showAsAction { if !menuItem.showAsAction {
uiActions.append(uiAction) uiActions.append(uiAction)
} else { } else {
navigationItem.rightBarButtonItems?.append( let buttonItem = UIBarButtonItem(primaryAction: uiAction)
UIBarButtonItem(primaryAction: uiAction) buttonItem.tintColor = menuItem.iconColor
) navigationItem.rightBarButtonItems?.append(buttonItem)
} }
} }
if !uiActions.isEmpty { if !uiActions.isEmpty {

View File

@ -23,7 +23,7 @@ public class InAppBrowserMenuItem: NSObject {
self.iconColor = iconColor self.iconColor = iconColor
self.showAsAction = showAsAction self.showAsAction = showAsAction
if #available(iOS 13.0, *), let icon = icon, let iconColor = iconColor { if #available(iOS 13.0, *), let icon = icon, let iconColor = iconColor {
icon.withTintColor(iconColor) icon.withTintColor(iconColor, renderingMode: .alwaysOriginal)
} }
} }

View File

@ -1,6 +1,6 @@
name: flutter_inappwebview_ios name: flutter_inappwebview_ios
description: iOS implementation of the flutter_inappwebview plugin. description: iOS implementation of the flutter_inappwebview plugin.
version: 1.0.2 version: 1.0.3
homepage: https://inappwebview.dev/ homepage: https://inappwebview.dev/
repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_ios repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_ios
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues

View File

@ -1,3 +1,7 @@
## 1.0.4
- Expose missing `InAppBrowserSettings.menuButtonColor` option
## 1.0.3 ## 1.0.3
- Expose missing old `AndroidInAppWebViewOptions` and `IOSInAppWebViewOptions` classes - Expose missing old `AndroidInAppWebViewOptions` and `IOSInAppWebViewOptions` classes

View File

@ -304,6 +304,7 @@ class InAppBrowserSettings_
this.closeButtonCaption, this.closeButtonCaption,
this.closeButtonColor, this.closeButtonColor,
this.hideCloseButton = false, this.hideCloseButton = false,
this.menuButtonColor,
this.presentationStyle = ModalPresentationStyle_.FULL_SCREEN, this.presentationStyle = ModalPresentationStyle_.FULL_SCREEN,
this.transitionStyle = ModalTransitionStyle_.COVER_VERTICAL, this.transitionStyle = ModalTransitionStyle_.COVER_VERTICAL,
this.hideTitleBar = false, this.hideTitleBar = false,

View File

@ -213,6 +213,7 @@ class InAppBrowserSettings
this.hideToolbarBottom = false, this.hideToolbarBottom = false,
this.hideToolbarTop = false, this.hideToolbarTop = false,
this.hideUrlBar = false, this.hideUrlBar = false,
this.menuButtonColor,
this.presentationStyle = ModalPresentationStyle.FULL_SCREEN, this.presentationStyle = ModalPresentationStyle.FULL_SCREEN,
this.shouldCloseOnBackButtonPressed = false, this.shouldCloseOnBackButtonPressed = false,
this.toolbarBottomBackgroundColor, this.toolbarBottomBackgroundColor,
@ -239,6 +240,9 @@ class InAppBrowserSettings
closeButtonColor: map['closeButtonColor'] != null closeButtonColor: map['closeButtonColor'] != null
? UtilColor.fromStringRepresentation(map['closeButtonColor']) ? UtilColor.fromStringRepresentation(map['closeButtonColor'])
: null, : null,
menuButtonColor: map['menuButtonColor'] != null
? UtilColor.fromStringRepresentation(map['menuButtonColor'])
: null,
toolbarBottomBackgroundColor: map['toolbarBottomBackgroundColor'] != null toolbarBottomBackgroundColor: map['toolbarBottomBackgroundColor'] != null
? UtilColor.fromStringRepresentation( ? UtilColor.fromStringRepresentation(
map['toolbarBottomBackgroundColor']) map['toolbarBottomBackgroundColor'])
@ -271,9 +275,6 @@ class InAppBrowserSettings
instance.hideToolbarBottom = map['hideToolbarBottom']; instance.hideToolbarBottom = map['hideToolbarBottom'];
instance.hideToolbarTop = map['hideToolbarTop']; instance.hideToolbarTop = map['hideToolbarTop'];
instance.hideUrlBar = map['hideUrlBar']; instance.hideUrlBar = map['hideUrlBar'];
instance.menuButtonColor = map['menuButtonColor'] != null
? UtilColor.fromStringRepresentation(map['menuButtonColor'])
: null;
instance.presentationStyle = instance.presentationStyle =
ModalPresentationStyle.fromNativeValue(map['presentationStyle']); ModalPresentationStyle.fromNativeValue(map['presentationStyle']);
instance.shouldCloseOnBackButtonPressed = instance.shouldCloseOnBackButtonPressed =

View File

@ -6,10 +6,7 @@ part of 'platform_webview_feature.dart';
// ExchangeableEnumGenerator // ExchangeableEnumGenerator
// ************************************************************************** // **************************************************************************
///Class that represents an Android-specific utility class for checking which WebView Support Library features are supported on the device. ///{@macro flutter_inappwebview_platform_interface.PlatformWebViewFeature}
///
///**Officially Supported Platforms/Implementations**:
///- Android native WebView
class WebViewFeature { class WebViewFeature {
final String _value; final String _value;
final String _nativeValue; final String _nativeValue;
@ -320,37 +317,11 @@ class WebViewFeature {
return null; return null;
} }
///Return whether a feature is supported at run-time. On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher, ///{@macro flutter_inappwebview_platform_interface.PlatformWebViewFeature.isFeatureSupported}
///this will check whether a feature is supported, depending on the combination of the desired feature, the Android version of device,
///and the WebView APK on the device. If running on a device with a lower API level, this will always return `false`.
///
///**Note**: This method is different from [isStartupFeatureSupported] and this
///method only accepts certain features.
///Please verify that the correct feature checking method is used for a particular feature.
///
///**Note**: If this method returns `false`, it is not safe to invoke the methods
///requiring the desired feature.
///Furthermore, if this method returns `false` for a particular feature, any callback guarded by that feature will not be invoked.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)
static Future<bool> isFeatureSupported(WebViewFeature feature) => static Future<bool> isFeatureSupported(WebViewFeature feature) =>
PlatformWebViewFeature.static().isFeatureSupported(feature); PlatformWebViewFeature.static().isFeatureSupported(feature);
///Return whether a startup feature is supported at run-time. ///{@macro flutter_inappwebview_platform_interface.PlatformWebViewFeature.isStartupFeatureSupported}
///On devices running Android version `Build.VERSION_CODES.LOLLIPOP` and higher,
///this will check whether a startup feature is supported,
///depending on the combination of the desired feature,
///the Android version of device, and the WebView APK on the device.
///If running on a device with a lower API level, this will always return `false`.
///
///**Note**: This method is different from [isFeatureSupported] and this method only accepts startup features.
///Please verify that the correct feature checking method is used for a particular feature.
///
///**Note**: If this method returns `false`, it is not safe to invoke the methods requiring the desired feature.
///Furthermore, if this method returns `false` for a particular feature,
///any callback guarded by that feature will not be invoked.
///
///**Official Android API**: https://developer.android.com/reference/androidx/webkit/WebViewFeature#isFeatureSupported(java.lang.String)
static Future<bool> isStartupFeatureSupported( static Future<bool> isStartupFeatureSupported(
WebViewFeature startupFeature) => WebViewFeature startupFeature) =>
PlatformWebViewFeature.static().isStartupFeatureSupported(startupFeature); PlatformWebViewFeature.static().isStartupFeatureSupported(startupFeature);

View File

@ -6,7 +6,7 @@ part of 'custom_tabs_navigation_event_type.dart';
// ExchangeableEnumGenerator // ExchangeableEnumGenerator
// ************************************************************************** // **************************************************************************
///The type corresponding to the navigation event of [PlatformChromeSafariBrowser.onNavigationEvent]. ///The type corresponding to the navigation event of [PlatformChromeSafariBrowserEvents.onNavigationEvent].
class CustomTabsNavigationEventType { class CustomTabsNavigationEventType {
final int _value; final int _value;
final int? _nativeValue; final int? _nativeValue;

View File

@ -1,6 +1,6 @@
name: flutter_inappwebview_platform_interface name: flutter_inappwebview_platform_interface
description: A common platform interface for the flutter_inappwebview plugin. description: A common platform interface for the flutter_inappwebview plugin.
version: 1.0.3 version: 1.0.4
homepage: https://inappwebview.dev/ homepage: https://inappwebview.dev/
repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_platform_interface repository: https://github.com/pichillilorenzo/flutter_inappwebview/tree/master/flutter_inappwebview_platform_interface
issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues issue_tracker: https://github.com/pichillilorenzo/flutter_inappwebview/issues