Commit 61e2cce9 authored by Wilko Manger's avatar Wilko Manger

Make context optional in nameOf function

parent 384d9196
......@@ -38,7 +38,7 @@ class ChatName extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureOrBuilder<String>(
futureOr: nameOf(context, room),
futureOr: nameOf(room, context),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.hasData) {
final name = snapshot.data;
......
......@@ -28,7 +28,7 @@ Url avatarUrlOf(Room room) =>
room.avatarUrl ??
(room.isDirect ? room.directUser.avatarUrl : room.avatarUrl);
FutureOr<String> nameOf(BuildContext context, Room room) {
FutureOr<String> nameOf(Room room, [BuildContext context]) {
if (room.name != null) {
return room.name;
}
......@@ -40,7 +40,7 @@ FutureOr<String> nameOf(BuildContext context, Room room) {
String calculateName(Iterable<User> members) {
var name = '';
if (members != null) {
if (members.length == 1) {
if (members.length == 1 && context != null) {
return l(context).you;
// TODO: Check for aliases (public chats)
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment