优化状态切换

This commit is contained in:
DelLevin-Home
2026-08-12 21:01:54 +08:00
parent 98d8350693
commit e543618139
8 changed files with 957 additions and 606 deletions

View File

@@ -7,11 +7,15 @@ class ShimmerSkeleton extends StatefulWidget {
final double height;
final double borderRadius;
/// 覆盖默认颜色(默认 surfaceContainerHighest在深色背景上对比弱时可用
final Color? color;
const ShimmerSkeleton({
super.key,
required this.width,
required this.height,
this.borderRadius = 6,
this.color,
});
@override
@@ -44,6 +48,7 @@ class _ShimmerSkeletonState extends State<ShimmerSkeleton>
@override
Widget build(BuildContext context) {
final colors = Theme.of(context).colorScheme;
final baseColor = widget.color ?? colors.surfaceContainerHighest;
return AnimatedBuilder(
animation: _animation,
builder: (context, child) {
@@ -51,7 +56,7 @@ class _ShimmerSkeletonState extends State<ShimmerSkeleton>
width: widget.width,
height: widget.height,
decoration: BoxDecoration(
color: colors.surfaceContainerHighest.withValues(alpha: _animation.value),
color: baseColor.withValues(alpha: _animation.value),
borderRadius: BorderRadius.circular(widget.borderRadius),
),
);