woltapp / wolt_modal_sheet

This package provides a responsive modal with multiple pages, motion animation for page transitions, and scrollable content within each page.
MIT License
520 stars 65 forks source link

Hot Reload #178

Open dickermoshe opened 8 months ago

dickermoshe commented 8 months ago

Bug report

Describe the bug When making changes to an open bottom sheet, it isn't rebuilt

Steps to reproduce

Steps to reproduce the behavior:

  1. Open Bottom Sheet
  2. Edit Widget
  3. Hot Restart

Expected behavior

See changes instantly


Additional context

This seems to be a general issue, but being that with dialogs and bottom sheets, but those can be wrapped in a custom widget workaround it. Having to open and close it during development isn't great. Is there something I'm missing?


felipecastrosales commented 6 months ago

hey! this appears here also. @dickermoshe any expectations?

dickermoshe commented 6 months ago

hey! this appears here also. @dickermoshe any expectations?

Say What? I don't understand the question.

dickermoshe commented 6 months ago

The workaround for this issue is to wrap the base widget in a StatefulBuilder

felipecastrosales commented 6 months ago

@dickermoshe I've been trying this - because in common bottomsheets I do this, but it didn't work with this package for me. Can you send me how you implemented it?

dickermoshe commented 6 months ago
mainContentSlivers: [
      SliverToBoxAdapter(
        child: StatefulBuilder(builder: (ctx, _) {
          return Container(color:Colors.red, height:50,width: 50); // Any widget in here will rebuild on a hot reload
        }),
      ),
    ],
felipecastrosales commented 6 months ago

and how make with WoltModalSheetPage? in child doesn't works as expected. I think this plugin can put this internally, or in documents explain about the use of StatefulBuilder and where it can be added; with this we can close this issue - IMHO.

mainContentSlivers: [
      SliverToBoxAdapter(
        child: StatefulBuilder(builder: (ctx, _) {
          return Container(color:Colors.red, height:50,width: 50); // Any widget in here will rebuild on a hot reload
        }),
      ),
    ],
dickermoshe commented 6 months ago

I agree, @ulusoyca What do you think about wrapping every widget in a StatefulBuilder under the hood?

(Sorry if I shouldn't be pinging people)

ulusoyca commented 6 months ago

@dickermoshe How about this one? This still won't solve the hot reload issue, but I think this is easier way to update the current page without decorator, builders and value listenable builders

https://github.com/woltapp/wolt_modal_sheet/pull/213

felipecastrosales commented 6 months ago

I keep thinking that it's a problem not to have a hot-reload when using this package, cc @ulusoyca. Yesterday I took a quick look at the package and couldn't identify what it could be.

ulusoyca commented 6 months ago

@felipecastrosales Indeed identifying the problem is a bit difficult. I thought I fixed it with https://github.com/woltapp/wolt_modal_sheet/pull/213 but nope. Hot reload partly works.

We will work on a larger refactor in H2. Fingers crossed 🤞🏻

dickermoshe commented 6 months ago

@ulusoyca I'm just wondering, what's wrong with wrapping each widget with a stateful builder under the hood? Seems like a good temporary fix

ulusoyca commented 6 months ago

@ulusoyca I'm just wondering, what's wrong with wrapping each widget with a stateful builder under the hood? Seems like a good temporary fix

No problem at all, but how does it work? I am not sure how hot reload would work when it is done but very interested in learning. Do you mind showing with a PR?

BTW; what do you think about https://github.com/woltapp/wolt_modal_sheet/pull/213?

dickermoshe commented 6 months ago

I really wish I knew why it worked, but it does. I’ve had this experience working on the Google pay plug-in for flutter, where we had to make a widget stateful in order for hot-reload to work. I’ll work on a PR later.

If you know anyone who has an advanced understanding of flutters architecture, I’m sure you could ask them.

On Tue, May 28, 2024 at 9:21 AM Cagatay Ulusoy @.***> wrote:

@ulusoyca https://github.com/ulusoyca I'm just wondering, what's wrong with wrapping each widget with a stateful builder under the hood? Seems like a good temporary fix

No problem at all, but how does it work? I am not sure how hot reload would work when it is done but very interested in learning. Do you mind showing with a PR?

BTW; what do you think about #213 https://github.com/woltapp/wolt_modal_sheet/pull/213?

— Reply to this email directly, view it on GitHub https://github.com/woltapp/wolt_modal_sheet/issues/178#issuecomment-2135204849, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASDJ623YETABUUEJR256T33ZESAF5AVCNFSM6AAAAABF5DWNWOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZVGIYDIOBUHE . You are receiving this because you were mentioned.Message ID: @.***>

venbrinoDev commented 3 months ago

Still having issue with hot reload using the WoltModalSheetPage

anyone got any fix to this yet?