Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative to background canvas painter #46

Closed
caiogranero opened this issue Jul 8, 2020 · 5 comments
Closed

Alternative to background canvas painter #46

caiogranero opened this issue Jul 8, 2020 · 5 comments
Assignees
Labels
enhancement New feature or request question Further information is requested

Comments

@caiogranero
Copy link

Hi :)

I'm using the version 0.2.1+6 in my app and i want to update to the package latest version but i was using the eventsColumnBackgroundPainter property in DayView and now this property doest not exists and now i don't find a alternative since the remove of the property.

Previously i created a inheritance with the EventsColumnBackgroundPainter class because i needed a padding left in content.

My code:

class CalendarDayViewBackgroundPainter extends EventsColumnBackgroundPainter {
  final double left;

  CalendarDayViewBackgroundPainter({
    backgroundColor,
    rulesColor,
    this.left = 0 // This is my change
  }) : super (
    backgroundColor: backgroundColor,
    rulesColor:rulesColor,
  );

  @override
  void paint(Canvas canvas, Size size) {
    if (backgroundColor != null) {
      canvas.drawRect(Rect.fromLTWH(0, 0, size.width, size.height), Paint()..color = backgroundColor);
    }

    if (rulesColor != null) {
      for (int hour = 1; hour < 24; hour++) {
        double topOffset = topOffsetCalculator(hour);
        Paint paint = Paint();
        paint.color = rulesColor;
        paint.strokeWidth = 1;
        canvas.drawLine(Offset(left, topOffset), Offset(size.width, topOffset), paint);
      }
    }
  }
}

Is there an alternative to help me?

Thank you.

@caiogranero caiogranero added the enhancement New feature or request label Jul 8, 2020
@Skyost Skyost added the question Further information is requested label Jul 8, 2020
@Skyost
Copy link
Owner

Skyost commented Jul 8, 2020

I thought that nobody was using it at first, that's why I replaced it with easier properties (backgroundColor for example). Maybe I could do something for you 😉

@caiogranero
Copy link
Author

Yeah, i was using hahaha.

I will wait for this to update in my project, thank you!

@Skyost Skyost closed this as completed in 3e60e36 Jul 16, 2020
@Skyost
Copy link
Owner

Skyost commented Jul 16, 2020

Done ! You will have to override the DayViewStyle class in order to provide your custom implementation of createBackgroundPainter.

@caiogranero
Copy link
Author

caiogranero commented Jul 20, 2020

Hi, thank you so much, you rock!

When do you pretend release the new version?

@Skyost

@Skyost
Copy link
Owner

Skyost commented Jul 20, 2020

@caiogranero I don't know, I need to do some tests before but I'm currently very busy. I hope in two or three weeks. But you can test it using :

dependencies:
  flutter_week_view:
    git:
      url: https://github.com/Skyost/FlutterWeekView
      ref: master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants