linkable 1.0.5

  • Readme
  • Changelog
  • Example
  • Installing
  • 83

linkable pub package #

A Flutter widget to add links to your text. By default, the Text or RichText widgets render the URLs in them as simple text which are not clickable. So, Linkable widget is a wrapper over RichText which allows you to render links that can be clicked to redirect to the URL. That means that a Linkable widget supports all the attributes of a RichText Widget.

Currently linkable supports the following types:

Note: You don't need to specify the URL scheme (mailto, tel etc). The widget will parse it automatically.

Install #

To install the package, add the following dependency to your pubspec.yaml

dependencies:
  linkable: ^1.0.5
  url_launcher: ^5.4.10

Usage #

Basic #

import 'package:linkable/linkable.dart';

Linkable(
	text:
	"Hi!\nI'm Anup.\n\nYou can email me at 1anuppanwar@gmail.com.\nOr just whatsapp me @ +91-8968894728.\n\nFor more info visit: \ngithub.com/anupkumarpanwar \nor\nhttps://www.linkedin.com/in/anupkumarpanwar/",
);

Attributes #

KeyDescription
textThe text to be displayed in the widget.
textColorColor of the non-link text. (default: black)
linkColorColor of the links. (default: blue)
styleTextStyle to be applied on the widget.
textAlignTextAlign value. (default: TextAlign.start)
textDirectionDetermines the order to lay children out horizontally.
maxLinesMaximum number of lines to be displayed.
overflowHandles text that crosses maxLines. (default: TextOverflow.clip)
textScaleFactorThe number of font pixels for each logical pixel.
localeSets text locale.

Screenshot #

Screenshot

[1.0.1] - 2 June 2020. #

  • Add link to websites, emails, telephones numbers.

[1.0.2] - 2 June 2020. #

  • Renamed widget.

[1.0.3] - 3 June 2020. #

  • Fixed bug when no link is present.

[1.0.4] - 3 June 2020. #

  • Convert to stateless widget.

[1.0.5] - 3 July 2020. #

  • Changed http url regexp.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:linkable/linkable.dart';

void main() => runApp(new LinkableExample());

class LinkableExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Linkable example',
      home: Scaffold(
        body: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            Center(
              child: Linkable(
                text:
                    "Hi!\nI'm Anup.\n\nYou can email me at 1anuppanwar@gmail.com.\nOr just whatsapp me @ +91-8968894728.\n\nFor more info visit: \ngithub.com/anupkumarpanwar \nor\nhttps://www.linkedin.com/in/anupkumarpanwar/",
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  linkable: ^1.0.5

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:linkable/linkable.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Jul 7, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform windows

Because of import path [package:linkable/linkable.dart, package:url_launcher/url_launcher.dart] that declares support for platforms: android, ios, linux, macos, web

Package not compatible with SDK dart

because of import path [linkable] that is in a package requiring null.

Health issues and suggestions

Document public APIs. (-0.43 points)

51 out of 52 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/linkable.dart. (-0.50 points)

Analysis of lib/linkable.dart reported 1 hint:

line 13 col 7: This class (or a class that this class inherits from) is marked as '@immutable', but one or more of its instance fields aren't final: Linkable._parsers, Linkable._links

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
url_launcher ^5.4.10 5.5.0
Transitive dependencies
collection 1.14.12 1.14.13
flutter_web_plugins 0.0.0
meta 1.1.8 1.2.1
platform_detect 1.4.0
plugin_platform_interface 1.0.2
pub_semver 1.4.4
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
url_launcher_linux 0.0.1+1
url_launcher_macos 0.0.1+7
url_launcher_platform_interface 1.0.7
url_launcher_web 0.1.2
vector_math 2.0.8
Dev dependencies
flutter_test