@@ -515,11 +515,13 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
515
515
return ;
516
516
}
517
517
518
+ // Might be used in the future
519
+ // ignore: unused_local_variable
518
520
final viewportDimension = scrollController.position.viewportDimension;
519
521
final currentScroll = scrollController.position.pixels;
520
522
521
523
// If we're one viewportDimension from the bottomList, scroll to it
522
- if (currentScroll + viewportDimension > 0 ) {
524
+ if (currentScroll + 300 > 0 ) {
523
525
524
526
// Calculate initial scroll parameters
525
527
final distanceToCenter = scrollController.position.pixels;
@@ -537,17 +539,18 @@ class _MessageListState extends State<MessageList> with PerAccountStoreAwareStat
537
539
538
540
// Wait for the layout to settle so scrollController.position.pixels is updated properly
539
541
540
-
541
- final distanceToBottom = scrollController.position.maxScrollExtent - scrollController.position.pixels;
542
- final durationMsToBottom = math.min (1500 , (1000 * distanceToBottom / 8000 ).ceil ());
542
+ var distanceToBottom = scrollController.position.maxScrollExtent - scrollController.position.pixels;
543
+ final durationMsToBottom = math.min (200 , (1000 * distanceToBottom / 8000 ).ceil ());
543
544
// If we go too fast, we'll overscroll.as
544
545
545
546
// After scroling to the bottom sliver, scroll to the bottom of the bottomSliver if we're not already there
546
- if (distanceToBottom > 36 ) {
547
+ while (distanceToBottom > 36 ) {
547
548
await scrollController.animateTo (
548
549
scrollController.position.maxScrollExtent,
549
550
duration: Duration (milliseconds: durationMsToBottom),
550
551
curve: Curves .ease);
552
+ distanceToBottom = scrollController.position.maxScrollExtent - scrollController.position.pixels;
553
+ await Future <void >.delayed (const Duration (milliseconds: 50 ));
551
554
}
552
555
553
556
}
@@ -783,7 +786,6 @@ class ScrollToBottomButton extends StatelessWidget {
783
786
final distanceToCenter = scrollController.position.pixels;
784
787
final durationMsAtSpeedLimit = (1000 * distanceToCenter / 8000 ).ceil ();
785
788
final durationMs = math.max (300 , durationMsAtSpeedLimit);
786
-
787
789
// If we're not at the bottomSliver,scroll to it
788
790
if (distanceToCenter< 36 ){
789
791
await scrollController.animateTo (
@@ -796,18 +798,21 @@ class ScrollToBottomButton extends StatelessWidget {
796
798
// Wait for the layout to settle so scrollController.position.pixels is updated properly
797
799
await Future <void >.delayed (const Duration (milliseconds: 50 ));
798
800
799
-
800
- final distanceToBottom = scrollController.position.maxScrollExtent - scrollController.position.pixels;
801
- final durationMsToBottom = math.min (1000 , (1000 * distanceToBottom / 8000 ).ceil ());
801
+ var distanceToBottom = scrollController.position.maxScrollExtent - scrollController.position.pixels;
802
+ final durationMsToBottom = math.min (1000 , (1200 * distanceToBottom / 8000 ).ceil ());
802
803
// If we go too fast, we'll overscroll.
803
-
804
804
// After scroling to the bottom sliver, scroll to the bottom of the bottomSliver if we're not already there
805
- if (distanceToBottom > 36 ) {
805
+ var count = 0 ;
806
+ while (distanceToBottom > 36 ) {
806
807
await scrollController.animateTo (
807
808
scrollController.position.maxScrollExtent,
808
809
duration: Duration (milliseconds: durationMsToBottom),
809
810
curve: Curves .easeOut);
811
+ await Future <void >.delayed (const Duration (milliseconds: 50 ));
812
+ distanceToBottom = scrollController.position.maxScrollExtent - scrollController.position.pixels;
813
+ count++ ;
810
814
}
815
+ print ("count: $count " );
811
816
}
812
817
813
818
@override
0 commit comments