getBoxesForSelection method

  1. @override
List<TextBox> getBoxesForSelection(
  1. TextSelection selection
)
override

Implementation

@override
List<TextBox> getBoxesForSelection(TextSelection selection) {
  if (!selection.isCollapsed) {
    return <TextBox>[
      TextBox.fromLTRBD(0, 0, size.width, size.height, TextDirection.ltr)
    ];
  }

  final left = selection.extentOffset == 0 ? 0.0 : size.width;
  final right = selection.extentOffset == 0 ? 0.0 : size.width;
  return <TextBox>[
    TextBox.fromLTRBD(left, 0, right, size.height, TextDirection.ltr)
  ];
}