在Flutter中,容器有填充:
padding: const EdgeInsets.only(
left: MyMeasurements.globalLeftPadding,
right: 20.0,
),
Run Code Online (Sandbox Code Playgroud)
我希望能够覆盖"左".
如果我这样做,我会收到运行时错误:
class MySectionHeader extends StatelessWidget {
final double left;
MySectionHeader({
this.left,
});
// down to the widget body
padding: const EdgeInsets.only(
left: left ?? MyMeasurements.globalLeftPadding,
right: 20.0,
),
// and in the container that has the override...
new MySectionHeader(
left: 12.0,
),
Run Code Online (Sandbox Code Playgroud)
这也会出现运行时错误:
padding: const EdgeInsets.only(
left: left ?? 14.0,
right: 20.0,
),
// and in the container that has the override...
new MySectionHeader(
left: 12.0,
),
Run Code Online (Sandbox Code Playgroud)
建议?
| 归档时间: |
|
| 查看次数: |
2040 次 |
| 最近记录: |