Flutter의 Dialog 컨트롤

3012 단어

AlertDialog

void _showAlertDialog() {
    showDialog(
        context: context,
        // 
        barrierDismissible: true,
        builder: (BuildContext context) {
          return new AlertDialog(
            title: new Text(' '),
            // 
            content: new Text(' '),
            actions: [
              new FlatButton(
                child: new Text(' '),
                onPressed: () {
                  Navigator.of(context).pop();
                },
              ),
              new FlatButton(
                child: new Text(' '),
                onPressed: () {
                  Navigator.of(context).pop();
                },
              ),
            ],
          );
        });
  }

SimpleDialog

void _showSimpleDialog() {
    showDialog(
      context: context,
      builder: (BuildContext context) {
        return new SimpleDialog(
          title: new Text(' '),
          children: [
            new SimpleDialogOption(
              child: new Text(' '),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
            new SimpleDialogOption(
              child: new Text(' '),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
            new SimpleDialogOption(
              child: new Text(' '),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }

CupertinoAlertDialog

void _showIOSDialog(BuildContext cxt) {
    showCupertinoDialog(
        context: cxt,
        builder: (cxt) {
          return new CupertinoAlertDialog(
            title: Text(' '),
            content: Text(' '),
            actions: [
              new Container(
                decoration: BoxDecoration(
                    border: Border(
                        right: BorderSide(color: Color(0xFFD9D9D9), width: 0.5),
                        top: BorderSide(color: Color(0xFFD9D9D9), width: 0.5))),
                child: CupertinoDialogAction(
                  child: new Text(" "),
                  onPressed: () {
                    Navigator.pop(context);
                  },
                ),
              ),
              new Container(
                decoration: BoxDecoration(
                    border: Border(
                        top: BorderSide(color: Color(0xFFD9D9D9), width: 0.5))),
                child: CupertinoDialogAction(
                  child: new Text(" "),
                  onPressed: () {
                    Navigator.pop(context);
                  },
                ),
              )
            ],
          );
        });
  }

좋은 웹페이지 즐겨찾기