21 lines
695 B
Dart
21 lines
695 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../model/endpointData.dart';
|
|
|
|
class UserAvatar extends StatelessWidget {
|
|
final String username;
|
|
final bool isGroup;
|
|
const UserAvatar({required this.username, this.isGroup = false, super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CircleAvatar(
|
|
foregroundImage: !isGroup ? Image.network("https://${EndpointData().nextcloud().full()}/avatar/$username/128").image : null,
|
|
backgroundColor: Theme.of(context).primaryColor,
|
|
foregroundColor: Colors.white,
|
|
onForegroundImageError: !isGroup ? (o, t) {} : null,
|
|
child: isGroup ? const Icon(Icons.group) : const Icon(Icons.person),
|
|
);
|
|
}
|
|
}
|