Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[webview_flutter] Update code by flutter version-up #49

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
Binary file not shown.
49 changes: 23 additions & 26 deletions packages/webview_flutter/lib/webview_flutter_tizen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ class TizenViewController extends PlatformViewController {

set pointTransformer(PointTransformer transformer) {
assert(transformer != null);
// _motionEventConverter._pointTransformer = transformer;
}

bool get isCreated => _state == _TizenViewState.created;
Expand All @@ -167,12 +166,16 @@ class TizenViewController extends PlatformViewController {
assert(_state != _TizenViewState.disposed,
'trying to set a layout direction for a disposed UIView. View id: $viewId');

if (layoutDirection == _layoutDirection) return;
if (layoutDirection == _layoutDirection) {
return;
}

assert(layoutDirection != null);
_layoutDirection = layoutDirection;

if (_state == _TizenViewState.waitingForSize) return;
if (_state == _TizenViewState.waitingForSize) {
return;
}

await SystemChannels.platform_views
.invokeMethod<void>('setDirection', <String, dynamic>{
Expand All @@ -183,6 +186,10 @@ class TizenViewController extends PlatformViewController {

@override
Future<void> dispatchPointerEvent(PointerEvent event) async {
if (event is PointerHoverEvent) {
return;
}

int eventType = 0;
if (event is PointerDownEvent) {
eventType = 0;
Expand All @@ -191,8 +198,7 @@ class TizenViewController extends PlatformViewController {
} else if (event is PointerUpEvent) {
eventType = 2;
} else {
// TODO: Not implemented.
return;
throw UnimplementedError('Not Implemented');
}
await SystemChannels.platform_views
.invokeMethod<dynamic>('touch', <String, dynamic>{
Expand Down Expand Up @@ -456,7 +462,9 @@ class RenderTizenView extends RenderBox with _PlatformViewGestureMixin {
set viewController(TizenViewController viewController) {
assert(_viewController != null);
assert(viewController != null);
if (_viewController == viewController) return;
if (_viewController == viewController) {
return;
}
_viewController.removeOnPlatformViewCreatedListener(_onPlatformViewCreated);
_viewController = viewController;
_sizePlatformView();
Expand Down Expand Up @@ -513,8 +521,9 @@ class RenderTizenView extends RenderBox with _PlatformViewGestureMixin {

@override
void paint(PaintingContext context, Offset offset) {
if (_viewController.textureId == null) return;

if (_viewController.textureId == null) {
return;
}
if (size.width < _currentTizenViewSize.width ||
size.height < _currentTizenViewSize.height) {
context.pushClipRect(true, offset, offset & size, _paintTexture);
Expand Down Expand Up @@ -705,18 +714,6 @@ class _TizenWebViewState extends State<TizenView> {
}
}

// class TizenMethodChannelWebViewPlatform extends MethodChannelWebViewPlatform {
// TizenMethodChannelWebViewPlatform(
// int id, WebViewPlatformCallbacksHandler handler)
// : super(id, handler) {
// print("[MONG] TizenMethodChannelWebViewPlatform : " + id.toString());
// }
// static Map<String, dynamic> creationParamsToMap(
// CreationParams creationParams) {
// return MethodChannelWebViewPlatform.creationParamsToMap(creationParams);
// }
// }

class TizenWebView implements WebViewPlatform {
@override
Widget build({
Expand Down Expand Up @@ -825,23 +822,23 @@ mixin _PlatformViewGestureMixin on RenderBox implements MouseTrackerAnnotation {
@override
PointerEnterEventListener get onEnter => null;

@override
PointerHoverEventListener get onHover => _handleHover;
void _handleHover(PointerHoverEvent event) {
if (_handlePointerEvent != null) _handlePointerEvent(event);
}

@override
PointerExitEventListener get onExit => null;

@override
MouseCursor get cursor => MouseCursor.uncontrolled;

@override
bool get validForMouseTracker => true;

@override
void handleEvent(PointerEvent event, HitTestEntry entry) {
if (event is PointerDownEvent) {
_gestureRecognizer.addPointer(event);
}
if (event is PointerHoverEvent) {
_handlePointerEvent?.call(event);
}
}

@override
Expand Down
4 changes: 3 additions & 1 deletion packages/webview_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: webview_flutter_tizen
description: Tizen implementation of the webview plugin
version: 0.0.1
homepage: https://github.com/flutter-tizen/plugins
version: 1.0.0

environment:
sdk: ">=2.2.2 <3.0.0"
Expand All @@ -9,6 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
webview_flutter: ^1.0.5

dev_dependencies:
flutter_test:
Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/webview_flutter/tizen/project_def.prop
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ USER_CPP_UNDEFS =
# Compiler/linker flags
USER_CFLAGS_MISC =
USER_CPPFLAGS_MISC = -c -fmessage-length=0
USER_LFLAGS = -llightweight-web-engine.mobile -Wl,-rpath=/opt/usr/globalapps/org.tizen.webview_flutter_tizen_example/lib/arm
USER_LFLAGS = -llightweight-web-engine.mobile -Wl,-rpath=/opt/usr/home/owner/apps_rw/org.tizen.webview_flutter_tizen_example/lib/arm

# Libraries and objects
USER_LIB_DIRS = lib
Expand Down
Loading