📜  在警报对话框中颤动单选按钮 - Dart 代码示例

📅  最后修改于: 2022-03-11 14:48:03.705000             🧑  作者: Mango

代码示例1
showDialog(
  context: context,
  builder: (BuildContext context) {
    int selectedRadio = 0;
    return AlertDialog(
      content: StatefulBuilder(
        builder: (BuildContext context, StateSetter setState) {
          return Column(
            mainAxisSize: MainAxisSize.min,
            children: List.generate(4, (int index) {
              return Radio(
                value: index,
                groupValue: selectedRadio,
                onChanged: (int value) {
                  setState(() => selectedRadio = value);
                },
              );
            }),
          );
        },
      ),
    );
  },