Skip to content

Commit eb71911

Browse files
committed
wip Integrate ComposeBox for testing.
Signed-off-by: Zixuan James Li <[email protected]>
1 parent f42f5de commit eb71911

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/widgets/compose_box.dart

+26
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import 'package:mime/mime.dart';
99
import '../api/exception.dart';
1010
import '../api/model/model.dart';
1111
import '../api/route/messages.dart';
12+
import '../log.dart';
1213
import '../model/binding.dart';
1314
import '../model/compose.dart';
1415
import '../model/narrow.dart';
@@ -1064,6 +1065,31 @@ class _FixedDestinationComposeBoxState extends State<_FixedDestinationComposeBox
10641065
@override FocusNode get contentFocusNode => _contentFocusNode;
10651066
final _contentFocusNode = FocusNode();
10661067

1068+
@override
1069+
void initState() {
1070+
super.initState();
1071+
_contentController.addListener(_contentChanged);
1072+
}
1073+
1074+
void _contentChanged() {
1075+
final store = PerAccountStoreWidget.of(context);
1076+
final curNarrow = widget.narrow;
1077+
assert(debugLog('${widget.narrow} content changed'));
1078+
if (curNarrow is TopicNarrow) {
1079+
if (_contentController.text.isNotEmpty) {
1080+
store.typingNotifier.handleTyping(
1081+
store,
1082+
StreamDestination(curNarrow.streamId, curNarrow.topic)
1083+
);
1084+
} else {
1085+
store.typingNotifier.handleTypingStop(
1086+
store,
1087+
StreamDestination(curNarrow.streamId, curNarrow.topic)
1088+
);
1089+
}
1090+
}
1091+
}
1092+
10671093
@override
10681094
void dispose() {
10691095
_contentController.dispose();

0 commit comments

Comments
 (0)