GithubHelp home page GithubHelp logo

alnitak / flutter_star_menu Goto Github PK

View Code? Open in Web Editor NEW
48.0 2.0 16.0 19.4 MB

Flutter contextual popup menu with different shapes and multiple ways to fine-tune animation and position

License: MIT License

Dart 81.47% Java 0.15% Swift 0.45% Objective-C 0.04% CMake 8.42% C++ 4.55% C 0.77% HTML 4.15%
flutter flutter-plugin flutter-ui menu popup menu-animation widget

flutter_star_menu's Introduction

Hi_there2

  • ๐Ÿ“† Flutter enthusiast since 2018, I've been on an exciting journey of creating innovative solutions using the power of Dart and Flutter.
  • ๐Ÿงฐ Open Source Advocate: I'm all about giving back to the community. You'll find some cool open-source Flutter plugins in my repository.
  • ๐Ÿ’ก Problem Solver: I love tackling complex challenges, and I'm constantly learning to keep my skills sharp.

๐ŸŒŸ My GitHub Highlights:

  • flutter_soloud๐Ÿ‘‡๐Ÿผ: Flutter low level audio plugin using SoLoud C++ library and FFI.
  • flutter_opencv_dlib๐Ÿ‘‡๐Ÿผ: Realtime face detection and face recognition using OpenCV and dlib with Dart:ffi.
  • flutter_opengl๐Ÿ‘‡๐Ÿผ: A Flutter OpenGL ES plugin using a Texture() widget.
  • magnifying_glass๐Ÿ‘‡๐Ÿผ: Flutter real-time magnifying glass lens widget with Barrel/Pincushion distortion.
  • flutter_star_menu๐Ÿ‘‡๐Ÿผ: Attach a popup menu to any widget with any widget as menu entries.
  • finger_painter๐Ÿ‘‡๐Ÿผ: Finger paint with different brushes and different blend modes.
  • flutter_flow_chart๐Ÿ‘‡๐Ÿผ: Draw a flow chart diagram with different kind of customizable elements.

Feel free to explore my repositories, and if you have any questions, suggestions, or collaboration ideas, I'm living on Earth (๐Ÿ‡ฎ๐Ÿ‡น) and I'm just a message away. Let's code something amazing together! ๐Ÿš€

LinkedIn Badge Youtube Badge Twitter Badge

Happy coding! ๐Ÿš€


flutter_soloud

soloud6.mp4
soloud9-waveform-B.mp4
Flutter low level audio plugin using SoLoud C++ library and FFI
  • Player and capture audio from microphone
  • 3D audio with doppler effect
  • Faders, oscillators, audio effects like echo, freeverb, robotizer, equalizer, bassboost
  • retrieval of audio FFT and wave data

flutter_opencv_dlib

flutter_opencv_dlib-linux.mp4
Realtime face detection and face recognition using OpenCV and dlib with Dart:ffi

flutter_opengl

A Flutter OpenGL ES plugin using a Texture() widget. Supports Android, Linux and Windows.
A project born in 2019 to address the absence of native OpenGL.
  • use platform GLSL
  • shaders can be modified and compiled at ruun-time
  • use dart:ffi to bind c/c++ OpenGL calls
  • vertex and fragment shaders
  • Many shaders from ShaderToy.com can be copy/pasted


some packages

magnifying_glass flutter_star_menu finger_painter flutter_flow_chart

Flutter real-time magnifying glass lens widget with Barrel/Pincushion distortion.

A simple way to attach a popup menu to any widget with any widget as menu entries.

Painting package that let you finger paint with different brushes and different blend modes. The result can be read as a bitmap or list of Points to be used ie on a Map.

A package that let you draw a flow chart diagram with different kind of customizable elements. Dashboards can be saved for later use.

flutter_star_menu's People

Contributors

alnitak avatar jbetts80 avatar kaminami avatar tksuns12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flutter_star_menu's Issues

How to show menu onLongPress?

Now on click show menu, how to display on long press?

import 'package:flutter/material.dart';
import 'package:star_menu/star_menu.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'StarMenu Demo',
      home: const MyHomePage(),
      theme: ThemeData(useMaterial3: false),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool isMenuVisible = false;

  @override
  Widget build(BuildContext context) {
    final backgroundStarMenuController = StarMenuController();

    // entries for the dropdown menu
    final upperMenuItems = <Widget>[
      const Text('menu entry 1'),
      const Text('menu entry 2'),
      const Text('menu entry 3'),
      const Text('menu entry 4'),
      const Text('menu entry 5'),
      const Text('menu entry 6'),
    ];

    return Scaffold(
      resizeToAvoidBottomInset: false,
      appBar: AppBar(
        title: const Text('StarMenu demo'),
      ),
      body: GestureDetector(
        child: Stack(
          children: [
            // Add your other widgets here
            Center(
              child: Text(
                'Long press anywhere to open the menu',
                style: TextStyle(fontSize: 20),
              ).addStarMenu(
                items: upperMenuItems,
                params: StarMenuParameters.dropdown(context).copyWith(
                  backgroundParams: const BackgroundParams().copyWith(
                    sigmaX: 3,
                    sigmaY: 3,
                  ),
                  useTouchAsCenter: true,
                ),
                controller: backgroundStarMenuController,
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Odd interaction with Google Maps Flutter

I posted abut this in the Flutter Dev subreddit yesterday, but I have done some more exploring and I think it is somehow related to the interaction between StarMenu and Google Maps in iOS. I put a skeleton app together and I can repro the issue on an iOS simulator. When I tap the button in the skeleton app with a Google Maps widget as part of the Stack, then I get the background flickering and sometimes catch a glimpse of the menu buttons flashing. If I remove the Google Maps widget, the menu works as expected. This is limited to iOS - I cannot repro it on Android.

import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:star_menu/star_menu.dart';


void main() {
  runApp(const MyApp());
}


class MyApp extends StatelessWidget {
  const MyApp({super.key});


  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'StarMenu test',
      theme: ThemeData(


        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'StarMenu test app'),
    );
  }
}


class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});


  final String title;
  @override
  State<MyHomePage> createState() => _MyHomePageState();
}


class _MyHomePageState extends State<MyHomePage> {
  
  late GoogleMapController _controller;



   void onMapCreated(GoogleMapController controller) async {
    _controller = controller;
  }


  List<FloatingActionButton> menuEntries = [
    const FloatingActionButton(
      onPressed: null,
      backgroundColor: Colors.white,
      child: Icon(Icons.add),
    ),
    const FloatingActionButton(
      onPressed: null,
      backgroundColor: Colors.white,
      child: Icon(Icons.search),
    ),
    const FloatingActionButton(
      onPressed: null,
      backgroundColor: Colors.white,
      child: Icon(Icons.logout),
    )
  ];


  @override
  Widget build(BuildContext context) {
    var containerKey = GlobalKey();
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Stack(
        fit: StackFit.expand,
        children: <Widget>[
      GoogleMap(
            onMapCreated: onMapCreated,
            initialCameraPosition: const CameraPosition(
              target: LatLng(0,0),
              zoom: 15.0,
            ),
            myLocationEnabled: true,
            myLocationButtonEnabled: false,
            zoomControlsEnabled: false,
          ),
      Positioned(bottom: 20,
            left: 20,
            child: StarMenu(
              params: StarMenuParameters(
                shape: MenuShape.linear,
                linearShapeParams: const LinearShapeParams(
                  angle: 90,
                  alignment: LinearAlignment.left,
                  space: 10,
                ),
                animationCurve: Curves.easeOutCubic,
                centerOffset: const Offset(0, -80),
                openDurationMs: 150,
                backgroundParams: BackgroundParams(
                  backgroundColor: Colors.blue.withOpacity(0.2),
                  animatedBackgroundColor: false,
                  animatedBlur: false,
                  sigmaX: 10,
                  sigmaY: 10,
                ),
              ),
              lazyItems: () async {
                return menuEntries;
              },
              parentContext: containerKey.currentContext,
              onItemTapped: (index, c) async {
                debugPrint('****** Item $index tapped ******');
                c.closeMenu!();
                },
                child: const FloatingActionButton(
                onPressed: null,
                backgroundColor: Colors.white,
                child: Icon(Icons.view_stream_rounded),
              ),
            ),
          )
        ],
      ),
    );
  }
}

pubspec dependencies:

dependencies:
  flutter:
    sdk: flutter
  star_menu: ^4.0.0
  google_maps_flutter: ^2.6.0
  google_maps_flutter_android: ^2.5.0
  google_maps_flutter_ios: ^2.5.0
  google_maps_flutter_platform_interface: ^2.6.0

How is it possible to make it work with a BottomNavigationBar ?

Hello,

I would like to use this lib with my BottomNavigationBar.

@override
Widget build(BuildContext context) {
  return BottomNavigationBar(
    selectedItemColor: ColorResources.blue,
    unselectedItemColor: ColorResources.black,
    showUnselectedLabels: true,
    items: <BottomNavigationBarItem>[
      BottomNavigationBarItem(
        icon: SvgPicture.asset(
          "assets/menu_icon/ICON_accueil.svg",
        ),
        activeIcon: SvgPicture.asset("assets/menu_icon/ICON_accueil.svg",
            color: ColorResources.blue),
        label: "Fil d'actu",
      ),
      BottomNavigationBarItem(
        icon: SvgPicture.asset("assets/menu_icon/Idees_votez.svg"),
        activeIcon: SvgPicture.asset("assets/menu_icon/Idees_votez.svg",
            color: ColorResources.blue),
        label: 'Idรฉes',
      ),
      BottomNavigationBarItem(
        icon: SvgPicture.asset("assets/menu_icon/Entraide.svg"),
        activeIcon: SvgPicture.asset("assets/menu_icon/Entraide.svg",
            color: ColorResources.blue),
        label: 'Entraide',
      ),
      BottomNavigationBarItem(
        icon: SvgPicture.asset("assets/menu_icon/Projet.svg"),
        activeIcon: SvgPicture.asset("assets/menu_icon/Projet.svg",
            color: ColorResources.blue),
        label: 'Projets',
      ),
      const BottomNavigationBarItem(
        icon: Icon(Icons.menu),
        activeIcon: Icon(Icons.menu, color: ColorResources.blue),
        label: 'Autres',
      ),
    ],
    currentIndex: _selectedIndex,
    onTap: showThat,
  );
}

The goal is to show the chipsEntries when i tap on the "Autres" Icon.

How can i do that ?

Thanks !

Starmenu Elements are not Stateful

The single Menu Elements are not stateful. As I try to use it as a checking menu with a background color change when clicked, it would be helpful to make the StarItems stateful.

Would be glad if thats on the pipeline for this great package!

Cannot get renderObject of inactive element

Hello. I'm using flutter_star_menu with your flutter_flow_chart package. Thank you for your extraordinary effort.
But when I try to change the value of a TextField widget inside of a StarMenu I'm encountering this error. I don't know how to solve this. Can you help me with this issue?

`
======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
Cannot get renderObject of inactive element.

In order for an element to have a valid renderObject, it must be active, which means it is part of the tree.
Instead, this element is in the _ElementLifecycle.defunct state.
If you called this method from a State object, consider guarding it with State.mounted.
The findRenderObject() method was called for the following element: StatefulElement#a8d55(DEFUNCT)
no widget
When the exception was thrown, this was the stack:
#0 Element.findRenderObject. (package:flutter/src/widgets/framework.dart:4581:9)
#1 Element.findRenderObject (package:flutter/src/widgets/framework.dart:4594:6)
#2 StarMenuState._showMenu (package:star_menu/src/star_menu.dart:398:36)
#3 StarMenuState.showMenu (package:star_menu/src/star_menu.dart:386:7)
#4 StarMenuState.resetForChanges (package:star_menu/src/star_menu.dart:244:7)
#5 StarMenuState.didChangeMetrics. (package:star_menu/src/star_menu.dart:229:7)
#6 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1325:15)
#7 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1264:9)
#8 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1113:5)
#9 _invoke (dart:ui/hooks.dart:312:13)
#10 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:383:5)
#11 _drawFrame (dart:ui/hooks.dart:283:31)

====================================================================================================
E/flutter (28082): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: 'package:flutter/src/widgets/overlay.dart': Failed assertion: line 168 pos 12: '_overlay != null': is not true.
E/flutter (28082): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
E/flutter (28082): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
E/flutter (28082): #2 OverlayEntry.remove (package:flutter/src/widgets/overlay.dart:168:12)
E/flutter (28082): #3 StarMenuState._dispose (package:star_menu/src/star_menu.dart:207:19)
E/flutter (28082): #4 StarMenuState.closeMenu. (package:star_menu/src/star_menu.dart:362:9)
E/flutter (28082): #5 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:846:45)
E/flutter (28082): #6 Future._propagateToListeners (dart:async/future_impl.dart:875:13)
E/flutter (28082): #7 Future._completeWithValue (dart:async/future_impl.dart:647:5)
E/flutter (28082): #8 Future._asyncCompleteWithValue. (dart:async/future_impl.dart:721:7)
E/flutter (28082): #9 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter (28082): #10 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
E/flutter (28082):

======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
Cannot get renderObject of inactive element.

In order for an element to have a valid renderObject, it must be active, which means it is part of the tree.
Instead, this element is in the _ElementLifecycle.defunct state.
If you called this method from a State object, consider guarding it with State.mounted.
The findRenderObject() method was called for the following element: StatefulElement#a8d55(DEFUNCT)
no widget
When the exception was thrown, this was the stack:
#0 Element.findRenderObject. (package:flutter/src/widgets/framework.dart:4581:9)
#1 Element.findRenderObject (package:flutter/src/widgets/framework.dart:4594:6)
#2 StarMenuState._showMenu (package:star_menu/src/star_menu.dart:398:36)
#3 StarMenuState.showMenu (package:star_menu/src/star_menu.dart:386:7)
#4 StarMenuState.build. (package:star_menu/src/star_menu.dart:286:9)
#5 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1325:15)
#6 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1264:9)
#7 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1113:5)
#8 _invoke (dart:ui/hooks.dart:312:13)
#9 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:383:5)
#10 _drawFrame (dart:ui/hooks.dart:283:31)

====================================================================================================
D/InputMethodManager(28082): HSIFW - flag : 0
D/InsetsSourceConsumer(28082): setRequestedVisible: visible=false, type=13, host=com.digitstudios.algorithm/com.digitstudios.algorithm.MainActivity, from=android.view.InsetsSourceConsumer.hide:236 android.view.ImeInsetsSourceConsumer.hide:101 android.view.InsetsController.hideDirectly:1430 android.view.InsetsController.controlAnimationUnchecked:1112 android.view.InsetsController.applyAnimation:1417 android.view.InsetsController.hide:984 android.view.ViewRootImpl$ViewRootHandler.handleMessage:6150 android.os.Handler.dispatchMessage:106 android.os.Looper.loop:246 android.app.ActivityThread.main:8653
D/InputConnectionAdaptor(28082): The input method toggled cursor monitoring off
I/SurfaceControl(28082): nativeRelease nativeObject s[505567771040]
I/SurfaceControl(28082): nativeRelease nativeObject e[505567771040]

======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
Cannot get renderObject of inactive element.

In order for an element to have a valid renderObject, it must be active, which means it is part of the tree.
Instead, this element is in the _ElementLifecycle.defunct state.
If you called this method from a State object, consider guarding it with State.mounted.
The findRenderObject() method was called for the following element: StatefulElement#a8d55(DEFUNCT)
no widget
When the exception was thrown, this was the stack:
#0 Element.findRenderObject. (package:flutter/src/widgets/framework.dart:4581:9)
#1 Element.findRenderObject (package:flutter/src/widgets/framework.dart:4594:6)
#2 StarMenuState._showMenu (package:star_menu/src/star_menu.dart:398:36)
#3 StarMenuState.showMenu (package:star_menu/src/star_menu.dart:386:7)
#4 StarMenuState.build. (package:star_menu/src/star_menu.dart:286:9)
#5 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1325:15)
#6 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1264:9)
#7 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1113:5)
#8 _invoke (dart:ui/hooks.dart:312:13)
#9 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:383:5)
#10 _drawFrame (dart:ui/hooks.dart:283:31)

====================================================================================================
`

Menu Offset broken

I am trying to use this widget and I noticed that the offset is broken for my use case.

image

I'm not doing anything fancy, just aligning the widget to the top-left:

Align(
    alignment: Alignment.topLeft,
    child: Padding(
        padding: const EdgeInsets.only(
            top: 20,
            left: 20,
        ),
        child: FloatingActionButton.extended(
            onPressed: () => print('FAB Tapped'),
            label: Text(state.activeSearchProfile.name),
            icon: Icon(MdiIcons.mapSearch),
            backgroundColor: Theme.of(context).colorScheme.background,
        ).addStarMenu(
            params: StarMenuParameters.dropdown(
                context
            ),
            onStateChanged: (state) => print('State Changed $state'),
            onItemTapped: (index, controller)
            {
                print('Item Tapped $index');
            },
            items: [
                Text('Item 1'),
                Text('Item 2'),
                Text('Item 3'),
                Text('Item 4'),
                Text('Item 5'),
            ],
        )
    )
)

Thoughts on how to fix this?

Open menu on hover

Hello
How can I open menu with onHover on flutter web?
Tried to use InkWell but it not works.
Thank you

'example/' is out-of-date

In the latest commit, the example/ folder was not harmonized with the code.
Commit 49e6b56 "added lazyItems and onStateChanged parameters to addStarMenu extension"

Under this last commit the example shows a syntax error:
"4 positional argument(s) expected, but 2 found.
Try adding the missing"

Rolling back to 3.1.0+1 has the expected signature, BUT one change is still required, in order to build correctly:
<activity android:exported="true"

With that, it now builds and displays correctly. Tested on Android 12.

Exception on dragging the child widget for version 3.1.6

Run on windows.

Version 3.1.4 do not have this exception.

But version 3.1.6 have this exception.

Dragging the child widget when menu is open can encounter this exception.

Here is the example

import 'package:flutter/material.dart';
import 'package:star_menu/star_menu.dart';

main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Container(
        width: 100,
        height: 100,
        color: Colors.blue,
      ).addStarMenu(
          params: const StarMenuParameters(
              backgroundParams:
                  BackgroundParams(backgroundColor: Colors.black12)),
          items: [
            Container(
              width: 10,
              height: 10,
              color: Colors.black,
            )
          ]),
    );
  }
}

When drag the container some error happened like this

Performing hot restart...
Syncing files to device Windows...
Restarted application in 406ms.
flutter: MOVE 1.885618083164125 -0.07 6.213185307179586
flutter: MOVE 3.887301263230196 -0.14 6.143185307179586

======== Exception caught by scheduler library =====================================================
The following assertion was thrown during a scheduler callback:
The third row and third column of a transform matrix for pointer events must be Vector4(0, 0, 1, 0) to ensure that a transformed point is directly under the pointing device. Did you forget to run the paint matrix through PointerEvent.removePerspectiveTransform? The provided matrix is:
[0] NaN,NaN,NaN,NaN
[1] NaN,NaN,NaN,NaN
[2] NaN,NaN,NaN,NaN
[3] NaN,NaN,NaN,NaN
'package:flutter/src/gestures/hit_test.dart':
Failed assertion: line 212 pos 7: '_debugVectorMoreOrLessEquals(transform.getRow(2), Vector4(0, 0, 1, 0)) &&
      _debugVectorMoreOrLessEquals(transform.getColumn(2), Vector4(0, 0, 1, 0))'


Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.yml

When the exception was thrown, this was the stack: 
#2      HitTestResult.pushTransform (package:flutter/src/gestures/hit_test.dart:212:7)
#3      BoxHitTestResult.addWithRawTransform (package:flutter/src/rendering/box.dart:834:7)
#4      BoxHitTestResult.addWithPaintTransform (package:flutter/src/rendering/box.dart:766:12)
#5      RenderTransform.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:2506:19)
#6      RenderTransform.hitTest (package:flutter/src/rendering/proxy_box.dart:2500:12)
#7      RenderBoxContainerDefaultsMixin.defaultHitTestChildren.<anonymous closure> (package:flutter/src/rendering/box.dart:2861:25)
#8      BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:800:31)
#9      RenderBoxContainerDefaultsMixin.defaultHitTestChildren (package:flutter/src/rendering/box.dart:2856:33)
#10     RenderStack.hitTestChildren (package:flutter/src/rendering/stack.dart:631:12)
#11     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#12     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#13     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#14     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#15     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#16     RenderPhysicalModel.hitTest (package:flutter/src/rendering/proxy_box.dart:1984:18)
#17     _RenderTheaterMixin.hitTestChildren.childHitTest (package:flutter/src/widgets/overlay.dart:902:81)
#18     BoxHitTestResult.addWithPaintOffset (package:flutter/src/rendering/box.dart:800:31)
#19     _RenderTheaterMixin.hitTestChildren (package:flutter/src/widgets/overlay.dart:903:22)
#20     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#21     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#22     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#23     RenderAbsorbPointer.hitTest (package:flutter/src/rendering/proxy_box.dart:3843:17)
#24     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#25     RenderProxyBoxWithHitTestBehavior.hitTest (package:flutter/src/rendering/proxy_box.dart:172:19)
#26     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#27     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#28     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#29     RenderCustomPaint.hitTestChildren (package:flutter/src/rendering/custom_paint.dart:559:18)
#30     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#31     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#32     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#33     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#34     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#35     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#36     RenderTapRegionSurface.hitTest (package:flutter/src/widgets/tap_region.dart:213:28)
#37     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#38     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#39     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#40     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#41     RenderProxyBoxMixin.hitTestChildren (package:flutter/src/rendering/proxy_box.dart:117:19)
#42     RenderBox.hitTest (package:flutter/src/rendering/box.dart:2482:11)
#43     RenderView.hitTest (package:flutter/src/rendering/view.dart:211:14)
#44     RendererBinding.hitTestInView (package:flutter/src/rendering/binding.dart:624:34)
#45     RendererBinding.initMouseTracker.<anonymous closure> (package:flutter/src/rendering/binding.dart:425:7)
#46     MouseTracker._findAnnotations (package:flutter/src/rendering/mouse_tracker.dart:261:60)
#47     MouseTracker.updateAllDevices.<anonymous closure> (package:flutter/src/rendering/mouse_tracker.dart:375:80)
#48     MouseTracker._deviceUpdatePhase (package:flutter/src/rendering/mouse_tracker.dart:210:9)
#49     MouseTracker.updateAllDevices (package:flutter/src/rendering/mouse_tracker.dart:372:5)
#50     RendererBinding._scheduleMouseTrackerUpdate.<anonymous closure> (package:flutter/src/rendering/binding.dart:474:22)
#51     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1325:15)
#52     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1264:9)
#53     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1113:5)
#54     _invoke (dart:ui/hooks.dart:312:13)
#55     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:383:5)
#56     _drawFrame (dart:ui/hooks.dart:283:31)
(elided 2 frames from class _AssertionError)
====================================================================================================

Open on long press?

Hello! Thank you for the great component! Is it possible to open a menu on long press?

Please use change major version when adding breaking changes into the code

Hi @alnitak

Thank you sincerely for your valuable contribution to the Flutter community! Today, I came across an issue with the latest version 3.1.8. It seems there's a breaking change, but the patch number was incremented in the versioning, leading to an automatic update by Flutter. To ensure smoother updates in the future, may I suggest incrementing the major number when introducing a breaking change?

Would it be possible to release version 4.0.0 instead of 3.1.8? This would align better with the nature of the changes.

Once you've had a chance to review this, feel free to close the issue. Your attention to this matter is greatly appreciated. Thank you again!

Menu position incorrect

I'm trying to show menu on ListTile widget inside ListView but the menu always appear at the edge (right edge in my case) of the screen and not originated from click location like in example. Specificallly the y coordinate is changing but looks like the x coordinate is ignored. Any clue what's wrong here? Here's is my attempt:

StarMenu(
      params: StarMenuParameters(
          // useScreenCenter: true,
          shape: MenuShape.linear,
          linearShapeParams: LinearShapeParams(angle: 270, space: 10, alignment: LinearAlignment.center),
          onItemTapped: (index, ctrllr) => onAyahMenuClick(ayah, index, ctrllr)),
      items: createAyahMenu(),
      child: ListTile(
        // onTap: () => print('clicked'),
        title: Text(ayah.ayahText + ' {${ayah.ayahNumInSurah}} ',
            style: TextStyle(height: 1.8, color: Colors.black, fontSize: controller.fontSize.value)),
        subtitle: ayah.tafseer == null
            ? null
            : Text(ayah.tafseer!,
                textAlign: controller.currTafseer == 'engTafseer' ? TextAlign.left : TextAlign.right,
                style: TextStyle(height: 1.8, color: Colors.green, fontSize: controller.fontSize.value - 3)),
      ),
    )

Simulator Screen Shot - iPhone 12 - 2022-03-09 at 12 28 17

Linear shape center offset not working as expected

First off, I must say this is such an awesome package for making visually appealing menus - thank you for your efforts!

I have a menu composed of a List of FloatingActionButtons. When I tap on a map marker, the menu pops up. I am expecting the menu to be centered on the marker that I tapped, but it isn't - it is offset to the right. Am I missing something?

Screenshot 2024-02-26 121855

 StarMenuOverlay.displayStarMenu(
       context!,
      StarMenu(
                params: StarMenuParameters(
                  shape: MenuShape.linear,
                  linearShapeParams: const LinearShapeParams(
                    angle: 0,
                    alignment: LinearAlignment.top,
                    space: 15,
                  ),
                  animationCurve: Curves.easeOutCubic,
                  centerOffset: const Offset(0, 0),
                  openDurationMs: 150,
                  backgroundParams: BackgroundParams(
                          backgroundColor: Colors.blue.withOpacity(0.2),
                          animatedBackgroundColor: false,
                          animatedBlur: false,
                          sigmaX: 10,
                          sigmaY: 10,
                        ),
                ),
                //params: StarMenuParameters.panel(context, columns: 4),
                items: menuEntries,
                parentContext: context,
                onItemTapped: (index, c) {
                  debugPrint('****** Item $index tapped ******');
                  c.closeMenu!();
                },
              ),
  );

close menu is not working as expected

I'm trying to close star menu when any item is clicked:

Widget _addStarMenu(GameView gameView) {
    return StarMenu(
      child: IconButton(icon: Icon(Icons.more_horiz),onPressed: ()=>{},),
      params: StarMenuParameters(),
      controller: widget._starMenuController,
      onItemTapped: (index, controller)  {
        controller.closeMenu!();
        },
      items:[
      IconButton(
        padding: const EdgeInsets.all(0),
        disabledColor: _userSettings.darkTheme ? Colors.grey.shade800 : Colors.grey.shade300,
        onPressed: () {
          //_nsCubit(context).openFolder(gameView.game);
        },
        icon: Icon(Icons.folder),
        tooltip: tr("open_folder"),
      ),
      IconButton(
        disabledColor:_userSettings.darkTheme ? Colors.grey.shade800 : Colors.grey.shade300,
        onPressed: gameView.game.isExternal
            ? null
            : () {
          //_nsCubit(context).renameGame(context, gameView.game);
        },
        icon: Icon(Icons.edit),
        tooltip: gameView.game.isExternal ? null : tr("rename_game"),
      ),
      IconButton(
        disabledColor:_userSettings.darkTheme ? Colors.grey.shade800 : Colors.grey.shade300,
        onPressed: gameView.game.isExternal
            ? null
            :() {
          //_nsCubit(context).deleteGame(context, gameView.game);
        },
        icon: Icon(Icons.delete),
        tooltip: gameView.game.isExternal ? null : tr("delete"),
      )
    ],);
  }

The Star menu is only closed if I click outside the menu.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.