textbutton background color flutter
// first way (most upvoted) TextButton( child: Text('test'), style: ButtonStyle(backgroundColor: MaterialStateProperty.all(Colors.red)), onPressed: () {}, ), // second way TextButton( child: Text('Example'), onPressed: () {}, style: TextButton.styleFrom(backgroundcolor: Colors.red), ) // third way TextButton( onPressed: () {}, child: Container( padding: EdgeInsets.fromLTRB(30, 10, 30, 10), color: Colors.red, child: Text(""), ), )