blob: 8f85a37e871269b3ec074afbb3926d8809e57682 [file] [log] [blame] [view]
# FuchsiaViewConnection class
*[<Null safety>](https://dart.dev/null-safety)*
<p>Defines a thin wrapper around <a href="../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController-class.md">FuchsiaViewController</a>.</p>
<p>Its primary purpose is to hold on to <code>ViewHolderToken</code> for the lifetime of
the view controller, since <a href="../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController-class.md">FuchsiaViewController</a> is agnostic to all
Fuchsia data types. (Eventually, <a href="../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaView-class.md">FuchsiaView</a> and <a href="../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController-class.md">FuchsiaViewController</a>
will be moved to Flutter framework, which cannot have Fuchsia data types.)</p>
**Inheritance**
- Object
- [FuchsiaViewController](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController-class.md)
- FuchsiaViewConnection
## Constructors
[FuchsiaViewConnection](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/FuchsiaViewConnection.md) (dynamic viewHolderToken, {dynamic viewRef, [FuchsiaViewConnectionCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionCallback.md)? onViewConnected, [FuchsiaViewConnectionCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionCallback.md)? onViewDisconnected, [FuchsiaViewConnectionStateCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionStateCallback.md)? onViewStateChanged, bool usePointerInjection = false, bool usePointerInjection2 = false, bool useFlatland = false})
Constructor.
[FuchsiaViewConnection.flatland](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/FuchsiaViewConnection.flatland.md) (dynamic viewportCreationToken, {dynamic viewRef, [FuchsiaViewConnectionCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionCallback.md)? onViewConnected, [FuchsiaViewConnectionCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionCallback.md)? onViewDisconnected, [FuchsiaViewConnectionStateCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionStateCallback.md)? onViewStateChanged, bool usePointerInjection2 = false, bool useFlatland = true})
## Properties
##### [connected](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/connected.md) &#8594; bool
Returns true when platform view is connected.
_<span class="feature read-only">read-only</span><span class="feature inherited">inherited</span>_
##### [hashCode](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/hashCode.md) &#8594; int
The hash code for this object.
_<span class="feature read-only">read-only</span><span class="feature inherited">inherited</span>_
##### [hostViewRef](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/hostViewRef.md) &#8594; dynamic
_<span class="feature read-only">read-only</span>_
##### [onPointerEvent](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/onPointerEvent.md) &#8594; [FuchsiaPointerEventsCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaPointerEventsCallback.md)?
Callback when pointer events are dispatched on top of child view.
_<span class="feature final">final</span><span class="feature inherited">inherited</span>_
##### [onViewConnected](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/onViewConnected.md) &#8594; [FuchsiaViewConnectionCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionCallback.md)?
Callback when the connection to child's view is connected to view tree.
_<span class="feature final">final</span><span class="feature inherited">inherited</span>_
##### [onViewDisconnected](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/onViewDisconnected.md) &#8594; [FuchsiaViewConnectionCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionCallback.md)?
Callback when the child's view is disconnected from view tree.
_<span class="feature final">final</span><span class="feature inherited">inherited</span>_
##### [onViewStateChanged](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/onViewStateChanged.md) &#8594; [FuchsiaViewConnectionStateCallback](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnectionStateCallback.md)?
Callback when the child view's state changes.
_<span class="feature final">final</span><span class="feature inherited">inherited</span>_
##### [pointerInjector](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/pointerInjector.md) &#8594; PointerInjector
Returns the <code>PointerInjector</code> instance used by this connection.
_<span class="feature read-only">read-only</span>_
##### [runtimeType](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/runtimeType.md) &#8594; Type
A representation of the runtime type of the object.
_<span class="feature read-only">read-only</span><span class="feature inherited">inherited</span>_
##### [useFlatland](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/useFlatland.md) &#8594; bool
_<span class="feature final">final</span>_
##### [usePointerInjection](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/usePointerInjection.md) &#8594; bool
Set to true if pointer injection into child views should be enabled.
This requires the view's <code>ViewRef</code> to be set during construction.
_<span class="feature final">final</span>_
##### [usePointerInjection2](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/usePointerInjection2.md) &#8594; bool
Set to true if pointer injection into child views should be enabled using
platform messages.
_<span class="feature final">final</span>_
##### [viewHolderToken](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/viewHolderToken.md) &#8594; dynamic
The Gfx view tree token when the view is attached.
_<span class="feature final">final</span>_
##### [viewId](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/viewId.md) &#8594; int
The raw value of the <code>ViewHolderToken</code> or <code>ViewportCreationToken</code> where
this view is attached.
_<span class="feature final">final</span><span class="feature inherited">inherited</span>_
##### [viewport](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/viewport.md) &#8594; dynamic
Returns the viewport rect of the child view in parent's coordinates.
_<span class="feature read-only">read-only</span><span class="feature inherited">inherited</span>_
##### [viewportCreationToken](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/viewportCreationToken.md) &#8594; dynamic
The Flatland token when the view is attached.
_<span class="feature final">final</span>_
##### [viewRef](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/viewRef.md) &#8594; dynamic
The handle to the view used for <a href="../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/requestFocus.md">requestFocus</a> calls.
_<span class="feature final">final</span>_
##### [whenConnected](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/whenConnected.md) &#8594; Future
The future that completes when the platform view is connected.
_<span class="feature read-only">read-only</span><span class="feature inherited">inherited</span>_
## Methods
##### [clearFocus](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/clearFocus.md)() Future&lt;void>
_<span class="feature inherited">inherited</span>_
##### [connect](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/connect.md)({bool hitTestable = true, bool focusable = true, dynamic viewOcclusionHint = Rect.zero}) Future&lt;void>
Connects to the platform view given it's <a href="../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/viewId.md">viewId</a>.
_<span class="feature inherited">inherited</span>_
##### [dispatchPointerEvent](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/dispatchPointerEvent.md)(dynamic event) Future&lt;void>
Dispatch pointer events for the child view. This MUST NOT be called
directly.
_<span class="feature inherited">inherited</span>_
##### [dispose](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/dispose.md)() Future&lt;void>
Dispose relevant resources when the view is take <code>OffStage</code> by Flutter.
_<span class="feature inherited">inherited</span>_
##### [noSuchMethod](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/noSuchMethod.md)(Invocation invocation) dynamic
Invoked when a non-existent method or property is accessed.
_<span class="feature inherited">inherited</span>_
##### [onPointerInjectionError](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/onPointerInjectionError.md)() void
##### [requestFocus](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewConnection/requestFocus.md)([int _ = 0]) Future&lt;void>
Requests that focus be transferred to the remote Scene represented by
this connection. This method is the point at which focus handling for
flatland diverges. In Flatland, the Flutter engine holds the ViewRef
and does not provide it to dart code, so we must refer to the child
view by viewId instead
_<span class="feature override">override</span>_
##### [requestFocusById](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/requestFocusById.md)(int viewId) Future&lt;void>
Requests that focus be transferred to the child view referred to by
viewId. Note that this method should only be used with the Flatland API
_<span class="feature inherited">inherited</span>_
##### [toString](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/toString.md)() String
A string representation of this object.
_<span class="feature inherited">inherited</span>_
##### [update](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/update.md)({bool focusable = true, bool hitTestable = true, dynamic viewOcclusionHint = Rect.zero}) Future&lt;void>
Updates properties on the platform view given it's <a href="../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/viewId.md">viewId</a>.
_<span class="feature inherited">inherited</span>_
## Operators
##### [operator ==](../package-fuchsia_scenic_flutter_fuchsia_view/FuchsiaViewController/operator_equals.md)(Object other) bool
The equality operator.
_<span class="feature inherited">inherited</span>_