Skip to content

Commit

Permalink
Updating super_editor example app to match new attributed_text api
Browse files Browse the repository at this point in the history
  • Loading branch information
jmatth committed Jul 6, 2022
1 parent 6dea7b1 commit 7985a20
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class HeaderWithHintComponentBuilder implements ComponentBuilder {
text: 'header goes here...',
spans: AttributedSpans(
attributions: const [
AttributionSpan(attribution: italicsAttribution, start: 12, end: 15),
AttributionSpan(attribution: italicsAttribution, start: 12, end: 16),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Document _createInitialDocument() {
AttributionSpan(
attribution: LinkAttribution(url: Uri.https('example.org', '')),
start: 30,
end: 35,
end: 36,
),
],
)),
Expand Down
6 changes: 3 additions & 3 deletions super_editor/example/lib/demos/example_editor/_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import 'dart:math';

import 'package:example/logging.dart';
import 'package:flutter/material.dart';
import 'package:super_editor/super_editor.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:super_editor/super_editor.dart';

/// Small toolbar that is intended to display near some selected
/// text and offer a few text formatting controls.
Expand Down Expand Up @@ -262,7 +262,7 @@ class _EditorToolbarState extends State<EditorToolbar> {
final extentOffset = (selection.extent.nodePosition as TextPosition).offset;
final selectionStart = min(baseOffset, extentOffset);
final selectionEnd = max(baseOffset, extentOffset);
final selectionRange = SpanRange(start: selectionStart, end: selectionEnd - 1);
final selectionRange = SpanRange(start: selectionStart, end: selectionEnd);

final textNode = widget.editor!.document.getNodeById(selection.extent.nodeId) as TextNode;
final text = textNode.text;
Expand All @@ -283,7 +283,7 @@ class _EditorToolbarState extends State<EditorToolbar> {
final extentOffset = (selection.extent.nodePosition as TextPosition).offset;
final selectionStart = min(baseOffset, extentOffset);
final selectionEnd = max(baseOffset, extentOffset);
final selectionRange = SpanRange(start: selectionStart, end: selectionEnd - 1);
final selectionRange = SpanRange(start: selectionStart, end: selectionEnd);

final textNode = widget.editor!.document.getNodeById(selection.extent.nodeId) as TextNode;
final text = textNode.text;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class _InteractiveTextFieldDemoState extends State<InteractiveTextFieldDemo> {
text: AttributedText(
text: 'Super Editor is an open source text editor for Flutter projects.',
spans: AttributedSpans(attributions: const [
AttributionSpan(attribution: brandAttribution, start: 0, end: 11),
AttributionSpan(attribution: flutterAttribution, start: 47, end: 53),
AttributionSpan(attribution: brandAttribution, start: 0, end: 12),
AttributionSpan(attribution: flutterAttribution, start: 47, end: 54),
])),
);

Expand Down

0 comments on commit 7985a20

Please sign in to comment.