0

Im trying to change the color of my outline border . When focus on it ,it get a default color I think and I wanna change that to black but dont now how to doing that .

This is my widget :

@override
  Widget build(BuildContext context) {
    return Container(
      
      margin: EdgeInsets.only(top: 8),
      padding: EdgeInsets.all(8),
      child: Row(
        children: <Widget>[
          Expanded(
            
            child: TextField(
              controller: _controller,
              decoration: InputDecoration( hintText: 'Send a message',border: OutlineInputBorder( borderRadius:
              const BorderRadius.all(
                const Radius.circular(40.0),
              ),

              ),

              ),
              onChanged: (value) {
                setState(() {
                  _enteredMessage = value;
                });
              },
            ),
          ),
          IconButton(
            color: Colors.black,
            icon: Icon(
              Icons.send,
            ),
            onPressed: _enteredMessage.trim().isEmpty ? null : _sendMessage,
          )
        ],
      ),
    );
  }
}

So when user try to inout some text the radius should be black .Hope anyone can help thanks .

  • 2
    Does this answer your question? [Flutter: Outline input border](https://stackoverflow.com/questions/54143526/flutter-outline-input-border) – HeIsDying Mar 22 '21 at 01:43

2 Answers2

0

InputDecoration has many attributes for different situations such as errorBorder, focusedBorder, focusedErrorBorder, disabledBorder, enabledBorder, border,

I think what you need here, you can achieve it by focusedBorder

focusedBorder: OutlineInputBorder(
              borderRadius: const BorderRadius.all(
                const Radius.circular(40.0),
              ),
              borderSide: BorderSide(width: 1, color: Colors.black),
            ),
    
DNS
  • 851
  • 11
  • 19
  • You're welcome. Why did you change the best response? Was there a problem with my response? – DNS Mar 20 '21 at 21:24
  • No it wasnt but the other user was 3 minutes before you ,its just fair he have the same answer in my opinion. –  Mar 20 '21 at 21:25
  • No I answered 2 mins before the other user :) That's ok, no problem – DNS Mar 20 '21 at 21:31
0

Add this to your input decoration

focusedBorder: OutlineInputBorder(
  borderRadius: const BorderRadius.all(
    const Radius.circular(40.0),
 ),
 borderSide: BorderSide(color: Colors.black),
),
Loren.A
  • 4,872
  • 1
  • 10
  • 17