Fix BorderSide.none
requiring explicit transparent color for UnderlineInputBorder
(#145329)
Fix could have been "paint transparent when Border none" but, following other Borders, we will just not paint anything. Fix https://github.com/flutter/flutter/issues/143746
This commit is contained in:
parent
e1c6445467
commit
784f19c49c
@ -243,6 +243,10 @@ class UnderlineInputBorder extends InputBorder {
|
|||||||
double gapPercentage = 0.0,
|
double gapPercentage = 0.0,
|
||||||
TextDirection? textDirection,
|
TextDirection? textDirection,
|
||||||
}) {
|
}) {
|
||||||
|
if (borderSide.style == BorderStyle.none) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (borderRadius.bottomLeft != Radius.zero || borderRadius.bottomRight != Radius.zero) {
|
if (borderRadius.bottomLeft != Radius.zero || borderRadius.bottomRight != Radius.zero) {
|
||||||
// This prevents the border from leaking the color due to anti-aliasing rounding errors.
|
// This prevents the border from leaking the color due to anti-aliasing rounding errors.
|
||||||
final BorderRadius updatedBorderRadius = BorderRadius.only(
|
final BorderRadius updatedBorderRadius = BorderRadius.only(
|
||||||
|
@ -9729,4 +9729,18 @@ void main() {
|
|||||||
expect(tester.renderObject<RenderBox>(find.text('COUNTER')).size, Size.zero);
|
expect(tester.renderObject<RenderBox>(find.text('COUNTER')).size, Size.zero);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('UnderlineInputBorder with BorderStyle.none should not show anything', (WidgetTester tester) async {
|
||||||
|
// Regression test for https://github.com/flutter/flutter/issues/143746
|
||||||
|
const InputDecoration decoration = InputDecoration(
|
||||||
|
enabledBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(style: BorderStyle.none),
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await tester.pumpWidget(buildInputDecorator(decoration: decoration));
|
||||||
|
final RenderBox box = tester.renderObject(find.byType(InputDecorator));
|
||||||
|
expect(box, isNot(paints..drrect()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user