fix: Colored background for transparent avatars

This commit is contained in:
Christian Pauly 2021-07-31 22:17:18 +02:00
parent 42f64393c8
commit 19fc1378fb

View File

@ -36,18 +36,18 @@ class Avatar extends StatelessWidget {
} else if ((name?.runes?.length ?? 0) == 1) { } else if ((name?.runes?.length ?? 0) == 1) {
fallbackLetters = name; fallbackLetters = name;
} }
final noPic = mxContent == null ||
mxContent.toString().isEmpty ||
mxContent.toString() == 'null';
final textWidget = Center( final textWidget = Center(
child: Text( child: Text(
fallbackLetters, fallbackLetters,
style: TextStyle( style: TextStyle(
color: Colors.white, color: noPic ? Colors.white : null,
fontSize: 18, fontSize: 18,
), ),
), ),
); );
final noPic = mxContent == null ||
mxContent.toString().isEmpty ||
mxContent.toString() == 'null';
final borderRadius = BorderRadius.circular(size / 2); final borderRadius = BorderRadius.circular(size / 2);
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
@ -57,7 +57,7 @@ class Avatar extends StatelessWidget {
child: Container( child: Container(
width: size, width: size,
height: size, height: size,
color: name?.color, color: noPic ? name?.color : Theme.of(context).secondaryHeaderColor,
child: noPic child: noPic
? textWidget ? textWidget
: CachedNetworkImage( : CachedNetworkImage(