How scroll over a disabled TextField with fixed number of lines in Flutter?
1,009
make readOnly: true now you can't edit the field and still you can scroll the field.
TextFormField( enabled: true, readOnly: true, initialValue: 'initial value', )
Author by
Grégori Fernandes de Lima
Updated on December 16, 2022Comments
-
Grégori Fernandes de Lima over 1 year
After i set 'enable: false' i can't see the others lines if a text has more than 9 lines. I need set 'enable:false' because i don't want user edit text in this TextField. I tried use SigleChildScrollView, but it didn't work...
Container( child: SingleChildScrollView( child: TextField( enabled: false, keyboardType: TextInputType.multiline, maxLines: 9, controller: chatController, decoration: InputDecoration( hintText: "Chat...", border: OutlineInputBorder( borderRadius: BorderRadius.circular(15.0), ), ), ), ), ),
-
Benjamin over 4 yearsMark the text field as readOnly instead of disabled.
-
HasilT over 4 yearsuse
Text
widget if it is always disabled -
Grégori Fernandes de Lima over 4 yearsI maked it as readOnly an it works! Thank you!
-