LoginSignup
0
0

Flutter ドロップダウンメニューのテンプレート

Posted at

ドロップダウンメニュー (PopupMenuButton)のテンプレート

「…」を押すと出てくるメニュー

これです↓

コード

PopupMenuButton<String>(
                  onSelected: (String s){
                    switch(s){
                      case "del":
                        break;

                      case "edit":
                        break;
                    }
                      
                  },
                  
                  itemBuilder: (BuildContext context){
                    return [
                      const PopupMenuItem(value: "edit", child: ListTile(
                          leading: Icon(Icons.edit),
                          title: Text('編集'),
                        ),
                      ),
                      const PopupMenuItem(value: "del",  child: ListTile(
                          leading: Icon(Icons.delete),
                          title: Text('削除'),
                        ),),
                    ];
                  },
                )

実際に実装したアプリ

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0