Flutter Dialog 예제

|

Flutter Dialog

showDialog(
  context: context,
  builder: (BuildContext context) {
    // return object of type Dialog
    return AlertDialog(
      title: Text(node.name),
      content: const Text("Edit node."),
      actions: [
        TextButton(
          child: const Text("Ok"),
          onPressed: () {
            // TODO
            setState(() {
              node.name = node.name + '+';
            });
            Navigator.pop(context);
          },
        ),
      ],
    );
  },
);
</pre>