Skyost / FlutterWeekView

Displays a highly customizable week view (or day view) which is able to display events, to be scrolled, to be zoomed-in & out and a lot more !
https://pub.dev/packages/flutter_week_view
MIT License
208 stars 89 forks source link

Is it possible to change the width of WeekView then rebuild the widget? #58

Closed nadhirfr closed 3 years ago

nadhirfr commented 4 years ago

Is your feature request related to a problem? Please describe. I want to add a button to change the width of the dayview in WeekView class. I found out that dayViewWidth property in WeekViewStyle is final, which I could not change once it initialized.

Is there any advice about this one?

Thanks

Skyost commented 4 years ago

You could always try to put the week view in a stateful widget and change the width via setState.

nadhirfr commented 4 years ago

Hello @Skyost ,

I tried to put the week view in a stateful widget. Then change the weekViewStyle attribute via setState. However only dayViewSeparatorWidth and headerSize are changed, the widget rebuild, but dayViewWidth doesn't change.

Android-Emulator-Pixel-2-API-30

Skyost commented 4 years ago

Oh I see. I may need to check didUpdateWidget in the week view.

Skyost commented 4 years ago

@nadhirfr I fixed it in 741acc128950fdb6975c4e0c1ce188168ba9af32 (I hope), could you please tell me if it works for you ? You can try the changes using :

dependencies:
  flutter_week_view:
    git:
      url: https://github.com/Skyost/FlutterWeekView
      ref: master

(in your pubspec.yml)

nadhirfr commented 4 years ago

Hi @Skyost checked and got following result: Android-Emulator-Pixel-2-API-30 14-09-20 2

I think the width of the event changed, but not with the Day View width. And the scrolling is back to the first day

Skyost commented 4 years ago

Thanks for checking out @nadhirfr. I think I still have to call a setState somewhere...

Skyost commented 4 years ago

I think it should be fixed now. Could you try it by running pub upgrade @nadhirfr ?