send only if text is not empty

This commit is contained in:
Sacha
2021-02-26 11:58:37 +01:00
parent 32159b2b2d
commit 049429b221
+14 -2
View File
@@ -19,6 +19,15 @@ class _MessageInputState extends State<MessageInput> {
File _image;
final picker = ImagePicker();
@override
void initState() {
super.initState();
textController.addListener(() {
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return Align(
@@ -72,8 +81,11 @@ class _MessageInputState extends State<MessageInput> {
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(CupertinoIcons.arrow_up_circle_fill,
color: CupertinoColors.activeGreen, size: 35),
child: textController.text.isNotEmpty
? Icon(CupertinoIcons.arrow_up_circle_fill,
color: CupertinoColors.activeGreen, size: 35)
: Icon(CupertinoIcons.exclamationmark_circle_fill,
color: CupertinoColors.systemRed, size: 35),
),
),
decoration: BoxDecoration(