@@ -23,7 +23,6 @@ import 'framework.dart';
23
23
import 'media_query.dart' ;
24
24
import 'notification_listener.dart' ;
25
25
import 'scroll_notification.dart' ;
26
- import 'stretch_effect.dart' ;
27
26
import 'ticker_provider.dart' ;
28
27
import 'transitions.dart' ;
29
28
@@ -775,6 +774,20 @@ class _StretchingOverscrollIndicatorState extends State<StretchingOverscrollIndi
775
774
return false ;
776
775
}
777
776
777
+ AlignmentGeometry _getAlignmentForAxisDirection (_StretchDirection stretchDirection) {
778
+ // Accounts for reversed scrollables by checking the AxisDirection
779
+ final AxisDirection direction = switch (stretchDirection) {
780
+ _StretchDirection .trailing => widget.axisDirection,
781
+ _StretchDirection .leading => flipAxisDirection (widget.axisDirection),
782
+ };
783
+ return switch (direction) {
784
+ AxisDirection .up => AlignmentDirectional .topCenter,
785
+ AxisDirection .down => AlignmentDirectional .bottomCenter,
786
+ AxisDirection .left => Alignment .centerLeft,
787
+ AxisDirection .right => Alignment .centerRight,
788
+ };
789
+ }
790
+
778
791
@override
779
792
void dispose () {
780
793
_stretchController.dispose ();
@@ -789,34 +802,30 @@ class _StretchingOverscrollIndicatorState extends State<StretchingOverscrollIndi
789
802
animation: _stretchController,
790
803
builder: (BuildContext context, Widget ? child) {
791
804
final double stretch = _stretchController.value;
805
+ double x = 1.0 ;
806
+ double y = 1.0 ;
792
807
final double mainAxisSize;
793
808
794
809
switch (widget.axis) {
795
810
case Axis .horizontal:
811
+ x += stretch;
796
812
mainAxisSize = MediaQuery .widthOf (context);
797
813
case Axis .vertical:
814
+ y += stretch;
798
815
mainAxisSize = MediaQuery .heightOf (context);
799
816
}
800
817
818
+ final AlignmentGeometry alignment = _getAlignmentForAxisDirection (
819
+ _stretchController.stretchDirection,
820
+ );
821
+
801
822
final double viewportDimension =
802
823
_lastOverscrollNotification? .metrics.viewportDimension ?? mainAxisSize;
803
-
804
- double overscroll = stretch;
805
-
806
- if (_stretchController.stretchDirection == _StretchDirection .trailing) {
807
- overscroll = - overscroll;
808
- }
809
-
810
- // Adjust overscroll for reverse scroll directions.
811
- if (widget.axisDirection == AxisDirection .up ||
812
- widget.axisDirection == AxisDirection .left) {
813
- overscroll = - overscroll;
814
- }
815
-
816
- final Widget transform = StretchEffect (
817
- stretchStrength: overscroll,
818
- axis: widget.axis,
819
- child: widget.child! ,
824
+ final Widget transform = Transform (
825
+ alignment: alignment,
826
+ transform: Matrix4 .diagonal3Values (x, y, 1.0 ),
827
+ filterQuality: stretch == 0 ? null : FilterQuality .medium,
828
+ child: widget.child,
820
829
);
821
830
822
831
// Only clip if the viewport dimension is smaller than that of the
0 commit comments