|
|
@ -58,6 +58,7 @@ class EditableTextBlock extends StatelessWidget { |
|
|
|
final bool hasFocus; |
|
|
|
final bool hasFocus; |
|
|
|
final EdgeInsets contentPadding; |
|
|
|
final EdgeInsets contentPadding; |
|
|
|
final EmbedBuilder embedBuilder; |
|
|
|
final EmbedBuilder embedBuilder; |
|
|
|
|
|
|
|
final StyleBuilder styleBuilder; |
|
|
|
final CursorCont cursorCont; |
|
|
|
final CursorCont cursorCont; |
|
|
|
final Map<int, int> indentLevelCounts; |
|
|
|
final Map<int, int> indentLevelCounts; |
|
|
|
|
|
|
|
|
|
|
@ -73,7 +74,7 @@ class EditableTextBlock extends StatelessWidget { |
|
|
|
this.contentPadding, |
|
|
|
this.contentPadding, |
|
|
|
this.embedBuilder, |
|
|
|
this.embedBuilder, |
|
|
|
this.cursorCont, |
|
|
|
this.cursorCont, |
|
|
|
this.indentLevelCounts) |
|
|
|
this.indentLevelCounts, this.styleBuilder) |
|
|
|
: assert(hasFocus != null), |
|
|
|
: assert(hasFocus != null), |
|
|
|
assert(embedBuilder != null), |
|
|
|
assert(embedBuilder != null), |
|
|
|
assert(cursorCont != null); |
|
|
|
assert(cursorCont != null); |
|
|
@ -114,14 +115,15 @@ class EditableTextBlock extends StatelessWidget { |
|
|
|
index++; |
|
|
|
index++; |
|
|
|
EditableTextLine editableTextLine = EditableTextLine( |
|
|
|
EditableTextLine editableTextLine = EditableTextLine( |
|
|
|
line, |
|
|
|
line, |
|
|
|
_buildLeading(context, line, index, indentLevelCounts, count), |
|
|
|
Center(child: _buildLeading(context, line, index, indentLevelCounts, count)), |
|
|
|
TextLine( |
|
|
|
TextLine( |
|
|
|
line: line, |
|
|
|
line: line, |
|
|
|
textDirection: textDirection, |
|
|
|
textDirection: textDirection, |
|
|
|
embedBuilder: embedBuilder, |
|
|
|
embedBuilder: embedBuilder, |
|
|
|
|
|
|
|
styleBuilder:styleBuilder, |
|
|
|
styles: styles, |
|
|
|
styles: styles, |
|
|
|
), |
|
|
|
), |
|
|
|
_getIndentWidth(), |
|
|
|
_getIndentWidth(defaultStyles), |
|
|
|
_getSpacingForLine(line, index, count, defaultStyles), |
|
|
|
_getSpacingForLine(line, index, count, defaultStyles), |
|
|
|
textDirection, |
|
|
|
textDirection, |
|
|
|
textSelection, |
|
|
|
textSelection, |
|
|
@ -185,9 +187,9 @@ class EditableTextBlock extends StatelessWidget { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double _getIndentWidth() { |
|
|
|
double _getIndentWidth(DefaultStyles defaultStyles) { |
|
|
|
Map<String, Attribute> attrs = block.style.attributes; |
|
|
|
Map<String, Attribute> attrs = block.style.attributes; |
|
|
|
|
|
|
|
double minimumIndent = defaultStyles?.textBlockStyle?.lineSpacing?.item1??0; |
|
|
|
Attribute indent = attrs[Attribute.indent.key]; |
|
|
|
Attribute indent = attrs[Attribute.indent.key]; |
|
|
|
double extraIndent = 0.0; |
|
|
|
double extraIndent = 0.0; |
|
|
|
if (indent != null && indent.value != null) { |
|
|
|
if (indent != null && indent.value != null) { |
|
|
@ -195,10 +197,10 @@ class EditableTextBlock extends StatelessWidget { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (attrs.containsKey(Attribute.blockQuote.key)) { |
|
|
|
if (attrs.containsKey(Attribute.blockQuote.key)) { |
|
|
|
return 16.0 + extraIndent; |
|
|
|
return minimumIndent + extraIndent; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return 32.0 + extraIndent; |
|
|
|
return minimumIndent + extraIndent; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Tuple2 _getSpacingForLine( |
|
|
|
Tuple2 _getSpacingForLine( |
|
|
|