add custom indentWidth

pull/350/head
ritheshSalyan 5 years ago
parent 0258bd4788
commit 7a976ab346
  1. 2
      lib/src/widgets/delegate.dart
  2. 9
      lib/src/widgets/text_block.dart

@ -10,7 +10,7 @@ import 'text_selection.dart';
typedef EmbedBuilder = Widget Function(
BuildContext context, Embed node, bool readOnly);
typedef StyleBuilder = TextStyle Function(Attribute<dynamic> attribute);
typedef StyleBuilder = TextStyle Function(Attribute<dynamic>? attribute);
abstract class EditorTextSelectionGestureDetectorBuilderDelegate {
GlobalKey<EditorState> getEditableTextKey();

@ -129,7 +129,7 @@ class EditableTextBlock extends StatelessWidget {
styles: styles!,
readOnly: readOnly,
),
_getIndentWidth(),
_getIndentWidth(defaultStyles),
_getSpacingForLine(line, index, count, defaultStyles),
textDirection,
textSelection,
@ -204,20 +204,21 @@ class EditableTextBlock extends StatelessWidget {
return null;
}
double _getIndentWidth() {
double _getIndentWidth(DefaultStyles? defaultStyles) {
final attrs = block.style.attributes;
final indent = attrs[Attribute.indent.key];
var extraIndent = 0.0;
final minimumIndent = defaultStyles?.paragraph?.lineSpacing.item1??0;
if (indent != null && indent.value != null) {
extraIndent = 16.0 * indent.value;
}
if (attrs.containsKey(Attribute.blockQuote.key)) {
return 16.0 + extraIndent;
return minimumIndent + extraIndent;
}
return 32.0 + extraIndent;
return minimumIndent+ extraIndent;
}
Tuple2 _getSpacingForLine(

Loading…
Cancel
Save