diff --git a/lib/view/pages/more/roomplan/roomplan.dart b/lib/view/pages/more/roomplan/roomplan.dart index ecf73e3..25d3fc2 100644 --- a/lib/view/pages/more/roomplan/roomplan.dart +++ b/lib/view/pages/more/roomplan/roomplan.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:photo_view/photo_view.dart'; diff --git a/lib/view/pages/talk/chatTextfield.dart b/lib/view/pages/talk/chatTextfield.dart index 69f0a50..8ef04fa 100644 --- a/lib/view/pages/talk/chatTextfield.dart +++ b/lib/view/pages/talk/chatTextfield.dart @@ -24,7 +24,6 @@ class ChatTextfield extends StatefulWidget { class _ChatTextfieldState extends State { final TextEditingController _textBoxController = TextEditingController(); - bool sending = false; bool isLoading = false; void _query() { @@ -128,7 +127,6 @@ class _ChatTextfieldState extends State { color: Colors.white, ), controller: _textBoxController, - readOnly: sending, maxLines: 7, minLines: 1, decoration: InputDecoration( @@ -143,20 +141,24 @@ class _ChatTextfieldState extends State { mini: true, onPressed: (){ if(_textBoxController.text.isEmpty) return; + if(isLoading) return; + setState(() { - sending = true; + isLoading = true; }); - SendMessage(widget.sendToToken, SendMessageParams(_textBoxController.text)).run().then((value) => { - _query(), - _textBoxController.text = "", + SendMessage(widget.sendToToken, SendMessageParams(_textBoxController.text)).run().then((value) { + _query(); setState(() { - sending = false; - }), + isLoading = false; + }); + _textBoxController.text = ""; }); }, backgroundColor: Theme.of(context).primaryColor, elevation: 5, - child: const Icon(Icons.send, color: Colors.white, size: 18), + child: isLoading + ? Container(padding: const EdgeInsets.all(10), child: const CircularProgressIndicator(color: Colors.white, strokeWidth: 2)) + : const Icon(Icons.send, color: Colors.white, size: 18), ), ], ),