Skip to content
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

Example with Riverpod state management #189

Open
spehj opened this issue Apr 30, 2024 · 7 comments
Open

Example with Riverpod state management #189

spehj opened this issue Apr 30, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@spehj
Copy link

spehj commented Apr 30, 2024

Description

Riverpod is one of the top 3 most popular state management packages. I suggest creating an example of using Riverpod providers to manage state when moving between sheets.

Please tell us the problem you are running into that led to you wanting a new feature.

I was developing an app for a client and decided to use the Wolt Modal Sheets package because it looks cool and works out of the box. The only problem is, that I need to dig deep into the example code and translate it from Provider to Riverpod state management which takes quite some time.

@spehj spehj added the enhancement New feature or request label Apr 30, 2024
@ulusoyca
Copy link
Collaborator

ulusoyca commented May 6, 2024

Hi, I am working on a new demo app which I will push this week. It uses the Provider package, but it will be very simple to use Riverpod for it. Please also tune in for my talk in which I will explain the demo app: https://fullstackflutter.dev/

@ulusoyca
Copy link
Collaborator

Hi, the full stack flutter conference is today!

Here is the demo app. In this commit I show how I convert the imperative call to showing modal sheet to declarative call.

Also, full demo app with provider is here: #217

@Purus
Copy link

Purus commented Jun 7, 2024

I am struggling to get the data from each page to the other using riverpod. Any simple code example for reference would be great.

@spehj
Copy link
Author

spehj commented Jun 9, 2024

I am struggling to get the data from each page to the other using riverpod. Any simple code example for reference would be great.

It's been a while since I opened this issue. In the end, I decided to go with a simple PageView widget to be able to use Riverpod instead of using Wolt Modal Sheets.

@ulusoyca ulusoyca reopened this Jun 9, 2024
@ulusoyca
Copy link
Collaborator

ulusoyca commented Jun 9, 2024

I am struggling to get the data from each page to the other using riverpod. Any simple code example for reference would be great.

You can do this by using the decorator field. All you need to do is to provide a ChangeNotifierProvider or some other notifiers using this field. By doing so, the decorator widget wraps the entire subtree of the modal, and you can manage your data inside the decorator widget no matter which page you are in.

The coffee maker app is an example to this use case. Please check this example.

@ulusoyca
Copy link
Collaborator

ulusoyca commented Jun 9, 2024

I am struggling to get the data from each page to the other using riverpod. Any simple code example for reference would be great.

It's been a while since I opened this issue. In the end, I decided to go with a simple PageView widget to be able to use Riverpod instead of using Wolt Modal Sheets.

Have you had any chance to check the demo app? I really would like to make it easy to understand regardless of the state management package. Maybe I can improve the Readme if you can provide feedback about what is confusing.

@spehj
Copy link
Author

spehj commented Jun 14, 2024

I quickly looked at the demo app with the decorator field. I need some time to play with it to see if it works well with Riverpod. Anyway, I miss the option to make the modals reactive in the "native" flutter way (using widgets) with the WMS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants