From c718f5eb079a2f2443002fdf62192dce8ef7fe78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20M=C3=BCller?= Date: Mon, 18 Sep 2023 22:28:39 +0200 Subject: [PATCH] Fixed state not updating in tablet-view for chat textfield --- lib/view/pages/talk/components/chatTextfield.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/view/pages/talk/components/chatTextfield.dart b/lib/view/pages/talk/components/chatTextfield.dart index 0e2424d..c3170fb 100644 --- a/lib/view/pages/talk/components/chatTextfield.dart +++ b/lib/view/pages/talk/components/chatTextfield.dart @@ -70,13 +70,14 @@ class _ChatTextfieldState extends State { @override void initState() { - settings = Provider.of(context, listen: false); - _textBoxController.text = settings.val().talkSettings.drafts[widget.sendToToken] ?? ""; super.initState(); + settings = Provider.of(context, listen: false); } @override Widget build(BuildContext context) { + _textBoxController.text = settings.val().talkSettings.drafts[widget.sendToToken] ?? ""; + return Stack( children: [ Align( @@ -151,7 +152,13 @@ class _ChatTextfieldState extends State { hintStyle: TextStyle(color: Theme.of(context).colorScheme.onSecondary), border: InputBorder.none, ), + cursorColor: Colors.white, onChanged: (String text) { + if(text == "marbot marbot marbot") { + var newText = "Roboter sind cool und so, aber marbots sind besser!"; + _textBoxController.text = newText; + text = newText; + } setDraft(text); }, ),