Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Deprecated ThemeData buttonColor #82196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 10, 2021

Conversation

HansMuller
Copy link
Contributor

@HansMuller HansMuller commented May 10, 2021

This property had been used to define the background fill color for the (now deprecated) RaisedButton class. It has not been used by Flutter since #59702 landed the new Button classes. At that time, RaisedButton was replaced by ElevatedButton, whose background and foreground colors can be specified with a ButtonStyle:

ElevatedButton(
  style: ElevatedButton.styleFrom(
    primary: Colors.red, // background
    onPrimary: Colors.white, // foreground
  ),
  onPressed: () { },
  child: Text('ElevatedButton with custom foreground/background'),
)

To change the background color of all ElevatedButtons in a MaterialApp:

MaterialApp(
  theme: ThemeData.from(colorScheme: ColorScheme.light()).copyWith(
    elevatedButtonTheme: ElevatedButtonThemeData(
      style: ElevatedButton.styleFrom(
         primary: Colors.red, // background
         onPrimary: Colors.white, // foreground
       ),
     ),
  ),
  // ...
)

More information about configuring ElevatedButton et al. can be found here: https://flutter.dev/docs/release/breaking-changes/buttons.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 10, 2021
@google-cla google-cla bot added the cla: yes label May 10, 2021
@HansMuller HansMuller requested a review from darrenaustin May 10, 2021 17:13
@HansMuller HansMuller force-pushed the deprecate_button_color branch from ed6b35d to 37402f4 Compare May 10, 2021 18:54
Copy link
Contributor

@darrenaustin darrenaustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. LGTM.

@HansMuller HansMuller merged commit 1d8ab0f into flutter:master May 10, 2021
naturallymitchell pushed a commit to naturallymitchell/experiences that referenced this pull request May 4, 2022
buttonColor is deprecated and unused:
flutter/flutter#82196

FIX: 77251
Change-Id: Ife5b43c87bfffbd0182902c33220335cc0227af2
Reviewed-on: https://fuchsia-review.googlesource.com/c/experiences/+/533961
Fuchsia-Auto-Submit: Alex Legg <[email protected]>
Reviewed-by: Sarah Pham <[email protected]>
Reviewed-by: Abdulla Kamar <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
github-actions bot pushed a commit to gnoliyil/fuchsia that referenced this pull request Oct 11, 2022
buttonColor is deprecated and unused:
flutter/flutter#82196

FIX: 77251
Change-Id: Ife5b43c87bfffbd0182902c33220335cc0227af2
Reviewed-on: https://fuchsia-review.googlesource.com/c/experiences/+/533961
Fuchsia-Auto-Submit: Alex Legg <[email protected]>
Reviewed-by: Sarah Pham <[email protected]>
Reviewed-by: Abdulla Kamar <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants