title: Flutter - how to get AppBar title foreground color
body: <p>I have a Flutter app, where on the <code>appBar</code>, I have added a dropdown button. My app supports primary / secondary color changing.
  The screenshot below shows an <code>appBar</code> for two different primary colors. 
  <a href="https://i.stack.imgur.com/Au5X4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Au5X4.png" alt="enter image description here"></a></p>
  
  <p>As you can see, the Flutter is able to decide what color to use for app bar text to keep proper readability - white for dark color and black for light color (second app bar).
  I would like to set dropdown items' text color identical for the one, used by Flutter app bar text, hence, I would like to retrieve it.
  Looking at <code>Theme.of(context)</code> properties, however, didn't give me a clue what color should I use to achieve what I need to.</p>
  
  <p>Below is the code snippet:</p>
  
  <pre><code>final ThemeData _theme = Theme.of(context);
  final int index = values.indexWhere((TimeSpan element) =&gt; element.value == initialValue.value);
  return Theme(
    data: _theme.copyWith(
      canvasColor: _theme.primaryColor,
      brightness: Brightness.dark,
    ),
    child: DropdownButtonHideUnderline(
      child: DropdownButton&lt;TimeSpan&gt;(
        items: values
            .map(
              (value) =&gt; DropdownMenuItem(
                child: Text(
                  value.toString(),
                  style: TextStyle(color: _theme.colorScheme.surface),
                ),
                value: value,
              ),
            )
            .toList(),
        onChanged: callback,
        isExpanded: false,
        value: values[index],
      ),
    ),
  );
  </code></pre>