Skip to content

Commit

Permalink
Refactor: Migrate from 'withOpacity' to 'withAlpha'
Browse files Browse the repository at this point in the history
  • Loading branch information
AmosHuKe committed Dec 11, 2024
1 parent 5010d9a commit 971dae0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
## 3.2.0 (Unreleased)

## 3.2.0-rc.2

### Improvements

- Migrate from `withOpacity` to `withAlpha`.

## 3.2.0-rc.1

### New features
Expand Down
6 changes: 4 additions & 2 deletions lib/src/widget/tilt_light.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ class TiltLight extends StatelessWidget with TiltDecoration {
decoration: BoxDecoration(
gradient: RadialGradient(
colors: <Color>[
lightConfig.color.withOpacity(showProgress),
lightConfig.color.withOpacity(0),
/// TODO: Flutter v3.27.0 之后需要迁移,在这之前暂时使用 withAlpha
/// https://docs.flutter.dev/release/breaking-changes/wide-gamut-framework
lightConfig.color.withAlpha((255.0 * showProgress).round()),
lightConfig.color.withAlpha(0),
],
stops: const <double>[0.01, 0.99],
),
Expand Down
4 changes: 3 additions & 1 deletion lib/src/widget/tilt_shadow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ class TiltShadowBase extends TiltShadow {
boxShadow: <BoxShadow>[
if (!shadowDisable)
BoxShadow(
color: shadowConfig.color.withOpacity(showShadow),
/// TODO: Flutter v3.27.0 之后需要迁移,在这之前暂时使用 withAlpha
/// https://docs.flutter.dev/release/breaking-changes/wide-gamut-framework
color: shadowConfig.color.withAlpha((255.0 * showShadow).round()),
offset: offset,
blurRadius: blurRadius,
spreadRadius: spreadRadius,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: Easily apply tilt parallax hover effects for Flutter, which support
# https://semver.org/spec/v2.0.0-rc.1.html
# https://dart.dev/tools/pub/versioning#semantic-versions
# https://dart.dev/tools/pub/dependencies#version-constraints
version: 3.2.0-rc.1
version: 3.2.0-rc.2
homepage: https://amoshuke.github.io/flutter_tilt_book
repository: https://github.com/fluttercandies/flutter_tilt
issue_tracker: https://github.com/fluttercandies/flutter_tilt/issues
Expand Down

0 comments on commit 971dae0

Please sign in to comment.