Skip to content

Commit 7e7cca4

Browse files
committed
compose [nfc]: Convert _TopicInput to a StatefulWidget
1 parent af66988 commit 7e7cca4

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
@@ -669,12 +669,17 @@ class _StreamContentInputState extends State<_StreamContentInput> {
669669
}
670670
}
671671

672-
class _TopicInput extends StatelessWidget {
672+
class _TopicInput extends StatefulWidget {
673673
const _TopicInput({required this.streamId, required this.controller});
674674

675675
final int streamId;
676676
final StreamComposeBoxController controller;
677677

678+
@override
679+
State<_TopicInput> createState() => _TopicInputState();
680+
}
681+
682+
class _TopicInputState extends State<_TopicInput> {
678683
@override
679684
Widget build(BuildContext context) {
680685
final zulipLocalizations = ZulipLocalizations.of(context);
@@ -686,18 +691,18 @@ class _TopicInput extends StatelessWidget {
686691
).merge(weightVariableTextStyle(context, wght: 600));
687692

688693
return TopicAutocomplete(
689-
streamId: streamId,
690-
controller: controller.topic,
691-
focusNode: controller.topicFocusNode,
692-
contentFocusNode: controller.contentFocusNode,
694+
streamId: widget.streamId,
695+
controller: widget.controller.topic,
696+
focusNode: widget.controller.topicFocusNode,
697+
contentFocusNode: widget.controller.contentFocusNode,
693698
fieldViewBuilder: (context) => Container(
694699
padding: const EdgeInsets.only(top: 10, bottom: 9),
695700
decoration: BoxDecoration(border: Border(bottom: BorderSide(
696701
width: 1,
697702
color: designVariables.foreground.withFadedAlpha(0.2)))),
698703
child: TextField(
699-
controller: controller.topic,
700-
focusNode: controller.topicFocusNode,
704+
controller: widget.controller.topic,
705+
focusNode: widget.controller.topicFocusNode,
701706
textInputAction: TextInputAction.next,
702707
style: topicTextStyle,
703708
decoration: InputDecoration(

0 commit comments

Comments
 (0)