background 1.3.1
background: ^1.3.1 copied to clipboard
A Flutter package to display images or videos as backgrounds.
πΌοΈ 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