weather_icons library

Library using erikflowers/WeatherIcons in a Flutter app.

WeatherIcons class contains all of the icons. Along with a helper function converting from CSS class names to the IconData.

Example:

// Using the regular Icon can have some display issues
IconButton(
  icon: Icon(WeatherIcons.rain),
  onPressed: () { print("Hello World"); }
);

// Try using BoxedIcon to properly set its bounds
IconButton(
  icon: BoxedIcon(WeatherIcons.rain),
  onPressed: () { print("Hello World"); }
);

WindIcon is a helper widget for creating a rotated wind symbol.

Note: WindIcon automatically uses the BoxedIcon widget.

Example Wind usage:

// Using a preset degree
IconButton(
  icon: WindIcon.towards_ne,
  onPressed: () { print("Hello World"); }
);

// Using a custom degree between 0-360
IconButton(
  icon: WindIcon(degree: 45),
  onPressed: () { print("Hello World"); }
);

TimeIcon is a helper class for creating the different time icons.

Example time usage:

// Manual hour
IconButton(
  icon: Icon(TimeIcon.iconFromHour(3)),
  onPressed: () { print("Displaying the third hour!"); }
);

// Using a [DateTime] instance
IconButton(
  icon: Icon(TimeIcon.iconFromDate(DateTime())),
  onPressed: () { print("Current hour"); }
);

// Creating your own [Icon]
Icon(
  icon: Icon(TimeIcon.fromHour(3)),
  size: 60,
)

Note the WeatherIcons data is auto-generated by scraping the font webpage, and the font file is downloaded automatically.

Classes

BoxedIcon
Create a consistent Icon for WeatherIcons.
TimeIcon
Collection of helper functions for getting a time icon.
WeatherIcons
All of WeatherIcons in the form of static IconData variables.
WindIcon
Create a rotated 'wind' Icon using an degree between 0-360.