You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.9 KiB
58 lines
1.9 KiB
part of '../neon_spreed.dart'; |
|
|
|
class SpreedRoomIcon extends StatelessWidget { |
|
const SpreedRoomIcon({ |
|
required this.roomType, |
|
this.roomName, |
|
this.backgroundColor, |
|
this.foregroundColor, |
|
super.key, |
|
}) : assert( |
|
(roomType != spreed.RoomType.oneToOne && roomType != spreed.RoomType.oneToOneFormer) || roomName != null, |
|
'roomName has to be set when roomType is oneToOne', |
|
); |
|
|
|
final spreed.RoomType roomType; |
|
final String? roomName; |
|
final Color? backgroundColor; |
|
final Color? foregroundColor; |
|
|
|
@override |
|
Widget build(final BuildContext context) { |
|
if (roomType == spreed.RoomType.oneToOne || roomType == spreed.RoomType.oneToOneFormer) { |
|
return NeonUserAvatar( |
|
username: roomName, |
|
account: NeonProvider.of<AccountsBloc>(context).activeAccount.value!, |
|
backgroundColor: backgroundColor, |
|
foregroundColor: foregroundColor, |
|
); |
|
} |
|
|
|
if (roomType == spreed.RoomType.changelog) { |
|
return CircleAvatar( |
|
radius: smallIconSize, |
|
backgroundColor: backgroundColor ?? Theme.of(context).colorScheme.primary, |
|
child: VectorGraphic( |
|
width: smallIconSize, |
|
height: smallIconSize, |
|
colorFilter: ColorFilter.mode(foregroundColor ?? Theme.of(context).colorScheme.onPrimary, BlendMode.srcIn), |
|
loader: const AssetBytesLoader( |
|
'assets/app.svg.vec', |
|
packageName: 'neon_spreed', |
|
), |
|
semanticsLabel: NeonLocalizations.of(context).nextcloudLogo, |
|
), |
|
); |
|
} |
|
|
|
if (roomType == spreed.RoomType.group || roomType == spreed.RoomType.public) { |
|
return NeonGroupAvatar( |
|
icon: roomType == spreed.RoomType.group ? Icons.group : Icons.public, |
|
backgroundColor: backgroundColor, |
|
foregroundColor: foregroundColor, |
|
); |
|
} |
|
|
|
throw UnimplementedError('Room type $roomType has no implemented icon'); |
|
} |
|
}
|
|
|