added Bitwise OR operator support for AndroidActionModeMenuItem class

This commit is contained in:
Lorenzo Pichilli 2022-04-26 21:24:21 +02:00
parent 442b51db0f
commit 9aa812e130
4 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1,7 @@
## 5.4.3
- Added Bitwise OR operator support for `AndroidActionModeMenuItem` class
## 5.4.2+1 ## 5.4.2+1
- Fixed "Latest version 5.4.2 crashes on Android - HeadlessInAppWebView.dispose" [#1155](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1155) - Fixed "Latest version 5.4.2 crashes on Android - HeadlessInAppWebView.dispose" [#1155](https://github.com/pichillilorenzo/flutter_inappwebview/issues/1155)

View File

@ -8,7 +8,6 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import '../context_menu.dart'; import '../context_menu.dart';
import '../types.dart'; import '../types.dart';
@ -17,6 +16,7 @@ import 'webview.dart';
import 'in_app_webview_controller.dart'; import 'in_app_webview_controller.dart';
import 'in_app_webview_options.dart'; import 'in_app_webview_options.dart';
import '../pull_to_refresh/pull_to_refresh_controller.dart'; import '../pull_to_refresh/pull_to_refresh_controller.dart';
import '../pull_to_refresh/pull_to_refresh_options.dart';
///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree. ///Flutter Widget for adding an **inline native WebView** integrated in the flutter widget tree.
class InAppWebView extends StatefulWidget implements WebView { class InAppWebView extends StatefulWidget implements WebView {

View File

@ -1966,7 +1966,8 @@ class AndroidActionModeMenuItem {
return AndroidActionModeMenuItem.values return AndroidActionModeMenuItem.values
.firstWhere((element) => element.toValue() == value); .firstWhere((element) => element.toValue() == value);
} catch (e) { } catch (e) {
return null; // maybe coming from a Bitwise OR operator
return AndroidActionModeMenuItem._internal(value);
} }
} }
return null; return null;
@ -1984,9 +1985,9 @@ class AndroidActionModeMenuItem {
case 4: case 4:
return "MENU_ITEM_PROCESS_TEXT"; return "MENU_ITEM_PROCESS_TEXT";
case 0: case 0:
default:
return "MENU_ITEM_NONE"; return "MENU_ITEM_NONE";
} }
return _value.toString();
} }
///No menu items should be disabled. ///No menu items should be disabled.
@ -2005,6 +2006,9 @@ class AndroidActionModeMenuItem {
bool operator ==(value) => value == _value; bool operator ==(value) => value == _value;
AndroidActionModeMenuItem operator |(AndroidActionModeMenuItem value) =>
AndroidActionModeMenuItem._internal(value.toValue() | _value);
@override @override
int get hashCode => _value.hashCode; int get hashCode => _value.hashCode;
} }

View File

@ -1,6 +1,6 @@
name: flutter_inappwebview name: flutter_inappwebview
description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window. description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window.
version: 5.4.2+1 version: 5.4.3
homepage: https://github.com/pichillilorenzo/flutter_inappwebview homepage: https://github.com/pichillilorenzo/flutter_inappwebview
environment: environment: