Is there a way to dynamically change the Flutter TextField's maxLines?

前端 未结 2 666

I have a TextField like this:

new Flexible(
    fit: FlexFit.loose,
    child: new Container(
        alignment: FractionalOffset.topLeft,
        child: new         


        
相关标签:
2条回答
  • 2020-12-31 03:32

    its look like a text-area. you can try with maxLines

    maxLines: 8

    TextField(
            maxLines: 8,
            decoration: InputDecoration(hintText: "Enter your text here", border: OutlineInputBorder(),
            labelText: 'Post Body'),
        ),
    
    0 讨论(0)
  • 2020-12-31 03:34

    Flutter was lagging multiline support in TextField. After an issue was raised regarding the same, the multiline feature has been added in the 0.0.16 release.

    Make sure you upgrade flutter to the latest release. To get multiline TextField use:

    new TextField(
        maxLines: null,
        keyboardType: TextInputType.multiline,
    ) 
    

    Hope this helped!

    0 讨论(0)
提交回复
热议问题