|
@@ -13,6 +13,7 @@ import 'package:fis_lib_report/report_info/report_base_info.dart';
|
|
|
import 'package:fis_lib_report/report_info/report_event_args.dart';
|
|
|
import 'package:fis_lib_report/report_info/rt_table_info.dart';
|
|
|
import 'package:fis_lib_report/report_info/single_selected_info.dart';
|
|
|
+import 'package:flutter/cupertino.dart';
|
|
|
|
|
|
class ReportInfo extends ReportBaseInfo {
|
|
|
static ReportInfo? _reportInfo;
|
|
@@ -30,30 +31,19 @@ class ReportInfo extends ReportBaseInfo {
|
|
|
List<dynamic> jsonBlocks = json['BlockInfos'];
|
|
|
if (jsonBlocks.isNotEmpty) {
|
|
|
for (var block in jsonBlocks) {
|
|
|
- final type = block['ElementType'];
|
|
|
- final jsonType = ElementType.fromJson(type);
|
|
|
- final name = jsonType.name;
|
|
|
- if (name == ElementType.paragraph.name) {
|
|
|
- final paragraphInfo = block as Map<String, dynamic>;
|
|
|
- _paragraphInfoFromJson(paragraphInfo);
|
|
|
- } else if (name == ElementType.rtTable.name) {
|
|
|
- final tableInfo = block as Map<String, dynamic>;
|
|
|
- List<dynamic> jsonElements = tableInfo['Cells'];
|
|
|
- int index = 0;
|
|
|
- for (var map in jsonElements) {
|
|
|
-
|
|
|
- if (index.isOdd) {
|
|
|
- final jsonType = map['ElementType'];
|
|
|
- final type = ElementType.fromJson(jsonType);
|
|
|
- if (type.name == ElementType.rtCell.name) {
|
|
|
- final cellMap = map as Map<String, dynamic>;
|
|
|
- final jsonBlocks = cellMap['Blocks'] as Map<String, dynamic>;
|
|
|
- _paragraphInfoFromJson(jsonBlocks);
|
|
|
- }
|
|
|
- }
|
|
|
- index++;
|
|
|
- }
|
|
|
- }
|
|
|
+ _blockElementInfoFromJson(block);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<dynamic> jsonHeaders = json['HeadInfos'];
|
|
|
+ if (jsonHeaders.isNotEmpty) {
|
|
|
+ for (var block in jsonHeaders) {
|
|
|
+ _blockElementInfoFromJson(block);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<dynamic> jsonFooters = json['FooterInfos'];
|
|
|
+ if (jsonFooters.isNotEmpty) {
|
|
|
+ for (var block in jsonFooters) {
|
|
|
+ _blockElementInfoFromJson(block);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -157,6 +147,43 @@ class ReportInfo extends ReportBaseInfo {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ void _blockElementInfoFromJson(Map<String, dynamic> block) {
|
|
|
+ final type = block['ElementType'];
|
|
|
+ final jsonType = ElementType.fromJson(type);
|
|
|
+ final name = jsonType.name;
|
|
|
+ if (name == ElementType.paragraph.name) {
|
|
|
+ final paragraphInfo = block as Map<String, dynamic>;
|
|
|
+ _paragraphInfoFromJson(paragraphInfo);
|
|
|
+ } else if (name == ElementType.rtTable.name) {
|
|
|
+ final tableInfo = block as Map<String, dynamic>;
|
|
|
+ List<dynamic> jsonElements = tableInfo['Cells'];
|
|
|
+ int index = 0;
|
|
|
+ for (var map in jsonElements) {
|
|
|
+
|
|
|
+ if (index.isOdd) {
|
|
|
+ final jsonType = map['ElementType'];
|
|
|
+ final type = ElementType.fromJson(jsonType);
|
|
|
+ if (type.name == ElementType.rtCell.name) {
|
|
|
+ final cellMap = map as Map<String, dynamic>;
|
|
|
+ final jsonBlocks = cellMap['Blocks'] as Map<String, dynamic>;
|
|
|
+ _paragraphInfoFromJson(jsonBlocks);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ } else if (name == ElementType.imageList.name) {
|
|
|
+ final imageList = block as Map<String, dynamic>;
|
|
|
+ final id = imageList['Id'];
|
|
|
+ final imagesInfo = getElementInfoById(id) as InputImageListInfo;
|
|
|
+ final images = imageList['SelectedImages'];
|
|
|
+ List<String> targetImages = [];
|
|
|
+ for (var i in images) {
|
|
|
+ targetImages.add(i.toString());
|
|
|
+ }
|
|
|
+ imagesInfo.selectedImages = targetImages;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
void _paragraphInfoFromJson(Map<String, dynamic> paragraphInfo) {
|
|
|
List<dynamic> jsonElements = paragraphInfo['ElementInfos'];
|
|
|
if (jsonElements.isEmpty) {
|