【问题标题】:Flutter radio button text with icon带图标的 Flutter 单选按钮文本
【发布时间】:2023-02-10 20:05:28
【问题描述】:

我是一名颤振初学者。我们使用 Dart 语言。如何创建一个只有一个国旗和国家名称的单选按钮?谁能帮我这个?提前致谢!

Row(
            children: [
              Text('Country & Currency',
                  style: TextStyle(
                      fontSize: 15,
                      color: Color(0xff8712bc),
                      decorationStyle: TextDecorationStyle.wavy)),
            ],
          ),
          RadioListTile(
            title: Text("Bahrain"),
            value: "Bahrain",
            groupValue: "bahrain",
            onChanged: (value) {
              setState(() {});
            },
          )

【问题讨论】:

  • 你能包括到目前为止你试过的样本图像和sn-p吗
  • Row( children: [ Text('Country & Currency', style: TextStyle( fontSize: 15, color: Color(0xff8712bc), decorationStyle: TextDecorationStyle.wavy)), ], ), RadioListTile( title: Text("巴林") ,值:“巴林”,groupValue:“巴林”,onChanged:(值){setState((){});},)
  • 你能包括这个小部件结构的一些原型/图像吗?

标签: flutter dart radio-button


【解决方案1】:

您可以在 title 上使用 Row 小部件。

RadioListTile(
  title: Row(
    children: [
      ///use your image
      Icon(Icons.flag),
      Text("Bahrain"),
    ],
  ),
  value: "Bahrain",
  groupValue: "bahrain",
  onChanged: (value) {
    setState(() {});
  },
),

【讨论】:

    猜你喜欢
    • 2021-12-07
    • 2013-10-06
    • 2016-09-03
    • 2022-12-31
    • 1970-01-01
    • 2021-01-11
    • 2021-07-26
    • 1970-01-01
    • 2020-12-08
    相关资源
    最近更新 更多