Giter Site home page Giter Site logo

Comments (3)

aleksanderwozniak avatar aleksanderwozniak commented on May 9, 2024

I agree, adding holiday support sounds like a good idea.

As for customizing markers - have you tried using Calendar Builders? You can also take a look in example project.

Do you have any suggestions about displaying holiday rules? Eg. different text color / different background / additional markers (via builders)

from table_calendar.

espenandreassen79 avatar espenandreassen79 commented on May 9, 2024

Hello,

When it comes to Holiday support, I was thinking on an interface like "public bool IsHoliday(DateTime date)". Then people can write theire own logic into it.

When it comes to customizing markers:
I am new to Flutter/Dart, so I thought the example main.dart, line 220, was mandatory Text child.
child: Text(
'${events.length}',
style: TextStyle().copyWith(
color: Colors.white,
fontSize: 12.0,
),
Now, I have learned that I can replace Text to a Row of Images, if I want.

However, the Interface does only support ONE marker, and it is places in the right bottom. It would be great with yet another marker, in the left corner :)

Colors:
According to my calander that I find in the store. The holiday is marked in the color red, as same as sundays. That should be the default color, but people should be able to override it.

WeekendStyle: I don't like that you handle both Saturday and sunday the same. Many people work on saturday, and people has different salery on sauturday vs. sunday. You should have SaturdayStyle and SundayStyle instead of WeekendStyle, or maybe all of them.

Regards

from table_calendar.

aleksanderwozniak avatar aleksanderwozniak commented on May 9, 2024

#39 resolves all of this by adding revamped markers API and holiday support 🎉

First, update your package version to 1.2.0.

New markers API uses a list of widgets, instead of a single widget. This allows for a much more refined customization -> provide as many icons as you want. Then you can wrap each of them with Positioned widget to control their layout (see example project).

For holidays, take a look here.

As for splitting weekendStyle into 2 entities, I suggest a different solution - just use a custom Builder:

weekendDayBuilder: (context, date, _) {
  TextStyle style;

  if (date.weekday == 7) {
    // Sunday
    style = TextStyle().copyWith(color: Colors.red);
  } else {
    // Saturday
    style = TextStyle().copyWith(color: Colors.purple);
  }

  return Center(
    child: Text(
      '${date.weekday}',
      style: style,
    ),
  );
},

Note that you will also need to provide selectedDayBuilder and todayDayBuilder, but they follow the same template. Take a look at example project - then using them should be clear.

from table_calendar.

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.