diff --git a/packages/flutter/lib/fix_data/fix_widgets/fix_interactive_viewer.yaml b/packages/flutter/lib/fix_data/fix_widgets/fix_interactive_viewer.yaml new file mode 100644 index 00000000000..e800dbaa8d7 --- /dev/null +++ b/packages/flutter/lib/fix_data/fix_widgets/fix_interactive_viewer.yaml @@ -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. diff --git a/packages/flutter/lib/src/widgets/interactive_viewer.dart b/packages/flutter/lib/src/widgets/interactive_viewer.dart index baa8ec12b0e..818ab5851ae 100644 --- a/packages/flutter/lib/src/widgets/interactive_viewer.dart +++ b/packages/flutter/lib/src/widgets/interactive_viewer.dart @@ -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. /// diff --git a/packages/flutter/test_fixes/widgets/interactive_viewer.dart b/packages/flutter/test_fixes/widgets/interactive_viewer.dart new file mode 100644 index 00000000000..e516d81f132 --- /dev/null +++ b/packages/flutter/test_fixes/widgets/interactive_viewer.dart @@ -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,); +} diff --git a/packages/flutter/test_fixes/widgets/interactive_viewer.dart.expect b/packages/flutter/test_fixes/widgets/interactive_viewer.dart.expect new file mode 100644 index 00000000000..72b8d547bb9 --- /dev/null +++ b/packages/flutter/test_fixes/widgets/interactive_viewer.dart.expect @@ -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,); +}