addTextBox method
Adds a new text box on the current page and records the action in history.
Implementation
TextBox? addTextBox() {
_textBoxes[_currentPage] ??= [];
TextBox newTextBox = TextBox(
"New Text",
Offset(100, 100),
); // Default position and text.
_textBoxes[_currentPage]!.add(newTextBox);
_history[_currentPage]!.add(
TextBoxAction(newTextBox, isAdd: true),
); // Record action.
notifyListeners(); // Notify listeners about the change.
return newTextBox;
}