mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-28 17:12:33 +01:00
fix: Avatar noPic detection
This commit is contained in:
parent
8d752164a7
commit
1a23e5fa23
@ -6,7 +6,7 @@ extension StringColor on String {
|
||||
for (var i = 0; i < length; i++) {
|
||||
number += codeUnitAt(i);
|
||||
}
|
||||
number = (number % 10) * 25.5;
|
||||
number = (number % 12) * 25.5;
|
||||
return HSLColor.fromAHSL(1, number, 1, 0.35).toColor();
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ extension StringColor on String {
|
||||
for (var i = 0; i < length; i++) {
|
||||
number += codeUnitAt(i);
|
||||
}
|
||||
number = (number % 10) * 25.5;
|
||||
number = (number % 12) * 25.5;
|
||||
return HSLColor.fromAHSL(1, number, 1, 0.2).toColor();
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ extension StringColor on String {
|
||||
for (var i = 0; i < length; i++) {
|
||||
number += codeUnitAt(i);
|
||||
}
|
||||
number = (number % 10) * 25.5;
|
||||
number = (number % 12) * 25.5;
|
||||
return HSLColor.fromAHSL(1, number, 1, 0.8).toColor();
|
||||
}
|
||||
}
|
||||
|
@ -40,14 +40,14 @@ class Avatar extends StatelessWidget {
|
||||
child: Text(
|
||||
fallbackLetters,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).brightness == Brightness.light
|
||||
? name?.darkColor
|
||||
: name?.lightColor ?? Colors.white,
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
);
|
||||
final noPic = mxContent == null || mxContent.toString().isEmpty;
|
||||
final noPic = mxContent == null ||
|
||||
mxContent.toString().isEmpty ||
|
||||
mxContent.toString() == 'null';
|
||||
final borderRadius = BorderRadius.circular(size / 2);
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
@ -57,11 +57,7 @@ class Avatar extends StatelessWidget {
|
||||
child: Container(
|
||||
width: size,
|
||||
height: size,
|
||||
color: noPic
|
||||
? Theme.of(context).brightness == Brightness.light
|
||||
? name?.lightColor
|
||||
: name?.darkColor ?? Theme.of(context).secondaryHeaderColor
|
||||
: Theme.of(context).secondaryHeaderColor,
|
||||
color: name?.color,
|
||||
child: noPic
|
||||
? textWidget
|
||||
: CachedNetworkImage(
|
||||
|
Loading…
Reference in New Issue
Block a user