@@ -612,23 +612,18 @@ class _StreamSendButtonState extends State<_StreamSendButton> {
612
612
|| widget.contentController.hasValidationErrors.value;
613
613
}
614
614
615
- void _showSendFailedDialog (BuildContext context) {
616
- List <String > validationErrorMessages = [
617
- for (final error in widget.topicController.validationErrors)
618
- error.message (),
619
- for (final error in widget.contentController.validationErrors)
620
- error.message (),
621
- ];
622
-
623
- return showErrorDialog (
624
- context: context,
625
- title: 'Message not sent' ,
626
- message: validationErrorMessages.join ('\n\n ' ));
627
- }
628
-
629
- void _handleSendPressed (BuildContext context) {
615
+ void _send () {
630
616
if (_hasValidationErrors) {
631
- _showSendFailedDialog (context);
617
+ List <String > validationErrorMessages = [
618
+ for (final error in widget.topicController.validationErrors)
619
+ error.message (),
620
+ for (final error in widget.contentController.validationErrors)
621
+ error.message (),
622
+ ];
623
+ showErrorDialog (
624
+ context: context,
625
+ title: 'Message not sent' ,
626
+ message: validationErrorMessages.join ('\n\n ' ));
632
627
return ;
633
628
}
634
629
@@ -643,9 +638,8 @@ class _StreamSendButtonState extends State<_StreamSendButton> {
643
638
644
639
@override
645
640
Widget build (BuildContext context) {
646
- ColorScheme colorScheme = Theme .of (context).colorScheme;
647
-
648
641
final disabled = _hasValidationErrors;
642
+ final colorScheme = Theme .of (context).colorScheme;
649
643
650
644
// Copy FilledButton defaults (_FilledButtonDefaultsM3.backgroundColor)
651
645
final backgroundColor = disabled
@@ -672,7 +666,7 @@ class _StreamSendButtonState extends State<_StreamSendButton> {
672
666
673
667
color: foregroundColor,
674
668
icon: const Icon (Icons .send),
675
- onPressed: () => _handleSendPressed (context) ));
669
+ onPressed: _send ));
676
670
}
677
671
}
678
672
0 commit comments