Unverified Commit 7ea710c5 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Fix Border.symmetric: phase 2 (#61666)

This updates the default value of the `invertMeaningOfVerticalAndHorizontal`
argument from true to false.

https://github.com/flutter/flutter/issues/61470
parent b0c146c5
...@@ -332,20 +332,16 @@ class Border extends BoxBorder { ...@@ -332,20 +332,16 @@ class Border extends BoxBorder {
/// ///
/// All arguments default to [BorderSide.none] and must not be null. /// All arguments default to [BorderSide.none] and must not be null.
/// ///
/// Currently, the `vertical` argument will apply to the top and bottom /// If the `invertMeaningOfVerticalAndHorizontal` argument is set to true,
/// borders, and the `horizontal` argument will apply to the left and right /// then the `vertical` argument will apply to the top and bottom borders, and
/// borders. This is not consistent with the use of "vertical" and /// the `horizontal` argument will apply to the left and right borders. This
/// "horizontal" elsewhere in the framework, so the /// is not consistent with the use of "vertical" and "horizontal" elsewhere in
/// `invertMeaningOfVerticalAndHorizontal` argument exists to facilitate /// the framework, so callers are discouraged from overriding the default
/// the transition of this constructor to using the correct semantics of /// value of that argument. In a future change, the argument will be removed.
/// these arguments. Callers are encouraged to pass false to that argument
/// to get the correct semantics. In a future change, the default value of
/// the argument will be changed to false, followed by the removal of the
/// argument altogether.
const Border.symmetric({ const Border.symmetric({
BorderSide vertical = BorderSide.none, BorderSide vertical = BorderSide.none,
BorderSide horizontal = BorderSide.none, BorderSide horizontal = BorderSide.none,
bool invertMeaningOfVerticalAndHorizontal = true, bool invertMeaningOfVerticalAndHorizontal = false,
}) : assert(vertical != null), }) : assert(vertical != null),
assert(horizontal != null), assert(horizontal != null),
assert(invertMeaningOfVerticalAndHorizontal != null), assert(invertMeaningOfVerticalAndHorizontal != null),
......
...@@ -31,19 +31,19 @@ void main() { ...@@ -31,19 +31,19 @@ void main() {
const BorderSide side1 = BorderSide(color: Color(0xFFFFFFFF)); const BorderSide side1 = BorderSide(color: Color(0xFFFFFFFF));
const BorderSide side2 = BorderSide(color: Color(0xFF000000)); const BorderSide side2 = BorderSide(color: Color(0xFF000000));
const Border border = Border.symmetric(vertical: side1, horizontal: side2); const Border border = Border.symmetric(vertical: side1, horizontal: side2);
expect(border.left, same(side2)); expect(border.left, same(side1));
expect(border.top, same(side1)); expect(border.top, same(side2));
expect(border.right, same(side2)); expect(border.right, same(side1));
expect(border.bottom, same(side1)); expect(border.bottom, same(side2));
const Border border2 = Border.symmetric( const Border border2 = Border.symmetric(
vertical: side1, vertical: side1,
horizontal: side2, horizontal: side2,
invertMeaningOfVerticalAndHorizontal: false, invertMeaningOfVerticalAndHorizontal: true,
); );
expect(border2.left, same(side1)); expect(border2.left, same(side2));
expect(border2.top, same(side2)); expect(border2.top, same(side1));
expect(border2.right, same(side1)); expect(border2.right, same(side2));
expect(border2.bottom, same(side2)); expect(border2.bottom, same(side1));
}); });
test('Border.merge', () { test('Border.merge', () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment