Git Product home page Git Product logo

Comments (2)

kizitonwose avatar kizitonwose commented on June 30, 2024

Using the daysOfWeek() list, you can check if the CalendarDay.date.dayOfWeek is the first or last on the list and not apply the padding for those cases.

from calendar.

MarcLFJ avatar MarcLFJ commented on June 30, 2024

Thanks for the quick response.
I can see i forgot to mention that i also only show a blank space for dates outside of the current month showing.

But your solution helped me find a way when also using day.position.
I resorted to adding padding only to top and start and disabling when i was at the edges of the calendar.

Root container of the dayContent has the following applied to it's modifier:

Modifier
      .background(AppColor.Grey) // The color of the "border"
      .padding(
                      top = when {
                          day.position == DayPosition.OutDate -> spacing
                          day.position == DayPosition.InDate || isInFirstWeek -> 0.dp
                          else -> spacing
                      },
                      start = when {
                          day.position == DayPosition.InDate || isFirstDayOfWeek -> 0.dp
                          day.position == DayPosition.OutDate && date.dayOfMonth != 1 -> 0.dp
                          else -> spacing
                      },
                  )
      .background(AppColor.White)

Note: The DayPostion.InDate and DayPosition.OutDate is due to not showing dates from other months, but we still need to handle spacing for these, to have all "borders" aligned.

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