twinkling_stars 1.0.3
twinkling_stars: ^1.0.3 copied to clipboard
A customizable twinkling star background for Flutter apps, supporting multi-color and multiple shapes.
π Twinkling Stars #
A beautiful, customizable twinkling star background widget for Flutter apps.
Supports multiple star shapes, colors, and star sizes. Perfect to decorate your UI with starry backgrounds.
π§ Installation #
Add the package to your pubspec.yaml
dependencies:
dependencies:
twinkling_stars: ^1.0.3
Then run:
flutter pub get
βοΈ Features #
- Customizable number of stars (
starCount
) - Option to include big stars (
includeBigStars
) - Supports multiple star colors (
starColors
) - Supports multiple star shapes (
starShapes
) - Custom star size multiplier (
sizeMultiplier
) - Can be used with multiple widgets/screens independently
- Allows a child widget to be placed over the star background
π Usage #
Wrap your widget with TwinklingStarsBackground
:
TwinklingStarsBackground(
starCount: 150,
includeBigStars: true,
sizeMultiplier: 1.5,
starColors: [
Colors.white,
Colors.lightBlueAccent,
Colors.amberAccent,
Colors.pinkAccent,
],
starShapes: [
StarShape.star5,
StarShape.diamond,
StarShape.fivePoint,
StarShape.sparkle4,
],
child: Center(
child: Container(
padding: const EdgeInsets.all(24),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.6),
borderRadius: BorderRadius.circular(16),
),
child: const Text(
'Twinkling Stars β¨',
style: TextStyle(
fontSize: 28,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
)
π Properties #
Property | Type | Description |
---|---|---|
starCount | int | Total number of stars to display |
includeBigStars | bool | Whether to include some larger stars |
starColors | List | List of colors used randomly for the stars |
starShapes | List | List of star shapes used randomly for the stars |
sizeMultiplier | double | Multiplies the base size of all stars (default: 1.0) |
child | Widget | Widget displayed on top of the star background |
πΈ Preview #
π Example #
See the full example in the example/main.dart
file.