How to get input with HTML tags in flutter app
I am developing a mobile app using flutter. It should have a text field like this.
From this input field I want to get input as a normal text with given controls and want to store it in the form of HTML. For example consider below text.
Hi this is my title
This is sample text
I want to store it my database in the form of HTML like bellow.
<b>Hi this is my title</b><br>
<i>This is sample text</i>
How can I do this using flutter?
Solution 1:
For simple html tags like above you can use the styled_text package.
StyledText(
text: text.replaceAll("<br>", "\n"),
tags: {
'b': StyledTextTag(style: TextStyle(fontWeight: FontWeight.bold)),
'i': StyledTextTag(style: TextStyle(fontStyle: FontStyle.italic))
},
);
link: https://pub.dev/packages/styled_text