如何扩大FAB

时间:2019-05-18 14:52:02

标签: dart flutter material-design flutter-sliver

如何使底部 FAB 像下面的图像一样?

enter image description here

这是我当前的代码示例:

(for tumbling window $window in ('Cat', 'likes', 'fish', 'Dog', 'likes', 'bones')
start at $s when $s mod 3 = 1
return
  string-join($window)
  )
  ! bs:next-function(.)

我尝试了很多但没有运气:(有什么解决方法吗?谢谢您的建议:)

1 个答案:

答案 0 :(得分:3)

无法设置FAB的尺寸。相反,您必须使用RawMaterialButton,复制FAB的默认属性并更改大小:

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: Stack(
      alignment: Alignment.bottomCenter,
      children: <Widget>[
        CustomScrollView(
          slivers: <Widget>[
            ...
          ],
        ),
        RawMaterialButton(
          elevation: 6,
          highlightElevation: 12.0,
          constraints: BoxConstraints(
            minHeight: 48.0,
            minWidth: double.infinity,
            maxHeight: 48.0,
          ),
          fillColor: Theme.of(context).accentColor,
          textStyle: Theme.of(context).accentTextTheme.button.copyWith(
            color: Theme.of(context).accentIconTheme.color,
            letterSpacing: 1.2,
          ),
          child: Text("SAVE THE CHANGE"),
          onPressed: () {},
        )
      ],
    ),
  );
}