Skip to content

Commit 0c6b600

Browse files
authored
Deprecate invalid InputDecoration.collapsed parameters (flutter#152486)
## Description This PR is a follow up to flutter#152165 (review). It deprecates two parameters that should not have been added (`floatingLabelBehavior` and `floatingLabelAlignment`) to `InputDecoration.collapsed`. Those parameters are related to the floating label but a collapsed input decoration is not supposed to have labels. For the dart_fix, I created a new fix file and moved some previous fixes to it. ## Tests Adds 1 test, updates 1.
1 parent 7133a89 commit 0c6b600

File tree

7 files changed

+325
-244
lines changed

7 files changed

+325
-244
lines changed
Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
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/to/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 InputDecoration and InputDecorationTheme from the Material library. *
19+
version: 1
20+
transforms:
21+
# Changes made in https://github.com/flutter/flutter/pull/152486.
22+
- title: "Remove invalid parameter"
23+
date: 2024-07-27
24+
element:
25+
uris: [ 'material.dart' ]
26+
constructor: 'collapsed'
27+
inClass: 'InputDecoration'
28+
changes:
29+
- kind: 'removeParameter'
30+
name: 'floatingLabelBehavior'
31+
32+
# Changes made in https://github.com/flutter/flutter/pull/152486.
33+
- title: "Remove invalid parameter"
34+
date: 2024-07-27
35+
element:
36+
uris: [ 'material.dart' ]
37+
constructor: 'collapsed'
38+
inClass: 'InputDecoration'
39+
changes:
40+
- kind: 'removeParameter'
41+
name: 'floatingLabelAlignment'
42+
43+
# Changes made in https://github.com/flutter/flutter/pull/46115
44+
- title: "Migrate to 'floatingLabelBehavior'"
45+
date: 2020-01-15
46+
element:
47+
uris: [ 'material.dart' ]
48+
field: 'hasFloatingPlaceholder'
49+
inClass: 'InputDecorationTheme'
50+
changes:
51+
- kind: 'rename'
52+
newName: 'floatingLabelBehavior'
53+
54+
# Changes made in https://github.com/flutter/flutter/pull/46115
55+
- title: "Migrate to 'floatingLabelBehavior'"
56+
date: 2020-01-15
57+
element:
58+
uris: [ 'material.dart' ]
59+
constructor: ''
60+
inClass: 'InputDecorationTheme'
61+
oneOf:
62+
- if: "hasFloatingPlaceholder == 'true'"
63+
changes:
64+
- kind: 'addParameter'
65+
index: 14
66+
name: 'floatingLabelBehavior'
67+
style: optional_named
68+
argumentValue:
69+
expression: '{% FloatingLabelBehavior %}.auto'
70+
requiredIf: "hasFloatingPlaceholder == 'true'"
71+
variables:
72+
FloatingLabelBehavior:
73+
kind: 'import'
74+
uris: [ 'material.dart' ]
75+
name: 'FloatingLabelBehavior'
76+
- kind: 'removeParameter'
77+
name: 'hasFloatingPlaceholder'
78+
- if: "hasFloatingPlaceholder == 'false'"
79+
changes:
80+
- kind: 'addParameter'
81+
index: 14
82+
name: 'floatingLabelBehavior'
83+
style: optional_named
84+
argumentValue:
85+
expression: '{% FloatingLabelBehavior %}.never'
86+
requiredIf: "hasFloatingPlaceholder == 'false'"
87+
variables:
88+
FloatingLabelBehavior:
89+
kind: 'import'
90+
uris: [ 'material.dart' ]
91+
name: 'FloatingLabelBehavior'
92+
- kind: 'removeParameter'
93+
name: 'hasFloatingPlaceholder'
94+
variables:
95+
hasFloatingPlaceholder:
96+
kind: 'fragment'
97+
value: 'arguments[hasFloatingPlaceholder]'
98+
99+
# Changes made in https://github.com/flutter/flutter/pull/46115
100+
- title: "Migrate to 'floatingLabelBehavior'"
101+
date: 2020-01-15
102+
element:
103+
uris: [ 'material.dart' ]
104+
method: 'copyWith'
105+
inClass: 'InputDecorationTheme'
106+
oneOf:
107+
- if: "hasFloatingPlaceholder == 'true'"
108+
changes:
109+
- kind: 'addParameter'
110+
index: 14
111+
name: 'floatingLabelBehavior'
112+
style: optional_named
113+
argumentValue:
114+
expression: '{% FloatingLabelBehavior %}.auto'
115+
requiredIf: "hasFloatingPlaceholder == 'true'"
116+
variables:
117+
FloatingLabelBehavior:
118+
kind: 'import'
119+
uris: [ 'material.dart' ]
120+
name: 'FloatingLabelBehavior'
121+
- kind: 'removeParameter'
122+
name: 'hasFloatingPlaceholder'
123+
- if: "hasFloatingPlaceholder == 'false'"
124+
changes:
125+
- kind: 'addParameter'
126+
index: 14
127+
name: 'floatingLabelBehavior'
128+
style: optional_named
129+
argumentValue:
130+
expression: '{% FloatingLabelBehavior %}.never'
131+
requiredIf: "hasFloatingPlaceholder == 'false'"
132+
variables:
133+
FloatingLabelBehavior:
134+
kind: 'import'
135+
uris: [ 'material.dart' ]
136+
name: 'FloatingLabelBehavior'
137+
- kind: 'removeParameter'
138+
name: 'hasFloatingPlaceholder'
139+
variables:
140+
hasFloatingPlaceholder:
141+
kind: 'fragment'
142+
value: 'arguments[hasFloatingPlaceholder]'
143+
144+
# Changes made in https://github.com/flutter/flutter/pull/46115
145+
- title: "Migrate to 'floatingLabelBehavior'"
146+
date: 2020-01-15
147+
element:
148+
uris: [ 'material.dart' ]
149+
field: 'hasFloatingPlaceholder'
150+
inClass: 'InputDecoration'
151+
changes:
152+
- kind: 'rename'
153+
newName: 'floatingLabelBehavior'
154+
155+
# Changes made in https://github.com/flutter/flutter/pull/46115
156+
- title: "Rename to 'floatingLabelBehavior'"
157+
date: 2020-01-15
158+
element:
159+
uris: [ 'material.dart' ]
160+
constructor: 'collapsed'
161+
inClass: 'InputDecoration'
162+
oneOf:
163+
- if: "hasFloatingPlaceholder == 'true'"
164+
changes:
165+
- kind: 'addParameter'
166+
index: 14
167+
name: 'floatingLabelBehavior'
168+
style: optional_named
169+
argumentValue:
170+
expression: '{% FloatingLabelBehavior %}.auto'
171+
requiredIf: "hasFloatingPlaceholder == 'true'"
172+
variables:
173+
FloatingLabelBehavior:
174+
kind: 'import'
175+
uris: [ 'material.dart' ]
176+
name: 'FloatingLabelBehavior'
177+
- kind: 'removeParameter'
178+
name: 'hasFloatingPlaceholder'
179+
- if: "hasFloatingPlaceholder == 'false'"
180+
changes:
181+
- kind: 'addParameter'
182+
index: 14
183+
name: 'floatingLabelBehavior'
184+
style: optional_named
185+
argumentValue:
186+
expression: '{% FloatingLabelBehavior %}.never'
187+
requiredIf: "hasFloatingPlaceholder == 'false'"
188+
variables:
189+
FloatingLabelBehavior:
190+
kind: 'import'
191+
uris: [ 'material.dart' ]
192+
name: 'FloatingLabelBehavior'
193+
- kind: 'removeParameter'
194+
name: 'hasFloatingPlaceholder'
195+
variables:
196+
hasFloatingPlaceholder:
197+
kind: 'fragment'
198+
value: 'arguments[hasFloatingPlaceholder]'
199+
200+
# Changes made in https://github.com/flutter/flutter/pull/46115
201+
- title: "Rename to 'floatingLabelBehavior'"
202+
date: 2020-01-15
203+
element:
204+
uris: [ 'material.dart' ]
205+
constructor: ''
206+
inClass: 'InputDecoration'
207+
oneOf:
208+
- if: "hasFloatingPlaceholder == 'true'"
209+
changes:
210+
- kind: 'addParameter'
211+
index: 14
212+
name: 'floatingLabelBehavior'
213+
style: optional_named
214+
argumentValue:
215+
expression: '{% FloatingLabelBehavior %}.auto'
216+
requiredIf: "hasFloatingPlaceholder == 'true'"
217+
variables:
218+
FloatingLabelBehavior:
219+
kind: 'import'
220+
uris: [ 'material.dart' ]
221+
name: 'FloatingLabelBehavior'
222+
- kind: 'removeParameter'
223+
name: 'hasFloatingPlaceholder'
224+
- if: "hasFloatingPlaceholder == 'false'"
225+
changes:
226+
- kind: 'addParameter'
227+
index: 14
228+
name: 'floatingLabelBehavior'
229+
style: optional_named
230+
argumentValue:
231+
expression: '{% FloatingLabelBehavior %}.never'
232+
requiredIf: "hasFloatingPlaceholder == 'false'"
233+
variables:
234+
FloatingLabelBehavior:
235+
kind: 'import'
236+
uris: [ 'material.dart' ]
237+
name: 'FloatingLabelBehavior'
238+
- kind: 'removeParameter'
239+
name: 'hasFloatingPlaceholder'
240+
variables:
241+
hasFloatingPlaceholder:
242+
kind: 'fragment'
243+
value: 'arguments[hasFloatingPlaceholder]'
244+
245+
# Before adding a new fix: read instructions at the top of this file.

0 commit comments

Comments
 (0)