setScrollableRect method

  1. @override
Future<void> setScrollableRect(
  1. int id,
  2. Rect rect
)
override

Sets the scrollable area rectangle for a given view ID.

This method communicates the position and size of a scrollable widget to the native implementation so it can properly handle keyboard interaction within that area.

The id uniquely identifies the scrollable view, and rect contains the global coordinates and dimensions of the scrollable area.

Implementation

@override
Future<void> setScrollableRect(int id, Rect rect) {
  try {
    return methodChannel.invokeMethod('setScrollableRect', {
      'id': id,
      'rect': {
        'x': rect.left,
        'y': rect.top,
        'width': rect.width,
        'height': rect.height,
      },
    });
  } catch (e) {
    throw PlatformException(
      code: 'SET_SCROLLABLE_RECT_FAILED',
      message: 'Failed to set scrollable rect for id $id',
      details: e.toString(),
    );
  }
}