Fixed state not updating in tablet-view for chat textfield

This commit is contained in:
Elias Müller 2023-09-18 22:28:39 +02:00
parent 52de843a64
commit c718f5eb07

@ -70,13 +70,14 @@ class _ChatTextfieldState extends State<ChatTextfield> {
@override
void initState() {
settings = Provider.of<SettingsProvider>(context, listen: false);
_textBoxController.text = settings.val().talkSettings.drafts[widget.sendToToken] ?? "";
super.initState();
settings = Provider.of<SettingsProvider>(context, listen: false);
}
@override
Widget build(BuildContext context) {
_textBoxController.text = settings.val().talkSettings.drafts[widget.sendToToken] ?? "";
return Stack(
children: <Widget>[
Align(
@ -151,7 +152,13 @@ class _ChatTextfieldState extends State<ChatTextfield> {
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);
},
),