DayNightTheme constructor

DayNightTheme({
  1. required Widget builder(
    1. ThemeData currentTheme
    ),
  2. required ThemeData darkTheme,
  3. required ThemeData lightTheme,
  4. int sunriseHour = 6,
  5. int sunriseMinutes = 0,
  6. int sunsetMinutes = 0,
  7. int sunsetHour = 19,
})

Implementation

DayNightTheme({
  required this.builder,
  required this.darkTheme,
  required this.lightTheme,
  this.sunriseHour = 6,
  this.sunriseMinutes = 0,
  this.sunsetMinutes = 0,
  this.sunsetHour = 19,
}) {
  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');
}