debugFillProperties method

  1. @override
void debugFillProperties(
  1. DiagnosticPropertiesBuilder properties, {
  2. String prefix = '',
})
override

Adds all properties prefixing property names with the optional prefix.

Implementation

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties, {String prefix = ''}) {
  super.debugFillProperties(properties);
  if (debugLabel != null) {
    properties.add(MessageProperty('${prefix}debugLabel', debugLabel!));
  }
  final List<DiagnosticsNode> styles = <DiagnosticsNode>[
    StringProperty('${prefix}family', fontFamily, defaultValue: null, quoted: false),
    IterableProperty<String>('${prefix}familyFallback', fontFamilyFallback, defaultValue: null),
    DoubleProperty('${prefix}size', fontSize, defaultValue: null),
  ];
  String? weightDescription;
  if (fontWeight != null) {
    weightDescription = 'w${fontWeight!.index + 1}00';
  }
  // TODO(jacobr): switch this to use enumProperty which will either cause the
  // weight description to change to w600 from 600 or require existing
  // enumProperty to handle this special case.
  styles.add(
    DiagnosticsProperty<FontWeight>(
      '${prefix}weight',
      fontWeight,
      description: weightDescription,
      defaultValue: null,
    ),
  );
  styles.add(EnumProperty<FontStyle>('${prefix}style', fontStyle, defaultValue: null));
  styles.add(DoubleProperty('${prefix}height', height, unit: 'x', defaultValue: null));
  styles.add(
    FlagProperty(
      '${prefix}forceStrutHeight',
      value: forceStrutHeight,
      ifTrue: '$prefix<strut height forced>',
      ifFalse: '$prefix<strut height normal>',
    ),
  );

  final bool styleSpecified = styles.any(
    (DiagnosticsNode n) => !n.isFiltered(DiagnosticLevel.info),
  );
  styles.forEach(properties.add);

  if (!styleSpecified) {
    properties.add(
      FlagProperty(
        'forceStrutHeight',
        value: forceStrutHeight,
        ifTrue: '$prefix<strut height forced>',
        ifFalse: '$prefix<strut height normal>',
      ),
    );
  }
}