3
、コンテナは、詰め物を持っていますFlutter.io(ダーツ) - 左のパディングオーバーライドを作成する方法は?フラッターで
padding: const EdgeInsets.only(
left: MyMeasurements.globalLeftPadding,
right: 20.0,
),
私は「左」を上書きできるようにしたいです。
私はこれを行う場合、私はランタイムエラーを取得:
padding: const EdgeInsets.only(
left: left ?? 14.0,
right: 20.0,
),
// and in the container that has the override...
new MySectionHeader(
left: 12.0,
),
提案:
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,
),
これは、実行時エラーを取得しましたか?
多くのありがとうございます!!!! – Deborah