Skip to content

Commit

Permalink
chore: upgrade dependencies
Browse files Browse the repository at this point in the history
fix: replace deprecated color.value with argbValue
fix: loosen intl version constraints
  • Loading branch information
Andrew-Bekhiet committed Jan 14, 2025
1 parent 9f43aaa commit 241163d
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 188 deletions.
2 changes: 1 addition & 1 deletion lib/src/models/data/person.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class PersonBase extends DataObjectWithPhoto {
'Gender': gender,
'ShammasLevel': shammasLevel,
'StudyYear': studyYear,
'Color': color?.value,
'Color': color?.argbValue,
};
}

Expand Down
13 changes: 13 additions & 0 deletions lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,16 @@ extension ContrastingColor on Color? {
}
}
// coverage:ignore-end

extension ColorValue on Color {
static int _floatToInt8(double x) {
return (x * 255.0).round() & 0xff;
}

int get argbValue {
return _floatToInt8(a) << 24 |
_floatToInt8(r) << 16 |
_floatToInt8(g) << 8 |
_floatToInt8(b) << 0;
}
}
Loading

0 comments on commit 241163d

Please sign in to comment.