Skip to content

Commit

Permalink
Merge branch 'fix/deprecated_color' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Dec 15, 2024
2 parents a8aaeb6 + 8d77c85 commit 2994f08
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
4 changes: 4 additions & 0 deletions audio_service_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.3

* Fix deprecated Color.value.

## 0.1.2

* Support MPNowPlayingInfoPropertyIsLiveStream on IOS (@MuradSh, @celsoft).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,8 @@ class AudioServiceConfigMessage {
'androidNotificationChannelName': androidNotificationChannelName,
'androidNotificationChannelDescription':
androidNotificationChannelDescription,
'notificationColor': notificationColor?._colorValue,
// ignore: deprecated_member_use
'notificationColor': notificationColor?.value, //_colorValue,
'androidNotificationIcon': androidNotificationIcon,
'androidShowNotificationBadge': androidShowNotificationBadge,
'androidNotificationClickStartsActivity':
Expand All @@ -1446,12 +1447,12 @@ Map<String, dynamic>? _castMap(Map<dynamic, dynamic>? map) =>
map?.cast<String, dynamic>();

/// Reimplements deprecated Color.value.
extension _ColorExtension on Color {
int get _colorValue =>
_floatToInt8(a) << 24 |
_floatToInt8(r) << 16 |
_floatToInt8(g) << 8 |
_floatToInt8(b) << 0;

int _floatToInt8(double x) => (x * 255.0).round() & 0xff;
}
// extension _ColorExtension on Color {
// int get _colorValue =>
// _floatToInt8(a) << 24 |
// _floatToInt8(r) << 16 |
// _floatToInt8(g) << 8 |
// _floatToInt8(b) << 0;
//
// int _floatToInt8(double x) => (x * 255.0).round() & 0xff;
// }
2 changes: 1 addition & 1 deletion audio_service_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A common platform interface for the audio_service plugin. Different
homepage: https://github.com/ryanheise/audio_service/tree/master/audio_service_platform_interface
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 0.1.2
version: 0.1.3

dependencies:
flutter:
Expand Down

0 comments on commit 2994f08

Please sign in to comment.