From 1fadd850b74201bf88b772d4f4e98b5db84f925d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 6 Jan 2025 21:46:21 +0800 Subject: [PATCH] :lipstick: Optimize some styling --- lib/theme.dart | 2 +- lib/widgets/universal_image.dart | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/theme.dart b/lib/theme.dart index c2123f3..287d65e 100644 --- a/lib/theme.dart +++ b/lib/theme.dart @@ -48,7 +48,7 @@ Future createAppTheme( appBarTheme: AppBarTheme( centerTitle: true, elevation: hasAppBarBlurry ? 0 : null, - backgroundColor: hasAppBarBlurry ? colorScheme.surfaceContainer.withAlpha(200) : colorScheme.primary, + backgroundColor: hasAppBarBlurry ? colorScheme.primary.withAlpha(200) : colorScheme.primary, foregroundColor: hasAppBarBlurry ? colorScheme.onSurface : colorScheme.onPrimary, ), scaffoldBackgroundColor: Colors.transparent, diff --git a/lib/widgets/universal_image.dart b/lib/widgets/universal_image.dart index 4a4aa17..54b2aaa 100644 --- a/lib/widgets/universal_image.dart +++ b/lib/widgets/universal_image.dart @@ -55,17 +55,20 @@ class UniversalImage extends StatelessWidget { ? null : (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) { if (loadingProgress == null) return child; - return Center( - child: TweenAnimationBuilder( - tween: Tween( - begin: 0, - end: loadingProgress.expectedTotalBytes != null - ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes! - : 0, - ), - duration: const Duration(milliseconds: 300), - builder: (context, value, _) => CircularProgressIndicator( - value: loadingProgress.expectedTotalBytes != null ? value.toDouble() : null, + return Container( + constraints: BoxConstraints(maxHeight: 80), + child: Center( + child: TweenAnimationBuilder( + tween: Tween( + begin: 0, + end: loadingProgress.expectedTotalBytes != null + ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes! + : 0, + ), + duration: const Duration(milliseconds: 300), + builder: (context, value, _) => CircularProgressIndicator( + value: loadingProgress.expectedTotalBytes != null ? value.toDouble() : null, + ), ), ), );