-1

In Flutter my Text Forms widget is not scrolling, same issue again.I tried adding SingleChildScrollView but it is not working`.

Please fix my isue I tried adding " body: SingleChildScrollView( ) but the total forms page is getting disappeared.

Following is my Widget code

      Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.all(8.0),
      child: TextFormField(
        decoration: InputDecoration(
          hintText: hintText,
          contentPadding: EdgeInsets.all(10.0),
          border: InputBorder.none,
          filled: true,
          fillColor: Colors.grey[200],
        ),

        validator: validator,
        onSaved: onSaved,
        keyboardType: isService ? TextInputType.streetAddress: TextInputType.text ,
      ),
    );
  }
}
sr2k23
  • 127
  • 1
  • 2
  • 12
  • Where is your SingleChildScrollView? Do you mean scroll within the TextFormField? If so, have you tried `maxLines` ? You can check its doc here: https://api.flutter.dev/flutter/material/TextField/maxLines.html – Sludge Sep 17 '20 at 13:00
  • Also, see this question here: https://stackoverflow.com/questions/51205333/flutter-textfield-that-auto-expands-when-text-is-entered-and-then-starts-scrolli/51205467#51205467 – Sludge Sep 17 '20 at 13:02

1 Answers1

0

There might be two cases :

  1. You have multiple textform field and you want to scroll between them

  2. You have single text area in which you want to scroll

for first one, Wrap your code inside a (column + SingleChildScrollView) or Listview and add as many textfield you want to add inside

for second one, you can set max line for text form and it will behave like a textarea and to control height and width of it you can apply it under container and set height for it

Vivek Jain
  • 2,730
  • 6
  • 12
  • 27
Piyush Dubey
  • 276
  • 1
  • 13