فهرست منبع

布局结构完善

loki.wu 2 سال پیش
والد
کامیت
a09ec80c2d

+ 36 - 2
lib/converts/alignment_convert.dart

@@ -1,5 +1,6 @@
 import 'package:fis_lib_report/report/interfaces/position_layout.dart';
 import 'package:flutter/widgets.dart';
+import 'package:flutter/widgets.dart';
 
 class AlignmentConvert {
   static TextAlignVertical verticalAlignmentConvert(VerticalLayout? value) {
@@ -41,13 +42,30 @@ class AlignmentConvert {
     } else {
       switch (value) {
         case HorizontalLayout.Left:
-          return MainAxisAlignment.spaceAround;
+          return MainAxisAlignment.start;
         case HorizontalLayout.Center:
           return MainAxisAlignment.center;
         case HorizontalLayout.Right:
           return MainAxisAlignment.end;
         case HorizontalLayout.Stretch:
-          return MainAxisAlignment.spaceEvenly;
+          return MainAxisAlignment.start;
+      }
+    }
+  }
+
+  static WrapAlignment wrapAlignment(HorizontalLayout? value) {
+    if (value == null) {
+      return WrapAlignment.start;
+    } else {
+      switch (value) {
+        case HorizontalLayout.Left:
+          return WrapAlignment.start;
+        case HorizontalLayout.Center:
+          return WrapAlignment.center;
+        case HorizontalLayout.Right:
+          return WrapAlignment.end;
+        case HorizontalLayout.Stretch:
+          return WrapAlignment.start;
       }
     }
   }
@@ -67,4 +85,20 @@ class AlignmentConvert {
         return Alignment.centerLeft;
     }
   }
+
+  static Alignment horizontalConvert(HorizontalLayout? value) {
+    if (value == null) {
+      return Alignment.center;
+    }
+    switch (value) {
+      case HorizontalLayout.Left:
+        return Alignment.centerLeft;
+      case HorizontalLayout.Right:
+        return Alignment.centerRight;
+      case HorizontalLayout.Center:
+        return Alignment.center;
+      case HorizontalLayout.Stretch:
+        return Alignment.centerLeft;
+    }
+  }
 }

+ 9 - 0
lib/converts/text_size_converter.dart

@@ -14,4 +14,13 @@ class TextSizeConvert {
       ..layout(maxWidth: maxWidth);
     return textPainter.size;
   }
+
+  static double paintWidthWithTextStyle(TextStyle style, String text) {
+    final TextPainter textPainter = TextPainter(
+        text: TextSpan(text: text, style: style),
+        maxLines: 1,
+        textDirection: TextDirection.ltr)
+      ..layout(minWidth: 0, maxWidth: double.infinity);
+    return textPainter.size.width;
+  }
 }

+ 32 - 34
lib/main.dart

@@ -56,17 +56,11 @@ class _MyHomePageState extends State<MyHomePage> {
   double _baseFontSize = 9.0;
   double _footerDistance = 34.0;
   double _footerHeight = 0;
-  EdgeInsetsGeometry _padding = const EdgeInsets.all(56.83);
+  EdgeInsetsGeometry _padding = EdgeInsets.all(PtToPxConverter.ptToPx(56.83));
 
   @override
   initState() {
     _intitTemplate();
-    final padding = _reportTemplate.pagePadding!;
-    _padding = EdgeInsets.only(
-        top: PtToPxConverter.ptToPx(padding.top!),
-        bottom: PtToPxConverter.ptToPx(padding.bottom!),
-        right: PtToPxConverter.ptToPx(padding.right!),
-        left: PtToPxConverter.ptToPx(padding.left!));
     super.initState();
   }
 
@@ -76,23 +70,27 @@ class _MyHomePageState extends State<MyHomePage> {
       body: Container(
         decoration: _buildDecoration(),
         padding: _padding,
-        height: PtToPxConverter.ptToPx(_height),
-        width: PtToPxConverter.ptToPx(_width),
-        child: Column(
-          mainAxisSize: MainAxisSize.min,
-          mainAxisAlignment: MainAxisAlignment.start,
-          children: [
-            ..._header.map((head) {
-              return BlockElementPage(element: head);
-            }),
-            ..._blocks.map((block) {
-              return BlockElementPage(element: block);
-            }),
-            const SizedBox(height: 10),
-            ..._footer.map((footer) {
-              return BlockElementPage(element: footer);
-            }),
-          ],
+        alignment: Alignment.center,
+        height: _height,
+        width: _width,
+        child: Container(
+          child: Column(
+            mainAxisAlignment: MainAxisAlignment.center,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            mainAxisSize: MainAxisSize.min,
+            children: [
+              ..._header.map((head) {
+                return BlockElementPage(element: head);
+              }),
+              ..._blocks.map((block) {
+                return BlockElementPage(element: block);
+              }),
+              const SizedBox(height: 10),
+              ..._footer.map((footer) {
+                return BlockElementPage(element: footer);
+              }),
+            ],
+          ),
         ),
       ),
     );
@@ -104,7 +102,7 @@ class _MyHomePageState extends State<MyHomePage> {
           width: 0.5,
           color: const Color.fromARGB(255, 83, 83, 83),
         ),
-        color: Colors.grey[200]);
+        color: Colors.white);
   }
 
   void _intitTemplate() {
@@ -120,18 +118,18 @@ class _MyHomePageState extends State<MyHomePage> {
 
   void _initPage() {
     try {
-      _height = _reportTemplate.pageSize!.height ?? 841;
-      _width = _reportTemplate.pageSize!.width ?? 595;
-      _baseFontSize = _reportTemplate.baseFontSize ?? 14;
-      _footerDistance = _reportTemplate.footerDistance ?? 0;
-      _footerHeight = _reportTemplate.footerHeight ?? 0;
+      _height = PtToPxConverter.ptToPx(_reportTemplate.pageSize!.height);
+      _width = PtToPxConverter.ptToPx(_reportTemplate.pageSize!.width);
+      _baseFontSize = PtToPxConverter.ptToPx(_reportTemplate.baseFontSize);
+      _footerDistance = PtToPxConverter.ptToPx(_reportTemplate.footerDistance);
+      _footerHeight = PtToPxConverter.ptToPx(_reportTemplate.footerHeight);
       final pagePadding =
           _reportTemplate.pagePadding ?? RTThickness.uniform(56);
       _padding = EdgeInsets.only(
-        left: pagePadding.left ?? 0,
-        right: pagePadding.right ?? 0,
-        top: pagePadding.top ?? 0,
-        bottom: pagePadding.bottom ?? 0,
+        left: PtToPxConverter.ptToPx(pagePadding.left),
+        right: PtToPxConverter.ptToPx(pagePadding.right),
+        top: PtToPxConverter.ptToPx(pagePadding.top),
+        bottom: PtToPxConverter.ptToPx(pagePadding.bottom),
       );
       _footer = _reportTemplate.footer ?? [];
       _blocks = _reportTemplate.blocks ?? [];

+ 5 - 1
lib/pages/block_element_page.dart

@@ -1,6 +1,7 @@
 import 'package:fis_lib_report/pages/helpler.dart';
 import 'package:fis_lib_report/pages/paragraph_page.dart';
 import 'package:fis_lib_report/pages/rt_table.dart';
+import 'package:fis_lib_report/report/cellPostion.dart';
 import 'package:fis_lib_report/report/element_type.dart';
 import 'package:fis_lib_report/report/inputImageList.dart';
 import 'package:fis_lib_report/report/interfaces/block_element.dart';
@@ -34,7 +35,10 @@ class _BlockElementState extends State<BlockElementPage> {
   Widget build(BuildContext context) {
     if (_type != null && _type!.name == ElementType.rtTable!.name) {
       RTTable t = widget.element as RTTable;
-      return RTTablePage(element: t);
+      return Container(
+        alignment: Alignment.center,
+        child: RTTablePage(element: t),
+      );
     } else if (_type != null && _type!.name == ElementType.paragraph!.name) {
       final paragraph = widget.element as Paragraph;
       return ParagraphPage(paragraph: paragraph);

+ 0 - 1
lib/pages/components/input_text.dart

@@ -57,7 +57,6 @@ class _RInputTextState extends State<RInputText> {
     _textWrap = inputText.textWrap;
     _fontSize = PtToPxConverter.ptToPx(inputText.fontSize);
     _height = _fontSize! > 30 ? 36.5 : 22;
-    print(_lineLength);
     super.initState();
   }
 

+ 2 - 0
lib/pages/components/line.dart

@@ -1,4 +1,5 @@
 import 'package:fis_lib_report/converts/pt_to_px_converter.dart';
+import 'package:fis_lib_report/pages/helpler.dart';
 import 'package:fis_lib_report/report/line.dart';
 import 'package:fis_lib_report/report/rt_thickness.dart';
 import 'package:flutter/cupertino.dart';
@@ -37,6 +38,7 @@ class _LineState extends State<RLine> {
     final margin = line.margin ?? RTThickness.uniform(0);
     return Container(
       height: 10, //TODO(Loki):这里的Height在Json中没有
+      alignment: Alignment.center,
       margin: EdgeInsets.only(
           top: margin.top!,
           bottom: margin.bottom!,

+ 241 - 0
lib/pages/components/multi_selected.dart

@@ -0,0 +1,241 @@
+import 'package:fis_lib_report/converts/pt_to_px_converter.dart';
+import 'package:fis_lib_report/converts/text_size_converter.dart';
+import 'package:fis_lib_report/pages/components/input_text.dart';
+import 'package:fis_lib_report/report/inputText.dart';
+import 'package:fis_lib_report/report/multiSelected.dart';
+import 'package:fis_lib_report/report/rt_color.dart';
+import 'package:fis_lib_report/report/singleSelected.dart';
+import 'package:flutter/material.dart';
+import 'package:dropdown_button2/dropdown_button2.dart';
+import 'package:fis_lib_report/report/inputText.dart';
+import 'package:fis_ui/simple/select.dart';
+
+class RMultiSelected extends StatefulWidget {
+  final MultiSelected multiSelected;
+  RMultiSelected(this.multiSelected);
+  @override
+  State<StatefulWidget> createState() {
+    return _RRMultiSelectedState(multiSelected);
+  }
+}
+
+class _RRMultiSelectedState extends State<RMultiSelected> {
+  MultiSelected multiSelected;
+  _RRMultiSelectedState(this.multiSelected);
+  String _value = '';
+  String? _selectedItemView = '';
+  List<String>? _items = [];
+  List<String>? _selectedItems = [];
+  double _width = 0.0;
+  TextStyle _textStyle = TextStyle();
+  @override
+  initState() {
+    if (multiSelected.items!.isNotEmpty) {
+      _items = multiSelected.items;
+    }
+    _width = PtToPxConverter.ptToPx(multiSelected.lineWidth);
+    final fontColor = multiSelected.fontColor ?? RTColor.Black;
+    _textStyle = TextStyle(
+      color: Color.fromARGB(
+          fontColor.a!, fontColor.r!, fontColor.g!, fontColor.b!),
+      fontSize: PtToPxConverter.ptToPx(multiSelected.fontSize),
+    );
+    super.initState();
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    final background = multiSelected.background ?? RTColor(255, 255, 255, 255);
+
+    return Stack(
+      children: [
+        Container(
+          decoration: BoxDecoration(
+            border: Border.all(color: Colors.grey, width: 1.0),
+            borderRadius: BorderRadius.circular(0),
+            color: Color.fromARGB(
+                background.a!, background.r!, background.g!, background.b!),
+          ),
+          padding: const EdgeInsets.only(right: 25),
+          width: _width,
+          height: 22,
+          child: Text(
+            _selectedItemView!,
+            maxLines: 1,
+            style: _textStyle,
+          ),
+        ),
+        _buildDropdownButton(),
+      ],
+    );
+  }
+
+  List<DropdownMenuItem<String>> buildItems() {
+    return _items!.map((String e) {
+      final active = e == _value;
+      return DropdownMenuItem<String>(
+        child: _OptionRow(
+          multiSelected,
+          e,
+          isActive: active,
+          height: 22,
+          onTap: () {
+            setState(() {
+              if (_selectedItems!.contains(e)) {
+                _selectedItems!.remove(e);
+              } else {
+                _selectedItems!.add(e);
+              }
+              String text = '';
+              for (var element in _selectedItems!) {
+                final index = _selectedItems!.indexOf(element);
+                if (index > 0) {
+                  text = text + ',' + element;
+                } else if (index == 0) {
+                  text = element;
+                } else if (_selectedItems!.isEmpty) {
+                  text = '';
+                }
+              }
+              _selectedItemView = text;
+              final width = TextSizeConvert.getTextSize(text, _textStyle).width;
+              if (_width < width - 25) {
+                // _width = width - 25;
+              }
+            });
+          },
+          isSelected: _selectedItems!.contains(e),
+        ),
+        value: e,
+      );
+    }).toList();
+  }
+
+  Widget _buildDropdownButton() {
+    if (_items!.isEmpty) {
+      return const SizedBox();
+    }
+    var buttonDecoration = BoxDecoration(
+      border: Border.all(color: Colors.transparent, width: 1.0),
+      borderRadius: BorderRadius.circular(0),
+      color: Colors.transparent,
+    );
+    return SizedBox(
+      height: 22,
+      width: _width,
+      child: DropdownButtonHideUnderline(
+        child: DropdownButton2<String>(
+          dropdownMaxHeight: 300,
+          buttonWidth: _width,
+          itemPadding: const EdgeInsets.symmetric(horizontal: 1, vertical: 2),
+          itemHeight: 28,
+          //    itemPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
+          isExpanded: false,
+          dropdownOverButton: false,
+          scrollbarAlwaysShow: true,
+          scrollbarThickness: 4,
+          scrollbarRadius: const Radius.circular(2),
+          buttonPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 0),
+          dropdownDecoration: BoxDecoration(
+            borderRadius: BorderRadius.circular(4),
+          ),
+          buttonDecoration: buttonDecoration,
+          offset: const Offset(0, -4),
+          selectedItemHighlightColor: Theme.of(context).secondaryHeaderColor,
+          selectedItemBuilder: (_) => _selectedItems!.map((e) {
+            return SizedBox(
+              width: _width - 34,
+              child: Text(
+                e,
+                maxLines: 1,
+              ),
+            );
+          }).toList(),
+          value: null,
+          items: buildItems(),
+          onChanged: (v) {},
+        ),
+      ),
+    );
+  }
+}
+
+class _OptionRow extends StatefulWidget {
+  _OptionRow(
+    this.multiSelected,
+    this.label, {
+    Key? key,
+    this.isActive = false,
+    this.height,
+    this.onTap,
+    this.isSelected,
+  }) : super(key: key);
+
+  final Function? onTap;
+  final MultiSelected multiSelected;
+  final String label;
+  final bool isActive;
+  final double? height;
+  bool? isSelected = false;
+
+  @override
+  State<StatefulWidget> createState() {
+    return _OptionRowState(isSelected!);
+  }
+}
+
+class _OptionRowState extends State<_OptionRow> {
+  _OptionRowState(this.isSelected);
+  bool? isSelected = false;
+
+  @override
+  Widget build(BuildContext context) {
+    final color = widget.multiSelected.fontColor!;
+    final background = widget.multiSelected.background!;
+    final text = Text(
+      widget.label,
+      style: TextStyle(
+        backgroundColor: Color.fromARGB(
+            background.a!, background.r!, background.g!, background.b!),
+        fontSize: PtToPxConverter.ptToPx(widget.multiSelected.fontSize),
+        color: Color.fromARGB(color.a!, color.r!, color.g!, color.b!),
+      ),
+    );
+    if (widget.height != null) {
+      return GestureDetector(
+        onTap: () {
+          setState(() {
+            isSelected = !isSelected!;
+          });
+          if (widget.onTap != null) {
+            widget.onTap!.call();
+          }
+        },
+        child: Container(
+          color: Colors.white,
+          alignment: Alignment.centerLeft,
+          height: widget.height,
+          width: PtToPxConverter.ptToPx(widget.multiSelected.lineWidth) - 34,
+          child: Row(
+            children: [
+              Checkbox(
+                onChanged: (bool? value) {
+                  setState(() {
+                    isSelected = value ?? false;
+                  });
+                  if (widget.onTap != null) {
+                    widget.onTap!.call();
+                  }
+                },
+                value: isSelected,
+              ),
+              Expanded(child: text),
+            ],
+          ),
+        ),
+      );
+    } else {
+      return text;
+    }
+  }
+}

+ 1 - 2
lib/pages/components/single_select.dart

@@ -39,12 +39,11 @@ class _RSingleSelectState extends State<RSingleSelected> {
       color: Colors.white,
     );
     return SizedBox(
-      height: 28,
+      height: 24,
       child: DropdownButtonHideUnderline(
         child: DropdownButton2<String>(
           dropdownMaxHeight: 280,
           buttonWidth: PtToPxConverter.ptToPx(singleSelected.lineWidth),
-          buttonHeight: 28,
           itemHeight: 28,
           itemPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
           isExpanded: false,

+ 29 - 12
lib/pages/components/static_text.dart

@@ -1,3 +1,6 @@
+import 'dart:convert';
+import 'dart:typed_data';
+
 import 'package:fis_lib_report/converts/alignment_convert.dart';
 import 'package:fis_lib_report/converts/pt_to_px_converter.dart';
 import 'package:fis_lib_report/converts/text_size_converter.dart';
@@ -20,16 +23,15 @@ class _RStaticTextState extends State<RStaticText> {
   _RStaticTextState(this.staticText);
 
   double _fontSize = 15.0;
-  double _width = 0;
-  TextStyle _style = TextStyle();
+  TextStyle _style = const TextStyle();
   Color _fontColor = Colors.black;
   Color _backgroundColor = const Color.fromARGB(255, 255, 255, 255);
-  EdgeInsets _margin = EdgeInsets.all(0);
+  EdgeInsets _margin = const EdgeInsets.all(0);
   @override
   initState() {
     _fontSize = staticText.fontSize ?? 15.0;
     //TODO(Loki):常规模板暂未设置fontStyles,后续再支持
-    final fontStyles = staticText.fontStyles;
+    //final fontStyles = staticText.fontStyles;
     final fontColor = staticText.fontColor;
     if (fontColor != null) {
       _fontColor = Color.fromARGB(
@@ -54,24 +56,39 @@ class _RStaticTextState extends State<RStaticText> {
       backgroundColor: _backgroundColor,
     );
 
-    _width = PtToPxConverter.ptToPx(
-        TextSizeConvert.getTextSize(staticText.text ?? '', _style).width * 2);
     super.initState();
   }
 
   @override
   Widget build(BuildContext context) {
+    final text = staticText.text!;
     return Container(
       margin: _margin,
-      alignment:
-          AlignmentConvert.verticalLayoutConvert(staticText.verticalAlignment!),
-      width: _width,
       child: Text(
-        staticText.text ?? '',
+        _syncText(text),
         style: _style,
-        textAlign: AlignmentConvert.horizontalAlignmentConvert(
-            staticText.horizontalAlignment),
       ),
     );
   }
+
+  String _syncText(String value) {
+    try {
+      if (value.contains(' ')) {
+        String result = '';
+        for (var i = 0; i < value.length; i++) {
+          if (value[i] == ' ') {
+            result += value[i] + ' ';
+          } else {
+            result += value[i];
+          }
+        }
+        return result;
+      } else {
+        return value;
+      }
+    } catch (e) {
+      print(e);
+      return value;
+    }
+  }
 }

+ 14 - 34
lib/pages/paragraph_page.dart

@@ -3,8 +3,10 @@ import 'package:fis_lib_report/pages/components/RDateTime.dart';
 import 'package:fis_lib_report/pages/components/input_text.dart';
 import 'package:fis_lib_report/pages/components/line.dart';
 import 'package:fis_lib_report/pages/components/multi_select.dart';
+import 'package:fis_lib_report/pages/components/multi_selected.dart';
 import 'package:fis_lib_report/pages/components/single_select.dart';
 import 'package:fis_lib_report/pages/components/static_Text.dart';
+import 'package:fis_lib_report/pages/helpler.dart';
 import 'package:fis_lib_report/report/dateTimeElement.dart';
 import 'package:fis_lib_report/report/element_type.dart';
 import 'package:fis_lib_report/report/inputText.dart';
@@ -52,24 +54,22 @@ class _ParagraphState extends State<ParagraphPage> {
         left: margin.left!,
         right: margin.right!,
       ),
-      alignment: AlignmentConvert.verticalLayoutConvert(
-          widget.paragraph.verticalAlignment),
-      child: Row(
-        mainAxisAlignment:
-            widget.paragraph.horizontalAlignment == HorizontalLayout.Center
-                ? MainAxisAlignment.center
-                : MainAxisAlignment.start,
-        crossAxisAlignment: CrossAxisAlignment.start,
+      alignment: AlignmentConvert.horizontalConvert(
+          widget.paragraph.horizontalAlignment),
+      child: Wrap(
+        alignment: WrapAlignment.spaceEvenly,
         children: [
           ..._elements!.map((element) {
             if (element.elementType!.name == ElementType.inputText!.name) {
               InputText inputText = element as InputText;
-              return RInputText(
-                inputText: inputText,
-              );
+
+              return RInputText(inputText: inputText);
             } else if (element.elementType!.name ==
                 ElementType.staticText!.name) {
               StaticText staticText = element as StaticText;
+              if (staticText.lineWidth == 0) {
+                staticText.lineWidth = staticText.lineLength! * 10.5;
+              }
               return RStaticText(staticText);
             } else if (element.elementType!.name ==
                 ElementType.singleSelected!.name) {
@@ -85,33 +85,13 @@ class _ParagraphState extends State<ParagraphPage> {
             } else if (element.elementType!.name ==
                 ElementType.multiSelected!.name) {
               final multiSelected = element as MultiSelected;
-
-              List<String>? values = multiSelected.items;
-              return SizedBox(
-                width: 120,
-                height: 28,
-                child: TextField(
-                  cursorWidth: 0,
-                  mouseCursor: SystemMouseCursors.click,
-                  decoration: const InputDecoration(
-                    suffixIcon: Icon(Icons.arrow_drop_down),
-                  ),
-                  onTap: () {
-                    _showMultiSelect(values);
-                  },
-                ),
-              );
+              return RMultiSelected(multiSelected);
             }
             return Container(
               height: 30,
               width: 80,
-              decoration: BoxDecoration(
-                  border: Border.all(
-                    width: 0.5,
-                    color: const Color.fromARGB(255, 83, 83, 83),
-                  ),
-                  color: Colors.grey[200]),
-              child: const Text('组件占位'),
+              decoration: TestBoxDecoration.buildDecoration(),
+              child: const Text('未知组件占位'),
             );
           }),
         ],

+ 2 - 3
lib/pages/rt_cell.dart

@@ -34,9 +34,8 @@ class _RTCellState extends State<RTCellPage> {
             height: 30,
             decoration: TestBoxDecoration.buildDecoration(),
           )
-        : Column(
-            mainAxisSize: MainAxisSize.min,
-            mainAxisAlignment: MainAxisAlignment.start,
+        : Wrap(
+            alignment: WrapAlignment.start,
             children: [
               ..._blocks!.map((e) {
                 if (e.elementType!.name == ElementType.paragraph!.name) {

+ 15 - 9
lib/pages/rt_table.dart

@@ -1,5 +1,6 @@
 import 'dart:math';
 
+import 'package:fis_lib_report/converts/alignment_convert.dart';
 import 'package:fis_lib_report/converts/pt_to_px_converter.dart';
 import 'package:fis_lib_report/pages/rt_cell.dart';
 import 'package:fis_lib_report/report/cellPostion.dart';
@@ -36,11 +37,11 @@ class _RTTableState extends State<RTTablePage> {
     cellPostions.sort(((a, b) => (b.column!).compareTo(a.column!)));
     // +1 为列数
     _column = cellPostions.first.column! + 1;
-
+    _values = _cells!.values.toList();
     for (int i = 0; i < _column! - 1; i++) {
       _width += widget.element.columnDefinitions![i].width!;
     }
-    _values = _cells!.values.toList();
+
     _row = widget.element.rowDefinitions!.length + 1;
   }
 
@@ -69,9 +70,10 @@ class _RTTableState extends State<RTTablePage> {
                     0.0;
           }
         }
-        print('height' + height.toString() + '   width:' + width.toString());
+
         final cell = _cells![cellPostion];
         RTCell c = cell as RTCell;
+        print('width:' + width.toString() + ' height:' + height.toString());
         childwidgets.add(
           SizedBox(
             width: PtToPxConverter.ptToPx(width),
@@ -84,17 +86,21 @@ class _RTTableState extends State<RTTablePage> {
       });
       final row = SizedBox(
         child: Row(
+          //mainAxisAlignment: MainAxisAlignment.center,
           children: childwidgets,
         ),
       );
 
-      widgets.add(Container(
-        child: row,
-      ));
+      widgets.add(row);
     }
-    return SizedBox(
-      child:
-          Column(mainAxisAlignment: MainAxisAlignment.start, children: widgets),
+    return Container(
+      alignment: AlignmentConvert.horizontalConvert(
+          widget.element.horizontalAlignment),
+      child: Column(
+        mainAxisAlignment: AlignmentConvert.horizontalToMainConvert(
+            widget.element.horizontalAlignment),
+        children: widgets,
+      ),
     );
   }
 }