小编Ash*_*hta的帖子

点击文本或其他小部件时如何触发单选按钮?

我用 2 个这样的小部件创建 Row

Row(
   children: [
      new Radio(
        value: 0,
        groupValue: rv0,
        onChanged: _handleRadioValueChange1,
      ),

      GestureDetector(
         onTap: (){ //trigger radio button },
         child: Text('Tap Me')
      )
   ],
)
Run Code Online (Sandbox Code Playgroud)

因此,当我点击文本时,收音机将被触发,例如在带有 jquery 的 javascript 中

$('#radio').click()
Run Code Online (Sandbox Code Playgroud)

在 dart flutter 中如何做到这一点?谢谢

dart flutter

6
推荐指数
2
解决办法
5693
查看次数

Flutter:无法确定任务':shared_preferences:compileDebugAidl'的依赖关系

我在 flutter 中创建了新应用程序,运行它时它可以工作,但是当我添加 shared_preferences 包时,运行它时出现此错误

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':shared_preferences:compileDebugAidl'.
> Could not resolve all task dependencies for configuration ':shared_preferences:debugCompileClasspath'.
   > Could not resolve project :shared_preferences_macos.
     Required by:
         project :shared_preferences
      > Unable to find a matching configuration of project :shared_preferences_macos:
          - None of the consumable configurations have attributes.
   > Could not resolve project :shared_preferences_web.
     Required by:
         project :shared_preferences
      > Unable to find a matching configuration of project …
Run Code Online (Sandbox Code Playgroud)

dart flutter

4
推荐指数
2
解决办法
1万
查看次数

如何将dart中的每个字母大写?

我尝试了这段代码,但结果只是大写第一个字母(不是每个字母)

String ucwords(String input) {
    if (input == null) {
      throw new ArgumentError("string: $input");
    }
    if (input.length == 0) {
      return input;
    }
    return input[0].toUpperCase() + input.substring(1);
}
Run Code Online (Sandbox Code Playgroud)

dart flutter

2
推荐指数
1
解决办法
5976
查看次数

标签 统计

dart ×3

flutter ×3