moon_phase 1.0.1+8 copy "moon_phase: ^1.0.1+8" to clipboard
moon_phase: ^1.0.1+8 copied to clipboard

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

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:moon_phase/moon_widget.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('MoonWidget example app'),
        ),
        body: Center(
          child: Padding(
            padding: const EdgeInsets.all(30.0),
            child: Wrap(
              spacing: 10,
              runSpacing: 10,
              direction: Axis.horizontal,
              children: _moonPhases(),
            ),
          ),
        ),
      ),
    );
  }

  _moonPhases() {
    var _list = <Widget>[];
    for (int i = 0; i < 30 * (24 / 12); i++) {
      _list.add(
        MoonWidget(
          date: DateTime(2021, 10, 6, 5).add(Duration(hours: i * 12)),
          resolution: 64,
          size: 48,
          moonColor: Colors.amber,
          earthshineColor: Colors.blueGrey.shade900,
        ),
      );
    }
    return _list;
  }
}
17
likes
130
pub points
73%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (LICENSE)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on moon_phase