728x90
반응형
class _pentagonBorder extends ShapeBorder {
@override
EdgeInsetsGeometry get dimensions => EdgeInsets.only();
@override
Path getInnerPath(Rect rect, {TextDirection? textDirection}) {
return getOuterPath(rect, textDirection: textDirection!);
}
@override
Path getOuterPath(Rect rect, {TextDirection? textDirection}) {
return Path()
..moveTo(rect.left + rect.width / 2.0, rect.top)
..lineTo(rect.right, rect.top + rect.height / 2.0)
..lineTo(rect.right - 20.0, rect.top + rect.height)
..lineTo(rect.left + rect.width, rect.bottom)
..lineTo(rect.left + 20.0, rect.top + rect.height)
..lineTo(rect.left + rect.width - 100.0, rect.bottom - rect.height / 2.0)
..close();
}
@override
void paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) {}
@override
ShapeBorder scale(double t) {
return RoundedRectangleBorder(
side: BorderSide.none.scale(t),
borderRadius: BorderRadius.zero * t,
);
}
}
RawMaterialButton(
onPressed: () => {},
constraints: BoxConstraints.tightFor(
width: 100.0, // double? width
height: 100.0 // double? height
),
fillColor: Colors.amber,
shape: _pentagonBorder(),
)
728x90
728x90
'Flutter' 카테고리의 다른 글
'File.create' has fewer named arguments than those of overridden method 'File.create' (0) | 2024.01.09 |
---|---|
onHighlightChanged (0) | 2024.01.07 |
BoxConstraints.tightFor (0) | 2024.01.07 |
안드로이드스튜디오 PlatformException(null-error, Host platform returned null value for non-null return value., null, null) (0) | 2024.01.07 |
안드로이드 Apps targeting Android 12 and higher 에러 (0) | 2024.01.01 |
댓글