copyWith method

  1. @override
ThemeExtension<TDThemeData> copyWith({
  1. String? name,
  2. Map<String, Color>? colorMap,
  3. Map<String, Font>? fontMap,
  4. Map<String, double>? radiusMap,
  5. Map<String, FontFamily>? fontFamilyMap,
  6. Map<String, List<BoxShadow>>? shadowMap,
  7. Map<String, double>? marginMap,
  8. TDExtraThemeData? extraThemeData,
})
override

Creates a copy of this theme extension with the given fields replaced by the non-null parameter values.

Implementation

@override
ThemeExtension<TDThemeData> copyWith({
  String? name,
  Map<String, Color>? colorMap,
  Map<String, Font>? fontMap,
  Map<String, double>? radiusMap,
  Map<String, FontFamily>? fontFamilyMap,
  Map<String, List<BoxShadow>>? shadowMap,
  Map<String, double>? marginMap,
  TDExtraThemeData? extraThemeData,
}) {
  var result = TDThemeData(
      name: name ?? 'default',
      colorMap: _copyMap<Color>(this.colorMap, colorMap),
      fontMap: _copyMap<Font>(this.fontMap, fontMap),
      radiusMap: _copyMap<double>(this.radiusMap, radiusMap),
      fontFamilyMap: _copyMap<FontFamily>(this.fontFamilyMap, fontFamilyMap),
      shadowMap: _copyMap<List<BoxShadow>>(this.shadowMap, shadowMap),
      spacerMap: _copyMap<double>(spacerMap, marginMap),
      extraThemeData: extraThemeData ?? this.extraThemeData);
  return result;
}