fluffychat/lib/utils/room_extension.dart

16 lines
513 B
Dart
Raw Normal View History

2020-01-19 15:07:42 +01:00
import 'package:famedlysdk/famedlysdk.dart';
2020-01-20 13:46:39 +01:00
import 'package:fluffychat/i18n/i18n.dart';
2020-01-19 15:07:42 +01: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 16:56:13 +01:00
!this.isDirectChat &&
(this.mHeroes != null && this.mHeroes.isNotEmpty)) {
2020-01-20 13:46:39 +01:00
return I18n.of(context).groupWith(this.displayname);
2020-01-19 15:07:42 +01:00
}
return this.displayname;
}
}