본문 바로가기
기초다지기/Flutter&Dart

Flutter FloatingActionButton

by 김빵그 2023. 5. 22.

 

Scaffold(
      appBar: AppBar(
        title: const Text('FloatingActionButton Sample'),
      ),
      body: const Center(child: Text('Press the button below!')),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          // Add your onPressed code here!
        },
        backgroundColor: Colors.green,
        child: const Icon(Icons.navigation),
      ),
    );
  • 머터리얼 디자인 플로팅 액션 버튼
  • 하단탭이 있는 경우 플러터에 fab도 끼워넣을 수 있는데 아래와 같은 코드를 사용하면 된다
Scaffold(
	floatingActionButton : ...
    bottomNavigationBar : BottomAppBar 
    	color:Colors.yellow, 
        child : Container(height:50.0), 
        floationgActionButtonLocation : FloatingActionButtonLocatiopn.endDocked,
        
    ),

)

 

 

 

 

 

FloatingActionButton class - material library - Dart API

A Material Design floating action button. A floating action button is a circular icon button that hovers over content to promote a primary action in the application. Floating action buttons are most commonly used in the Scaffold.floatingActionButton field.

api.flutter.dev