1. /**
    2. const FloatingActionButton({
    3. Key key,
    4. this.child,//按钮显示的内容
    5. this.tooltip,//长按时显示的提示
    6. this.foregroundColor,//前景色,影响到文字颜色
    7. this.backgroundColor,//背景色
    8. this.heroTag = const _DefaultHeroTag(),//hero效果使用的tag,系统默认会给所有FAB使用同一个tag,方便做动画效果
    9. this.elevation = 6.0,//未点击时阴影值
    10. this.highlightElevation = 12.0,//点击下阴影值
    11. @required this.onPressed,
    12. this.mini = false,//FloatingActionButton有regular, mini, extended三种类型,默认为false即regular类型,true时按钮变小即mini类型,extended需要通过FloatingActionButton.extended()创建,可以定制显示内容
    13. this.shape = const CircleBorder(),//定义FAB的shape,设置shape时,默认的elevation将会失效,默认为CircleBorder
    14. this.clipBehavior = Clip.none,
    15. this.materialTapTargetSize,
    16. this.isExtended = false,//是否为”extended”类型
    17. })
    18. */

    设置位置

    1. 设置FloatingActionButton位置
    2. //centerDocked 底部中间
    3. //endDocked 底部右侧
    4. //centerFloat 中间偏上
    5. //endFloat 底部偏上
    6. home: Scaffold(
    7. appBar: AppBar(
    8. title: Text("FloatingActionButton"),
    9. ),
    10. body: Container(),
    11. floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
    12. floatingActionButton: FloatingActionButton(
    13. onPressed: () => print("FloatingActionButton"),
    14. child: Text("button"),
    15. ),
    16. ),