flutter 单个默认选中单选按钮抖动

hc8w905p  于 2023-02-13  发布在  Flutter
关注(0)|答案(1)|浏览(139)

在flutter中,如何设置单个单选按钮默认选中,如下图所示?
我想要的



我得到的

Center(
            child: Row(
              children: [
                Padding(
                  padding: const EdgeInsets.only(left: 30, top: 10),
                  child: SizedBox(
                    width: 150, // <-- match_parent
                    height: 45,
                    child: RadioListTile(
                      title: Padding(
                        padding: const EdgeInsets.only(left: 0),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.start,
                          children: [
                            ///use your image
                            Text(
                              "  English",
                              style: TextStyle(
                                color: Color(0xff000000),
                                fontWeight: FontWeight.bold,
                              ),
                            ),
                          ],
                        ),
                      ),
                      value: "English",
                      groupValue: "english",
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(5)),
                      onChanged: (value) {
                        setState(() {});
                      },
                      tileColor: Color(0xff28e8df),
                    ),
                  ),
w41d8nur

w41d8nur1#

您可以将valuegroupValue设置为相同。

value: "English",
groupValue: "English",

value: "english",
groupValue: "english",

相关问题