flutter / website

Flutter documentation web site
https://docs.flutter.dev
Other
2.83k stars 3.24k forks source link

Change deprecated properties `primary` & `onSurface` on 'New Buttons and Button Themes' page #8115

Open JasperVanDenBosch opened 1 year ago

JasperVanDenBosch commented 1 year ago

Page URL

https://docs.flutter.dev/release/breaking-changes/buttons#the-stylefrom-buttonstyle-utility-methods

Page source

No response

Describe the problem

The current breaking changes page for release, recommends a styling strategy for buttons that includes the "primary" colour, which is deprecated in the current stable channel release (3.3.10).

For example:

This example creates a button that overrides its foreground color, as well as its overlay color, using the specified primary color and the opacities from the Material Design spec.

TextButton(
  style: TextButton.styleFrom(
    primary: Colors.blue,
  ),
  onPressed: () { },
  child: Text('TextButton'),
)
Screenshot 2023-01-17 at 15 14 42

Expected fix

Change recommendation to use foregroundColor for instance.

Additional context

[✓] Flutter (Channel stable, 3.3.10, on macOS 12.6 21G115 darwin-arm, locale en-GB) • Flutter version 3.3.10 on channel stable at /opt/homebrew/Caskroom/flutter/3.0.5/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 135454af32 (5 weeks ago), 2022-12-15 07:36:55 -0800 • Engine revision 3316dd8728 • Dart version 2.18.6 • DevTools version 2.15.0

danagbemava-nc commented 1 year ago

Hi @ilogue, thanks for pointing this out.

It turns out onSurface is also deprecated as well.