File tree Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Expand file tree Collapse file tree 3 files changed +38
-3
lines changed Original file line number Diff line number Diff line change @@ -561,7 +561,7 @@ class _OutlineBorder extends ShapeBorder implements MaterialStateProperty<ShapeB
561
561
case BorderStyle .none:
562
562
break ;
563
563
case BorderStyle .solid:
564
- canvas.drawPath (shape.getOuterPath (rect, textDirection: textDirection), side.toPaint ());
564
+ canvas.drawPath (shape.getOuterPath (rect. deflate (side.width / 2.0 ) , textDirection: textDirection), side.toPaint ());
565
565
}
566
566
}
567
567
Original file line number Diff line number Diff line change @@ -867,6 +867,39 @@ void main() {
867
867
);
868
868
});
869
869
870
+ testWidgets ('OutlineButton uses borderSide width to paint' , (WidgetTester tester) async {
871
+ final GlobalKey buttonKey = GlobalKey ();
872
+ const double thickness = 12.5 ;
873
+ await tester.pumpWidget (
874
+ Directionality (
875
+ textDirection: TextDirection .ltr,
876
+ child: Material (
877
+ child: Align (
878
+ alignment: Alignment .topLeft,
879
+ child: OutlineButton (
880
+ key: buttonKey,
881
+ borderSide: const BorderSide (
882
+ color: Colors .black12,
883
+ width: thickness),
884
+ onPressed: () {},
885
+ child: const SizedBox (
886
+ width: 120 ,
887
+ height: 50 ,
888
+ child: Text ('ABC' ),
889
+ ),
890
+ ),
891
+ ),
892
+ ),
893
+ ),
894
+ );
895
+
896
+ final Finder outlineButton = find.byType (OutlineButton );
897
+ expect (outlineButton, paints..path (
898
+ includes: const < Offset > [Offset (60 , thickness / 2.0 )],
899
+ excludes: const < Offset > [Offset (60 , thickness / 3.0 )],
900
+ ));
901
+ });
902
+
870
903
testWidgets ('OutlineButton contributes semantics' , (WidgetTester tester) async {
871
904
final SemanticsTester semantics = SemanticsTester (tester);
872
905
await tester.pumpWidget (
Original file line number Diff line number Diff line change @@ -1163,13 +1163,15 @@ class _PathPaintPredicate extends _DrawCommandPaintPredicate {
1163
1163
if (includes != null ) {
1164
1164
for (final Offset offset in includes) {
1165
1165
if (! pathArgument.contains (offset))
1166
- throw 'It called $methodName with a path that unexpectedly did not contain $offset .' ;
1166
+ throw 'It called $methodName with a path that unexpectedly did not '
1167
+ 'contain $offset . Path bounds = ${pathArgument .getBounds ()}' ;
1167
1168
}
1168
1169
}
1169
1170
if (excludes != null ) {
1170
1171
for (final Offset offset in excludes) {
1171
1172
if (pathArgument.contains (offset))
1172
- throw 'It called $methodName with a path that unexpectedly contained $offset .' ;
1173
+ throw 'It called $methodName with a path that unexpectedly '
1174
+ 'contained $offset . . Path bounds = ${pathArgument .getBounds ()}' ;
1173
1175
}
1174
1176
}
1175
1177
}
You can’t perform that action at this time.
0 commit comments