copyWith method

CapsulePrize copyWith({
  1. LuckyFill? topFill,
  2. LuckyFill? bottomFill,
  3. List<LuckyText>? texts,
  4. List<LuckyImage>? images,
  5. double? weight,
  6. bool? disabled,
  7. CapsulePrizePainter? painter,
})

返回替换非空参数的副本,例如 value.copyWith() 保留全部字段。

Implementation

CapsulePrize copyWith(
        {LuckyFill? topFill,
        LuckyFill? bottomFill,
        List<LuckyText>? texts,
        List<LuckyImage>? images,
        double? weight,
        bool? disabled,
        CapsulePrizePainter? painter}) =>
    CapsulePrize(
        topFill: topFill ?? this.topFill,
        bottomFill: bottomFill ?? this.bottomFill,
        texts: texts ?? this.texts,
        images: images ?? this.images,
        weight: weight ?? this.weight,
        disabled: disabled ?? this.disabled,
        painter: painter ?? this.painter);