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', )

Share:
1,009
Grégori Fernandes de Lima
Author by

Grégori Fernandes de Lima

Updated on December 16, 2022

Comments

  • Grégori Fernandes de Lima
    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
      Benjamin over 4 years
      Mark the text field as readOnly instead of disabled.
    • HasilT
      HasilT over 4 years
      use Text widget if it is always disabled
    • Grégori Fernandes de Lima
      Grégori Fernandes de Lima over 4 years
      I maked it as readOnly an it works! Thank you!