censor 1.0.2
censor: ^1.0.2 copied to clipboard
A Flutter widget that creates a TV static/noise effect for censoring content.
Censor #
A Flutter widget that overlays animated black and white particles on top of any child widget when censored, creating a TV static/noise effect for hiding sensitive content.
Demo example #

Features #
- 🎭 Overlay animated particles pattern on any widget
- ⚡ Smooth, efficient animation using CustomPainter
- 🎨 Customizable particles size, spacing, and animation speed
- 🔧 Works with any child widget (Text, Image, Container, etc.)
- 📦 Zero dependencies (uses only Flutter SDK)
Getting started #
Add this to your package's pubspec.yaml file:
dependencies:
censor:
path: ../censor # Or your package path
Then run:
flutter pub get
Usage #
Basic Example #
import 'package:censor/censor.dart';
Censor(
censored: true,
child: Text(
'Secret Information',
style: TextStyle(fontSize: 24),
),
)
Advanced Example with Custom Settings #
Censor(
censored: shouldCensor,
particlesSize: 4.0, // Size of each particles
particlesSpacing: 5.0, // Space between particless
animationSpeed: 2.0, // Animation speed multiplier
child: Container(
width: 200,
height: 150,
child: Image.network('https://example.com/image.jpg'),
),
)
Interactive Example #
class MyWidget extends StatefulWidget {
@override
State<MyWidget> createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> {
bool _isCensored = true;
@override
Widget build(BuildContext context) {
return Column(
children: [
Censor(
censored: _isCensored,
child: Text('Confidential Data'),
),
ElevatedButton(
onPressed: () => setState(() => _isCensored = !_isCensored),
child: Text(_isCensored ? 'Reveal' : 'Hide'),
),
],
);
}
}
Parameters #
| Parameter | Type | Default | Description |
|---|---|---|---|
child |
Widget |
required | The widget to be censored |
censored |
bool |
required | Whether to show the censored overlay |
particlesSize |
double |
3.0 |
The size of each particle in pixels |
particlesSpacing |
double |
4.0 |
The spacing between particles in pixels |
animationSpeed |
double |
1.0 |
Animation speed multiplier (higher = faster) |
How It Works #
The Censor widget uses a Stack to overlay a CustomPaint widget on top of the child when censored is true. The CustomPaint uses an AnimationController to continuously redraw random black and white particles, creating the animated static effect.
Additional information #
For more examples, check the /example folder in the repository.
To report issues or contribute, please visit the repository.