Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

flutter - Firebase Firestore new line command

I'm trying to utilize a new line command to create a new line in text. It appears from this issue that this is not possible: New Line Command ( ) Not Working With Firebase Firestore Database Strings

Is this still the case? Assuming so, does Flutter offer any methods with similar functionality to the following that would allow me to work around this?

label.text = stringRecived.replacingOccurrences(of: "
", with: "
")

*More context: Here is a picture of my Firestore string where I entered the data. Firestore string with line break

I then use a future builder to call this from Firestore and then pass the string (in this case comment) into another widget.

return new SocialFeedWidget(
  filter: false,
  articleID: document['article'],
  article_header: document['article_title'],
  userName: document['author'],
  spectrumValue: document['spectrum_value'].toDouble(),
  comment: document['comment'],
  fullName: document['firstName'] + " " + document['lastName'],
  user_id: document['user_id'],
  postID: document.documentID,
  posterID: userID,
  );
}).toList(),

In the new widget, I pass it in as a string an feed it via a Text widget as follows:

new Text(
  comment,
  style: new TextStyle(
    color: Color.fromRGBO(74, 74, 74, 1.0),
    fontSize: 13.0,
  ),
),

When it appears, it still has the within the string. From the console

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...