본문 바로가기
Flutter/Flutter FAQ

Flutter 커스텀 카드 모양 플러터 SDK, Custom Card Shape Flutter SDK

by 베타코드 2023. 5. 28.
반응형

질문


I have developed an app with GridView on Flutter. GridView items are Card and the default card shape is Rectangle with a radius of 4.

I know there is shape property for Card Widget and it takes ShapeBorder class but I am unable to find how to use ShapeBorder class and customize my cards in GridView.

How do I go about this?


답변


이렇게 사용할 수 있습니다.

enter image description here

Card(
  shape: RoundedRectangleBorder(
    borderRadius: BorderRadius.circular(15.0),
  ),
  child: Text(
    'Card with circular border',
    textScaleFactor: 1.2,
  ),
),
Card(
  shape: BeveledRectangleBorder(
    borderRadius: BorderRadius.circular(10.0),
  ),
  child: Text(
    'Card with Beveled border',
    textScaleFactor: 1.2,
  ),
),
Card(
  shape: StadiumBorder(
  side: BorderSide(
    color: Colors.black,
    width: 2.0,
  ),
),
  child: Text(
    'Card with Stadium border',
    textScaleFactor: 1.2,
  ),
),
반응형

댓글