Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pr changes
  • Loading branch information
LouiseHsu committed Dec 1, 2023
commit e72057e3720d3d827dc49cddec2ebc8c71a2977f
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.10.0
## NEXT

* Adds iOS implementation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: pointer_interceptor
description: A widget to prevent clicks from being swallowed by underlying HtmlElementViews on the web.
repository: https://github.com/flutter/packages/tree/main/packages/pointer_interceptor/pointer_interceptor
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+pointer_interceptor%22
version: 0.9.4
version: 0.9.3+7
# while transitioning to federated structure, removed ability to published temporarily.
publish_to: none

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
test('Tell the user where to find the real tests', () {
print('---');
// TODO(louisehsu): add non web integration tests.
print('Please find platform tests in their respective packages.');
print('---');
});
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import 'package:integration_test/integration_test.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

// Integration tests for iOS requires a native platform view and thus
// can not be tested in Dart. These tests can instead
// be found in the XCUITests
testWidgets('placeholder test', (WidgetTester tester) async {});
// Full tests are done via XCUITest and can be found in RunnerUITests.
// This test just validates that the example builds and launches successfully.
testWidgets('launch test', (WidgetTester tester) async {});
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ import XCTest

class RunnerTests: XCTestCase {
func testNonDebugMode() {
let view = PointerInterceptorView(frame: CGRect(x: 0, y: 0, width: 180, height: 48.0), debug: false);
let view = PointerInterceptorView(
frame: CGRect(x: 0, y: 0, width: 180, height: 48.0), debug: false)

let debugView = view.view();
let debugView = view.view()
XCTAssertTrue(debugView.backgroundColor == UIColor.clear)
}

func testDebugMode() {
let view = PointerInterceptorView(frame: CGRect(x: 0, y: 0, width: 180, height: 48.0), debug: true);
let view = PointerInterceptorView(
frame: CGRect(x: 0, y: 0, width: 180, height: 48.0), debug: true)

let debugView = view.view();
let debugView = view.view()
XCTAssertTrue(debugView.backgroundColor == UIColor(red: 1, green: 0, blue: 0, alpha: 0.5))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,38 @@ import XCTest
final class RunnerUITests: XCTestCase {

override func setUp() {
continueAfterFailure = false
}
continueAfterFailure = false
}

func testPointerInterceptorBlocksGesturesFromFlutter() {
let app = XCUIApplication()
app.launch()

let fabInitial = app.buttons["Initial"]
if !(fabInitial.waitForExistence(timeout: 30)) {
print(app.debugDescription)
XCTFail("Could not find Flutter button to click on")
return
}

fabInitial.tap()

func testPointerInterceptorBlocksGesturesFromFlutter() {
let app = XCUIApplication()
app.launch()

let fabInitial = app.buttons["Initial"]
if (!(fabInitial.waitForExistence(timeout: 30))){
print(app.debugDescription);
XCTFail("Could not find Flutter button to click on")
return
}

fabInitial.tap();

let fabAfter = app.buttons["Tapped"]
if (!(fabAfter.waitForExistence(timeout: 30))){
print(app.debugDescription);
XCTFail("Flutter button did not change on tap")
return
}

let exp = expectation(description: "Check platform view not clicked after 3 seconds")
let result = XCTWaiter.wait(for: [exp], timeout: 3.0)
if result == XCTWaiter.Result.timedOut {
let dummyButton = app.staticTexts["Not Clicked"]
if (!(dummyButton.waitForExistence(timeout: 30))){
print(app.debugDescription);
XCTFail("Pointer interceptor did not block gesture from hitting platform view")
return
}
}
let fabAfter = app.buttons["Tapped"]
if !(fabAfter.waitForExistence(timeout: 30)) {
print(app.debugDescription)
XCTFail("Flutter button did not change on tap")
return
}

let exp = expectation(description: "Check platform view not clicked after 3 seconds")
let result = XCTWaiter.wait(for: [exp], timeout: 3.0)
if result == XCTWaiter.Result.timedOut {
let dummyButton = app.staticTexts["Not Clicked"]
if !(dummyButton.waitForExistence(timeout: 30)) {
print(app.debugDescription)
XCTFail("Pointer interceptor did not block gesture from hitting platform view")
return
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:pointer_interceptor_platform_interface/pointer_interceptor_platform_interface.dart';

void main() {
runApp(const MaterialApp(home: PointerInterceptorIOSExample()));
Expand Down Expand Up @@ -50,7 +50,7 @@ class _PointerInterceptorIOSExampleState
alignment: AlignmentDirectional.center,
children: <Widget>[
const _DummyPlatformView(),
PointerInterceptor(
PointerInterceptorPlatform.instance.buildWidget(
child: TextButton(
style: TextButton.styleFrom(foregroundColor: Colors.red),
child: _buttonTapped
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
name: pointer_interceptor_ios_example
description: "Demonstrates how to use the pointer_interceptor_ios plugin."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: 'none'

environment:
sdk: '>=3.1.0-134.0.dev <4.0.0'
sdk: '>=3.1.0 <4.0.0'
flutter: '>=3.13.0'

dependencies:
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
pointer_interceptor:
path: ../../pointer_interceptor
pointer_interceptor_platform_interface: ^0.10.0

dev_dependencies:
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
integration_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import Flutter

class PointerInterceptorFactory: NSObject, FlutterPlatformViewFactory {
func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView {
func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?)
-> FlutterPlatformView
{
let debug = (args as? [String: Any])?["debug"] as? Bool ?? false
return PointerInterceptorView(frame: frame, debug: debug)
}

public func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol {
return FlutterStandardMessageCodec.sharedInstance()
return FlutterStandardMessageCodec.sharedInstance()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import UIKit

public class PointerInterceptorIosPlugin: NSObject, FlutterPlugin {
public static func register(with registrar: FlutterPluginRegistrar) {
registrar.register(PointerInterceptorFactory(), withId: "plugins.flutter.dev/pointer_interceptor_ios")
registrar.register(
PointerInterceptorFactory(), withId: "plugins.flutter.dev/pointer_interceptor_ios")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ public class PointerInterceptorView: NSObject, FlutterPlatformView {

let interceptorView: UIView

init(frame:CGRect, debug:Bool) {
interceptorView = UIView(frame:frame)
interceptorView.backgroundColor = debug ? UIColor(red: 1, green: 0, blue: 0, alpha: 0.5) : UIColor.clear
init(frame: CGRect, debug: Bool) {
interceptorView = UIView(frame: frame)
interceptorView.backgroundColor =
debug ? UIColor(red: 1, green: 0, blue: 0, alpha: 0.5) : UIColor.clear
}

public func view() -> UIView {
return interceptorView;
return interceptorView
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: pointer_interceptor_ios
description: iOS implementation of the pointer_interceptor plugin.
repository: https://github.com/flutter/packages/tree/main/packages/pointer_interceptor/pointer_interceptor_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apointer_interceptor_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apointer_interceptor
version: 0.10.0

environment:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.10.0

* Moved web implementation to own package.
* Moves web implementation to its own package.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'dart:html' as html;
import 'dart:ui_web' as ui_web;

import 'package:flutter/material.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:pointer_interceptor_platform_interface/pointer_interceptor_platform_interface.dart';

const String _htmlElementViewType = '_htmlElementViewType';
const double _videoWidth = 640;
Expand Down Expand Up @@ -86,7 +86,7 @@ class _MyHomePageState extends State<MyHomePage> {
appBar: AppBar(
title: const Text('PointerInterceptor demo'),
actions: <Widget>[
PointerInterceptor(
PointerInterceptorPlatform.instance.buildWidget(
// debug: true,
child: IconButton(
icon: const Icon(Icons.add_alert),
Expand Down Expand Up @@ -129,8 +129,7 @@ class _MyHomePageState extends State<MyHomePage> {
_clickedOn('transparent-button');
},
),
PointerInterceptor(
intercepting: false,
PointerInterceptorPlatform.instance.buildWidget(
child: ElevatedButton(
key: const Key('wrapped-transparent-button'),
child:
Expand All @@ -140,7 +139,7 @@ class _MyHomePageState extends State<MyHomePage> {
},
),
),
PointerInterceptor(
PointerInterceptorPlatform.instance.buildWidget(
child: ElevatedButton(
key: const Key('clickable-button'),
child: const Text('Works As Expected'),
Expand All @@ -160,7 +159,7 @@ class _MyHomePageState extends State<MyHomePage> {
floatingActionButton: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
PointerInterceptor(
PointerInterceptorPlatform.instance.buildWidget(
// debug: true,
child: FloatingActionButton(
child: const Icon(Icons.navigation),
Expand All @@ -172,7 +171,7 @@ class _MyHomePageState extends State<MyHomePage> {
],
),
drawer: Drawer(
child: PointerInterceptor(
child: PointerInterceptorPlatform.instance.buildWidget(
// debug: true, // Enable this to "see" the interceptor covering the column.
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
name: pointer_interceptor_web_example
description: "Demonstrates how to use the pointer_interceptor_web plugin."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: 'none'

environment:
sdk: '>=3.1.0-134.0.dev <4.0.0'
sdk: ">=3.1.0 <4.0.0"
flutter: ">=3.13.0"

dependencies:
cupertino_icons: ^1.0.2
flutter:
sdk: flutter
pointer_interceptor:
path: ../../pointer_interceptor
pointer_interceptor_platform_interface: ^0.10.0

dev_dependencies:
flutter_lints: ^2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: pointer_interceptor_web
description: Web implementation of the pointer_interceptor plugin.
repository: https://github.com/flutter/packages/tree/main/packages/pointer_interceptor/pointer_interceptor_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apointer_interceptor_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3Apointer_interceptor
version: 0.10.0

environment:
Expand Down