Writing/ Pasting long lenghty text into TextField.

44 views
Skip to first unread message

faro vitus

unread,
Oct 14, 2020, 2:51:55 AM10/14/20
to Flutter Development (flutter-dev)

I am creating a note app using Flutter, and as we know we may need to write or paste a short/medium/long lengthy text and save them right ? Well TextField only works for me on short/medium lengthy notes while for long ones it just doesn't save it.

1- I should let you know that i am perfectly able to save/edit short/medium notes so the issue can't be related to database or controller.
2- In case of pasting a long text in textfield the textField Expands and show the whole note but when you hit the save button and automatically get to homescreen i see a blank note.
3- I am using sqflite for database in case you all need to know, and added a part of the code related to textfield below.
4- Btw i am able to paste the same long text in Google Keep so i don't see why i have such limitation in my Flutter app.
5- Tried setting maxLines to null and that didn't help as well.
6- I am using Flutter 1.22.0 Stable

import 'package:flutter/material.dart'; class NoteContentState extends State<NoteContent> { DatabaseHandler handler = DatabaseHandler(); TextEditingController noteController = TextEditingController(); @override Widget build(BuildContext context) { return Scaffold( body: Padding( padding: EdgeInsets.only(top: 15.0, bottom: 15.0), child: TextField( controller: noteController, onChanged: (text) { update(); }, decoration: InputDecoration( labelText: 'Note', border: OutlineInputBorder( borderRadius: BorderRadius.circular(5.0) ) ), ), ), ); } }

Suzuki Tomohiro

unread,
Oct 14, 2020, 3:07:45 AM10/14/20
to Flutter Development (flutter-dev)
Can you create and share a Youtube of the behavior?

Can you share minimum reproducible code as a Github project?

How big is lengthy note? 100 characters?

Any error message do you observe? A blank appears when there’s an error and the app is built with release mode. Do you see the same blank when you run the debug mode?

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/6314ea5c-9e42-4fb7-98a4-8fd82b6e48ban%40googlegroups.com.

faro vitus

unread,
Oct 14, 2020, 5:29:05 AM10/14/20
to Flutter Development (flutter-dev)
Hi thanks for your quick reply and for your understanding. 

I talked about the issue in here but unfortunately i was not able to be clear enough to let them understand the issue.

I can create a video later today showing the abnormal behavior, also the text might be +1000 characters cause as i said in my case (creating a note app) sometimes user might need to write or copy an article and save it and that’s where the issue happens. If a user decide to write a short or medium notes than everything works as expected.

Suzuki Tomohiro

unread,
Oct 14, 2020, 7:32:19 AM10/14/20
to Flutter Development (flutter-dev)
Yes, making others understand your problem is not an easy task.

Looking forward to the video and the minimum reproducible project.

faro vitus

unread,
Oct 14, 2020, 9:50:58 AM10/14/20
to Flutter Development (flutter-dev)
https://youtu.be/PD6O1AqJClA Test 1

https://youtu.be/p2iJwe_uRZ4 Test 2 ( see how it have same behavior if i pressed the back key)



Also i used this website to generate a long text to paste in textField 

Suzuki Tomohiro

unread,
Oct 14, 2020, 10:00:21 AM10/14/20
to Flutter Development (flutter-dev)
Nice. I see that pasted text somehow disappears when you hide the keyboard. This could be a bug in your app or Flutter. Can you create a minimum reproducible project in GitHub?

In the course of creating the project, you'll identify whether it's related to SQLite or not.



faro vitus

unread,
Oct 14, 2020, 10:15:07 AM10/14/20
to Flutter Development (flutter-dev)
I shared this link on GitHub maybe you can try it out and help with this please ?

https://github.com/boriszv/Programming-Addict-Code-Examples/tree/master/9.%20Flutter%20SQLite/Flutter%20SQLite%20-%20Part%202

This code ^ does not use a database.


Personally on my project I don’t think that database is the problem because it works fine when you try anything else, the textField or controller just can’t handle that many characters i guess and ends up not passing the new data to database.


Suzuki Tomohiro

unread,
Oct 14, 2020, 11:35:36 AM10/14/20
to Flutter Development (flutter-dev)
(I don’t run the project) By any chance, this piece of code resets the text?




faro vitus

unread,
Oct 14, 2020, 12:24:06 PM10/14/20
to Flutter Development (flutter-dev)
I can check it out later today, but by any chance do you have telegram if so my username is @farovitus 
Reply all
Reply to author
Forward
0 new messages