Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
402 views
in Technique[技术] by (71.8m points)

android - How to open this type of alert dialog in flutter

I want to show this type of alert dialog in flutter. How can achieve this I wanted to show dialog in my application. How can i achieve this using flutter


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can use a PopupMenuButton (https://api.flutter.dev/flutter/material/PopupMenuButton-class.html) to achieve this in flutter. See example code below:

PopupMenuButton<int>(
    itemBuilder: (context) => [
      const PopupMenuItem(
        value: 1,
        child: Center(
          child: Icon(
            Icons.download_outlined,
            size: 30.0,
          ),
        ),
      ),
      const PopupMenuItem(
        value: 2,
        child: Center(
          child: Icon(
            Icons.link,
            size: 30.0,
          ),
        ),
      ),
      const PopupMenuItem(
        value: 2,
        child: Center(
          child: Icon(
            Icons.share,
            size: 30.0,
          ),
        ),
      ),
    ],
    icon: const Icon(
      Icons.more_horiz,
      size: 40.0,
    ),
    offset: const Offset(150, -150),
  );

The above example popups a list of Icons when the PopupMenuButton is pressed. You can adapt this to your use-case above.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...