huextrat / menu_button

Flutter plugin to display a popup menu button widget with handsome design and easy to use.
https://pub.dev/packages/menu_button
MIT License
65 stars 23 forks source link

Last menu item gets extra area #12

Closed dipcse07 closed 4 years ago

dipcse07 commented 4 years ago

Describe the bug When there is only 2 button items then there is another two button area in the drop down menu items before even selecting the button items..i guess..

Screen Shot 2020-06-16 at 9 14 30 PM

Expected behavior there should not have any extra area like this one i assume.

if i have understood correctly i am not using any expanded widget for menu button... i have only used which is given in the how to use section of the pub.dev for this packages..

I am using column so is it occurring for using column?

here is the code:

b``` ody: Container( alignment: Alignment.center, child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [

         MenuButton(
           child: SizedBox(
             width: 83,
             height: 40,
             child: Padding(
               padding: const EdgeInsets.only(left: 16, right: 11),
               child: Row(
                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
                 children: <Widget>[
                   Flexible(

                     child: Text(
                       selectedItem,
                       style: TextStyle(color: Colors.black),
                       overflow: TextOverflow.ellipsis,
                     ),
                   ),
                   SizedBox(
                       width: 12,
                       height: 17,
                       child: FittedBox(
                           fit: BoxFit.fill,
                           child: Icon(
                             Icons.arrow_drop_down,
                             color: Colors.grey,
                           )
                       )
                   ),
                 ],
               ),
             ),
           ),// Widget displayed as the button
           items: ['button1','button2'],// List of your items
           topDivider: true,
           selectedItem: selectedItem,
           popupHeight: 200, // This popupHeight is optional. The default height is the size of items
           scrollPhysics: AlwaysScrollableScrollPhysics(), // Change the physics of opened menu (example: you can remove or add scroll to menu)
           itemBuilder: (value) => Container(
               width: 83,
               height: 40,
               alignment: Alignment.centerLeft,
               padding: const EdgeInsets.symmetric(horizontal: 16),
               child: Text(value)
           ),// Widget displayed for each item
           toggledChild: Container(
             color: Colors.white,
             child: SizedBox(
               width: 83,
               height: 40,
               child: Padding(
                 padding: const EdgeInsets.only(left: 16, right: 11),
                 child: Row(
                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
                   children: <Widget>[
                     Flexible(

                       child: Text(
                         selectedItem,
                         style: TextStyle(color: Colors.black),
                         overflow: TextOverflow.ellipsis,
                       ),
                     ),
                     SizedBox(
                         width: 12,
                         height: 17,
                         child: FittedBox(
                             fit: BoxFit.fill,
                             child: Icon(
                               Icons.arrow_drop_down,
                               color: Colors.grey,
                             )
                         )
                     ),
                   ],
                 ),
               ),
             ),// Widget displayed as the button,
           ),
           divider: Container(
             height: 1,
             color: Colors.grey,
           ),
           onItemSelected: (value) {
             setState(() {
               selectedItem = value;
               print(selectedItem);
             });

             // Action when new item is selected
           },
           decoration: BoxDecoration(
               border: Border.all(color: Colors.grey[300]),
               borderRadius: const BorderRadius.all(Radius.circular(3.0)),
               color: Colors.white
           ),
           onMenuButtonToggle: (isToggle) {
             print(isToggle);
           },
         ),
dipcse07 commented 4 years ago

@huextrat I have created a new issue as you suggested.. i will be here if you need any other info

huextrat commented 4 years ago

Thank you @dipcse07 I'll take a look in few minutes ;)

dipcse07 commented 4 years ago

okay thanks..

huextrat commented 4 years ago

@dipcse07 Ok after investigation there is no issue. You use popupHeight: 200 so the popup takes a height of 200 which is the expected behavior. You can delete it so you don't have the extra space at the bottom ;)

dipcse07 commented 4 years ago

okay.. it worked thanks then i will close this issue.. now..