Skip to content

Commit 100aece

Browse files
committed
compose [nfc]: Make isTopicVacuous private and move some of its dartdoc
This helper will become more relevant within the context of `ComposeTopicController`. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 9a5f3af commit 100aece

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

lib/widgets/compose_box.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,20 @@ abstract class ComposeController<ErrorT> extends TextEditingController {
128128
}
129129

130130
enum TopicValidationError {
131-
mandatoryButEmpty,
131+
/// Error when the topic fails a mandatory-topics check
132+
/// (see [ComposeTopicController.mandatory]).
133+
///
134+
/// The term "Vacuous" draws distinction from [String.isEmpty], in the sense
135+
/// that certain strings are not empty but also indicate the absence of a topic.
136+
mandatoryButVacuous,
137+
132138
tooLong;
133139

134140
String message(ZulipLocalizations zulipLocalizations) {
135141
switch (this) {
136142
case tooLong:
137143
return zulipLocalizations.topicValidationErrorTooLong;
138-
case mandatoryButEmpty:
144+
case mandatoryButVacuous:
139145
return zulipLocalizations.topicValidationErrorMandatoryButEmpty;
140146
}
141147
}
@@ -161,17 +167,14 @@ class ComposeTopicController extends ComposeController<TopicValidationError> {
161167
}
162168

163169
/// Whether [textNormalized] would fail a mandatory-topics check
164-
/// (see [mandatory]).
165-
///
166-
/// The term "Vacuous" draws distinction from [String.isEmpty], in the sense
167-
/// that certain strings are not empty but also indicate the absence of a topic.
168-
bool get isTopicVacuous => textNormalized == kNoTopicTopic;
170+
/// (see [TopicValidationError.mandatoryButVacuous]).
171+
bool get _isTopicVacuous => textNormalized == kNoTopicTopic;
169172

170173
@override
171174
List<TopicValidationError> _computeValidationErrors() {
172175
return [
173-
if (mandatory && isTopicVacuous)
174-
TopicValidationError.mandatoryButEmpty,
176+
if (mandatory && _isTopicVacuous)
177+
TopicValidationError.mandatoryButVacuous,
175178

176179
if (
177180
_lengthUnicodeCodePointsIfLong != null

0 commit comments

Comments
 (0)