Flutter 更改活动 ExpensionTile 上的文本颜色

Flutter change text color on active ExpensionTile

如何在活动时更改 ExpensionTile 文本颜色?

这是我要更改的 ExpensionTile,您可以看到当前颜色是紫色。

这是代码:

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

设置更改 ExpansionTile(), you can use the textColor 属性 的文本颜色:

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

用法:

textColor: Colors.green

在你的例子中:

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