Skip to content

Commit 39a99b0

Browse files
authored
Docs improvements per @Hixie's comments (flutter#7387)
1 parent 26e02aa commit 39a99b0

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

lib/ui/text.dart

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -882,43 +882,47 @@ class TextBox {
882882
/// characters. For newline characters, the position is fully specified by the
883883
/// offset alone, and there is no ambiguity.
884884
///
885-
/// TextAffinity also affects bidirectional text at the interface between LTR
885+
/// [TextAffinity] also affects bidirectional text at the interface between LTR
886886
/// and RTL text. Consider the following string, where the lowercase letters
887887
/// will be displayed as LTR and the uppercase letters RTL: "helloHELLO". When
888888
/// rendered, the string would appear visually as "helloOLLEH". An offset of 5
889-
/// would be ambiguous without a corresponding TextAffinity. Looking at the
889+
/// would be ambiguous without a corresponding [TextAffinity]. Looking at the
890890
/// string in code, the offset represents the position just after the "o" and
891891
/// just before the "H". When rendered, this offset could be either in the
892892
/// middle of the string to the right of the "o" or at the end of the string to
893893
/// the right of the "H".
894894
enum TextAffinity {
895-
/// The position has affinity for the upstream side of the text position, or
895+
/// The position has affinity for the upstream side of the text position, i.e.
896896
/// in the direction of the beginning of the string.
897897
///
898898
/// In the example of an offset at the place where text is wrapping, upstream
899899
/// indicates the end of the first line.
900900
///
901-
/// In the bidirectional text example above, an offset of 5 with TextAffinity
902-
/// upstream would appear in the middle of the rendered text, just to the
903-
/// right of the "o".
901+
/// In the bidirectional text example "helloHELLO", an offset of 5 with
902+
/// [TextAffinity] upstream would appear in the middle of the rendered text,
903+
/// just to the right of the "o". See the definition of [TextAffinity] for the
904+
/// full example.
904905
upstream,
905906

906-
/// The position has affinity for the downstream side of the text position, or
907-
/// in the direction of the end of the string.
907+
/// The position has affinity for the downstream side of the text position,
908+
/// i.e. in the direction of the end of the string.
908909
///
909910
/// In the example of an offset at the place where text is wrapping,
910911
/// downstream indicates the beginning of the second line.
911912
///
912-
/// In the bidirectional text example above, an offset of 5 with TextAffinity
913-
/// downstream would appear at the end of the rendered text, just to the right
914-
/// of the "H".
913+
/// In the bidirectional text example "helloHELLO", an offset of 5 with
914+
/// [TextAffinity] downstream would appear at the end of the rendered text,
915+
/// just to the right of the "H". See the definition of [TextAffinity] for the
916+
/// full example.
915917
downstream,
916918
}
917919

918-
/// A position in a string of text. A TextPosition can be used to locate a
919-
/// position in a string in code (using the [offset] property), and it can also
920-
/// be used to locate the same position visually in a rendered string of text
921-
/// (using [offset] and, when needed to resolve ambiguity, [affinity]).
920+
/// A position in a string of text.
921+
///
922+
/// A TextPosition can be used to locate a position in a string in code (using
923+
/// the [offset] property), and it can also be used to locate the same position
924+
/// visually in a rendered string of text (using [offset] and, when needed to
925+
/// resolve ambiguity, [affinity]).
922926
///
923927
/// The location of an offset in a rendered string is ambiguous in two cases.
924928
/// One happens when rendered text is forced to wrap. In this case, the offset

0 commit comments

Comments
 (0)