FurryChat/lib/utils/room_extension.dart

16 lines
513 B
Dart
Raw Normal View History

2020-01-19 14:07:42 +00:00
import 'package:famedlysdk/famedlysdk.dart';
2020-01-20 12:46:39 +00:00
import 'package:fluffychat/i18n/i18n.dart';
2020-01-19 14:07:42 +00:00
import 'package:flutter/material.dart';
extension LocalizedRoomDisplayname on Room {
String getLocalizedDisplayname(BuildContext context) {
if ((this.name?.isEmpty ?? true) &&
(this.canonicalAlias?.isEmpty ?? true) &&
2020-01-19 15:56:13 +00:00
!this.isDirectChat &&
(this.mHeroes != null && this.mHeroes.isNotEmpty)) {
2020-01-20 12:46:39 +00:00
return I18n.of(context).groupWith(this.displayname);
2020-01-19 14:07:42 +00:00
}
return this.displayname;
}
}