Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,18 @@ class _CustomPlatformViewState extends State<CustomPlatformView>
_reportWidgetPosition();
}

@override
void onWindowMinimize() {
_reportSurfaceSize();
_reportWidgetPosition();
}

@override
void onWindowRestore() {
_reportSurfaceSize();
_reportWidgetPosition();
}

@override
Widget build(BuildContext context) {
return Focus(
Expand Down
8 changes: 8 additions & 0 deletions flutter_inappwebview_windows/lib/src/platform_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ abstract mixin class PlatformUtilListener {
void onWindowMove() {}
void onWindowStartMove() {}
void onWindowEndMove() {}
void onWindowMinimize() {}
void onWindowRestore() {}
}

///Platform native utilities
Expand Down Expand Up @@ -51,6 +53,12 @@ class PlatformUtil {
case 'onWindowEndMove':
listener.onWindowEndMove();
break;
case 'onWindowMinimize':
listener.onWindowMinimize();
break;
case 'onWindowRestore':
listener.onWindowRestore();
break;
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions flutter_inappwebview_windows/windows/platform_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ namespace flutter_inappwebview_plugin
_EmitEvent("onWindowEndMove");
}
}
else if (message == WM_SIZE) {
if (wParam == SIZE_MINIMIZED) {
if (!window_is_minimized_) {
window_is_minimized_ = true;
_EmitEvent("onWindowMinimize");
}
_EmitEvent("onWindowMove");
}
else if (wParam == SIZE_RESTORED || wParam == SIZE_MAXIMIZED) {
if (window_is_minimized_) {
window_is_minimized_ = false;
_EmitEvent("onWindowRestore");
}
_EmitEvent("onWindowMove");
}
}

return result;
}
Expand Down
1 change: 1 addition & 0 deletions flutter_inappwebview_windows/windows/platform_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace flutter_inappwebview_plugin
void PlatformUtil::_EmitEvent(std::string eventName);
bool window_is_moving_ = false;
bool window_start_move_sent_ = false;
bool window_is_minimized_ = false;
};
}

Expand Down