getPageViewDayHeaderText function

Widget getPageViewDayHeaderText(
  1. int diff,
  2. DateTime date
)

Implementation

Widget getPageViewDayHeaderText(int diff, DateTime date) {
  if (diff.abs() > 14) {
    final text = dateWithWeekDay(date.toString().split(' ')[0]);
    return SmallHeadline(
        text: '${text.split(',')[0]},${text.split(',')[1]}',
        color: Colors.white.withOpacity(0.9),
        shadowed: true,
        size: 18);
  } else if (diff.abs() > 7) {
    final text = dateWithWeekDay(date.toString().split(' ')[0])
        .split(',')[0]
        .substring(0, 3);
    return SmallTitle(
        text: 'Next $text',
        color: Colors.white.withOpacity(0.9),
        shadowed: true);
  } else if (diff.abs() > 1) {
    final text = dateWithWeekDay(date.toString().split(' ')[0]).split(',')[0];
    return SmallTitle(
        text: text, color: Colors.white.withOpacity(0.9), shadowed: true);
  } else if (diff == -1) {
    return SmallTitle(
        text: 'Yesterday',
        color: Colors.white.withOpacity(0.9),
        shadowed: true);
  } else if (diff == 0) {
    return SmallTitle(
        text: 'Today', color: Colors.white.withOpacity(0.9), shadowed: true);
  } else {
    return SmallTitle(
        text: 'Tomorrow', color: Colors.white.withOpacity(0.9), shadowed: true);
  }
}