Flutter change text color on active ExpensionTile

Issue

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

Solution

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
                            ),
                          )
                      ),
                    ],
                  );

Answered By – MendelG

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.