Fixed send button, now throw exception is message empty
This commit is contained in:
parent
7f26da7954
commit
cafc161aac
|
@ -170,7 +170,7 @@
|
|||
"description": "Text displayed when the host is being checked",
|
||||
"context": "Visible in the settings view"
|
||||
},
|
||||
"settingsHostInvalid": "Issue: {type, select, url{Invalid URL} host{Invalid Host} other{Request Failed}}",
|
||||
"settingsHostInvalid": "Issue: {type, select, url{Invalid URL} host{Invalid Host} timeout{Request Failed. Server issues} other{Request Failed}}",
|
||||
"@settingsHostInvalid": {
|
||||
"description": "Text displayed when the host is invalid",
|
||||
"context": "Visible in the settings view",
|
||||
|
|
|
@ -171,6 +171,7 @@ class _MainAppState extends State<MainApp> {
|
|||
bool menuVisible = false;
|
||||
|
||||
int tipId = Random().nextInt(5);
|
||||
bool sendable = false;
|
||||
|
||||
List<Widget> sidebar(BuildContext context, Function setState) {
|
||||
return List.from([
|
||||
|
@ -1147,6 +1148,9 @@ class _MainAppState extends State<MainApp> {
|
|||
}
|
||||
}
|
||||
if (chatAllowed) return;
|
||||
if (text.trim() == "") {
|
||||
throw Exception();
|
||||
}
|
||||
messages.insert(
|
||||
0,
|
||||
types.TextMessage(
|
||||
|
@ -1168,6 +1172,9 @@ class _MainAppState extends State<MainApp> {
|
|||
)
|
||||
.timeout(const Duration(seconds: 15));
|
||||
if (chatAllowed) return;
|
||||
if (request.message!.content.trim() == "") {
|
||||
throw Exception();
|
||||
}
|
||||
messages.insert(
|
||||
0,
|
||||
types.TextMessage(
|
||||
|
@ -1496,10 +1503,16 @@ class _MainAppState extends State<MainApp> {
|
|||
l10n: ChatL10nEn(
|
||||
inputPlaceholder: AppLocalizations.of(context)!
|
||||
.messageInputPlaceholder),
|
||||
inputOptions: const InputOptions(
|
||||
inputOptions: InputOptions(
|
||||
keyboardType: TextInputType.multiline,
|
||||
sendButtonVisibilityMode:
|
||||
SendButtonVisibilityMode.always),
|
||||
onTextChanged: (p0) {
|
||||
setState(() {
|
||||
sendable = p0.trim().isNotEmpty;
|
||||
});
|
||||
},
|
||||
sendButtonVisibilityMode: (sendable)
|
||||
? SendButtonVisibilityMode.always
|
||||
: SendButtonVisibilityMode.hidden),
|
||||
user: user,
|
||||
hideBackgroundOnEmojiMessages: false,
|
||||
theme: (Theme.of(context).brightness == Brightness.light)
|
||||
|
|
Loading…
Reference in New Issue