text_element.dart 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import 'package:fis_lib_report/report/inlineElement.dart';
  2. import 'package:fis_lib_report/report/interfaces/textElement.dart';
  3. import 'package:fis_lib_report/report/rt_color.dart';
  4. abstract class TextElement extends InlineElement implements ITextElement {
  5. String? fontName;
  6. double? fontSize;
  7. List<RTFontStyle>? fontStyles = [];
  8. RTColor? fontColor;
  9. RTColor? background;
  10. int? lineLength;
  11. double? lineWidth;
  12. ///是否自动换行
  13. bool? textWrap;
  14. TextElement.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
  15. fontName = json['FontName'];
  16. fontSize = json['FontSize'];
  17. List<dynamic> jsonStyles = json['FontStyles'];
  18. if (jsonStyles.isNotEmpty) {
  19. jsonStyles.forEach((s) {
  20. fontStyles!
  21. .add(RTFontStyle.values.firstWhere((element) => element.name == s));
  22. });
  23. }
  24. fontColor = RTColor.fromJson(json['FontColor']);
  25. background = RTColor.fromJson(json['Background']);
  26. lineLength = json['LineLength'];
  27. lineWidth = json['LineWidth'];
  28. textWrap = json['TextWrap'];
  29. }
  30. }