一个可定制的浮动操作按钮菜单,它将弹出带有特殊动画的fabs。

安装

在您的 flutter 项目的 pubspec.yaml 文件中,添加以下依赖项

dependencies:
  flutter:
    sdk:
  fan_floating_menu: any

像这样导入fantasy menu包

  import 'package:fan_floating_menu/fan_floating_menu.dart';

用法

只需创建一个FanFloatingMenu组件,并传递所需的参数

  FanFloatingMenu(
        menuItems: [
          FanMenuItem(onTap: () {}, icon: Icons.edit_rounded, title: 'Edit Texts'),
          FanMenuItem(onTap: () {}, icon: Icons.save_rounded, title: 'Save Notes'),
          FanMenuItem(onTap: () {}, icon: Icons.send_rounded, title: 'Send Images'),
        ],
      ),

自定义

使用这些参数自定义FanFloatingMenu组件

  /// Defines the direction of the whole Floating Menu.
  /// Defaults to [FanMenuDirection.ltr]
  final FanMenuDirection fanMenuDirection;

  /// Defines menu items, that are of [FanMenuItem] type.
  final List<FanMenuItem> menuItems;

  /// Defines the [Curve] for use in all animations related to.
  /// Defaults to [Curves.easeInOutBack]
  final Curve expandItemsCurve;

  /// Defines any widget for the toggle button widget.
  /// If null then a plus icon will be shown.
  final Widget? toggleButtonWidget;

  /// Defines the color for the toggle button icon.
  /// Defaults to [Colors.white]
  final Color toggleButtonIconColor;

  /// Defines the color for the toggle button background.
  /// Defaults to [Colors.pink]
  final Color toggleButtonColor;

GitHub

查看 Github