Skip to content

Commit e21b35a

Browse files
committed
chore: upgrade flutter version, migrate deprecated API
1 parent 92a6838 commit e21b35a

14 files changed

Lines changed: 156 additions & 105 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
- uses: subosito/flutter-action@v2
2828
with:
29-
flutter-version: '3.41.x'
29+
flutter-version: '3.44.x'
3030
channel: "stable"
3131
cache: true
3232
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Set up Flutter
6363
uses: subosito/flutter-action@v2
6464
with:
65-
flutter-version: '3.41.x' # When updating this, also update the corresponding f-droid metadata file
65+
flutter-version: '3.44.x' # When updating this, also update the corresponding f-droid metadata file
6666
channel: 'stable'
6767
cache: true
6868

@@ -127,7 +127,7 @@ jobs:
127127
- name: Set up Flutter
128128
uses: subosito/flutter-action@v2
129129
with:
130-
flutter-version: '3.41.x' # When updating this, also update the corresponding f-droid metadata file
130+
flutter-version: '3.44.x' # When updating this, also update the corresponding f-droid metadata file
131131
channel: 'stable'
132132
cache: true
133133

android/build.gradle

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,57 @@ subprojects {
1616
project.buildDir = "${rootProject.buildDir}/${project.name}"
1717
}
1818

19+
subprojects { subproject ->
20+
def configureJavaJvmTarget = {
21+
if (subproject.plugins.hasPlugin("com.android.application") || subproject.plugins.hasPlugin("com.android.library")) {
22+
subproject.android {
23+
compileOptions {
24+
sourceCompatibility JavaVersion.VERSION_17
25+
targetCompatibility JavaVersion.VERSION_17
26+
}
27+
}
28+
}
29+
30+
subproject.tasks.withType(JavaCompile).configureEach {
31+
sourceCompatibility = JavaVersion.VERSION_17.toString()
32+
targetCompatibility = JavaVersion.VERSION_17.toString()
33+
}
34+
}
35+
36+
def configureKotlinJvmTarget = {
37+
subproject.tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
38+
if (subproject.name == "flutter_avif_android") {
39+
exclude("**/FlutterAvifPlugin.kt")
40+
}
41+
42+
kotlinOptions {
43+
jvmTarget = JavaVersion.VERSION_17.toString()
44+
}
45+
}
46+
}
47+
48+
plugins.withId("com.android.application") {
49+
configureJavaJvmTarget()
50+
}
51+
52+
plugins.withId("com.android.library") {
53+
configureJavaJvmTarget()
54+
}
55+
56+
plugins.withId("org.jetbrains.kotlin.android") {
57+
configureKotlinJvmTarget()
58+
}
59+
60+
plugins.withId("kotlin-android") {
61+
configureKotlinJvmTarget()
62+
}
63+
64+
afterEvaluate {
65+
configureJavaJvmTarget()
66+
configureKotlinJvmTarget()
67+
}
68+
}
69+
1970
subprojects {
2071
project.evaluationDependsOn(':app')
2172
}

android/gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ android.enableJetifier=true
44
android.defaults.buildfeatures.buildconfig=true
55
android.nonTransitiveRClass=false
66
android.nonFinalResIds=false
7+
android.builtInKotlin=false
8+
android.newDsl=false

flutter

Submodule flutter updated 6498 files

lib/src/app/shell/thunder_app.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:async';
22
import 'dart:io';
33

4+
import 'package:flutter/cupertino.dart';
45
import 'package:flutter/material.dart';
56
import 'package:flutter/services.dart';
67

lib/src/features/account/presentation/widgets/profile_modal_body.dart

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,10 @@ class _ProfileModalBodyState extends State<ProfileModalBody> {
5959
Widget build(BuildContext context) {
6060
return Navigator(
6161
key: ProfileModalBody.shellNavigatorKey,
62-
onPopPage: (route, result) => false,
62+
onDidRemovePage: (_) {},
6363
pages: [
6464
MaterialPage(
65+
canPop: false,
6566
child: ProfileSelect(
6667
pushRegister: pushRegister,
6768
showLogoutDialog: widget.showLogoutDialog,
@@ -206,11 +207,8 @@ class _ProfileSelectState extends State<ProfileSelect> {
206207
SliverReorderableList(
207208
onReorderStart: (index) => setState(() => accountBeingReorderedIndex = index),
208209
onReorderEnd: (index) => setState(() => accountBeingReorderedIndex = null),
209-
onReorder: (int oldIndex, int newIndex) {
210+
onReorderItem: (int oldIndex, int newIndex) {
210211
setState(() {
211-
if (oldIndex < newIndex) {
212-
newIndex -= 1;
213-
}
214212
final AccountExtended item = accounts!.removeAt(oldIndex);
215213
accounts!.insert(newIndex, item);
216214
});
@@ -452,11 +450,8 @@ class _ProfileSelectState extends State<ProfileSelect> {
452450
SliverReorderableList(
453451
onReorderStart: (index) => setState(() => anonymousInstanceBeingReorderedIndex = index),
454452
onReorderEnd: (index) => setState(() => anonymousInstanceBeingReorderedIndex = null),
455-
onReorder: (int oldIndex, int newIndex) {
453+
onReorderItem: (int oldIndex, int newIndex) {
456454
setState(() {
457-
if (oldIndex < newIndex) {
458-
newIndex -= 1;
459-
}
460455
final AnonymousInstanceExtended item = anonymousInstances!.removeAt(oldIndex);
461456
anonymousInstances!.insert(newIndex, item);
462457
});

lib/src/features/notification/presentation/utils/local_notification_utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ Future<void> _showMessageNotifications({
282282

283283
/// This method handles "headless" callbacks (i.e., whent the app is not running)
284284
@pragma('vm:entry-point')
285-
void backgroundFetchHeadlessTask(HeadlessTask task) async {
285+
void backgroundFetchHeadlessTask(HeadlessEvent task) async {
286286
if (task.timeout) return BackgroundFetch.finish(task.taskId);
287287

288288
// Ensure Flutter bindings are initialized for background isolate
@@ -306,7 +306,7 @@ void backgroundFetchHeadlessTask(HeadlessTask task) async {
306306

307307
/// This method handles "headless" callbacks for testing
308308
@pragma('vm:entry-point')
309-
void backgroundTestFetchHeadlessTask(HeadlessTask task) async {
309+
void backgroundTestFetchHeadlessTask(HeadlessEvent task) async {
310310
if (task.timeout) return BackgroundFetch.finish(task.taskId);
311311

312312
await showTestAndroidNotification();

lib/src/features/post/presentation/widgets/post_page_scroll_body.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:flutter/material.dart';
2+
import 'package:flutter/rendering.dart';
23

34
import 'package:flutter_bloc/flutter_bloc.dart';
45
import 'package:super_sliver_list/super_sliver_list.dart';
@@ -58,7 +59,7 @@ class PostPageScrollBody extends StatelessWidget {
5859
Widget build(BuildContext context) {
5960
return CustomScrollView(
6061
controller: scrollController,
61-
cacheExtent: 1000,
62+
scrollCacheExtent: ScrollCacheExtent.pixels(1000),
6263
slivers: [
6364
PostPageAppBar(
6465
key: appBarKey,

lib/src/features/settings/domain/full_name.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'package:flutter/widgets.dart';
33
import 'package:flutter_bloc/flutter_bloc.dart';
44

55
import 'package:thunder/src/features/settings/api.dart';
6-
import 'package:thunder/src/shared/name/name_style.dart' show FullNameSeparator;
76
import 'package:thunder/src/shared/name/name_formatting.dart' show formatCommunityFullNamePrefix, formatCommunityFullNameSuffix, formatUserFullNamePrefix, formatUserFullNameSuffix;
87

98
export 'package:thunder/src/shared/name/name_style.dart' show FullNameSeparator, NameColor, NameThickness;

0 commit comments

Comments
 (0)