How can I add a special character (e.g., copyright sign instead of (c)) in the following example:
Widget copyrightText = new Container(
padding: const EdgeInsets.only(left: 32.0, right: 32.0),
child: Text('2018 (c) Author's Name'),
);
How can I add a special character (e.g., copyright sign instead of (c)) in the following example:
Widget copyrightText = new Container(
padding: const EdgeInsets.only(left: 32.0, right: 32.0),
child: Text('2018 (c) Author's Name'),
);
You can add it as unicode like
child: new Text('2018 \u00a9 Author's Name'),
or
child: new Text('2018 © Author's Name'),
See also
Only one other thing to add.
Dart/Flutter add another concept of "Runes" which are integer/Unicode representations of Strings (beyond what you can type) ... e.g.
var myRichRunesMessage = new Runes('2018 \u00a9 Author\'s Name \u{1f60e}');
print(new String.fromCharCodes(myRichRunesMessage));
Which would render something like this ...
Pretty cool capability to enable characters not generally typeable on many keyboards - even Emoji :-) ...
To add any special character, You can use its unicode.
The unicode for Copyright Sign is 00a9
You can use it like this: new Text("2018 \u00a9 Author's Name");
You can find unicode of any characters from here.
If you're getting the text from api. You can do this:
Text(utf8.decode(text.codeUnits)
First thing is to add this plugin to your flutter application charcode: (there is no need to add a version)
to display Text('2018 (c) Author's Name')
simply use type this Text ("2018 ${String.fromCharCode(0x00A9) Author's name")
this will work, the charcode for copyright symbol is 0x00A9, you can check out this link for any special character like euro, gamma, epsilon, and if you want to use them add them the same way I added the copyright code i.e StringfromCharCode(charcode of the special character)
You can do it very easily using double quotes.
Widget copyrightText = new Container(
padding: const EdgeInsets.only(left: 32.0, right: 32.0),
child: Text("2018 (c) Author's Name"),
);