Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
FlutterView.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERVIEW_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERVIEW_H_
7
8#import <Metal/Metal.h>
9#import <UIKit/UIKit.h>
10
13
14@protocol FlutterViewEngineDelegate <NSObject>
15
16@property(nonatomic, readonly) FlutterPlatformViewsController* platformViewsController;
17
18- (flutter::Rasterizer::Screenshot)takeScreenshot:(flutter::Rasterizer::ScreenshotType)type
19 asBase64Encoded:(BOOL)base64Encode;
20
21/**
22 * A callback that is called when iOS queries accessibility information of the Flutter view.
23 *
24 * This is useful to predict the current iOS accessibility status. For example, there is
25 * no API to listen whether voice control is turned on or off. The Flutter engine uses
26 * this callback to enable semantics in order to catch the case that voice control is
27 * on.
28 */
29- (void)flutterViewAccessibilityDidCall;
30@end
31
32/**
33 * A custom NSLayoutConstraint subclass for autoresizing the FlutterView.
34 * This class is a special NSLayoutConstraint used internally to
35 * manage the dynamic resizing of a FlutterView based on its content.
36 *
37 * In native, `intrinsicContentSize` is a public property that determines the preferred
38 * sized of an UIView, based on it's internal content. Given a position and layout constraints,
39 * this allows the UIView to size itself.
40 * However, the mechanism in which this sizing occurs based on`intrinsicContentSize`
41 * and the layout constraints is private.
42 *
43 * This custom NSLayoutConstraint allows us to replicate this mechanizm without needing to rely
44 * on private APIs.
45 */
46@interface FlutterAutoResizeLayoutConstraint : NSLayoutConstraint
47@end
48
49@interface FlutterView : UIView
50
51- (instancetype)init NS_UNAVAILABLE;
52+ (instancetype)new NS_UNAVAILABLE;
53- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
54- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
55
56- (instancetype)initWithDelegate:(id<FlutterViewEngineDelegate>)delegate
57 opaque:(BOOL)opaque
58 enableWideGamut:(BOOL)isWideGamutEnabled NS_DESIGNATED_INITIALIZER;
59
60- (UIScreen*)screen;
61- (MTLPixelFormat)pixelFormat;
62
63/**
64 * A method that sets the instrinsic content size
65 * This is used when autoResizable is enabled.
66 */
67- (void)setIntrinsicContentSize:(CGSize)size;
68
69/**
70 * A method that resets and recalculates the instrinsic content size
71 * Currently called when the device orientation changes.
72 */
73- (void)resetIntrinsicContentSize;
74@property(nonatomic, assign, readwrite) BOOL autoResizable;
75
76@end
77
78#endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERVIEW_H_
instancetype init NS_UNAVAILABLE
instancetype initWithFrame
instancetype initWithCoder
int BOOL