import 'package:flutter/material.dart'; void main() { runApp( MaterialApp( home: Home() )); } class Home extends StatefulWidget { @override State<Home> createState() => _HomeState(); } class _HomeState extends State<Home> { TextEditingController textarea = TextEditingController(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text("Multi Line TextField"), backgroundColor: Colors.redAccent, ), body: Container( alignment: Alignment.center, padding: EdgeInsets.all(20), child: Column( children: [ TextField( controller: textarea, keyboardType: TextInputType.multiline, maxLines: 4, decoration: InputDecoration( hintText: "Enter Remarks", focusedBorder: OutlineInputBorder( borderSide: BorderSide(width: 1, color: Colors.redAccent) ) ), ), ElevatedButton( onPressed: (){ print(textarea.text); }, child: Text("Get TextField Value") ) ], ), ) ); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter