Skip to content

IconButton.styleFrom is missing iconColor property #163126

@TahaTesser

Description

@TahaTesser

Steps to reproduce

More details in this thread.
#162880 (comment)

This works as expected

Image

Image

However, we can't define iconColor in the button style class using IconButton.styleFrom. IconButton.styleFrom is missing iconColor property.
https://api.flutter.dev/flutter/material/IconButton/styleFrom.html

Expected results

IconButton icon color should be customizable using ButtonStyle.iconColor as well as using IconButton.styleFrom

IconButton.styleFrom is missing iconColor property
https://api.flutter.dev/flutter/material/IconButton/styleFrom.html

Actual results

Cannot override iconColor using IconButton.styleFrom.

Code sample

Code sample
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: IconButtonTheme(
            data: const IconButtonThemeData(
              style: ButtonStyle(
                iconColor: WidgetStatePropertyAll<Color>(Colors.red),
              ),
              // ),
              // data: IconButton.styleFrom(
              //   iconColor:
            ),
            child: IconButton(
              onPressed: () {},
              icon: const Icon(Icons.ac_unit),
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.team-designOwned by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions