Edit profile

This commit is contained in:
2024-11-10 01:04:39 +08:00
parent ed2e44cc54
commit abc1d5a9d7
20 changed files with 928 additions and 60 deletions

View File

@ -4,7 +4,7 @@ import 'package:surface/providers/sn_network.dart';
import 'package:surface/widgets/universal_image.dart';
class AccountImage extends StatelessWidget {
final String content;
final String? content;
final Color? backgroundColor;
final Color? foregroundColor;
final double? radius;
@ -22,21 +22,21 @@ class AccountImage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final sn = context.read<SnNetworkProvider>();
final url = sn.getAttachmentUrl(content);
final url = sn.getAttachmentUrl(content ?? '');
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
return CircleAvatar(
key: Key('attachment-${content.hashCode}'),
radius: radius,
backgroundColor: backgroundColor,
backgroundImage: content.isNotEmpty
backgroundImage: (content?.isNotEmpty ?? false)
? ResizeImage(
UniversalImage.provider(url),
width: ((radius ?? 20) * devicePixelRatio * 2).round(),
height: ((radius ?? 20) * devicePixelRatio * 2).round(),
)
: null,
child: content.isEmpty
child: (content?.isEmpty ?? true)
? (fallbackWidget ??
Icon(
Icons.account_circle,