Skip to content

Commit 09463cf

Browse files
authored
Fix android 15 (#89)
* value and withOpacity deprecated, using colorValues extension and withValue * update flutter version in ci * ypdate android compile version to 15
1 parent 5a3522f commit 09463cf

18 files changed

+72
-60
lines changed

.github/workflows/qa.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
env:
1010
java_version: '17'
1111
ruby_version: '2.7.2'
12-
flutter_version: '3.24.4'
12+
flutter_version: '3.27.0'
1313

1414
jobs:
1515
android-QA:

.github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
env:
1111
java_version: '17'
1212
ruby_version: '2.7.2'
13-
flutter_version: '3.24.4'
13+
flutter_version: '3.27.0'
1414

1515
jobs:
1616
android-internal:

android/app/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ android {
4141
defaultConfig {
4242
applicationId "com.dartz.amiibo_network"
4343
minSdkVersion flutter.minSdkVersion
44-
targetSdkVersion 34
44+
targetSdkVersion 35
45+
compileSdkVersion 35
4546
multiDexEnabled true
4647
versionCode flutterVersionCode.toInteger()
4748
versionName flutterVersionName

lib/affiliation_product/presentation/widget/amazon_affiliation_button.dart

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:amiibo_network/affiliation_product/presentation/widget/amazon_af
33
import 'package:amiibo_network/resources/resources.dart';
44
import 'package:amiibo_network/riverpod/amiibo_provider.dart';
55
import 'package:amiibo_network/riverpod/preferences_provider.dart';
6+
import 'package:amiibo_network/utils/color_utils.dart';
67
import 'package:flutter/material.dart';
78
import 'package:hooks_riverpod/hooks_riverpod.dart';
89
import 'package:material_color_utilities/material_color_utilities.dart';
@@ -26,8 +27,8 @@ class AmazonAffiliationButton extends HookConsumerWidget {
2627
?.resolve(state);
2728
if (color != null) {
2829
final int value = Blend.hctHue(
29-
color.value,
30-
amazonColor.value,
30+
color.colorValue,
31+
amazonColor.colorValue,
3132
0.75,
3233
);
3334
return Color(value);
@@ -41,8 +42,8 @@ class AmazonAffiliationButton extends HookConsumerWidget {
4142
?.resolve(state);
4243
if (color != null) {
4344
final int value = Blend.hctHue(
44-
color.value,
45-
amazonColor.value,
45+
color.colorValue,
46+
amazonColor.colorValue,
4647
0.5,
4748
);
4849
return Color(value);
@@ -78,8 +79,8 @@ class AmazonAffiliationIconButton extends HookConsumerWidget {
7879
final color = style?.backgroundColor?.resolve(state);
7980
if (color != null) {
8081
final int value = Blend.hctHue(
81-
color.value,
82-
amazonColor.value,
82+
color.colorValue,
83+
amazonColor.colorValue,
8384
0.15,
8485
);
8586
return Color(value);
@@ -90,8 +91,8 @@ class AmazonAffiliationIconButton extends HookConsumerWidget {
9091
final color = style?.foregroundColor?.resolve(state);
9192
if (color != null) {
9293
final int value = Blend.hctHue(
93-
color.value,
94-
amazonColor.value,
94+
color.colorValue,
95+
amazonColor.colorValue,
9596
0.25,
9697
);
9798
return Color(value);

lib/repository/theme_mode_scheme_repository.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ class AmiiboTheme3 implements AmiiboTheme {
318318

319319
ThemeData _themeFromScheme(ColorScheme scheme,
320320
[bool useSurfaceElevation = true]) {
321-
final overlay = scheme.primary.withOpacity(0.24);
321+
final overlay = scheme.primary.withValues(alpha: 0.24);
322322
final inverseBrightness = scheme.brightness == Brightness.light
323323
? Brightness.dark
324324
: Brightness.light;
@@ -428,7 +428,7 @@ class AmiiboTheme3 implements AmiiboTheme {
428428
borderRadius: BorderRadius.all(Radius.circular(8.0)),
429429
),
430430
elevation: !useSurfaceElevation ? 0 : 4.0,
431-
shadowColor: scheme.surface.withOpacity(0.12),
431+
shadowColor: scheme.surface.withValues(alpha: 0.12),
432432
surfaceTintColor: scheme.surfaceTint,
433433
),
434434
checkboxTheme: CheckboxThemeData(
@@ -538,7 +538,7 @@ class AmiiboTheme3 implements AmiiboTheme {
538538
),
539539
focusColor: scheme.inversePrimary,
540540
fontFamily: null,
541-
highlightColor: scheme.primaryContainer.withOpacity(0.38),
541+
highlightColor: scheme.primaryContainer.withValues(alpha: 0.38),
542542
hintColor: Colors.black38,
543543
hoverColor: scheme.primaryContainer,
544544
iconTheme: IconThemeData(color: scheme.onSurface),
@@ -678,7 +678,7 @@ class AmiiboTheme3 implements AmiiboTheme {
678678
),
679679
behavior: SnackBarBehavior.floating,
680680
),
681-
splashColor: scheme.tertiaryContainer.withOpacity(0.24),
681+
splashColor: scheme.tertiaryContainer.withValues(alpha: 0.24),
682682
switchTheme: SwitchThemeData(
683683
thumbColor: WidgetStateProperty.resolveWith<Color?>((states) {
684684
if (states.contains(WidgetState.disabled)) {
@@ -696,9 +696,9 @@ class AmiiboTheme3 implements AmiiboTheme {
696696
return null;
697697
} else if (states.contains(WidgetState.focused) ||
698698
states.contains(WidgetState.pressed)) {
699-
return scheme.onPrimaryContainer.withOpacity(0.24);
699+
return scheme.onPrimaryContainer.withValues(alpha: 0.24);
700700
} else if (states.contains(WidgetState.selected)) {
701-
return scheme.primary.withOpacity(0.24);
701+
return scheme.primary.withValues(alpha: 0.24);
702702
}
703703
return null;
704704
}),

lib/resources/material3_schemes.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:convert';
22

33
import 'package:amiibo_network/resources/theme_material3_schemes.dart';
4+
import 'package:amiibo_network/utils/color_utils.dart';
45
import 'package:flutter/material.dart';
56
import 'package:freezed_annotation/freezed_annotation.dart';
67

@@ -194,7 +195,7 @@ class ColorConverter extends JsonConverter<Color, int> {
194195

195196
@override
196197
int toJson(Color color) {
197-
return color.value;
198+
return color.colorValue;
198199
}
199200
}
200201

@@ -206,7 +207,7 @@ class ColorOrNullConverter extends JsonConverter<Color?, int?> {
206207

207208
@override
208209
int? toJson(Color? color) {
209-
return color == null ? null : color.value;
210+
return color == null ? null : color.colorValue;
210211
}
211212
}
212213

lib/resources/theme_material3_schemes.dart

+19-18
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:amiibo_network/resources/material3_schemes.dart';
2+
import 'package:amiibo_network/utils/color_utils.dart';
23
import 'package:flutter/material.dart';
34
import 'package:material_color_utilities/material_color_utilities.dart';
45

@@ -8,7 +9,7 @@ ColorScheme blendScheme(
89
[double amount = 0.3]
910
) {
1011
Color _harmonize(Color original, Color destiny) => Color(
11-
Blend.hctHue(original.value, destiny.value, amount),
12+
Blend.hctHue(original.colorValue, destiny.colorValue, amount),
1213
);
1314
return ColorScheme(
1415
brightness: originalScheme.brightness,
@@ -81,7 +82,7 @@ class TonalColor extends ColorSwatch<int> {
8182
///
8283
/// The `primary` argument should be the 32 bit ARGB value of one of the
8384
/// values in the swatch, as would be passed to the [Color.new] constructor
84-
/// for that same color, and as is exposed by [value]. (This is distinct from
85+
/// for that same color, and as is exposed by [colorValue]. (This is distinct from
8586
/// the specific index of the color in the swatch.)
8687
const TonalColor(super.primary, super.swatch);
8788

@@ -130,22 +131,22 @@ class TonalColor extends ColorSwatch<int> {
130131
TonalColor blend(Color sourceColor) {
131132
final blend = Blend.harmonize;
132133
return TonalColor(
133-
blend(value, sourceColor.value),
134+
blend(colorValue, sourceColor.colorValue),
134135
<int, Color>{
135-
0: Color(blend(this[0]!.value, sourceColor.value)),
136-
10: Color(blend(this[10]!.value, sourceColor.value)),
137-
20: Color(blend(this[20]!.value, sourceColor.value)),
138-
30: Color(blend(this[30]!.value, sourceColor.value)),
139-
40: Color(blend(this[40]!.value, sourceColor.value)),
140-
50: Color(blend(this[50]!.value, sourceColor.value)),
141-
60: Color(blend(this[60]!.value, sourceColor.value)),
142-
70: Color(blend(this[70]!.value, sourceColor.value)),
143-
80: Color(blend(this[80]!.value, sourceColor.value)),
144-
90: Color(blend(this[90]!.value, sourceColor.value)),
145-
95: Color(blend(this[95]!.value, sourceColor.value)),
146-
98: Color(blend(this[98]!.value, sourceColor.value)),
147-
99: Color(blend(this[99]!.value, sourceColor.value)),
148-
100: Color(blend(this[100]!.value, sourceColor.value)),
136+
0: Color(blend(this[0]!.colorValue, sourceColor.colorValue)),
137+
10: Color(blend(this[10]!.colorValue, sourceColor.colorValue)),
138+
20: Color(blend(this[20]!.colorValue, sourceColor.colorValue)),
139+
30: Color(blend(this[30]!.colorValue, sourceColor.colorValue)),
140+
40: Color(blend(this[40]!.colorValue, sourceColor.colorValue)),
141+
50: Color(blend(this[50]!.colorValue, sourceColor.colorValue)),
142+
60: Color(blend(this[60]!.colorValue, sourceColor.colorValue)),
143+
70: Color(blend(this[70]!.colorValue, sourceColor.colorValue)),
144+
80: Color(blend(this[80]!.colorValue, sourceColor.colorValue)),
145+
90: Color(blend(this[90]!.colorValue, sourceColor.colorValue)),
146+
95: Color(blend(this[95]!.colorValue, sourceColor.colorValue)),
147+
98: Color(blend(this[98]!.colorValue, sourceColor.colorValue)),
148+
99: Color(blend(this[99]!.colorValue, sourceColor.colorValue)),
149+
100: Color(blend(this[100]!.colorValue, sourceColor.colorValue)),
149150
},
150151
);
151152
}
@@ -154,7 +155,7 @@ class TonalColor extends ColorSwatch<int> {
154155
final swatch = ColorSwatch.lerp(a, b, t);
155156
if (swatch == null) return null;
156157
return TonalColor(
157-
swatch.value,
158+
swatch.colorValue,
158159
<int, Color>{
159160
0: swatch[0]!,
160161
10: swatch[10]!,

lib/screen/search_screen.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class SearchScreen extends HookConsumerWidget {
6363
isCollapsed: true,
6464
hintText: translate.category(amiiboCategory),
6565
hintStyle: style?.copyWith(
66-
color: style.color?.withOpacity(0.5),
66+
color: style.color?.withValues(alpha: 0.5),
6767
),
6868
border: InputBorder.none,
6969
),
@@ -221,8 +221,8 @@ class _SliverPersistentHeader extends SliverPersistentHeaderDelegate {
221221
stops: const [0.3, 0.6, 0.9],
222222
colors: [
223223
_color,
224-
_color.withOpacity(0.85),
225-
_color.withOpacity(0.2),
224+
_color.withValues(alpha: 0.85),
225+
_color.withValues(alpha: 0.2),
226226
],
227227
),
228228
),

lib/service/service.dart

-3
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ interface class Service {
169169
where &= Cond.like('amiiboSeries', '%$search%');
170170
break;
171171
case AmiiboCategory.All:
172-
default:
173172
where = And();
174173
}
175174
if (category != AmiiboCategory.AmiiboSeries && hiddenCategories != null) {
@@ -250,8 +249,6 @@ interface class Service {
250249
return Cond.like('gameSeries', '%$filter%');
251250
case SearchCategory.AmiiboSeries:
252251
return Cond.like('amiiboSeries', '%$filter%');
253-
default:
254-
return And();
255252
}
256253
}
257254

lib/utils/color_utils.dart

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import 'dart:ui';
2+
3+
extension ColorX on Color {
4+
5+
int get colorValue {
6+
int floatToInt8(double x) => (x * 255.0).round() & 0xff;
7+
return floatToInt8(a) << 24 |
8+
floatToInt8(r) << 16 |
9+
floatToInt8(g) << 8 |
10+
floatToInt8(b) << 0;
11+
}
12+
}

lib/utils/format_color_on_theme.dart

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ Color? colorOnThemeMode(ThemeMode mode, Brightness brightness) {
77
case ThemeMode.dark:
88
return Colors.white54;
99
case ThemeMode.system:
10-
default:
1110
return brightness == Brightness.dark ? Colors.white54 : null;
1211
}
1312
}

lib/widget/amiibo_button_toggle.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class WishedOutlinedButton extends ConsumerWidget {
7575
final S translate = S.of(context);
7676
final preferencesPalette =
7777
Theme.of(context).extension<PreferencesExtension>()!;
78-
final color = preferencesPalette.wishContainer.withOpacity(0.24);
78+
final color = preferencesPalette.wishContainer.withValues(alpha: 0.24);
7979
return IconButton.outlined(
8080
style: const ButtonStyle(
8181
shape: WidgetStatePropertyAll(
@@ -132,7 +132,7 @@ class OwnedOutlinedButton extends ConsumerWidget {
132132
final S translate = S.of(context);
133133
final preferencesPalette =
134134
Theme.of(context).extension<PreferencesExtension>()!;
135-
final color = preferencesPalette.ownContainer.withOpacity(0.24);
135+
final color = preferencesPalette.ownContainer.withValues(alpha: 0.24);
136136
return IconButton.outlined(
137137
style: const ButtonStyle(
138138
shape: WidgetStatePropertyAll(
@@ -204,7 +204,7 @@ class WishedButton extends ConsumerWidget {
204204
final S translate = S.of(context);
205205
final preferencesPalette =
206206
Theme.of(context).extension<PreferencesExtension>()!;
207-
final color = preferencesPalette.wishContainer.withOpacity(0.24);
207+
final color = preferencesPalette.wishContainer.withValues(alpha: 0.24);
208208
return IconButton(
209209
style: const ButtonStyle(
210210
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
@@ -258,7 +258,7 @@ class OwnedButton extends ConsumerWidget {
258258
final S translate = S.of(context);
259259
final preferencesPalette =
260260
Theme.of(context).extension<PreferencesExtension>()!;
261-
final color = preferencesPalette.ownContainer.withOpacity(0.24);
261+
final color = preferencesPalette.ownContainer.withValues(alpha: 0.24);
262262
return IconButton(
263263
style: const ButtonStyle(
264264
tapTargetSize: MaterialTapTargetSize.shrinkWrap,

lib/widget/detail/user_preferences_card.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ class ColumnButton extends StatelessWidget {
421421
shape: WidgetStatePropertyAll(RoundedRectangleBorder()),
422422
visualDensity: const VisualDensity(vertical: -2.0),
423423
),
424-
highlightColor: color?.withOpacity(0.16),
424+
highlightColor: color?.withValues(alpha: 0.16),
425425
icon: isDisabled
426426
? const Icon(Icons.remove_circle_sharp)
427427
: switch (effect) {

lib/widget/drawer.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class _CollectionDrawerState extends ConsumerState<CollectionDrawer> {
174174
),
175175
selectedTileColor: preferencesExtension
176176
.ownContainer
177-
.withOpacity(0.54),
177+
.withValues(alpha: 0.54),
178178
selectedColor:
179179
preferencesExtension.onOwnContainer,
180180
selected: isOwned,
@@ -193,7 +193,7 @@ class _CollectionDrawerState extends ConsumerState<CollectionDrawer> {
193193
),
194194
selectedTileColor: preferencesExtension
195195
.wishContainer
196-
.withOpacity(0.54),
196+
.withValues(alpha: 0.54),
197197
selectedColor:
198198
preferencesExtension.onWishContainer,
199199
selected: isWishlist,

lib/widget/preferences_bottomsheet.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class _BottomSheetSort extends StatelessWidget {
5454
surfaceTintColor: theme.colorScheme.surfaceTint,
5555
clipBehavior: Clip.antiAlias,
5656
child: ListTileTheme.merge(
57-
//selectedTileColor: theme.selectedRowColor.withOpacity(0.16),
57+
//selectedTileColor: theme.selectedRowColor.withValues(alpha: 0.16),
5858
contentPadding: const EdgeInsets.symmetric(horizontal: 16.0),
5959
dense: true,
6060
style: ListTileStyle.drawer,
@@ -84,7 +84,7 @@ class _BottomSheetSort extends StatelessWidget {
8484
style: theme.textTheme.bodyLarge,
8585
),
8686
inactiveTrackColor:
87-
theme.disabledColor.withOpacity(0.12),
87+
theme.disabledColor.withValues(alpha: 0.12),
8888
value: pref.usePercentage,
8989
onChanged: (value) async => await ref
9090
.read(personalProvider.notifier)
@@ -99,7 +99,7 @@ class _BottomSheetSort extends StatelessWidget {
9999
style: theme.textTheme.bodyLarge,
100100
),
101101
inactiveTrackColor:
102-
theme.disabledColor.withOpacity(0.12),
102+
theme.disabledColor.withValues(alpha: 0.12),
103103
value: pref.useGrid,
104104
onChanged: (value) async => await ref
105105
.read(personalProvider.notifier)
@@ -138,7 +138,7 @@ class _BottomSheetSort extends StatelessWidget {
138138
),
139139
isThreeLine: true,
140140
inactiveTrackColor:
141-
theme.disabledColor.withOpacity(0.12),
141+
theme.disabledColor.withValues(alpha: 0.12),
142142
value: ref.watch(ownTypesCategoryProvider),
143143
onChanged: (value) async => await ref
144144
.read(personalProvider.notifier)

lib/widget/single_stat.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class _StatContainer extends StatelessWidget {
197197
text: ' $subtitle',
198198
style: TextStyle(
199199
fontSize: 12.0,
200-
color: theme.colorScheme.onSurface.withOpacity(0.72),
200+
color: theme.colorScheme.onSurface.withValues(alpha: 0.72),
201201
fontFeatures: const [
202202
FontFeature.tabularFigures(),
203203
],

0 commit comments

Comments
 (0)