Skip to content

Commit fcd154b

Browse files
Remove deprecated InteractiveViewer.alignPanAxis (#142500)
1 parent 59da873 commit fcd154b

File tree

4 files changed

+145
-29
lines changed

4 files changed

+145
-29
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# Copyright 2014 The Flutter Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# For details regarding the *Flutter Fix* feature, see
6+
# https://flutter.dev/docs/development/tools/flutter-fix
7+
8+
# Please add new fixes to the top of the file, separated by one blank line
9+
# from other fixes. In a comment, include a link to the PR where the change
10+
# requiring the fix was made.
11+
12+
# Every fix must be tested. See the flutter/packages/flutter/test_fixes/README.md
13+
# file for instructions on testing these data driven fixes.
14+
15+
# For documentation about this file format, see
16+
# https://dart.dev/go/data-driven-fixes.
17+
18+
# * Fixes in this file are for InteractiveViewer from the widgets library. *
19+
version: 1
20+
transforms:
21+
# Change made in https://github.com/flutter/flutter/pull/109014
22+
- title: "Migrate to 'panAxis'"
23+
date: 2024-02-22
24+
element:
25+
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
26+
constructor: ''
27+
inClass: 'InteractiveViewer'
28+
variables:
29+
alignPanAxis:
30+
kind: 'fragment'
31+
value: 'arguments[alignPanAxis]'
32+
panAxis:
33+
kind: 'fragment'
34+
value: 'arguments[panAxis]'
35+
oneOf:
36+
- if: "panAxis == '' && alignPanAxis == 'true'"
37+
changes:
38+
- kind: 'addParameter'
39+
index: 0
40+
name: 'panAxis'
41+
style: optional_named
42+
argumentValue:
43+
expression: 'PanAxis.aligned'
44+
requiredIf: "alignPanAxis == 'true'"
45+
- kind: 'removeParameter'
46+
name: 'alignPanAxis'
47+
- if: "panAxis == '' && alignPanAxis == 'false'"
48+
changes:
49+
- kind: 'addParameter'
50+
index: 0
51+
name: 'panAxis'
52+
style: optional_named
53+
argumentValue:
54+
expression: 'PanAxis.free'
55+
requiredIf: "alignPanAxis == 'false'"
56+
- kind: 'removeParameter'
57+
name: 'alignPanAxis'
58+
- if: "alignPanAxis != ''"
59+
changes:
60+
- kind: 'removeParameter'
61+
name: 'alignPanAxis'
62+
63+
# Change made in https://github.com/flutter/flutter/pull/109014
64+
- title: "Migrate to 'panAxis'"
65+
date: 2024-02-22
66+
element:
67+
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
68+
constructor: 'builder'
69+
inClass: 'InteractiveViewer'
70+
variables:
71+
alignPanAxis:
72+
kind: 'fragment'
73+
value: 'arguments[alignPanAxis]'
74+
panAxis:
75+
kind: 'fragment'
76+
value: 'arguments[panAxis]'
77+
oneOf:
78+
- if: "panAxis == '' && alignPanAxis == 'true'"
79+
changes:
80+
- kind: 'addParameter'
81+
index: 0
82+
name: 'panAxis'
83+
style: optional_named
84+
argumentValue:
85+
expression: 'PanAxis.aligned'
86+
requiredIf: "alignPanAxis == 'true'"
87+
- kind: 'removeParameter'
88+
name: 'alignPanAxis'
89+
- if: "panAxis == '' && alignPanAxis == 'false'"
90+
changes:
91+
- kind: 'addParameter'
92+
index: 0
93+
name: 'panAxis'
94+
style: optional_named
95+
argumentValue:
96+
expression: 'PanAxis.free'
97+
requiredIf: "alignPanAxis == 'false'"
98+
- kind: 'removeParameter'
99+
name: 'alignPanAxis'
100+
- if: "alignPanAxis != ''"
101+
changes:
102+
- kind: 'removeParameter'
103+
name: 'alignPanAxis'
104+
105+
# Before adding a new fix: read instructions at the top of this file.

packages/flutter/lib/src/widgets/interactive_viewer.dart

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ class InteractiveViewer extends StatefulWidget {
6363
InteractiveViewer({
6464
super.key,
6565
this.clipBehavior = Clip.hardEdge,
66-
@Deprecated(
67-
'Use panAxis instead. '
68-
'This feature was deprecated after v3.3.0-0.5.pre.',
69-
)
70-
this.alignPanAxis = false,
7166
this.panAxis = PanAxis.free,
7267
this.boundaryMargin = EdgeInsets.zero,
7368
this.constrained = true,
@@ -112,11 +107,6 @@ class InteractiveViewer extends StatefulWidget {
112107
InteractiveViewer.builder({
113108
super.key,
114109
this.clipBehavior = Clip.hardEdge,
115-
@Deprecated(
116-
'Use panAxis instead. '
117-
'This feature was deprecated after v3.3.0-0.5.pre.',
118-
)
119-
this.alignPanAxis = false,
120110
this.panAxis = PanAxis.free,
121111
this.boundaryMargin = EdgeInsets.zero,
122112
// These default scale values were eyeballed as reasonable limits for common
@@ -162,25 +152,6 @@ class InteractiveViewer extends StatefulWidget {
162152
/// Defaults to [Clip.hardEdge].
163153
final Clip clipBehavior;
164154

165-
/// This property is deprecated, please use [panAxis] instead.
166-
///
167-
/// If true, panning is only allowed in the direction of the horizontal axis
168-
/// or the vertical axis.
169-
///
170-
/// In other words, when this is true, diagonal panning is not allowed. A
171-
/// single gesture begun along one axis cannot also cause panning along the
172-
/// other axis without stopping and beginning a new gesture. This is a common
173-
/// pattern in tables where data is displayed in columns and rows.
174-
///
175-
/// See also:
176-
/// * [constrained], which has an example of creating a table that uses
177-
/// alignPanAxis.
178-
@Deprecated(
179-
'Use panAxis instead. '
180-
'This feature was deprecated after v3.3.0-0.5.pre.',
181-
)
182-
final bool alignPanAxis;
183-
184155
/// When set to [PanAxis.aligned], panning is only allowed in the horizontal
185156
/// axis or the vertical axis, diagonal panning is not allowed.
186157
///
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter/widgets.dart';
6+
7+
void main() {
8+
// Change made in https://github.com/flutter/flutter/pull/109014
9+
InteractiveViewer(alignPanAxis: false);
10+
InteractiveViewer.builder(alignPanAxis: false);
11+
12+
InteractiveViewer(alignPanAxis: true);
13+
InteractiveViewer.builder(alignPanAxis: true);
14+
15+
InteractiveViewer(alignPanAxis: false, panAxis: PanAxis.aligned,);
16+
InteractiveViewer.builder(alignPanAxis: false, panAxis: PanAxis.aligned,);
17+
18+
InteractiveViewer(alignPanAxis: true, panAxis: PanAxis.aligned,);
19+
InteractiveViewer.builder(alignPanAxis: true, panAxis: PanAxis.aligned,);
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter/widgets.dart';
6+
7+
void main() {
8+
// Change made in https://github.com/flutter/flutter/pull/109014
9+
InteractiveViewer(panAxis: PanAxis.free);
10+
InteractiveViewer.builder(panAxis: PanAxis.free);
11+
12+
InteractiveViewer(panAxis: PanAxis.aligned);
13+
InteractiveViewer.builder(panAxis: PanAxis.aligned);
14+
15+
InteractiveViewer(panAxis: PanAxis.aligned,);
16+
InteractiveViewer.builder(panAxis: PanAxis.aligned,);
17+
18+
InteractiveViewer(panAxis: PanAxis.aligned,);
19+
InteractiveViewer.builder(panAxis: PanAxis.aligned,);
20+
}

0 commit comments

Comments
 (0)