Skip to content

Commit ec6622f

Browse files
committed
compose [nfc]: Convert _TopicInput to a StatefulWidget
We will shortly start adding listeners for this.
1 parent 90770e1 commit ec6622f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/widgets/compose_box.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,12 +671,17 @@ class _StreamContentInputState extends State<_StreamContentInput> {
671671
}
672672
}
673673

674-
class _TopicInput extends StatelessWidget {
674+
class _TopicInput extends StatefulWidget {
675675
const _TopicInput({required this.streamId, required this.controller});
676676

677677
final int streamId;
678678
final StreamComposeBoxController controller;
679679

680+
@override
681+
State<_TopicInput> createState() => _TopicInputState();
682+
}
683+
684+
class _TopicInputState extends State<_TopicInput> {
680685
@override
681686
Widget build(BuildContext context) {
682687
final zulipLocalizations = ZulipLocalizations.of(context);
@@ -688,18 +693,18 @@ class _TopicInput extends StatelessWidget {
688693
).merge(weightVariableTextStyle(context, wght: 600));
689694

690695
return TopicAutocomplete(
691-
streamId: streamId,
692-
controller: controller.topic,
693-
focusNode: controller.topicFocusNode,
694-
contentFocusNode: controller.contentFocusNode,
696+
streamId: widget.streamId,
697+
controller: widget.controller.topic,
698+
focusNode: widget.controller.topicFocusNode,
699+
contentFocusNode: widget.controller.contentFocusNode,
695700
fieldViewBuilder: (context) => Container(
696701
padding: const EdgeInsets.only(top: 10, bottom: 9),
697702
decoration: BoxDecoration(border: Border(bottom: BorderSide(
698703
width: 1,
699704
color: designVariables.foreground.withFadedAlpha(0.2)))),
700705
child: TextField(
701-
controller: controller.topic,
702-
focusNode: controller.topicFocusNode,
706+
controller: widget.controller.topic,
707+
focusNode: widget.controller.topicFocusNode,
703708
textInputAction: TextInputAction.next,
704709
style: topicTextStyle,
705710
decoration: InputDecoration(

0 commit comments

Comments
 (0)