Flutter Boom Menu

用于实现 Boom Menu 的 Flutter 插件,包含图标、标题、副标题、动画 FAB 图标和滚动时隐藏功能。

用法

BoomMenu 小部件旨在放置在 Scaffold.floatingActionButton 参数中,取代 FloatingActionButton 小部件。
无法使用 Scaffold.floatingActionButtonLocation 参数设置其位置,但可以使用 marginRightmarginBottom 参数(默认为 16)设置右边距和下边距,将按钮放置在屏幕的任何位置。
使用 Scaffold.bottomNavigationBar 时,浮动按钮始终位于导航栏上方,因此 BottomAppBar.hasNotch 应始终为 false

标题

每个子按钮都可以有一个 IconTitleSubTitle,可以通过自己提供来定制。如果 Title 参数未提供,则不会渲染标题。

该包将自行处理动画。

ezgif.com-video-to-gif

用法示例(包含所有参数)

Widget build(BuildContext context) {
    return Scaffold(
        floatingActionButton: BoomMenu(
      animatedIcon: AnimatedIcons.menu_close,
      animatedIconTheme: IconThemeData(size: 22.0),
      //child: Icon(Icons.add),
      onOpen: () => print('OPENING DIAL'),
      onClose: () => print('DIAL CLOSED'),
      scrollVisible: scrollVisible,
      overlayColor: Colors.black,
      overlayOpacity: 0.7,
      children: [
        MenuItem(
          child: Icon(Icons.accessibility, color: Colors.black),
          title: "Profiles",
          titleColor: Colors.white,
          subtitle: "You Can View the Noel Profile",
          subTitleColor: Colors.white,
          backgroundColor: Colors.deepOrange,
          onTap: () => print('FIRST CHILD'),
        ),
        MenuItem(
          child: Icon(Icons.brush, color: Colors.black),
          title: "Profiles",
          titleColor: Colors.white,
          subtitle: "You Can View the Noel Profile",
          subTitleColor: Colors.white,
          backgroundColor: Colors.green,
          onTap: () => print('SECOND CHILD'),
        ),
        MenuItem(
          child: Icon(Icons.keyboard_voice, color: Colors.black),
          title: "Profile",
          titleColor: Colors.white,
          subtitle: "You Can View the Noel Profile",
          subTitleColor: Colors.white,
          backgroundColor: Colors.blue,
          onTap: () => print('THIRD CHILD'),
        ),
        MenuItem(
          child: Icon(Icons.ac_unit, color: Colors.black),
          title: "Profiles",
          titleColor: Colors.white,
          subtitle: "You Can View the Noel Profile",
          subTitleColor: Colors.white,
          backgroundColor: Colors.blue,
          onTap: () => print('FOURTH CHILD'),
        )
      ],
    ),
    );
}

问题与反馈

请提交一个 issue 来发送反馈或报告错误。谢谢!

GitHub

https://github.com/ralphnoel13/flutter_boom_menu