@@ -394,24 +394,22 @@ class ComposeContentController extends ComposeController<ContentValidationError>
394
394
}
395
395
}
396
396
397
- class _ContentInput extends StatefulWidget {
398
- const _ContentInput ({
399
- required this .narrow,
397
+ class _TypingNotifier extends StatefulWidget {
398
+ const _TypingNotifier ({
400
399
required this .destination,
401
400
required this .controller,
402
- required this .hintText ,
401
+ required this .child ,
403
402
});
404
403
405
- final Narrow narrow;
406
404
final SendableNarrow destination;
407
405
final ComposeBoxController controller;
408
- final String hintText ;
406
+ final Widget child ;
409
407
410
408
@override
411
- State <_ContentInput > createState () => _ContentInputState ();
409
+ State <_TypingNotifier > createState () => _TypingNotifierState ();
412
410
}
413
411
414
- class _ContentInputState extends State <_ContentInput > with WidgetsBindingObserver {
412
+ class _TypingNotifierState extends State <_TypingNotifier > with WidgetsBindingObserver {
415
413
@override
416
414
void initState () {
417
415
super .initState ();
@@ -421,7 +419,7 @@ class _ContentInputState extends State<_ContentInput> with WidgetsBindingObserve
421
419
}
422
420
423
421
@override
424
- void didUpdateWidget (covariant _ContentInput oldWidget) {
422
+ void didUpdateWidget (covariant _TypingNotifier oldWidget) {
425
423
super .didUpdateWidget (oldWidget);
426
424
if (widget.controller != oldWidget.controller) {
427
425
oldWidget.controller.content.removeListener (_contentChanged);
@@ -484,6 +482,26 @@ class _ContentInputState extends State<_ContentInput> with WidgetsBindingObserve
484
482
}
485
483
}
486
484
485
+ @override
486
+ Widget build (BuildContext context) => widget.child;
487
+ }
488
+
489
+ class _ContentInput extends StatefulWidget {
490
+ const _ContentInput ({
491
+ required this .narrow,
492
+ required this .controller,
493
+ required this .hintText,
494
+ });
495
+
496
+ final Narrow narrow;
497
+ final ComposeBoxController controller;
498
+ final String hintText;
499
+
500
+ @override
501
+ State <StatefulWidget > createState () => _ContentInputState ();
502
+ }
503
+
504
+ class _ContentInputState <T extends _ContentInput > extends State <T > {
487
505
static double maxHeight (BuildContext context) {
488
506
final clampingTextScaler = MediaQuery .textScalerOf (context)
489
507
.clamp (maxScaleFactor: 1.5 );
@@ -645,12 +663,14 @@ class _StreamContentInputState extends State<_StreamContentInput> {
645
663
// ignore: dead_null_aware_expression // null topic names soon to be enabled
646
664
: '#$streamName > ${hintTopic .displayName ?? store .realmEmptyTopicDisplayName }' ;
647
665
648
- return _ContentInput (
649
- narrow: widget.narrow,
666
+ return _TypingNotifier (
650
667
destination: TopicNarrow (widget.narrow.streamId,
651
668
TopicName (widget.controller.topic.textNormalized)),
652
669
controller: widget.controller,
653
- hintText: zulipLocalizations.composeBoxChannelContentHint (hintDestination));
670
+ child: _ContentInput (
671
+ narrow: widget.narrow,
672
+ controller: widget.controller,
673
+ hintText: zulipLocalizations.composeBoxChannelContentHint (hintDestination)));
654
674
}
655
675
}
656
676
@@ -732,11 +752,13 @@ class _FixedDestinationContentInput extends StatelessWidget {
732
752
733
753
@override
734
754
Widget build (BuildContext context) {
735
- return _ContentInput (
736
- narrow: narrow,
755
+ return _TypingNotifier (
737
756
destination: narrow,
738
757
controller: controller,
739
- hintText: _hintText (context));
758
+ child: _ContentInput (
759
+ narrow: narrow,
760
+ controller: controller,
761
+ hintText: _hintText (context)));
740
762
}
741
763
}
742
764
0 commit comments