Update parameters to the styleFrom button methods. (#105291)

* Update parameters to the `styleFrom` button methods.

* Updated the Flutter fix data to point to this PR.

* Updated handling of background color to better maintain backwards compatibility with previous API.
This commit is contained in:
Darren Austin
2022-06-21 19:08:22 -07:00
committed by GitHub
parent ce10e6fff2
commit 2532584bf3
21 changed files with 404 additions and 106 deletions

View File

@@ -247,7 +247,7 @@ class TravelDestinationContent extends StatelessWidget {
final ThemeData theme = Theme.of(context);
final TextStyle titleStyle = theme.textTheme.headline5!.copyWith(color: Colors.white);
final TextStyle descriptionStyle = theme.textTheme.subtitle1!;
final ButtonStyle textButtonStyle = TextButton.styleFrom(primary: Colors.amber.shade500);
final ButtonStyle textButtonStyle = TextButton.styleFrom(foregroundColor: Colors.amber.shade500);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@@ -78,7 +78,7 @@ class _ShoppingCartPageState extends State<ShoppingCartPage> {
right: 16.0,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: kShrinePink100,
backgroundColor: kShrinePink100,
shape: const BeveledRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(7.0)),
),

View File

@@ -177,7 +177,7 @@ class _TextButton extends StatelessWidget {
final ThemeData theme = Theme.of(context);
return TextButton(
style: TextButton.styleFrom(
primary: theme.colorScheme.onPrimary,
foregroundColor: theme.colorScheme.onPrimary,
textStyle: theme.textTheme.subtitle1,
padding: EdgeInsets.zero,
),

View File

@@ -534,7 +534,7 @@ class _MyHomePageState extends State<MyHomePage> {
label: _model.rtl ? 'زر مسطح' : 'Text Button',
child: TextButton(
style: TextButton.styleFrom(
primary: Colors.white,
foregroundColor: Colors.white,
backgroundColor: m2Swatch[200]
),
onPressed: _model.enable ? () {} : null,

View File

@@ -44,7 +44,7 @@ class _HomeState extends State<Home> {
children: <Widget>[
TextButton(
style: TextButton.styleFrom(
primary: Colors.white,
foregroundColor: Colors.white,
backgroundColor: Colors.red.shade800,
),
onPressed: () { Navigator.pushNamed(context, 'underlines'); },
@@ -52,7 +52,7 @@ class _HomeState extends State<Home> {
),
TextButton(
style: TextButton.styleFrom(
primary: Colors.white,
foregroundColor: Colors.white,
backgroundColor: Colors.orange.shade700,
),
onPressed: () { Navigator.pushNamed(context, 'fallback'); },
@@ -60,7 +60,7 @@ class _HomeState extends State<Home> {
),
TextButton(
style: TextButton.styleFrom(
primary: Colors.black,
foregroundColor: Colors.black,
backgroundColor: Colors.yellow.shade700,
),
onPressed: () { Navigator.pushNamed(context, 'bidi'); },
@@ -68,7 +68,7 @@ class _HomeState extends State<Home> {
),
TextButton(
style: TextButton.styleFrom(
primary: Colors.black,
foregroundColor: Colors.black,
backgroundColor: Colors.green.shade400,
),
onPressed: () { Navigator.pushNamed(context, 'fuzzer'); },
@@ -76,7 +76,7 @@ class _HomeState extends State<Home> {
),
TextButton(
style: TextButton.styleFrom(
primary: Colors.white,
foregroundColor: Colors.white,
backgroundColor: Colors.blue.shade400,
),
onPressed: () { Navigator.pushNamed(context, 'zalgo'); },
@@ -84,7 +84,7 @@ class _HomeState extends State<Home> {
),
TextButton(
style: TextButton.styleFrom(
primary: Colors.black,
foregroundColor: Colors.black,
backgroundColor: Colors.purple.shade200,
),
onPressed: () { Navigator.pushNamed(context, 'painting'); },
@@ -618,7 +618,7 @@ class _UnderlinesState extends State<Underlines> {
),
TextButton(
style: TextButton.styleFrom(
primary: Colors.white,
foregroundColor: Colors.white,
backgroundColor: Colors.red,
),
onPressed: _text == '' ? null : () {