修复白屏BUG、UI 边界溢出 BUG
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:arcx/core/constants/app_defaults.dart';
|
||||
import 'package:arcx/data/local/models/models.dart';
|
||||
|
||||
/// Resolves a profile avatar to a local file when present, otherwise the
|
||||
/// default asset. Missing local files fall back safely (no FileImage crash).
|
||||
ImageProvider resolveAvatarImage(UserProfile? profile) {
|
||||
final path = profile?.avatarLocalPath?.trim();
|
||||
if (profile?.avatarSource == AvatarSource.localFile &&
|
||||
path != null &&
|
||||
path.isNotEmpty &&
|
||||
File(path).existsSync()) {
|
||||
return FileImage(File(path));
|
||||
}
|
||||
return const AssetImage(AppDefaults.defaultAvatarAssetPath);
|
||||
}
|
||||
Reference in New Issue
Block a user