Skip to content

Commit

Permalink
update AGP
Browse files Browse the repository at this point in the history
  • Loading branch information
CarGuo committed Oct 10, 2024
1 parent eaf40fc commit d11720d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ if (flutterVersionName == null) {
android {
compileSdkVersion 34

namespace "com.gsy.shuyu.gsy_flutter_demo"

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.0.3" apply false
id "com.android.application" version "8.6.1" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

Expand Down
29 changes: 25 additions & 4 deletions lib/widget/chat_list_scroll_demo_page_2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ class _ChatListScrollDemoPageState2 extends State<ChatListScrollDemoPage2> {

final ScrollPhysics _physics = const BouncingScrollPhysics();

Future<void> firstScrollToBottom({bool isAnimated = true}) async {
final double maxScroll = scroller.position.maxScrollExtent;
final double currentScroll = scroller.offset;

if (currentScroll < maxScroll) {
if (isAnimated) {
// Perform the animated scroll only on the first call
await scroller.animateTo(
maxScroll,
duration: const Duration(milliseconds: 100),
curve: Curves.linear,
);
} else {
// Perform an immediate jump to the bottom on subsequent recursive calls
scroller.jumpTo(maxScroll);
}

// Recursive call with isAnimated set to false
await firstScrollToBottom(isAnimated: false);
}
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -72,6 +94,7 @@ class _ChatListScrollDemoPageState2 extends State<ChatListScrollDemoPage2> {
setState(() {});
Future.delayed(const Duration(milliseconds: 1000), () {
scroller.jumpTo(scroller.position.maxScrollExtent);
//firstScrollToBottom(isAnimated: false);
});
},
child: const Text(
Expand Down Expand Up @@ -135,10 +158,7 @@ class _ChatListScrollDemoPageState2 extends State<ChatListScrollDemoPage2> {
duration: Duration(milliseconds: 1000),
));
Future.delayed(const Duration(milliseconds: 200), () {
scroller.jumpTo(scroller.position.maxScrollExtent);
Future.delayed(const Duration(milliseconds: 400), () {
scroller.jumpTo(scroller.position.maxScrollExtent);
});
firstScrollToBottom(isAnimated: false);
});
} else {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
Expand All @@ -151,6 +171,7 @@ class _ChatListScrollDemoPageState2 extends State<ChatListScrollDemoPage2> {
duration: const Duration(milliseconds: 500),
curve: Curves.linear);
});
//firstScrollToBottom(isAnimated: true);
},
child: Container(
height: 50,
Expand Down

0 comments on commit d11720d

Please sign in to comment.