LoadingContainerWidget
The LoadingContainerWidget
is a customizable, animated loading widget for Flutter applications. It provides a shimmering effect by sliding a secondary color over a primary color, giving the appearance of a content placeholder being loaded. The animation is cyclic, ensuring a continuous loading effect.
Buy Me A Coffee ☕️
Installation
Add the following line to your pubspec.yaml
file:
dependencies:
loading_container: ^0.0.1
Features
- Customizable
Width
andHeight
: Adjust the dimensions of the widget as required. Color
Customization: Define primary and secondary colors for the shimmer effect.- Custom
BorderRadius
: Set a custom border radius for the container. - Custom
Box Decoration
: If more customization is required, a custom box decoration can be
Properties
colorOne
: The primary color of the container. Default isColor(0xFFE5E5E5)
.colorTwo
: The secondary color that slides over the primary color to create the shimmer effect. Default isColor(0xFFF0F0F0)
.width
: The width of the container. Default isdouble.infinity
.height
: The height of the container. Default is50
.borderRadius
: The border radius of the container. Default is8.0
.boxDecoration
: An optional customBoxDecoration
for the container.duration
: The duration of the shimmering animation. Default is750 milliseconds
.
Usage
LoadingContainerWidget(
width: 200,
height: 50,
colorOne: Colors.grey[300],
colorTwo: Colors.grey[100],
borderRadius: BorderRadius.circular(10),
duration: Duration(milliseconds: 800),
)
Note
Ensure the widget is properly disposed to avoid potential memory leaks related to the animation controller.