
버튼(또는 박스)를 누르면 프레스 효과를 줄것이다.
1. InkWell위젯을 사용할 것.
2. onTap 핸들러를 설정하여, 기능은 그대로 유지할 것.
Positioned(
left: 38,
top: 231,
child: InkWell(
onTap: () {},
borderRadius: BorderRadius.circular(10),
splashColor: Colors.white.withOpacity(0.5),
highlightColor: Colors.white.withOpacity(0.1),
)
)
# 위 코드가 에러가 난다?
Material위젯을 추가하여, InkWell 위젯을 자식위젯으로 넣어준다.
Positioned(
left: 38,
top: 231,
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () {},
borderRadius: BorderRadius.circular(10),
splashColor: Colors.white.withOpacity(0.5),
highlightColor: Colors.white.withOpacity(0.1),
child: Container(...
)
)
)
)
끝*
'Flutter' 카테고리의 다른 글
| [Flutter] 첫번째 플루터 프로젝트를 끝냈다. (0) | 2023.09.18 |
|---|---|
| [Flutter] 스플래쉬(splash) 화면 설정하기 (0) | 2023.09.18 |