MCPcopy Create free account
hub / github.com/Roaa94/flutter_action_menu

github.com/Roaa94/flutter_action_menu @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
51 symbols 66 edges 17 files 11 documented · 22% updated 2y ago★ 244

Browse by type

Functions 44 Types & classes 7
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Flutter Action Menu

Animated action menu built with Flutter. Includes effects like the rubber band effect, different gesture handling, and haptic feedback that come together for a great interactive feel.

🔗 Original concept

https://github.com/Roaa94/flutter_action_menu/assets/50345358/0821ddbe-9a9c-48e2-93e7-11f6c1a5deb8

The Rubber Band Effect

The pull and stretch effect in the menu is similar to the sound & brightness sliders in the iOS control center.

The effect can be achieved by adjusting the scaling and positioning by the amount of stretch value, with a logarithmic function applied to it. With #Flutter this was done with a Transform.scale widget that increases scaleY, decreases scaleX, and switches the alignment between top and bottom based on the direction of the stretching.

🔗 The standalone widget for this rubber band slider.

https://github.com/Roaa94/flutter_action_menu/assets/50345358/c7eb0530-9bfe-43eb-abeb-daa8da90f027

Overlay Menu

The overlay menu is achieved using an OverlayPortal widget with a combination of CompositedTransformTarget and CompositedTransformFollower widgets to correctly position the overlay

image

class _OverlayPortalSkeletonState extends State<OverlayPortalSkeleton> {
  final _overlayController = OverlayPortalController();
  final _link = LayerLink();

  @override
  Widget build(BuildContext context) {
    return OverlayPortal(
      controller: _overlayController,
      overlayChildBuilder: (context) {
        return CompositedTransformFollower(
          link: _link,
          targetAnchor: Alignment.topCenter,
          followerAnchor: Alignment.bottomCenter,
          child: const Align(
            alignment: Alignment.bottomCenter,
            child: ActionMenu(),
          ),
        );
      },
      child: CompositedTransformTarget(
        link: _link,
        child: const ActionMenuButton(),
      ),
    );
  }
}

Gestures and Haptics

With different handling of gestures, using a Listener and a GestureDetector widget, both swapping up and long pressing on the action button open the overlay, with a spring effect on the long press gesture.

With those gestures, different levels of #HapticFeedback impacts are applied for an enhanced feel of responsiveness to user touch ✨ (highly recommend you run it and experience it yourself!)

import 'package: flutter/services.dart';

// Very light vibration
HapticFeedback.lightImpact);

// Light vibration
HapticFeedback.mediumImpact);

// Medium vibration
HapticFeedback.heavyImpact);

// Long and high vibration
HapticFeedback.vibrate();

// Very short and light vibration
// Used to indicate UI changes, for example, in a Slider widget
HapticFeedback.selectionClick();

Core symbols most depended-on inside this repo

Shape

Method 27
Function 17
Class 7

Languages

C++98%
Kotlin2%

Modules by API surface

windows/runner/win32_window.cpp23 symbols
linux/my_application.cc9 symbols
windows/runner/win32_window.h5 symbols
windows/runner/flutter_window.cpp5 symbols
windows/runner/utils.cpp3 symbols
windows/runner/main.cpp1 symbols
windows/runner/flutter_window.h1 symbols
windows/flutter/generated_plugin_registrant.cc1 symbols
linux/main.cc1 symbols
linux/flutter/generated_plugin_registrant.cc1 symbols
android/app/src/main/kotlin/com/roaakdm/flutter_action_menu/MainActivity.kt1 symbols

For agents

$ claude mcp add flutter_action_menu \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page