A glittering widget for Flutter.
What it does
This package provides three widgets:
- Glitters
- The main widget of this package that fades in and out glitter-like shapes one by one inside itself. This is useful when you want some part of your app to look shiny.
- GlitterStack
- A widget used to show multiple glitters by stacking them.
- SingleGlitter
- A widget to show a single static glitter-like shape.
Shape
Pre-defined glitter-like figure
const Glitters()
Icon
const Glitters.icon(
icon: Icons.star,
)
Widget
The Glitters.widget
constructor has no color parameter.
This may be a little less performant compared to glitters shown with other constructors.
const Glitters.widget(
child: Image.asset('assets/xxxxxx.png'),
)
Code examples
Simplest
Container(
width: 200.0,
height: 200.0,
color: Colors.black,
child: const Glitters(),
)
Multiple glitters
With Stack
:
SizedBox(
width: 200.0,
height: 200.0,
child: ColoredBox(
color: Colors.black,
child: Stack(
children: const [
Glitters(
duration: Duration(milliseconds: 200),
interval: Duration.zero,
color: Colors.orange,
maxOpacity: 0.7,
),
Glitters(
duration: Duration(milliseconds: 200),
interval: Duration.zero,
delay: Duration(milliseconds: 100),
color: Colors.white,
maxOpacity: 0.7,
),
],
),
),
)
With GlitterStack
:
const GlitterStack(
width: 200.0,
height: 200.0,
backgroundColor: Colors.black,
// You can set common settings for multiple glitters.
duration: Duration(milliseconds: 200),
interval: Duration.zero,
color: Colors.white,
maxOpacity: 0.7,
children: [
Glitters(
color: Colors.orange,
),
Glitters(
delay: Duration(milliseconds: 100),
),
],
)
A single static glitter
const ColoredBox(
color: Colors.black,
child: SingleGlitter(
maxWidth: 100.0,
maxHeight: 100.0,
aspectRatio: 0.8,
),
)