Skip to main content

Examples

Basic text area exampleBasic text area example

Basic text area with different configurations and features.

Properties

Required

TextEditingController
required
The controller for managing the text content of the text area.

Content

String?
Optional label text displayed above the text area.
String?
default:"Type here..."
Hint text displayed when the text area is empty.
String?
Optional helper text displayed below the text area. Hidden when errorText is present.
String?
Error message displayed below the text area. Takes priority over description.
List<TextInputFormatter>?
List of input formatters to control text input behavior (e.g., length limits, character restrictions).
List<String>?
Hints for autofill services.

Layout

int
default:"3"
Minimum number of lines to display.
int
default:"5"
Maximum number of lines for auto-sizing.
int?
default:"20"
Maximum number of lines when manually resized. Set to null for unlimited resizing.
bool
default:"true"
Whether to show the resize handle for manual height adjustment.
Double-tap the resize handle to reset to auto-sizing mode.

Behavior

ValueChanged<String>?
Callback triggered when the text content changes.
ValueChanged<String>?
Callback triggered when text is submitted via keyboard shortcuts.
VoidCallback
Callback function called when the text area loses focus. Useful for explicit blur event handling.
bool
default:"false"
Controls keyboard submission behavior:
  • true: Enter submits, Shift+Enter adds new line (chat-style)
  • false: Cmd/Ctrl+Enter submits, Enter adds new line (editor-style)
bool
default:"false"
Whether to keep focus on the text area after submission.

State

bool
default:"true"
Controls whether the text area is interactive. When disabled, the field appears dimmed and prevents all interaction.
FocusNode?
Optional focus node for advanced focus management. If not provided, an internal focus node is created.

Best Practices

  • Use appropriate line limits: Set minLines and maxLines based on expected content length
  • Use chat-style submission for messaging: Set submitOnEnter: true with maintainFocusOnSubmit: true for chat interfaces. You would also probably want to set minLines to 1.
Last modified on January 21, 2026