mirror of
https://github.com/flutter/flutter
synced 2024-07-16 10:29:14 +00:00
Remove deprecated InteractiveViewer.alignPanAxis
(#142500)
This commit is contained in:
parent
59da873ef0
commit
fcd154bd24
|
@ -0,0 +1,105 @@
|
|||
# Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# For details regarding the *Flutter Fix* feature, see
|
||||
# https://flutter.dev/docs/development/tools/flutter-fix
|
||||
|
||||
# Please add new fixes to the top of the file, separated by one blank line
|
||||
# from other fixes. In a comment, include a link to the PR where the change
|
||||
# requiring the fix was made.
|
||||
|
||||
# Every fix must be tested. See the flutter/packages/flutter/test_fixes/README.md
|
||||
# file for instructions on testing these data driven fixes.
|
||||
|
||||
# For documentation about this file format, see
|
||||
# https://dart.dev/go/data-driven-fixes.
|
||||
|
||||
# * Fixes in this file are for InteractiveViewer from the widgets library. *
|
||||
version: 1
|
||||
transforms:
|
||||
# Change made in https://github.com/flutter/flutter/pull/109014
|
||||
- title: "Migrate to 'panAxis'"
|
||||
date: 2024-02-22
|
||||
element:
|
||||
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
|
||||
constructor: ''
|
||||
inClass: 'InteractiveViewer'
|
||||
variables:
|
||||
alignPanAxis:
|
||||
kind: 'fragment'
|
||||
value: 'arguments[alignPanAxis]'
|
||||
panAxis:
|
||||
kind: 'fragment'
|
||||
value: 'arguments[panAxis]'
|
||||
oneOf:
|
||||
- if: "panAxis == '' && alignPanAxis == 'true'"
|
||||
changes:
|
||||
- kind: 'addParameter'
|
||||
index: 0
|
||||
name: 'panAxis'
|
||||
style: optional_named
|
||||
argumentValue:
|
||||
expression: 'PanAxis.aligned'
|
||||
requiredIf: "alignPanAxis == 'true'"
|
||||
- kind: 'removeParameter'
|
||||
name: 'alignPanAxis'
|
||||
- if: "panAxis == '' && alignPanAxis == 'false'"
|
||||
changes:
|
||||
- kind: 'addParameter'
|
||||
index: 0
|
||||
name: 'panAxis'
|
||||
style: optional_named
|
||||
argumentValue:
|
||||
expression: 'PanAxis.free'
|
||||
requiredIf: "alignPanAxis == 'false'"
|
||||
- kind: 'removeParameter'
|
||||
name: 'alignPanAxis'
|
||||
- if: "alignPanAxis != ''"
|
||||
changes:
|
||||
- kind: 'removeParameter'
|
||||
name: 'alignPanAxis'
|
||||
|
||||
# Change made in https://github.com/flutter/flutter/pull/109014
|
||||
- title: "Migrate to 'panAxis'"
|
||||
date: 2024-02-22
|
||||
element:
|
||||
uris: [ 'widgets.dart', 'material.dart', 'cupertino.dart' ]
|
||||
constructor: 'builder'
|
||||
inClass: 'InteractiveViewer'
|
||||
variables:
|
||||
alignPanAxis:
|
||||
kind: 'fragment'
|
||||
value: 'arguments[alignPanAxis]'
|
||||
panAxis:
|
||||
kind: 'fragment'
|
||||
value: 'arguments[panAxis]'
|
||||
oneOf:
|
||||
- if: "panAxis == '' && alignPanAxis == 'true'"
|
||||
changes:
|
||||
- kind: 'addParameter'
|
||||
index: 0
|
||||
name: 'panAxis'
|
||||
style: optional_named
|
||||
argumentValue:
|
||||
expression: 'PanAxis.aligned'
|
||||
requiredIf: "alignPanAxis == 'true'"
|
||||
- kind: 'removeParameter'
|
||||
name: 'alignPanAxis'
|
||||
- if: "panAxis == '' && alignPanAxis == 'false'"
|
||||
changes:
|
||||
- kind: 'addParameter'
|
||||
index: 0
|
||||
name: 'panAxis'
|
||||
style: optional_named
|
||||
argumentValue:
|
||||
expression: 'PanAxis.free'
|
||||
requiredIf: "alignPanAxis == 'false'"
|
||||
- kind: 'removeParameter'
|
||||
name: 'alignPanAxis'
|
||||
- if: "alignPanAxis != ''"
|
||||
changes:
|
||||
- kind: 'removeParameter'
|
||||
name: 'alignPanAxis'
|
||||
|
||||
# Before adding a new fix: read instructions at the top of this file.
|
|
@ -63,11 +63,6 @@ class InteractiveViewer extends StatefulWidget {
|
|||
InteractiveViewer({
|
||||
super.key,
|
||||
this.clipBehavior = Clip.hardEdge,
|
||||
@Deprecated(
|
||||
'Use panAxis instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
this.alignPanAxis = false,
|
||||
this.panAxis = PanAxis.free,
|
||||
this.boundaryMargin = EdgeInsets.zero,
|
||||
this.constrained = true,
|
||||
|
@ -112,11 +107,6 @@ class InteractiveViewer extends StatefulWidget {
|
|||
InteractiveViewer.builder({
|
||||
super.key,
|
||||
this.clipBehavior = Clip.hardEdge,
|
||||
@Deprecated(
|
||||
'Use panAxis instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
this.alignPanAxis = false,
|
||||
this.panAxis = PanAxis.free,
|
||||
this.boundaryMargin = EdgeInsets.zero,
|
||||
// These default scale values were eyeballed as reasonable limits for common
|
||||
|
@ -162,25 +152,6 @@ class InteractiveViewer extends StatefulWidget {
|
|||
/// Defaults to [Clip.hardEdge].
|
||||
final Clip clipBehavior;
|
||||
|
||||
/// This property is deprecated, please use [panAxis] instead.
|
||||
///
|
||||
/// If true, panning is only allowed in the direction of the horizontal axis
|
||||
/// or the vertical axis.
|
||||
///
|
||||
/// In other words, when this is true, diagonal panning is not allowed. A
|
||||
/// single gesture begun along one axis cannot also cause panning along the
|
||||
/// other axis without stopping and beginning a new gesture. This is a common
|
||||
/// pattern in tables where data is displayed in columns and rows.
|
||||
///
|
||||
/// See also:
|
||||
/// * [constrained], which has an example of creating a table that uses
|
||||
/// alignPanAxis.
|
||||
@Deprecated(
|
||||
'Use panAxis instead. '
|
||||
'This feature was deprecated after v3.3.0-0.5.pre.',
|
||||
)
|
||||
final bool alignPanAxis;
|
||||
|
||||
/// When set to [PanAxis.aligned], panning is only allowed in the horizontal
|
||||
/// axis or the vertical axis, diagonal panning is not allowed.
|
||||
///
|
||||
|
|
20
packages/flutter/test_fixes/widgets/interactive_viewer.dart
Normal file
20
packages/flutter/test_fixes/widgets/interactive_viewer.dart
Normal file
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() {
|
||||
// Change made in https://github.com/flutter/flutter/pull/109014
|
||||
InteractiveViewer(alignPanAxis: false);
|
||||
InteractiveViewer.builder(alignPanAxis: false);
|
||||
|
||||
InteractiveViewer(alignPanAxis: true);
|
||||
InteractiveViewer.builder(alignPanAxis: true);
|
||||
|
||||
InteractiveViewer(alignPanAxis: false, panAxis: PanAxis.aligned,);
|
||||
InteractiveViewer.builder(alignPanAxis: false, panAxis: PanAxis.aligned,);
|
||||
|
||||
InteractiveViewer(alignPanAxis: true, panAxis: PanAxis.aligned,);
|
||||
InteractiveViewer.builder(alignPanAxis: true, panAxis: PanAxis.aligned,);
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
void main() {
|
||||
// Change made in https://github.com/flutter/flutter/pull/109014
|
||||
InteractiveViewer(panAxis: PanAxis.free);
|
||||
InteractiveViewer.builder(panAxis: PanAxis.free);
|
||||
|
||||
InteractiveViewer(panAxis: PanAxis.aligned);
|
||||
InteractiveViewer.builder(panAxis: PanAxis.aligned);
|
||||
|
||||
InteractiveViewer(panAxis: PanAxis.aligned,);
|
||||
InteractiveViewer.builder(panAxis: PanAxis.aligned,);
|
||||
|
||||
InteractiveViewer(panAxis: PanAxis.aligned,);
|
||||
InteractiveViewer.builder(panAxis: PanAxis.aligned,);
|
||||
}
|
Loading…
Reference in a new issue