GithubHelp home page GithubHelp logo

flutter-context-menu's People

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

Watchers

 avatar  avatar  avatar

flutter-context-menu's Issues

Bad documentation?

Readme documentation says:

To get started, wrap a ContextMenuOverlay around your top-most view or app:

return ContextMenuOverlay(
  child: MaterialApp(...)
);

But this is giving some no directional widget found error. In the ContextMenuOverlay class documentation the docs are right, pointing that it should be placed somewhere in between MaterialApp and the top-most view.

Cast error

Hi, some times I get this error while trying to show the menu:

======== Exception caught by gesture ===============================================================
The following _CastError was thrown while handling a gesture:
type 'Null' is not a subtype of type '_InheritedContextMenu' in type cast

When the exception was thrown, this was the stack: 
#0      ContextMenuOverlay.of (package:context_menus/src/context_menu_overlay.dart:43:76)
#1      ContextMenuExtensions.contextMenuOverlay (package:context_menus/context_menus.dart:20:72)
#2      ContextMenuRegion.build.showMenu (package:context_menus/src/context_menu_region.dart:19:15)
#3      TapGestureRecognizer.handleTapUp.<anonymous closure> (package:flutter/src/gestures/tap.dart:619:71)
#4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#5      TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:619:11)
#6      BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:298:5)
#7      BaseTapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:232:7)
#8      PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:563:9)
#9      PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:94:12)
#10     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:139:9)
#11     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:614:13)
#12     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:137:18)
#13     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:123:7)
#14     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:445:19)
#15     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:425:22)
#16     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:329:11)
#17     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:380:7)
#18     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:344:5)
#19     GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:302:7)
#20     GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:285:7)
#24     _invoke1 (dart:ui/hooks.dart:170:10)
#25     PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:331:7)
#26     _dispatchPointerDataPacket (dart:ui/hooks.dart:94:31)
(elided 3 frames from dart:async)
Handler: "onSecondaryTap"
Recognizer: TapGestureRecognizer#e9365
  debugOwner: GestureDetector
  state: ready

My code:

child: ContextMenuRegion(
        contextMenu: GenericContextMenu(
          buttonConfigs: [
            ContextMenuButtonConfig(
              "Button 1",
              onPressed: () => _copyCode(),
            ),
 ContextMenuButtonConfig(
              "Button 2",
              onPressed: () => _copyCode(),
            ),
 ContextMenuButtonConfig(
              "Button 3",
              onPressed: () => _copyCode(),
            ),
          ],
        ),
        child: ListTile(...))

Is there a known issue?

Second click required to open menu

Hello, thanks for this package that I am exploring !

Tried a basic text adding menu to item on a columns

When a context menu is open and I right click another entries,
instead of opening a new context and closing the previous one,
it first close the first menu then another clic is required to open a new context.

Still exploring this package maybe I miss a parameter.

Cheers

GitHub repo not at parity with pub.dev

Hello! The current version of this package on pub.dev is 0.1.0+6, but pubspec.yaml file in this repo shows 0.0.1+1. I was hoping to see recent commits to the package on GitHub, but it like the repo has not been updated with the changes that were published to pub.dev.

ContextMenuOverlay does not work as shown in example

The example shows:

return ContextMenuOverlay(
  child: MaterialApp(...)
);

but when actually creating such a layout with this code:

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ContextMenuOverlay(child: MaterialApp(
      title: 'Flutter Demo',
      home: Scaffold(
        appBar: AppBar(
          title: Text("Test"),
        ),
        body: Column(children: [],),
      ),
    ));
  }
}

I get this error:

======== Exception caught by widgets library =======================================================
The following assertion was thrown building _InheritedContextMenu:
No MediaQuery widget ancestor found.

Scaffold widgets require a MediaQuery widget ancestor.
The specific widget that could not find a MediaQuery ancestor was: Scaffold
  dirty
  state: ScaffoldState#48e24(lifecycle state: initialized, tickers: tracking 2 tickers)
The ownership chain for the affected widget is: "Scaffold ← _InheritedContextMenu ← LayoutBuilder ← ContextMenuOverlay ← MyApp ← [root]"

No MediaQuery ancestor could be found starting from the context that was passed to MediaQuery.of(). This can happen because you have not added a WidgetsApp, CupertinoApp, or MaterialApp widget (those widgets introduce a MediaQuery), or it can happen if the context you use comes from a widget above those widgets.

The relevant error-causing widget was: 
  _InheritedContextMenu file:///C:/Users/Zarai/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/context_menus-0.1.0+5/lib/src/context_menu_overlay.dart:73:16
When the exception was thrown, this was the stack: 
#0      debugCheckHasMediaQuery.<anonymous closure> (package:flutter/src/widgets/debug.dart:219:7)
#1      debugCheckHasMediaQuery (package:flutter/src/widgets/debug.dart:234:4)
#2      MediaQuery.of (package:flutter/src/widgets/media_query.dart:820:12)
#3      ScaffoldState.didChangeDependencies (package:flutter/src/material/scaffold.dart:2831:50)
#4      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4732:11)
...
====================================================================================================

which doesn't happen when the ContextMenuOverlay is inside MaterialApp.

Repositioning of context menu when the content expands or contracts

  1. I would assume the widget not to jump around on click within.
  2. I assume a Navigator.pop(context); would close the context menu, but this does not seem to be the case.
  3. The cardBuilder of ContextMenuOverlay does not seem to work. (It is to note, that my ContextMenuOverlay is placed under the MaterialApp as of #4.
  4. Also it can happen that the context menu is repositions such that some of its area is placed outside of the visible screen. (Might also be because I work with ExpansionTile)

Regarding 1, here is an explanation video:

context_menu.mp4

Show context menu on regular tap

Hi,

It would be great if it was possible to show the context menu on regular tap in addition to secondary tap and long press.

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.