Skip to content

Commit

Permalink
Null safety for Shimmer effect (#10071)
Browse files Browse the repository at this point in the history
  • Loading branch information
agavrel authored Jan 31, 2024
1 parent 8cd1706 commit db6fa0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ class ShimmerState extends State<Shimmer> with SingleTickerProviderStateMixin {
);
// #enddocregion LinearGradient

bool get isSized => (context.findRenderObject() as RenderBox).hasSize;
bool get isSized =>
(context.findRenderObject() as RenderBox?)?.hasSize ?? false;

Size get size => (context.findRenderObject() as RenderBox).size;

Expand Down
3 changes: 2 additions & 1 deletion src/cookbook/effects/shimmer-loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,8 @@ class ShimmerState extends State<Shimmer> with SingleTickerProviderStateMixin {
_SlidingGradientTransform(slidePercent: _shimmerController.value),
);
bool get isSized => (context.findRenderObject() as RenderBox).hasSize;
bool get isSized =>
(context.findRenderObject() as RenderBox?)?.hasSize ?? false;
Size get size => (context.findRenderObject() as RenderBox).size;
Expand Down

0 comments on commit db6fa0b

Please sign in to comment.