Flutter iOS Embedder
flutter::OverlayLayer Struct Reference

State holder for a Flutter overlay layer. More...

#include <overlay_layer_pool.h>

Public Member Functions

 OverlayLayer (const fml::scoped_nsobject< UIView > &overlay_view, const fml::scoped_nsobject< UIView > &overlay_view_wrapper, std::unique_ptr< IOSSurface > ios_surface, std::unique_ptr< Surface > surface)
 
 ~OverlayLayer ()=default
 
void UpdateViewState (UIView *flutter_view, SkRect rect, int64_t view_id, int64_t overlay_id)
 

Public Attributes

fml::scoped_nsobject< UIView > overlay_view
 
fml::scoped_nsobject< UIView > overlay_view_wrapper
 
std::unique_ptr< IOSSurfaceios_surface
 
std::unique_ptr< Surface > surface
 
bool did_submit_last_frame
 
GrDirectContext * gr_context
 

Detailed Description

State holder for a Flutter overlay layer.

Definition at line 23 of file overlay_layer_pool.h.

Constructor & Destructor Documentation

◆ OverlayLayer()

flutter::OverlayLayer::OverlayLayer ( const fml::scoped_nsobject< UIView > &  overlay_view,
const fml::scoped_nsobject< UIView > &  overlay_view_wrapper,
std::unique_ptr< IOSSurface ios_surface,
std::unique_ptr< Surface >  surface 
)

Definition at line 12 of file overlay_layer_pool.mm.

◆ ~OverlayLayer()

flutter::OverlayLayer::~OverlayLayer ( )
default

Member Function Documentation

◆ UpdateViewState()

void flutter::OverlayLayer::UpdateViewState ( UIView *  flutter_view,
SkRect  rect,
int64_t  view_id,
int64_t  overlay_id 
)

Definition at line 21 of file overlay_layer_pool.mm.

24  {
25  UIView* overlay_view_wrapper = this->overlay_view_wrapper.get();
26  auto screenScale = [UIScreen mainScreen].scale;
27  // Set the size of the overlay view wrapper.
28  // This wrapper view masks the overlay view.
29  overlay_view_wrapper.frame = CGRectMake(rect.x() / screenScale, rect.y() / screenScale,
30  rect.width() / screenScale, rect.height() / screenScale);
31  // Set a unique view identifier, so the overlay_view_wrapper can be identified in XCUITests.
32  overlay_view_wrapper.accessibilityIdentifier =
33  [NSString stringWithFormat:@"platform_view[%lld].overlay[%lld]", view_id, overlay_id];
34 
35  UIView* overlay_view = this->overlay_view.get();
36  // Set the size of the overlay view.
37  // This size is equal to the device screen size.
38  overlay_view.frame = [flutter_view convertRect:flutter_view.bounds toView:overlay_view_wrapper];
39  // Set a unique view identifier, so the overlay_view can be identified in XCUITests.
40  overlay_view.accessibilityIdentifier =
41  [NSString stringWithFormat:@"platform_view[%lld].overlay_view[%lld]", view_id, overlay_id];
42 }

References overlay_view, and overlay_view_wrapper.

Member Data Documentation

◆ did_submit_last_frame

bool flutter::OverlayLayer::did_submit_last_frame

Definition at line 37 of file overlay_layer_pool.h.

◆ gr_context

GrDirectContext* flutter::OverlayLayer::gr_context

Definition at line 42 of file overlay_layer_pool.h.

◆ ios_surface

std::unique_ptr<IOSSurface> flutter::OverlayLayer::ios_surface

Definition at line 33 of file overlay_layer_pool.h.

◆ overlay_view

fml::scoped_nsobject<UIView> flutter::OverlayLayer::overlay_view

Definition at line 31 of file overlay_layer_pool.h.

Referenced by UpdateViewState().

◆ overlay_view_wrapper

fml::scoped_nsobject<UIView> flutter::OverlayLayer::overlay_view_wrapper

Definition at line 32 of file overlay_layer_pool.h.

Referenced by UpdateViewState().

◆ surface

std::unique_ptr<Surface> flutter::OverlayLayer::surface

Definition at line 34 of file overlay_layer_pool.h.


The documentation for this struct was generated from the following files:
flutter::OverlayLayer::ios_surface
std::unique_ptr< IOSSurface > ios_surface
Definition: overlay_layer_pool.h:33
flutter::OverlayLayer::surface
std::unique_ptr< Surface > surface
Definition: overlay_layer_pool.h:34
flutter::OverlayLayer::overlay_view
fml::scoped_nsobject< UIView > overlay_view
Definition: overlay_layer_pool.h:31
flutter::OverlayLayer::overlay_view_wrapper
fml::scoped_nsobject< UIView > overlay_view_wrapper
Definition: overlay_layer_pool.h:32