Git Product home page Git Product logo

custom_pop_up_menu's Introduction

CustomPopupMenu

Wrap a widget with CustomPopupMenu, Tap or Long Press this widget, a popup menu would display in a suitable position.

Features

  • Gesture: Tap/Long Press
  • Fully customized menu: This package doesn't preset any style of menu, the common styles see: example/lib/main.dart.
  • Auto calculate the position of menu, also supports manual adjustment.

Demo

Using this package, you are free to build similar popup menu in WeChat.

custom_pop_up_menu's People

Contributors

honjow avatar malikwang avatar mdpe-ir avatar nploi avatar tilongzs 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  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  avatar  avatar  avatar  avatar

Watchers

 avatar

custom_pop_up_menu's Issues

CustomPopupMenuController hideMenu not working

I can never close the menu with controller

CustomPopupMenuController _controller = CustomPopupMenuController();

CustomPopupMenu( child: Icon( Icons.more_horiz, color: Colors.black, ), controller: _controller, arrowColor: Colors.white, menuBuilder: () => TextButton( onPressed: _controller.hideMenu, child: Text('close'),), pressType: PressType.singleClick,)

WidgetsBinding.instance.addPostFrameCallback failed

Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' Try calling using ?. instead.

Controller's menuIsShowing is not getting updated.

First of all, hello and a big congrats for this awesome package!

It fits the exact needs I have for my project, but I have encountered a problem with it. Unless you explicitly call "controller.showMenu()" or "controller.hideMenu" or "controller.toggleMenu()", the controller.menuIsShowing property never gets updated.

It should be automatically set to true when the menu appears in my opinion, because outside of the component we cannot know if it is true or not, as we cannot wrap the child component of CustomMenuPopup with a GestureDetector, as the menu would not show anymore.

Thank you and I am looking forward to a reply on this matter.

On TextField Widget want to show menu on focus and hide on leave butt not working fine

below is my code i want to show menu when focus is in textfield widget and hide when leave textfield widget. butt when i do this multiple time. sometime menu never hide. how to resolve this issue
return CustomPopupMenu(
child: Container(

    padding: EdgeInsets.only(right:10),
    child:
    Focus(
    canRequestFocus: false,
onFocusChange: (focused) async{

if (!focused) {

  _controller.hideMenu();
}


},

child:
    TextField(
      autofocus: true,

      onTap: (){
        _controller.showMenu();
      },
      onChanged: (vale){
        // here i will load data from api

    },)),


  ),
  menuBuilder: () =>

      ClipRRect(
        borderRadius: BorderRadius.circular(10),
        child:
        Card(
          elevation: 10,
          child:
          Container(

// color:Colors.black54,

              height: 200,
              width: 250,
              child:
              SingleChildScrollView(child:
              Padding(
                  padding: EdgeInsets.all(5),
                  child:
                  Container(
                      padding: EdgeInsets.all(5),
                      child:
                      Column(

// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('hello')

                        ],)







                  )





              ),)
          ),),
      ),
  barrierColor: Colors.transparent,
  pressType: PressType.singleClick,
  verticalMargin: -10,
  controller: _controller,
);

Make popup menu scrollable when it doesn't fit on screen

Hi,
Thanks for the great plugin.

I have a popup menu button, when it's at the top of the page, the menu will fit on the screen. But when it's at the middle of the page, the menu goes out of the screen.

How can I make the menu scrollable only when it doesn't fit on screen?

Failed assertion: line 88 pos 12: '_route == ModalRoute.of(context)': is not true.

the view structure: ReorderableListView--ListItem---CustomPopupMenu.
When I dragging the item view, everything works fine on iOS platform.
But,When I dragging the item view on Android ,I got :
======== Exception caught by widgets library =======================================================
The following assertion was thrown building CustomPopupMenu(state: _CustomPopupMenuState#b4d4c):
'package:flutter/src/widgets/will_pop_scope.dart': Failed assertion: line 88 pos 12: '_route == ModalRoute.of(context)': is not true.

Duplicate Menus

00EA3029-E2FE-446B-B894-C8F1FC4405C2

I am using the example menu similar to wechat any idea what would cause this behavior?

Null check operator used on a null value

 Null check operator used on a null value
 State.context(package:flutter/src/widgets/framework.dart:1095)
_CustomPopupMenuState.initState.<anonymous closure>(package:custom_pop_up_menu/src/custom_pop_up_menu.dart:162)

Overheight widget and where to show to pop up

As the title, currently the pop up is show at top and bottom. But when we apply this to an over height widget. The pop up kinda not show. Can you add the PreferredPosition to be centered of the widget. Like the Line app ( the picture).
Much appreciated.

flutter 3.0.0 is detecting issue with the library

/D:/flutter_windows_3.0.0-stable/flutter/.pub-cache/hosted/pub.dartlang.org/custom_pop_up_menu-1.2.3+1/lib/src/custom_pop_up_menu.dart(195,20): warning G1E0FE241: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null. [D:\FlutterProjects\billz_cashier_desktop\build\windows\flutter\flutter_assemble.vcxproj]

菜单默认展示位置

个人以为,菜单默认展示在顶部操作起来会更舒服些。

bool isTop = true;
if (anchorBottomY + verticalMargin + arrowSize.height + contentSize.height
    < size.height / 2) {
  isTop = false;
}

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.