import 'package:flutter/material.dart'; void main() { runApp( MaterialApp( title: 'Flutter gesture', home: LearnFloatingActionButton(), )); } class LearnFloatingActionButton extends StatefulWidget{ @override State<StatefulWidget> createState() { return _LearnFloatingActionButton(); } } class _LearnFloatingActionButton extends State<LearnFloatingActionButton>{ @override Widget build(BuildContext context) { return new Scaffold( body: new Center( child:new FloatingActionButton( child: new Icon(Icons.ac_unit),//子Widet 可以是文本或者圖片 tooltip: '長按之后提示的文字',//長按提示的文字 foregroundColor: Colors.red,//設置顯示圖標或者文本的顏色//前提是子child沒有設置 backgroundColor: Colors.blueAccent,//設置按鈕的背景色 // heroTag: ,//類似於一個標識 elevation: 10.0,//設置陰影 highlightElevation: 50.0, shape: const CircleBorder(), // isExtended: true, onPressed: (){ print('aaaaaaaaaaaaaa點擊了懸浮按鈕aaaaaaaaaaaaa'); }, ), ), ); } }

