platform_text 0.2.0 platform_text: ^0.2.0 copied to clipboard
A Flutter package to make your text selectable for web and non-selectable for native builds.
PlatformText #
A Flutter package to make your text selectable for web and non-selectable for native builds.
Features #
PlatformText returns Text or SelectableText widget depending on the platform it's running on.
- Native → Text
- Web → SelectableText
Getting started #
Follow official installation guide. see more...
Usage #
PlatformText supports two constructors/widget classes: Text and SelectableText.
To migrate existing code just replace Text/SelectableText widget with PlatformText.
- Create a PlatformText widget.
PlatformText('Hello mom!');
- Create a PlatformText widget with the InlineSpan.
PlatformText.rich(
TextSpan(
text: 'Hello',
children: <TextSpan>[
TextSpan(
text: ' beautiful ',
style: TextStyle(fontStyle: FontStyle.italic),
),
TextSpan(
text: 'mom!',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
);
Support #
If you like my package you can buy me a coffee.