DayNightThemeChanger constructor

DayNightThemeChanger(
  1. ThemeData lightTheme,
  2. ThemeData darkTheme,
  3. int sunsetHour,
  4. int sunsetMinutes,
  5. int sunriseHour,
  6. int sunriseMinutes,
)

Implementation

DayNightThemeChanger(
  this.lightTheme,
  this.darkTheme,
  this.sunsetHour,
  this.sunsetMinutes,
  this.sunriseHour,
  this.sunriseMinutes,
) {
  DateTime now = CustomDateTime.current;
  DateTime sunriseTime =
      DateTime(now.year, now.month, now.day, sunriseHour, sunriseMinutes);
  DateTime sunsetTime =
      DateTime(now.year, now.month, now.day, sunsetHour, sunsetMinutes);
  assert(sunriseTime.isBefore(sunsetTime),
      'sunrise time must be less than sunset time');
  _init();
}