flutter / website

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

Fix code error on 'Migrating Buttons With Custom Overlay Colors' page #6185

Closed Swayam221 closed 1 year ago

Swayam221 commented 3 years ago

Page URL

https://flutter.dev/docs/release/breaking-changes/buttons#migrating-buttons-with-custom-overlay-colors

Page source

https://github.com/flutter/website/blob/master/src/docs/release/breaking-changes/buttons.md

Describe the problem

How to reproduce:

  1. Create a new flutter project.
  2. Add copy the code for the TextButton widget from https://flutter.dev/docs/release/breaking-changes/buttons#migrating-buttons-with-custom-overlay-colors , and it to the body of the default starting application for a new flutter project.

The error: The line return null is responsible for the error as the expected return type is a 'Color' . Shown in line number 31 in the following code snapshot.

WhatsApp Image 2021-08-20 at 11 16 23 PM

Expected fix

Can be fixed by replacing MaterialStateProperty.resolveWith<Color> with MaterialStateProperty.resolveWith<Color?> wherever necessary.

Additional context

No response

TahaTesser commented 3 years ago

Hi @Swayam221 Thanks for filing the issue,

Swayam221 commented 3 years ago

Hi @Swayam221 Thanks for filing the issue,

You're welcome. I would like to work on this issue as well.

Coronon commented 3 years ago

Duplicate of #6333

And fixed in 6dbe0c52428c93f8b2cc55b30ba1ba170782343e

/cc @TahaTesser

atsansone commented 1 year ago

Fixed in https://github.com/flutter/website/pull/6333. Closing this issue.