Home > database >  Flutter change text color on active ExpensionTile
Flutter change text color on active ExpensionTile

Time:03-04

How to change ExpensionTile text color on active?

enter image description here

This is the ExpensionTile I'm trying to change, as you can see the current color is purple.

This is the code:

ExpansionTile(
                    title: Text('Current Version',
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          fontSize: 15
                      ),),
                    children: <Widget>[
                      ListTile(
                          title: Text(
                            'Version 0.1',
                            style: TextStyle(
                                fontSize: 14
                            ),
                          )
                      ),
                    ],
                  ),

CodePudding user response:

To set change the text color of the ExpansionTile(), you can use the textColor property:

The color of the tile's titles when the sublist is expanded.

Usage:

textColor: Colors.green

In your example:

ExpansionTile(
      textColor: Colors.green,
                    title: Text('Current Version',
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          fontSize: 15
                      ),),
                    children: <Widget>[
                      ListTile(
                          title: Text(
                            'Version 0.1',
                            style: TextStyle(
                                fontSize: 14
                            ),
                          )
                      ),
                    ],
                  );
  • Related