DEV Community

loading...

Flutter Create Expandable & Scrollable Text and TextField Widgets

valerianagit profile image ValerianaGit💙 ・1 min read

If you would like to see the full context, check it out HERE in my github repo

Text

Expanded(
child: SingleChildScrollView(
//scrollable Text - > wrap in SingleChildScrollView -> wrap that in Expanded
child: Text(
'',
overflow: TextOverflow.visible,
),
),
);

TextField

Expanded(
//makes textfield scrollable - wrap in Expanded widget + maxlines = null
child: TextField(
maxLines: null, //wrap text
autofocus: true,
autocorrect: true,
cursorColor: Colors.purple[900],
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Notes and Thoughts',
),
onChanged: (newValue) {
newContent = newValue;
},
),
);

Discussion (1)

Collapse
pablonax profile image
Pablo Discobar

wow, that's awesome! if you are interested in this topic, then check this article - dev.to/pablonax/free-flutter-templ...

Forem Open with the Forem app