Skip to content

Commit 7ea710c

Browse files
authored
Fix Border.symmetric: phase 2 (#61666)
This updates the default value of the `invertMeaningOfVerticalAndHorizontal` argument from true to false. #61470
1 parent b0c146c commit 7ea710c

2 files changed

Lines changed: 16 additions & 20 deletions

File tree

‎packages/flutter/lib/src/painting/box_border.dart‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -332,20 +332,16 @@ class Border extends BoxBorder {
332332
///
333333
/// All arguments default to [BorderSide.none] and must not be null.
334334
///
335-
/// Currently, the `vertical` argument will apply to the top and bottom
336-
/// borders, and the `horizontal` argument will apply to the left and right
337-
/// borders. This is not consistent with the use of "vertical" and
338-
/// "horizontal" elsewhere in the framework, so the
339-
/// `invertMeaningOfVerticalAndHorizontal` argument exists to facilitate
340-
/// the transition of this constructor to using the correct semantics of
341-
/// these arguments. Callers are encouraged to pass false to that argument
342-
/// to get the correct semantics. In a future change, the default value of
343-
/// the argument will be changed to false, followed by the removal of the
344-
/// argument altogether.
335+
/// If the `invertMeaningOfVerticalAndHorizontal` argument is set to true,
336+
/// then the `vertical` argument will apply to the top and bottom borders, and
337+
/// the `horizontal` argument will apply to the left and right borders. This
338+
/// is not consistent with the use of "vertical" and "horizontal" elsewhere in
339+
/// the framework, so callers are discouraged from overriding the default
340+
/// value of that argument. In a future change, the argument will be removed.
345341
const Border.symmetric({
346342
BorderSide vertical = BorderSide.none,
347343
BorderSide horizontal = BorderSide.none,
348-
bool invertMeaningOfVerticalAndHorizontal = true,
344+
bool invertMeaningOfVerticalAndHorizontal = false,
349345
}) : assert(vertical != null),
350346
assert(horizontal != null),
351347
assert(invertMeaningOfVerticalAndHorizontal != null),

‎packages/flutter/test/painting/border_test.dart‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ void main() {
3131
const BorderSide side1 = BorderSide(color: Color(0xFFFFFFFF));
3232
const BorderSide side2 = BorderSide(color: Color(0xFF000000));
3333
const Border border = Border.symmetric(vertical: side1, horizontal: side2);
34-
expect(border.left, same(side2));
35-
expect(border.top, same(side1));
36-
expect(border.right, same(side2));
37-
expect(border.bottom, same(side1));
34+
expect(border.left, same(side1));
35+
expect(border.top, same(side2));
36+
expect(border.right, same(side1));
37+
expect(border.bottom, same(side2));
3838
const Border border2 = Border.symmetric(
3939
vertical: side1,
4040
horizontal: side2,
41-
invertMeaningOfVerticalAndHorizontal: false,
41+
invertMeaningOfVerticalAndHorizontal: true,
4242
);
43-
expect(border2.left, same(side1));
44-
expect(border2.top, same(side2));
45-
expect(border2.right, same(side1));
46-
expect(border2.bottom, same(side2));
43+
expect(border2.left, same(side2));
44+
expect(border2.top, same(side1));
45+
expect(border2.right, same(side2));
46+
expect(border2.bottom, same(side1));
4747
});
4848

4949
test('Border.merge', () {

0 commit comments

Comments
 (0)