FurryChat/lib/utils/room_extension.dart
2020-01-20 13:46:39 +01:00

16 lines
487 B
Dart

import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/i18n/i18n.dart';
import 'package:flutter/material.dart';
extension LocalizedRoomDisplayname on Room {
String getLocalizedDisplayname(BuildContext context) {
if ((this.name?.isEmpty ?? true) &&
(this.canonicalAlias?.isEmpty ?? true) &&
!this.isDirectChat &&
this.mHeroes.isNotEmpty) {
return I18n.of(context).groupWith(this.displayname);
}
return this.displayname;
}
}