Comments (9)
I've modified the widget to have this for my personal use with also square or line markers. For that I've modified the API to accept a Map<DateTime, List<DateMarkWidget>>
.
Therefore, when you provide the markers to the Calendar widget, you need to generate before all the widget for the month.
It's not a callback function in order to prevent it to stop the month widget to display the dates. If you have to perform some actions on each date to return the correct widget, the Calendar Widget will have to wait until you return the widget to process the following date.
So I've kept the current way the widgets are added to the calendar with some tweaks. When the month (or week) is changed, it emits an event which can be listened from the parent widget onMonthChanged(DateTime)
. This tells the parent widget that the month have changed and which date is actually displayed (first day of the month or first day of the week displayed). You can listen to it and generates the marked dates widget in a List<DateMarkWidget>
for each day and add them into a Map<DateTime, List<DateMarkWidget>>
and finally change the state of the parent widget.
There is also a helper from the DateMarkWidget
which can create the widget wanted: DateMarkWidget.square
, DateMarkWidget.dot
, DateMarkWidget.line
or DateMarkWidget.custom
(for custom widget).
So the final behavior is: the calendar is first displayed without marking, the calendar tells the current month displayed, the parent widget generates the marked widgets, the parent widget update its state, the calendar widget receive the new marked dates and update itself.
Tip: The devs can also add a loading animation when generating the marked widgets to tell the user that the month is not fully displayed yet.
If it's what was intended, I can prepare a PR with what I've modified/added.
from flutter_calendar_carousel.
@dooboolab I will be PRing this after resolving the previous PR (since it's kind of based on it).
from flutter_calendar_carousel.
I don't quite get what you want here.
You can set markedDateWidget
and also markedDatesMap
that gets the Datetime
and the number of marked uis.
from flutter_calendar_carousel.
I want to have different marked date widgets on the same date. The current method makes the marked dates same color or same widget. So some function which says on 28th return a list of markedDate widgets.
from flutter_calendar_carousel.
I see what you mean. I will try this soon.
from flutter_calendar_carousel.
@akuma06 can you share you work as a gist for the time being..i also need to listen to month changes and also render different widgets for different dates
from flutter_calendar_carousel.
@akuma06 Could you provide the PR
for this?
from flutter_calendar_carousel.
Thanks for your great work!
from flutter_calendar_carousel.
This can be closed for now.
from flutter_calendar_carousel.
Related Issues (20)
- Flutter FlatButton is deprecated HOT 2
- Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null. HOT 3
- Not an error but warning. WidgetsBinding now cannot be null.
- Days in spanish
- Heigth control responsive HOT 1
- Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null. HOT 2
- Changing firstDayOfWeek doesn't have any effect HOT 2
- intl Version issues HOT 1
- How to change the horizontal swipe animation ?
- Flutter Calendar carousel onCalendarChanged event call twice HOT 2
- Dependency Dashboard
- Not displaying next month starting Days HOT 1
- Calendar does not update on date change HOT 5
- Calendar header text: It will be better to have builder function instead of string property HOT 1
- this is not issues.this an offer to develop it HOT 1
- Add a controller HOT 1
- Please upgrade the intl version as it is conflicting with other packages HOT 2
- CalendarWidget Rendering Extra Blank Row in ListView HOT 1
- broken dependency due to flutter upgrade to latest release, localizations is pinned to intl 1.9.0 and and this lib to 1.8.0 HOT 5
- Default Colors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_calendar_carousel.