Skip to content

AlertDialog action buttons have the wrong text color #22789

@sir-boformer

Description

@sir-boformer

Flutter version: latest master

I created an app with a dark theme, pink primary swatch and orange accent color.

When I open an AlertDialog, the action buttons are turquoise. The theme colors are ignored:

screenshot_1538957302

This problem started recently on the master branch.

Code to reproduce:

import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        primarySwatch: Colors.pink,
        accentColor: Colors.orange,
        brightness: Brightness.dark,
      ),
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  void _showDialog() {
    showDialog(
      context: context,
      builder: (context) {
        return AlertDialog(
          title: Text('Some Title'),
          content: Text('Some content'),
          actions: <Widget>[
            FlatButton(
              onPressed: null,
              child: Text('DISABLED'),
            ),
            FlatButton(
              onPressed: () => Navigator.pop(context),
              child: Text('ENABLED'),
            )
          ],
        );
      },
    );
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(),
      body: new Center(
        child: FlatButton(
          textTheme: ButtonTextTheme.accent,
          onPressed: _showDialog,
          child: Text('SHOW DIALOG'),
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions