private static Widget ProcessTableClose(Token token, BuilderContext ctx)
            {
                var maxColumnCount = ctx.rows.Max(row => row.Count);

                ctx.rows.ForEach(row =>
                {
                    while (row.Count < maxColumnCount)
                    {
                        var cellContainer = row.Last();
                        row.Add(
                            new Container(
                                padding: cellContainer.padding,
                                decoration: cellContainer.decoration
                                )
                            );
                    }
                });
                var tableRows = ctx.rows.Select(row => new TableRow(children: row.Cast <Widget>().ToList())).ToList();
                var table     = new Container(
                    margin: EdgeInsets.only(top: 16f, bottom: 24f),
                    child: new Table(
                        border: TableBorder.all(
                            width: 1f,
                            color: new Color(0xffe0e0e0)
                            ),
                        defaultColumnWidth: new FlexColumnWidth(1.0f),
                        children: tableRows
                        )
                    );

                ctx.ClearColumn();
                return(table);
            }
Ejemplo n.º 2
0
 public static MarkdownStyleSheet defaultStyle()
 {
     return(new MarkdownStyleSheet(
                CTextStyle.PXLargeBlue,
                CTextStyle.PXLarge,
                CTextStyle.PCodeStyle,
                CTextStyle.H4,
                CTextStyle.H5,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge.copyWith(fontStyle: FontStyle.italic),
                CTextStyle.PXLarge.copyWith(fontWeight: FontWeight.bold),
                new TextStyle(decoration: TextDecoration.lineThrough),
                CTextStyle.PXLargeBody4,
                CTextStyle.PXLarge,
                CTextStyle.PXLarge,
                8.0f,
                24.0f,
                CTextStyle.PXLarge,
                new TextStyle(fontWeight: FontWeight.w600),
                CTextStyle.PXLarge,
                TextAlign.center,
                TableBorder.all(color: CColors.Grey, width: 0),
                new FlexColumnWidth(),
                EdgeInsets.fromLTRB(16, 8, 16, 8),
                tableCellsDecoration: new BoxDecoration(color: CColors.Grey),
                blockquotePadding: EdgeInsets.all(16.0f),
                blockquoteDecoration: new BoxDecoration(
                    border: new Border(
                        left: new BorderSide(
                            color: CColors.Separator,
                            8
                            ))
                    ),
                codeblockPadding: EdgeInsets.all(30.0f),
                codeblockDecoration: new BoxDecoration(
                    color: Color.fromRGBO(110, 198, 255, 0.12f)
                    ),
                horizontalRuleDecoration: new BoxDecoration(
                    border: new Border(
                        top: new BorderSide(width: 5.0f, color: CColors.Grey)
                        )
                    )));
 }
Ejemplo n.º 3
0
 public static MarkdownStyleSheet fromTheme(ThemeData theme)
 {
     return(new MarkdownStyleSheet(
                a: new TextStyle(true, Colors.blue),
                p: theme.textTheme.body1,
                code: theme.textTheme.body1.copyWith(
                    null,
                    null,
                    Colors.grey.shade200,
                    "monospace",
                    null,
                    theme.textTheme.body1.fontSize * 0.85f,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null,
                    null
                    ),
                h1: theme.textTheme.headline,
                h2: theme.textTheme.title,
                h3: theme.textTheme.subhead,
                h4: theme.textTheme.body2,
                h5: theme.textTheme.body2,
                h6: theme.textTheme.body2,
                em: new TextStyle(fontStyle: FontStyle.italic),
                strong: new TextStyle(fontWeight: FontWeight.bold),
                del: new TextStyle(decoration: TextDecoration.lineThrough),
                blockquote: theme.textTheme.body1,
                img: theme.textTheme.body1,
                checkbox: theme.textTheme.body1.copyWith(
                    color: theme.primaryColor
                    ),
                blockSpacing: 8.0f,
                listIndent: 24.0f,
                listBullet: theme.textTheme.body1,
                tableHead: new TextStyle(fontWeight: FontWeight.w600),
                tableBody: theme.textTheme.body1,
                tableHeadAlign: TextAlign.center,
                tableBorder: TableBorder.all(color: Colors.grey.shade300, width: 0),
                tableColumnWidth: new FlexColumnWidth(),
                tableCellsPadding: EdgeInsets.fromLTRB(16, 8, 16, 8),
                tableCellsDecoration: new BoxDecoration(color: Colors.grey.shade50),
                blockquotePadding: EdgeInsets.all(8.0f),
                blockquoteDecoration: new BoxDecoration(
                    color: Colors.blue.shade100,
                    borderRadius: BorderRadius.circular(2.0f)
                    ),
                codeblockPadding: EdgeInsets.all(8.0f),
                codeblockDecoration: new BoxDecoration(
                    color: Colors.grey.shade200,
                    borderRadius: BorderRadius.circular(2.0f)
                    ),
                horizontalRuleDecoration: new BoxDecoration(
                    border: new Border(
                        top: new BorderSide(width: 5.0f, color: Colors.grey.shade300)
                        )
                    )
                ));
 }