state property

InlineTimerState get state

Implementation

InlineTimerState get state {
  final current = now;
  if (startsAt != null && current.isBefore(startsAt!)) {
    return InlineTimerState.teaser;
  }
  if (!current.isBefore(deadline)) return InlineTimerState.ended;
  final threshold = urgentBelowSeconds;
  if (threshold != null &&
      (deadline.difference(current).inMilliseconds + 999) ~/ 1000 <=
          threshold) {
    return InlineTimerState.urgent;
  }
  return InlineTimerState.running;
}