Skip to content

Instantly share code, notes, and snippets.

@igabice
Created January 8, 2020 09:42
Show Gist options
  • Save igabice/160e45caba51b3866d4a4a8559f67b7c to your computer and use it in GitHub Desktop.
Save igabice/160e45caba51b3866d4a4a8559f67b7c to your computer and use it in GitHub Desktop.
Flutter textfield example with multiline
final _controller = TextEditingController();
Widget _buildMultilineTextField() {
return TextField(
controller: this._controller,
maxLines: 10,
textCapitalization: TextCapitalization.sentences,
decoration: InputDecoration(
counterText: '${this._controller.text.split(' ').length} words',
labelText: 'Enter multiline text:',
hintText: 'type something...',
border: OutlineInputBorder(),
),
onChanged: (text) => setState(() {}),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment