@@ -633,7 +633,7 @@ void main() {
633633 });
634634
635635 testWidgets ('getClipPath() works for lots of kinds of decorations' , (WidgetTester tester) async {
636- Future <void > test (Decoration decoration) async {
636+ Future <void > test (Decoration decoration, [ String ? name] ) async {
637637 await tester.pumpWidget (
638638 Directionality (
639639 textDirection: TextDirection .rtl,
@@ -653,12 +653,12 @@ void main() {
653653 );
654654 await expectLater (
655655 find.byType (Container ),
656- matchesGoldenFile ('container_test.getClipPath.${decoration .runtimeType }.png' ),
656+ matchesGoldenFile ('container_test.getClipPath.${name ?? decoration .runtimeType }.png' ),
657657 );
658658 }
659659
660660 await test (const BoxDecoration ());
661- await test (const _TestDecoration ());
661+ await test (const _TestDecoration (), 'UnderlineTabIndicator' );
662662 await test (const ShapeDecoration (shape: StadiumBorder ()));
663663 await test (const FlutterLogoDecoration ());
664664 });
@@ -845,13 +845,32 @@ class _TestDecoration extends Decoration {
845845
846846 @override
847847 Path getClipPath (Rect rect, TextDirection textDirection) {
848- return Path ()..addRRect (RRect .fromRectAndRadius (rect, const Radius .circular (10 )));
848+ const borderSideWidth = 2.0 ;
849+ final indicator = Rect .fromLTWH (
850+ rect.left,
851+ rect.bottom - borderSideWidth,
852+ rect.width,
853+ borderSideWidth,
854+ );
855+ return Path ()..addRect (indicator);
849856 }
850857}
851858
852859class _TestDecorationPainter extends BoxPainter {
853860 @override
854861 void paint (Canvas canvas, Offset offset, ImageConfiguration configuration) {
855- // No painting needed for clip path testing.
862+ assert (configuration.size != null );
863+ final Rect rect = offset & configuration.size! ;
864+ const borderSideWidth = 2.0 ;
865+ const color = Color (0xFFFFFFFF );
866+ final paint = Paint ()
867+ ..color = color
868+ ..strokeCap = StrokeCap .square
869+ ..strokeWidth = borderSideWidth
870+ ..style = PaintingStyle .stroke;
871+ final Offset indicatorBottomLeft = rect.bottomLeft + const Offset (0.0 , - borderSideWidth / 2.0 );
872+ final Offset indicatorBottomRight =
873+ rect.bottomRight + const Offset (0.0 , - borderSideWidth / 2.0 );
874+ canvas.drawLine (indicatorBottomLeft, indicatorBottomRight, paint);
856875 }
857876}
0 commit comments