Skip to content

Commit

Permalink
* Added isLoading param to LoaderShimmer
Browse files Browse the repository at this point in the history
* Updated version
  • Loading branch information
rithik-dev committed Mar 31, 2022
1 parent 5af58ad commit 7caff36
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.0.8] - 31/03/2022

* Added isLoading param to LoaderShimmer

## [1.0.7] - 31/03/2022

* Added some helper getters/functions in PaginatedItemsResponse.
Expand Down
25 changes: 17 additions & 8 deletions lib/src/loader_shimmer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,36 @@ class LoaderShimmer extends StatelessWidget {
/// The shimmer's direction. Defaults to [ShimmerConfig.direction].
final ShimmerDirection? direction;

/// Whether the shimmer is active or not.
final bool isLoading;

/// The child.
final Widget child;

const LoaderShimmer({
Key? key,
required this.child,
this.baseColor,
this.highlightColor,
this.duration,
this.direction,
required this.child,
this.isLoading = true,
}) : super(key: key);

@override
Widget build(BuildContext context) {
final shimmerConfig = PaginatedItemsBuilder.config!.shimmerConfig;

return Shimmer.fromColors(
highlightColor: highlightColor ?? shimmerConfig.highlightColor,
baseColor: baseColor ?? shimmerConfig.baseColor,
period: duration ?? shimmerConfig.duration,
direction: direction ?? shimmerConfig.direction,
child: child,
);
if (isLoading) {
return Shimmer.fromColors(
highlightColor: highlightColor ?? shimmerConfig.highlightColor,
baseColor: baseColor ?? shimmerConfig.baseColor,
period: duration ?? shimmerConfig.duration,
direction: direction ?? shimmerConfig.direction,
child: child,
);
} else {
return child;
}
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: paginated_items_builder
description: Easier to display items in a list/grid view from your controllers directly or handling state internally with support for pagination.
version: 1.0.7
version: 1.0.8
homepage: https://github.com/rithik-dev/paginated_items_builder

environment:
Expand Down

0 comments on commit 7caff36

Please sign in to comment.