@@ -1537,17 +1537,70 @@ void main() {
1537
1537
1538
1538
// Fill is the border's outer path, a rounded rectangle.
1539
1539
expect (box, paints
1540
- ..drrect (
1541
- style: PaintingStyle .fill,
1542
- inner: RRect .fromLTRBAndCorners (0.0 , 0.0 , 800.0 , 47.5 ,
1543
- bottomRight: const Radius .elliptical (12.0 , 11.5 ),
1544
- bottomLeft: const Radius .elliptical (12.0 , 11.5 )),
1545
- outer: RRect .fromLTRBAndCorners (0.0 , 0.0 , 800.0 , 48.5 ,
1546
- bottomRight: const Radius .elliptical (12.0 , 12.5 ),
1547
- bottomLeft: const Radius .elliptical (12.0 , 12.5 )),
1540
+ ..drrect (
1541
+ style: PaintingStyle .fill,
1542
+ inner: RRect .fromLTRBAndCorners (0.0 , 0.0 , 800.0 , 47.0 ,
1543
+ bottomRight: const Radius .elliptical (12.0 , 11.0 ),
1544
+ bottomLeft: const Radius .elliptical (12.0 , 11.0 )),
1545
+ outer: RRect .fromLTRBAndCorners (0.0 , 0.0 , 800.0 , 48.0 ,
1546
+ bottomRight: const Radius .elliptical (12.0 , 12.0 ),
1547
+ bottomLeft: const Radius .elliptical (12.0 , 12.0 )),
1548
1548
));
1549
1549
});
1550
1550
1551
+ testWidgets ('UnderlineInputBorder clips top border to prevent anti-aliasing glitches' , (WidgetTester tester) async {
1552
+ const Rect canvasRect = Rect .fromLTWH (0 , 0 , 100 , 100 );
1553
+ const UnderlineInputBorder border = UnderlineInputBorder (
1554
+ borderRadius: BorderRadius .all (Radius .circular (12.0 )),
1555
+ );
1556
+ expect (
1557
+ (Canvas canvas) => border.paint (canvas, canvasRect),
1558
+ paints
1559
+ ..drrect (
1560
+ outer: RRect .fromLTRBAndCorners (0.0 , 0.0 , 100.0 , 100.0 ,
1561
+ bottomRight: const Radius .elliptical (12.0 , 12.0 ),
1562
+ bottomLeft: const Radius .elliptical (12.0 , 12.0 )),
1563
+ inner: RRect .fromLTRBAndCorners (0.0 , 0.0 , 100.0 , 99.0 ,
1564
+ bottomRight: const Radius .elliptical (12.0 , 11.0 ),
1565
+ bottomLeft: const Radius .elliptical (12.0 , 11.0 )),
1566
+ ),
1567
+ );
1568
+
1569
+ const UnderlineInputBorder border2 = UnderlineInputBorder (
1570
+ borderRadius: BorderRadius .all (Radius .circular (60.0 )),
1571
+ );
1572
+ expect (
1573
+ (Canvas canvas) => border2.paint (canvas, canvasRect),
1574
+ paints
1575
+ ..drrect (
1576
+ outer: RRect .fromLTRBAndCorners (0.0 , 0.0 , 100.0 , 100.0 ,
1577
+ bottomRight: const Radius .elliptical (50.0 , 50.0 ),
1578
+ bottomLeft: const Radius .elliptical (50.0 , 50.0 )),
1579
+ inner: RRect .fromLTRBAndCorners (0.0 , 0.0 , 100.0 , 99.0 ,
1580
+ bottomRight: const Radius .elliptical (50.0 , 49.0 ),
1581
+ bottomLeft: const Radius .elliptical (50.0 , 49.0 )),
1582
+ ),
1583
+ reason: 'clamp is expected' ,
1584
+ );
1585
+ });
1586
+
1587
+ testWidgets ('UnderlineInputBorder draws bottom border inside container bounds' , (WidgetTester tester) async {
1588
+ const Rect canvasRect = Rect .fromLTWH (0 , 0 , 100 , 100 );
1589
+ const double borderWidth = 2.0 ;
1590
+ const UnderlineInputBorder border = UnderlineInputBorder (
1591
+ borderSide: BorderSide (width: borderWidth),
1592
+ );
1593
+ expect (
1594
+ (Canvas canvas) => border.paint (canvas, canvasRect),
1595
+ paints
1596
+ ..line (
1597
+ p1: Offset (0 , canvasRect.height - borderWidth / 2 ),
1598
+ p2: Offset (100 , canvasRect.height - borderWidth / 2 ),
1599
+ strokeWidth: borderWidth,
1600
+ ),
1601
+ );
1602
+ });
1603
+
1551
1604
testWidgets ('InputDecorator OutlineBorder focused label with icon' , (WidgetTester tester) async {
1552
1605
// This is a regression test for https://github.com/flutter/flutter/issues/82321
1553
1606
Widget buildFrame (TextDirection textDirection) {
@@ -5174,42 +5227,6 @@ void main() {
5174
5227
});
5175
5228
});
5176
5229
5177
- testWidgets ('UnderlineInputBorder clips top border to prevent anti-aliasing glitches' , (WidgetTester tester) async {
5178
- const Rect canvasRect = Rect .fromLTWH (0 , 0 , 100 , 100 );
5179
- const UnderlineInputBorder border = UnderlineInputBorder (
5180
- borderRadius: BorderRadius .all (Radius .circular (12.0 )),
5181
- );
5182
- expect (
5183
- (Canvas canvas) => border.paint (canvas, canvasRect),
5184
- paints
5185
- ..drrect (
5186
- outer: RRect .fromLTRBAndCorners (0.0 , 0.0 , 100.0 , 100.5 ,
5187
- bottomRight: const Radius .elliptical (12.0 , 12.5 ),
5188
- bottomLeft: const Radius .elliptical (12.0 , 12.5 )),
5189
- inner: RRect .fromLTRBAndCorners (0.0 , 0.0 , 100.0 , 99.5 ,
5190
- bottomRight: const Radius .elliptical (12.0 , 11.5 ),
5191
- bottomLeft: const Radius .elliptical (12.0 , 11.5 )),
5192
- ),
5193
- );
5194
-
5195
- const UnderlineInputBorder border2 = UnderlineInputBorder (
5196
- borderRadius: BorderRadius .all (Radius .circular (60.0 )),
5197
- );
5198
- expect (
5199
- (Canvas canvas) => border2.paint (canvas, canvasRect),
5200
- paints
5201
- ..drrect (
5202
- outer: RRect .fromLTRBAndCorners (0.0 , 0.0 , 100.0 , 100.5 ,
5203
- bottomRight: const Radius .elliptical (50.0 , 50.5 ),
5204
- bottomLeft: const Radius .elliptical (50.0 , 50.5 )),
5205
- inner: RRect .fromLTRBAndCorners (0.0 , 0.0 , 100.0 , 99.5 ,
5206
- bottomRight: const Radius .elliptical (50.0 , 49.5 ),
5207
- bottomLeft: const Radius .elliptical (50.0 , 49.5 )),
5208
- ),
5209
- reason: 'clamp is expected' ,
5210
- );
5211
- });
5212
-
5213
5230
testWidgets ('Ensure the height of labelStyle remains unchanged when TextField is focused' , (WidgetTester tester) async {
5214
5231
// Regression test for https://github.com/flutter/flutter/issues/141448.
5215
5232
final FocusNode focusNode = FocusNode ();
@@ -9754,12 +9771,12 @@ void main() {
9754
9771
expect (box, paints
9755
9772
..drrect (
9756
9773
style: PaintingStyle .fill,
9757
- inner: RRect .fromLTRBAndCorners (0.0 , 0.0 , 800.0 , 47.5 ,
9758
- bottomRight: const Radius .elliptical (12.0 , 11.5 ),
9759
- bottomLeft: const Radius .elliptical (12.0 , 11.5 )),
9760
- outer: RRect .fromLTRBAndCorners (0.0 , 0.0 , 800.0 , 48.5 ,
9761
- bottomRight: const Radius .elliptical (12.0 , 12.5 ),
9762
- bottomLeft: const Radius .elliptical (12.0 , 12.5 )),
9774
+ inner: RRect .fromLTRBAndCorners (0.0 , 0.0 , 800.0 , 47.0 ,
9775
+ bottomRight: const Radius .elliptical (12.0 , 11.0 ),
9776
+ bottomLeft: const Radius .elliptical (12.0 , 11.0 )),
9777
+ outer: RRect .fromLTRBAndCorners (0.0 , 0.0 , 800.0 , 48.0 ,
9778
+ bottomRight: const Radius .elliptical (12.0 , 12.0 ),
9779
+ bottomLeft: const Radius .elliptical (12.0 , 12.0 )),
9763
9780
));
9764
9781
});
9765
9782
0 commit comments