Skip to content

AppBar.brightness not changing the title widget text color #61618

@AirborneEagle

Description

@AirborneEagle

Steps to Reproduce

  1. Create this app:
import 'package:flutter/material.dart';

final Color darkBlue = Color.fromARGB(255, 18, 32, 47);

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
//           backgroundColor: Colors.black.withOpacity(.01),
//           brightness: Brightness.light,
        title: Text('App Name'),
          ),
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Text('Hello, World!', style: Theme.of(context).textTheme.headline4);
  }
}

  1. uncomment the two commented lines
  2. The title text stays white

Expected results:
I expected the title text to go dark. The icons in the status bar of the phone go dark, but not the text of the title.

Actual results:
The text in the title widget remains white
image

I understand that I can update the primaryColorBrightness in the main theme. However, it seems wrong to change the primary color brightness on the whole app just to adjust the color of an AppBar.

Am I over looking something simple?

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.found in release: 1.20Found to occur in 1.20frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions