rt_cell.dart 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import 'package:fis_lib_report/pages/helpler.dart';
  2. import 'package:fis_lib_report/pages/paragraph_page.dart';
  3. import 'package:fis_lib_report/report/element_type.dart';
  4. import 'package:fis_lib_report/report/interfaces/block_element.dart';
  5. import 'package:fis_lib_report/report/paragraph.dart';
  6. import 'package:fis_lib_report/report/rt_Cell.dart';
  7. import 'package:flutter/cupertino.dart';
  8. import 'package:flutter/material.dart';
  9. class RTCellPage extends StatefulWidget {
  10. const RTCellPage({required this.cell, Key? key}) : super(key: key);
  11. final RTCell cell;
  12. @override
  13. State<StatefulWidget> createState() {
  14. return _RTCellState();
  15. }
  16. }
  17. class _RTCellState extends State<RTCellPage> {
  18. List<IBlockElement>? _blocks = [];
  19. @override
  20. initState() {
  21. _blocks = widget.cell.blocks;
  22. super.initState();
  23. }
  24. @override
  25. Widget build(BuildContext context) {
  26. return _blocks!.isEmpty
  27. ? Container(
  28. height: 30,
  29. decoration: TestBoxDecoration.buildDecoration(),
  30. )
  31. : Column(
  32. mainAxisSize: MainAxisSize.min,
  33. mainAxisAlignment: MainAxisAlignment.start,
  34. children: [
  35. ..._blocks!.map((e) {
  36. if (e.elementType!.name == ElementType.paragraph!.name) {
  37. final paragraph = e as Paragraph;
  38. return ParagraphPage(paragraph: paragraph);
  39. }
  40. return Container(
  41. height: 30,
  42. decoration: TestBoxDecoration.buildDecoration());
  43. }),
  44. ],
  45. );
  46. }
  47. }