Giter Club home page Giter Club logo

Comments (9)

akuma06 avatar akuma06 commented on July 20, 2024 1

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.

akuma06 avatar akuma06 commented on July 20, 2024 1

@dooboolab I will be PRing this after resolving the previous PR (since it's kind of based on it).

from flutter_calendar_carousel.

hyochan avatar hyochan commented on July 20, 2024

I don't quite get what you want here.
image

You can set markedDateWidget and also markedDatesMap that gets the Datetime and the number of marked uis.

from flutter_calendar_carousel.

bigboateng avatar bigboateng commented on July 20, 2024

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.

image

from flutter_calendar_carousel.

hyochan avatar hyochan commented on July 20, 2024

I see what you mean. I will try this soon.

from flutter_calendar_carousel.

aqibgatoo avatar aqibgatoo commented on July 20, 2024

@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.

hyochan avatar hyochan commented on July 20, 2024

@akuma06 Could you provide the PR for this?

from flutter_calendar_carousel.

hyochan avatar hyochan commented on July 20, 2024

Thanks for your great work!

from flutter_calendar_carousel.

hyochan avatar hyochan commented on July 20, 2024

This can be closed for now.

from flutter_calendar_carousel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.