Search
 
SCRIPT & CODE EXAMPLE
 

DART

open popupbutton onclick in flutter

_showPopupMenu(){
    showMenu<String>(
      context: context,
      position: RelativeRect.fromLTRB(25.0, 25.0, 0.0, 0.0),      //position where you want to show the menu on screen
      items: [
        PopupMenuItem<String>(
            child: const Text('menu option 1'), value: '1'),
        PopupMenuItem<String>(
            child: const Text('menu option 2'), value: '2'),
        PopupMenuItem<String>(
            child: const Text('menu option 3'), value: '3'),
      ],
      elevation: 8.0,
    )
    .then<void>((String itemSelected) {

      if (itemSelected == null) return;

      if(itemSelected == "1"){
        //code here
      }else if(itemSelected == "2"){
        //code here
      }else{
        //code here
      }

    });
}
Comment

PREVIOUS NEXT
Code Example
Dart :: dart loop through object 
Dart :: get one document firestore flutter dart 
Dart :: how to put the Pi in dart 
Dart :: size row to maximum flutter 
Dart :: how to validate textformfield on text change flutter 
Dart :: dart date add year 
Dart :: flutter appbar leading icon 
Dart :: convert future<list list in flutter 
Dart :: flutter get carousel sliders current index 
Dart :: dart uri 
Dart :: bottomsheet shape flutter 
Dart :: DioError (DioError [DioErrorType.DEFAULT]: Converting object to an encodable object failed: Instance of 
Dart :: fibonacci numbers in dart 
Dart :: dart print item # of a list 
Dart :: change app bar height flutter 
Dart :: sort list dart 
Dart :: dart inline if else 
Dart :: data types in flutter 
Dart :: padding flutter top 
Dart :: remove item form list by index dart 
Dart :: flutter check application direction 
Dart :: pub http 
Dart :: flutter component position absolute 
Dart :: flutter how to execute function after building screen 
Dart :: Top level package requires Flutter but FLUTTER_ROOT environment variable not set. 
Dart :: most used extentions for flutter 
Dart :: skeleton container flutter 
Dart :: dart typedef 
Dart :: how to check string id is valid id in string file android studio 
Dart :: scrolling to top sliverlist flutter with back button 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =