Flutter.io(dart) – 如何创建左侧填充覆盖?

前端之家收集整理的这篇文章主要介绍了Flutter.io(dart) – 如何创建左侧填充覆盖?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_502_3@
在Flutter中,容器有填充:

padding: const EdgeInsets.only(
  left: MyMeasurements.globalLeftPadding,right: 20.0,),

我希望能够覆盖“左”.

如果我这样做,我会收到运行时错误

class MySectionHeader extends StatelessWidget {
    final double left;

MySectionHeader({
  this.left,});

// down to the widget body
padding: const EdgeInsets.only(
  left: left ?? MyMeasurements.globalLeftPadding,// and in the container that has the override...
new MySectionHeader(
  left: 12.0,

这也会出现运行时错误

padding: const EdgeInsets.only(
  left: left ?? 14.0,

建议?

解决方法

您不能同时使用const构造函数和动态内容. 做新的EdgeInsets.only(相反
@H_502_3@

猜你在找的Flutter相关文章