From d1e80d900ea639d53f61511780394450de3fb8e2 Mon Sep 17 00:00:00 2001 From: Joshua Matthews Date: Thu, 7 Jul 2022 00:05:20 -0400 Subject: [PATCH] Adding endIndex getters to data classes in attributed_text --- attributed_text/lib/src/attributed_spans.dart | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/attributed_text/lib/src/attributed_spans.dart b/attributed_text/lib/src/attributed_spans.dart index 5f714d779..3333f24ce 100644 --- a/attributed_text/lib/src/attributed_spans.dart +++ b/attributed_text/lib/src/attributed_spans.dart @@ -1038,9 +1038,22 @@ class AttributionSpan { }); final Attribution attribution; + + /// The start of the span, inclusive. + /// + /// Content at this index will have [attribution] applied. final int start; + + /// The end of the span, exclusive. + /// + /// Content at this index will _not_ have [attribution] applied. final int end; + /// The end of the span, inclusive. + /// + /// Content at this index will have [attribution] applied. + int get endIndex => end - 1; + AttributionSpan constrain({ required int start, required int end, @@ -1093,9 +1106,22 @@ class MultiAttributionSpan { }); final Set attributions; + + /// The start of the span, inclusive. + /// + /// Content at this index will have [attributions] applied. final int start; + + /// The end of the span, exclusive. + /// + /// Content at this index will _not_ have [attributions] applied. final int end; + /// The end of the span, inclusive. + /// + /// Content at this index will have [attributions] applied. + int get endIndex => end - 1; + MultiAttributionSpan copyWith({ Set? attributions, int? start,