setOffset method Null safety
- Offset off
override
Sets the offset of the platform view.
off
is the view's new offset in logical pixel.
On Android, this allows the Android native view to draw the a11y highlights in the same location on the screen as the platform view widget in the Flutter framework.
Implementation
@override
Future<void> setOffset(Offset off) async {
if (off == _off) {
return;
}
// Don't set the offset unless the Android view has been created.
// The implementation of this method channel throws if the Android view for this viewId
// isn't addressable.
if (_state != _AndroidViewState.created) {
return;
}
_off = off;
await SystemChannels.platform_views.invokeMethod<void>(
'offset',
<String, dynamic>{
'id': viewId,
'top': off.dy,
'left': off.dx,
},
);
}