Skip to content

Commit

Permalink
Adding endIndex getters to data classes in attributed_text
Browse files Browse the repository at this point in the history
  • Loading branch information
jmatth committed Aug 1, 2022
1 parent 0fd3bf5 commit d1e80d9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions attributed_text/lib/src/attributed_spans.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -1093,9 +1106,22 @@ class MultiAttributionSpan {
});

final Set<Attribution> 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<Attribution>? attributions,
int? start,
Expand Down

0 comments on commit d1e80d9

Please sign in to comment.