mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +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++) {
|
for (var i = 0; i < length; i++) {
|
||||||
number += codeUnitAt(i);
|
number += codeUnitAt(i);
|
||||||
}
|
}
|
||||||
number = (number % 10) * 25.5;
|
number = (number % 12) * 25.5;
|
||||||
return HSLColor.fromAHSL(1, number, 1, 0.35).toColor();
|
return HSLColor.fromAHSL(1, number, 1, 0.35).toColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ extension StringColor on String {
|
|||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
number += codeUnitAt(i);
|
number += codeUnitAt(i);
|
||||||
}
|
}
|
||||||
number = (number % 10) * 25.5;
|
number = (number % 12) * 25.5;
|
||||||
return HSLColor.fromAHSL(1, number, 1, 0.2).toColor();
|
return HSLColor.fromAHSL(1, number, 1, 0.2).toColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ extension StringColor on String {
|
|||||||
for (var i = 0; i < length; i++) {
|
for (var i = 0; i < length; i++) {
|
||||||
number += codeUnitAt(i);
|
number += codeUnitAt(i);
|
||||||
}
|
}
|
||||||
number = (number % 10) * 25.5;
|
number = (number % 12) * 25.5;
|
||||||
return HSLColor.fromAHSL(1, number, 1, 0.8).toColor();
|
return HSLColor.fromAHSL(1, number, 1, 0.8).toColor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,14 +40,14 @@ class Avatar extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
fallbackLetters,
|
fallbackLetters,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context).brightness == Brightness.light
|
color: Colors.white,
|
||||||
? name?.darkColor
|
|
||||||
: name?.lightColor ?? Colors.white,
|
|
||||||
fontSize: 18,
|
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);
|
final borderRadius = BorderRadius.circular(size / 2);
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
@ -57,11 +57,7 @@ class Avatar extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: size,
|
width: size,
|
||||||
height: size,
|
height: size,
|
||||||
color: noPic
|
color: name?.color,
|
||||||
? Theme.of(context).brightness == Brightness.light
|
|
||||||
? name?.lightColor
|
|
||||||
: name?.darkColor ?? Theme.of(context).secondaryHeaderColor
|
|
||||||
: Theme.of(context).secondaryHeaderColor,
|
|
||||||
child: noPic
|
child: noPic
|
||||||
? textWidget
|
? textWidget
|
||||||
: CachedNetworkImage(
|
: CachedNetworkImage(
|
||||||
|
Loading…
Reference in New Issue
Block a user