PlatformText

A Flutter package to make your text selectable for web and non-selectable for native builds.

pipeline status coverage report latest release

Features

PlatformText returns Text or SelectableText widget depending on the platform it's running on.

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.

PlatformText('Hello mom!');
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.

buymeacoffee.com/rozpo.dev

Additional information

  • Package maintainer: Piotr Rozpończyk rozpo.dev
  • Technical writer: Dawid Ratusz
  • Bug reporting: issues
  • Source code: gitlab

Libraries

platform_text