Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter TextField disabled with border

When I use the TextField Widget with enabled parameter set tofalse, the border disappears.

     Flexible(
          child: 
           TextField(
                  onTap: () {
                Future<DateTime> dateTime = _buildDataHoraInicial(context);
                dateTime.then((date){
                    _dataHoraInicial = date;
                    _dataTempoInicialController.text = date.toIso8601String();
                    print(_dataHoraInicial);
                });
              },
              controller: _dataTempoInicialController,
              style: TextStyle(color: Colors.white),
              decoration: InputDecoration(
                  contentPadding: const EdgeInsets.symmetric(vertical: 15.0),
                  enabledBorder: OutlineInputBorder(
                      borderSide: BorderSide(color: Color(0xfff7b733))),
                  prefixIcon: Icon(
                    Icons.calendar_today,
                    color: Color(0xfff7b733),
                    size: 16.0,
                  ),
                  suffixIcon: Icon(Icons.access_time,
                      color: Color(0xfff7b733), size: 16.0),
                  border: OutlineInputBorder(
                      borderSide: BorderSide(color: Color(0xfff7b733))),
                  labelText: 'Data e Hora de Início',
                  fillColor: Colors.white,
                  hintStyle: TextStyle(color: Colors.white),
                  labelStyle: TextStyle(
                      fontSize: 16.0, color: const Color(0xfff7b733))),
            ),
          ),

image of the TextField Widget

How can I use TextField Widget with enabled parameter set to true keeping the border?

like image 826
Thales Takáo Avatar asked Nov 22 '25 03:11

Thales Takáo


1 Answers

To solve this problem I added the disabledBorder parameter from the InputDecoration and set it to OutlineInputBorder(borderSide: BorderSide(color: Color(0xfff7b733)))

like image 185
Thales Takáo Avatar answered Nov 24 '25 22:11

Thales Takáo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!