rrousselGit / riverpod

A reactive caching and data-binding framework. Riverpod makes working with asynchronous code a breeze.
https://riverpod.dev
MIT License
5.82k stars 888 forks source link

fix: migrate MaterialStateProperty usage #3493

Closed drown0315 closed 3 weeks ago

drown0315 commented 4 weeks ago

Migrated all usages of MaterialStateProperty.all, This is because MaterialStateProperty.all will be deprecated in the future. just only change example and websites, so does not update CHANGELOG.md refer to: https://github.com/dart-lang/sdk/issues/49056. image

e.g. Replace MaterialStateProperty.all to MaterialStatePropertyAll Before:

            ElevatedButton(
              style: ButtonStyle(
                // If there is an error, we show the button in red
                backgroundColor: MaterialStateProperty.all(
                  isErrored ? Colors.red : null,
                ),
              ),

After:

            ElevatedButton(
              style: ButtonStyle(
                // If there is an error, we show the button in red
                backgroundColor: MaterialStatePropertyAll(
                  isErrored ? Colors.red : null,
                ),
              ),

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]).

changeset-bot[bot] commented 4 weeks ago

⚠️ No Changeset found

Latest commit: 5752b499b8beef1e419ade681785908272fe4a4f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

rrousselGit commented 4 weeks ago

Hello!

There are a few conflicts :) I personally migrated to WidgetsStateProperty instead

drown0315 commented 4 weeks ago

Just noticed that you have already completed the migration.

I have resolved these conflicts.

I found that WidgetStateProperty has not been released in the latest stable version of Flutter yet, which may cause errors for many developers running examples, so I think temporarily using MaterialStatePropertyAll might be a better option.

rrousselGit commented 4 weeks ago

I've already migrated the english variant to use WidgetsStateProperty.

I prefer being on the edge in terms of feature, because otherwise we'll have to updates the docs again later.

drown0315 commented 4 weeks ago

Okay, I have updated. I replace all occurrences of MaterialStateProperty.all with WidgetStatePropertyAll

gdurandrexel commented 3 weeks ago

You might want to use ElevatedButton.styleFrom instead of ButtonStyle, to avoid bothering with these XxxPropertyAll.

rrousselGit commented 3 weeks ago

LGTM