Flutter

Appbar(앱 바) & Drawer(드로어)

코코형아 2023. 6. 1. 02:15

App bar icon button

  • leading : 아이콘 버튼이나 간단한 위젯을 왼쪽에 배치할 때
  • actions : 복수의 아이콘 버튼 등을 오른쪽에 배치할 때
  • onPressed : 함수의 형태로 일반 버튼이나 아이콘 버튼을 터치했을 때 일어나는 이벤트를 정의

 

Drawer

  • ListView
    • UserAccountDrawerHeader
      • currentAccountPicture
      • accountName
      • accountEmail
      • onDetailsPressed
      • decoration
      • otherAccountPictures
    • ListTile
      • Icon
      • Text
      • onTap
      • leading : 앞에 배치
      • trailing : 뒤에 배치

출처 - 코딩셰프

 

 

<onPressed과 onTap의 차이점>

  • 기능상에서는 매우 유사함
  • 단지 쓰이는 곳이 조금 다르다.
    • onPressed : 주로 Button에 사용된다.
    • onTap : gestureDetector, InkWell - 길게 누르기, 두번 탭하기 등

 

<ListTile에서 onTap함수가 사용되는 이유>

  • 일반 버튼과 다르게 ListTile Widget은 탭하거나 길게누르기등 액션을 감지할 수 있는 기능을 가지고 있음.