Skip to content

Commit f029b68

Browse files
committed
compose [nfc]: Convert _TopicInput to a StatefulWidget
1 parent 288926f commit f029b68

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lib/widgets/compose_box.dart

+12-7
Original file line numberDiff line numberDiff line change
@@ -670,12 +670,17 @@ class _StreamContentInputState extends State<_StreamContentInput> {
670670
}
671671
}
672672

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

676676
final int streamId;
677677
final StreamComposeBoxController controller;
678678

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

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

0 commit comments

Comments
 (0)