Skip to content

Commit a4d12bc

Browse files
committed
refactor: migrate deprecated .withOpacity() to .withValues(alpha:)
`Color.withOpacity` is deprecated in the pinned Flutter SDK. `withValues` stores alpha as a double instead of quantising it to 8 bits; `toARGB32()` rounds to the same byte for every alpha, so nothing renders differently. 83 call sites in 52 files. Reproducible from the preceding commit: substitute `.withOpacity(X)` -> `.withValues(alpha: X)` and run `dart format`, which rewraps the 12 sites (10 files) where the longer name no longer fits the line.
1 parent 51f974d commit a4d12bc

52 files changed

Lines changed: 116 additions & 103 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎lib/notifications/notification_card_layout.dart‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ class NotificationCardLayout extends StatelessWidget {
8585
),
8686
if (read)
8787
Positioned.fill(
88-
child: RoundedContainer(color: colors.background.withOpacity(0.5)),
88+
child: RoundedContainer(
89+
color: colors.background.withValues(alpha: 0.5),
90+
),
8991
),
9092
],
9193
);

‎lib/pages/buy_view/buy_form.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
840840
? Theme.of(context)
841841
.extension<StackColors>()!
842842
.currencyListItemBG
843-
.withOpacity(_hovering1 ? 0.3 : 0)
843+
.withValues(alpha: _hovering1 ? 0.3 : 0)
844844
: Theme.of(
845845
context,
846846
).extension<StackColors>()!.textFieldDefaultBG,
@@ -906,7 +906,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
906906
? Theme.of(context)
907907
.extension<StackColors>()!
908908
.currencyListItemBG
909-
.withOpacity(_hovering2 ? 0.3 : 0)
909+
.withValues(alpha: _hovering2 ? 0.3 : 0)
910910
: Theme.of(
911911
context,
912912
).extension<StackColors>()!.textFieldDefaultBG,

‎lib/pages/buy_view/buy_view.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class _BuyViewState extends ConsumerState<BuyView> {
7373
Container(
7474
color: Theme.of(
7575
context,
76-
).extension<StackColors>()!.overlay.withOpacity(0.7),
76+
).extension<StackColors>()!.overlay.withValues(alpha: 0.7),
7777
height: MediaQuery.of(context).size.height,
7878
width: MediaQuery.of(context).size.width,
7979
child: const StackDialog(

‎lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class _ExchangeCurrencySelectionViewState
7878
child: Container(
7979
color: Theme.of(
8080
context,
81-
).extension<StackColors>()!.overlay.withOpacity(0.6),
81+
).extension<StackColors>()!.overlay.withValues(alpha: 0.6),
8282
child: const CustomLoadingOverlay(
8383
message: "Loading currencies",
8484
eventBus: null,

‎lib/pages/exchange_view/exchange_form.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
117117
child: Container(
118118
color: Theme.of(
119119
context,
120-
).extension<StackColors>()!.overlay.withOpacity(0.6),
120+
).extension<StackColors>()!.overlay.withValues(alpha: 0.6),
121121
child: const CustomLoadingOverlay(
122122
message: "Updating exchange rate",
123123
eventBus: null,

‎lib/pages/exchange_view/exchange_loading_overlay.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class _ExchangeLoadingOverlayViewState
7979
Container(
8080
color: Theme.of(
8181
context,
82-
).extension<StackColors>()!.overlay.withOpacity(0.7),
82+
).extension<StackColors>()!.overlay.withValues(alpha: 0.7),
8383
child: const CustomLoadingOverlay(
8484
message: "Loading Exchange data",
8585
eventBus: null,
@@ -92,7 +92,7 @@ class _ExchangeLoadingOverlayViewState
9292
Container(
9393
color: Theme.of(
9494
context,
95-
).extension<StackColors>()!.overlay.withOpacity(0.7),
95+
).extension<StackColors>()!.overlay.withValues(alpha: 0.7),
9696
child: Column(
9797
mainAxisAlignment: MainAxisAlignment.end,
9898
children: [

‎lib/pages/exchange_view/exchange_step_views/step_3_view.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class _Step3ViewState extends ConsumerState<Step3View> {
228228
color: Theme.of(context)
229229
.extension<StackColors>()!
230230
.overlay
231-
.withOpacity(0.6),
231+
.withValues(alpha: 0.6),
232232
child: const CustomLoadingOverlay(
233233
message: "Creating a trade",
234234
eventBus: null,

‎lib/pages/exchange_view/exchange_view.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class _ExchangeViewState extends ConsumerState<ExchangeView> {
9696
Material(
9797
color: Theme.of(
9898
context,
99-
).extension<StackColors>()!.overlay.withOpacity(0.6),
99+
).extension<StackColors>()!.overlay.withValues(alpha: 0.6),
100100
child: const CustomLoadingOverlay(
101101
message: "Updating exchange data",
102102
subMessage: "This could take a few minutes",

‎lib/pages/exchange_view/send_from_view.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class _SendFromCardState extends ConsumerState<SendFromCard> {
566566
children: [
567567
Container(
568568
decoration: BoxDecoration(
569-
color: ref.watch(pCoinColor(coin)).withOpacity(0.5),
569+
color: ref.watch(pCoinColor(coin)).withValues(alpha: 0.5),
570570
borderRadius: BorderRadius.circular(
571571
Constants.size.circularBorderRadius,
572572
),

‎lib/pages/exchange_view/wallet_initiated_exchange_view.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class _WalletInitiatedExchangeViewState
113113
Material(
114114
color: Theme.of(
115115
context,
116-
).extension<StackColors>()!.overlay.withOpacity(0.6),
116+
).extension<StackColors>()!.overlay.withValues(alpha: 0.6),
117117
child: const CustomLoadingOverlay(
118118
message: "Updating exchange data",
119119
subMessage: "This could take a few minutes",

0 commit comments

Comments
 (0)