flutter - Flutter 从父小部件继承所有道具
问题描述
我想在颤动上制作自定义按钮。这是一些代码:
// class LoadingButton.dart
MaterialButton(
padding: EdgeInsets.all(Spacing().value(2)),
textColor: Colors.white,
disabledColor: Colors.grey[100],
...props
);
如何动态添加道具而不一一说明构造函数?
我试过使用...props
,但它不会添加到道具中。
谢谢
解决方案
Dart 中没有这样的东西。只有复制粘贴所有属性才有效。
推荐阅读
- javascript - 如何在单个 if 语句中使用调用多个变量?
- java - 在 recyclearview 和 recyclearview 中滑动加载图像延迟和滞后
- javascript - 我在 Javascript 函数中得到错误的输出?
- firebase - Firebase/Flutter:推送后获取密钥
- logstash - 如何在 logstash 日志中识别 filebeat 源
- javascript - 如何使用angularjs中的两个单选按钮在div之间切换
- amazon-web-services - 到 opsgenie 警报系统的 AWS 故障转移事件
- python - 光伏组件(矩形)的边缘检测
- python - 加载 tf.keras 模型时的问题
- firebase-realtime-database - 如何在实时数据库中将 1000 万个子节点虚拟为父节点?