🖼️ Background
A Flutter package to beautifully display images or videos as dynamic backgrounds for your screens. Perfect for splash screens, login UIs, onboarding flows, and more!
✨ Features
- Image Background – Displays a static image when a supported image file is passed
- Video Background – Loops and plays a muted video in the background automatically
- Overlay Support – Seamlessly renders your widgets on top of the background
- Auto File Type Detection – Automatically detects whether the background file is an image or a video
- Smooth & Clean UI – Delivers professional UI experiences out of the box
🎬 Demo
🎥 Video Background | 🖼️ Image Background |
---|---|
![]() |
![]() |
🚀 Getting Started
1. Install the package
Add to your pubspec.yaml
:
dependencies:
background: <latest version>
Or use the command line:
flutter pub add background
2. Import it
import 'package:background/background.dart';
💡 Usage Examples
🖼️ Image Background
@override
Widget build(BuildContext context) {
return Scaffold(
body: Background(
path: 'assets/png/image.png', // Your image asset path
child: Center(
child: Text(
'Hello, Farhan!',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
),
);
}
🎥 Video Background
@override
Widget build(BuildContext context) {
return Scaffold(
body: Background(
path: 'assets/video/video.mp4', // Your video asset path
child: Center(
child: Text(
'Hello, Farhan!',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
),
);
}
📁 Supported File Types
Type | Extensions |
---|---|
Image | .png , .jpg , .jpeg , .gif , .bmp , .webp |
Video | .mp4 , .mov , .avi , .mkv , .webm |
🛠️ Tips
- Make sure your video files are muted or use a player that supports muted autoplay.
- For mobile platforms, add video assets correctly in your
pubspec.yaml
under theassets:
section.
🤝 Contributing
Pull requests and stars are welcome! If you find a bug or have a feature request, feel free to open an issue.
📄 License
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Farhan Sadik Galib