Skip to content

Commit

Permalink
Update text placeholder sizes in profile screen
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed Dec 22, 2023
1 parent 6ad9241 commit 068ab18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
15 changes: 11 additions & 4 deletions example/lib/src/common/widget/text_placeholder.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math' as math;

import 'package:example/src/common/widget/shimmer.dart';
import 'package:flutter/material.dart';

Expand All @@ -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],
),
);
}
10 changes: 5 additions & 5 deletions example/lib/src/feature/account/widget/profile_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,26 @@ class ProfileScreen extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
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),
),
],
),
Expand Down

0 comments on commit 068ab18

Please sign in to comment.