diff --git a/example/lib/src/common/widget/text_placeholder.dart b/example/lib/src/common/widget/text_placeholder.dart index 71fc326..2650b19 100644 --- a/example/lib/src/common/widget/text_placeholder.dart +++ b/example/lib/src/common/widget/text_placeholder.dart @@ -1,3 +1,5 @@ +import 'dart:math' as math; + import 'package:example/src/common/widget/shimmer.dart'; import 'package:flutter/material.dart'; @@ -16,9 +18,14 @@ class TextPlaceholder extends StatelessWidget { final Size size; @override - Widget build(BuildContext context) => Shimmer( - size: size, - color: Colors.grey[400], - backgroundColor: Colors.grey[100], + Widget build(BuildContext context) => LayoutBuilder( + builder: (context, constraints) => Shimmer( + size: Size( + math.min(size.width, constraints.maxWidth - 16), + size.height, + ), + color: Colors.grey[400], + backgroundColor: Colors.grey[100], + ), ); } diff --git a/example/lib/src/feature/account/widget/profile_screen.dart b/example/lib/src/feature/account/widget/profile_screen.dart index fa08fed..e9f709c 100644 --- a/example/lib/src/feature/account/widget/profile_screen.dart +++ b/example/lib/src/feature/account/widget/profile_screen.dart @@ -46,26 +46,26 @@ class ProfileScreen extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - TextPlaceholder(height: 16, width: 128), + TextPlaceholder(height: 16, width: 64), const SizedBox(height: 12), Padding( padding: const EdgeInsets.only(left: 8), - child: TextPlaceholder(height: 14, width: 200), + child: TextPlaceholder(height: 14, width: 100), ), const SizedBox(height: 8), Padding( padding: const EdgeInsets.only(left: 8), - child: TextPlaceholder(height: 14, width: 256), + child: TextPlaceholder(height: 14, width: 128), ), const SizedBox(height: 8), Padding( padding: const EdgeInsets.only(left: 8), - child: TextPlaceholder(height: 14, width: 164), + child: TextPlaceholder(height: 14, width: 72), ), const SizedBox(height: 8), Padding( padding: const EdgeInsets.only(left: 8), - child: TextPlaceholder(height: 14, width: 225), + child: TextPlaceholder(height: 14, width: 92), ), ], ),