Skip to content

Commit acbd64e

Browse files
committed
compose [nfc]: Extract isTopicEmpty helper
This will later (in another PR) be useful for checking emptiness when realmEmptyTopicDisplayName is given. Signed-off-by: Zixuan James Li <[email protected]>
1 parent 0264624 commit acbd64e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/widgets/compose_box.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@ class ComposeTopicController extends ComposeController<TopicValidationError> {
160160
return trimmed.isEmpty ? kNoTopicTopic : trimmed;
161161
}
162162

163+
bool get isTopicEmpty => textNormalized == kNoTopicTopic;
164+
163165
@override
164166
List<TopicValidationError> _computeValidationErrors() {
165167
return [
166-
if (mandatory && textNormalized == kNoTopicTopic)
168+
if (mandatory && isTopicEmpty)
167169
TopicValidationError.mandatoryButEmpty,
168170

169171
if (

0 commit comments

Comments
 (0)