add diffing for a lot of events
This commit is contained in:
parent
4e140e9fc7
commit
6e2d56ec75
2 changed files with 591 additions and 168 deletions
|
|
@ -20,6 +20,15 @@ extension DisplaynameColor on WidgetRef {
|
|||
),
|
||||
};
|
||||
|
||||
/// Like [displaynameColor], for when [userId]'s [level] is already known,
|
||||
/// like a level they're being given.
|
||||
Color displaynameColorAt(String userId, double level) => switch (watch(
|
||||
SettingsController.provider.select((settings) => settings.value?.nameColor),
|
||||
)) {
|
||||
.user => userId.colorHash,
|
||||
.powerLevel || null => powerLevelColor(level),
|
||||
};
|
||||
|
||||
static Color powerLevelColor(double level) => HSLColor.fromAHSL(
|
||||
1,
|
||||
level.isInfinite ? 30 : (210 + level / 50 * 137.50776) % 360,
|
||||
|
|
|
|||
13
lib/helpers/extensions/join_rule_name.dart
Normal file
13
lib/helpers/extensions/join_rule_name.dart
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import "package:nexus/models/join_rule.dart";
|
||||
|
||||
extension JoinRuleName on JoinRule {
|
||||
/// What the rule is called in the UI, e.g. "Invite only".
|
||||
String get displayName => switch (this) {
|
||||
.public => "Public",
|
||||
.invite => "Invite only",
|
||||
.knock => "Knock",
|
||||
.restricted => "Restricted",
|
||||
.knockRestricted => "Restricted or knock",
|
||||
.private => "Private",
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue