Closed luistrivelatto closed 4 years ago
Thanks for pointing this out. The problem is that internally, the WeekViewController
is instantiating a DayViewController
for each DayView
(this allows to scale them at the same time, to scroll them, etc...), therefore, the WeekViewController
is lost if we don't provide it a day view count ; and with a builder, it's not always possible to give an item count.
I think we should have to do an almost complete rewrite of WeekViewController
in order to fix this one.
The fix looks great, congrats :)
Describe the bug When using the WeekView.builder constructor, a dateCreator is required, but not a dateCount (which is in accordance to idiomatic builder constructors in Flutter). Indeed, the constructor allows that, with the assertion
assert(dateCount == null || dateCount >= 0)
. However this causes a crash whendateCount == null
and a WeekViewController isn't passed, since a WeekViewController is then instanced using dateCount, but WeekViewController itself doesn't allow for a null dateCount:assert(dayViewsCount != null && dayViewsCount > 0)
.To Reproduce Steps to reproduce the behavior:
_DemoWeekView
withExpected behavior No errors should be thrown, and the controllers should be managed seamlessly until
dateCreator
returns null for a given index.Smartphone (please complete the following information):