moon_phase 1.2.1 copy "moon_phase: ^1.2.1" to clipboard
moon_phase: ^1.2.1 copied to clipboard

Flutter plugin that creates moon widgets according to the moon's phase.

moon_phase #

Flutter plugin that creates moon widgets according to the moon's phase.

Usage #

Simple (solid colors) #

MoonWidget.simple(
  date: DateTime.now(),
  size: 64,
  moonColor: Colors.amber,
  earthshineColor: Colors.black87,
)

Image (with background) #

MoonWidget.image(
  date: DateTime.now(),
  backgroundImageAsset: 'assets/moon.png',
  size: 64,
  shadowRatio: 0.8,
  earthshineColor: Colors.black87,
)

With phase label #

MoonWidget.simple(
  date: DateTime.now(),
  size: 64,
  labelPosition: MoonLabelPosition.bottom,
  labelStyle: TextStyle(fontSize: 12),
)

Pass phaseLabels to inject localized strings; missing keys fall back to MoonPhaseNameX.defaultLabels (English).

Parameters #

Parameter Description
date DateTime to display
size Widget size
pixelSize Shadow rendering precision (smaller = smoother)
moonColor Light side color (simple mode)
earthshineColor Dark side color
backgroundImageAsset Background image path (image mode)
shadowRatio Shadow radius ratio 0.0~1.0 (image mode)
labelPosition Label placement: top / bottom / left / right. null = no label
phaseLabels Map<MoonPhaseName, String> for i18n; falls back to defaults when a key is missing
labelStyle TextStyle applied to the label
labelSpacing Gap in logical pixels between moon and label (default 4)

Acknowledgements #

About #

21
likes
160
points
167
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter plugin that creates moon widgets according to the moon's phase.

Repository (GitHub)
View/report issues

License

GPL-3.0 (license)

Dependencies

flutter, flutter_web_plugins, web

More

Packages that depend on moon_phase

Packages that implement moon_phase