resizeTextBox method

void resizeTextBox(
  1. TextBox textBox,
  2. Offset delta
)

Resizes a text box based on the delta values and ensures the width/height do not shrink below a threshold.

Implementation

void resizeTextBox(TextBox textBox, Offset delta) {
  textBox.width += delta.dx;
  textBox.height += delta.dy;
  textBox.width = textBox.width.clamp(
    20,
    double.infinity,
  ); // Min width of 20.
  textBox.height = textBox.height.clamp(
    20,
    double.infinity,
  ); // Min height of 20.
  notifyListeners(); // Notify listeners after resizing.
}