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