https://www.kindacode.com/article/how-to-make-circular-buttons-in-flutter/
ElevatedButton의 style 속성을 이용해서 만들 수 있다.
ElevatedButton(
child: const Text(
'Button',
style: TextStyle(fontSize: 24),
),
onPressed: () {},
style: ElevatedButton.styleFrom(
fixedSize: const Size(200, 200),
shape: const CircleBorder(),
),
),
MaterialButton(
color: Colors.blue,
shape: const CircleBorder(),
onPressed: () {},
child: const Padding(
padding: EdgeInsets.all(100),
child: Text(
'A circle button',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
)
주의 : InkWell 이 아니라서 Ink 반응이 없다.
GestureDetector(
onTap: () {
print('Button tapped');
},
child: const CircleAvatar(
radius: 100,
backgroundColor: Colors.indigo,
child: Text(
'A Button',
style: TextStyle(fontSize: 30),
),
)),
1번에 Container를 넣어서 좀 더 커스텀하기 좋게 만든 버전
ElevatedButton(
style: ElevatedButton.styleFrom(
shape: const CircleBorder(), primary: Colors.red),
child: Container(
width: 200,
height: 200,
alignment: Alignment.center,
decoration: const BoxDecoration(shape: BoxShape.circle),
child: const Text(
'I am a button',
style: TextStyle(fontSize: 24),
),
),
onPressed: () {},
)
Clip 계열, ClipOval 로 바꿔서도 가능하다.
ClipRRect(
borderRadius: BorderRadius.circular(120),
child: SizedBox(
width: 240,
height: 240,
child: ElevatedButton.icon(
icon: const Icon(
Icons.camera,
size: 40,
),
label: const Text(
'Camera',
style: TextStyle(fontSize: 25),
),
onPressed: () {},
),
),
),