|
1 | 1 | import 'dart:math' as math; |
2 | | -import 'dart:ui'; |
3 | 2 |
|
4 | 3 | import 'package:dart_bbcode_web_colors/dart_bbcode_web_colors.dart'; |
5 | 4 | import 'package:easy_refresh/easy_refresh.dart'; |
@@ -33,6 +32,7 @@ import 'package:tsdm_client/utils/show_dialog.dart'; |
33 | 32 | import 'package:tsdm_client/utils/show_toast.dart'; |
34 | 33 | import 'package:tsdm_client/widgets/attr_block.dart'; |
35 | 34 | import 'package:tsdm_client/widgets/cached_image/cached_image.dart'; |
| 35 | +import 'package:tsdm_client/widgets/cached_image/cached_image_provider.dart'; |
36 | 36 | import 'package:tsdm_client/widgets/debounce_buttons.dart'; |
37 | 37 | import 'package:tsdm_client/widgets/heroes.dart'; |
38 | 38 | import 'package:tsdm_client/widgets/icon_chip.dart'; |
@@ -313,35 +313,32 @@ class _ProfilePageState extends State<ProfilePage> { |
313 | 313 | minRadius: _appBarAvatarHeight / 2, |
314 | 314 | ), |
315 | 315 | ); |
316 | | - |
317 | 316 | if (userProfile.avatarUrl != null) { |
318 | 317 | flexSpace = Stack( |
319 | 318 | // Disable clip, let profile avatar show outside the stack. |
320 | 319 | clipBehavior: Clip.none, |
321 | 320 | children: [ |
322 | 321 | // Background blurred image. |
323 | 322 | Positioned.fill( |
324 | | - // Why we can not add padding here? |
325 | | - child: Column( |
326 | | - children: [ |
327 | | - // The height of color box is decided by the sigma in image filtered. |
328 | | - Container( |
329 | | - color: Theme.of(context).colorScheme.surfaceContainerLowest, |
330 | | - height: _appBarBackgroundTopPadding, |
| 323 | + child: Container( |
| 324 | + decoration: BoxDecoration( |
| 325 | + image: DecorationImage( |
| 326 | + image: CachedImageProvider(userProfile.avatarUrl!), |
| 327 | + fit: .fitWidth, |
| 328 | + isAntiAlias: true, |
331 | 329 | ), |
332 | | - Expanded( |
333 | | - child: Row( |
334 | | - children: [ |
335 | | - Expanded( |
336 | | - child: ImageFiltered( |
337 | | - imageFilter: ImageFilter.blur(sigmaX: 16, sigmaY: 16), |
338 | | - child: CachedImage(userProfile.avatarUrl!, fit: BoxFit.cover, enableAnimation: false), |
339 | | - ), |
340 | | - ), |
341 | | - ], |
342 | | - ), |
| 330 | + ), |
| 331 | + foregroundDecoration: BoxDecoration( |
| 332 | + gradient: LinearGradient( |
| 333 | + colors: [ |
| 334 | + Theme.of(context).colorScheme.surfaceContainerLowest.withValues(alpha: 0.6), |
| 335 | + Theme.of(context).colorScheme.surfaceContainerLowest, |
| 336 | + ], |
| 337 | + begin: .topCenter, |
| 338 | + end: .bottomCenter, |
| 339 | + stops: const [0.0, 0.55], |
343 | 340 | ), |
344 | | - ], |
| 341 | + ), |
345 | 342 | ), |
346 | 343 | ), |
347 | 344 | // Background color under avatar, height is half of avatar height. |
|
0 commit comments