Among Stars Animation

A Flutter package that generates animated star-like widgets, perfect for creating dynamic space-themed backgrounds. Created by Omer Genc with the psuedonym Harvey Jones.

Features

  • Generate a customizable number of star widgets
  • Each star contains a random celestial image
  • Stars are circular and have a glow effect
  • Customizable size range for the stars
  • Easy to integrate into any Flutter project to create a space ambiance

Among Stars Animation Demo

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  among_stars_animation: ^1.0.0

Then run:

$ flutter pub get

Usage

First, import the package in your Dart code:

import 'package:among_stars_animation/among_stars_animation.dart';

To generate a list of star widgets:

List<Widget> stars = generateStarWidgets();

You can customize the number of stars and their size range:

List<Widget> customStars = generateStarWidgets(
  count: 100,
  minSize: 2,
  maxSize: 10,
);

Example: Creating a starry background

Stack(
  children: [
    Container(color: Colors.black), // Space background
    ...generateStarWidgets().map((star) {
      return Positioned(
        left: Random().nextDouble() * MediaQuery.of(context).size.width,
        top: Random().nextDouble() * MediaQuery.of(context).size.height,
        child: star,
      );
    }).toList(),
    YourMainContent(),
  ],
)

Customization

The generateStarWidgets function accepts the following parameters:

  • count: The number of stars to generate (default: 50)
  • minSize: The minimum size of a star in logical pixels (default: 2)
  • maxSize: The maximum size of a star in logical pixels (default: 10)

Contributing

Contributions are welcome! If you'd like to improve the Among Stars Animation package, please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Libraries