rich_link_preview 0.1.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 80

rich_link_preview #

A Rich Link Preview widget written in Dart generating a rich presentation of the given link from social meta tags.

Getting Started #

Add the following line in your pubspec file #

rich_link_preview:

Get the package by running the command #

flutter packages get

Include the widget in your dart file #

import 'package:rich_link_preview/rich_link_preview.dart';

Example Usage: #

RichLinkPreview(
    link: 'https://ourland.hk/detail/72e1aeaf-360b-4f45-a528-ef1c5e4d803c',
    appendToLink: true,
)

image

RichLinkPreview(
    link: 'https://ourland.hk/detail/72e1aeaf-360b-4f45-a528-ef1c5e4d803c'
),

image

Parameters #

ParameterTypeDescriptionExampleRequired?Default
linkStringLink to be previewedhttps://ourland.hk/detail/72e1aeaf-360b-4f45-a528-ef1c5e4d803cN''
heightdoubleHeight of the Rich Link Preview container150.0N100.0
borderColorColorColor of the container borderColor(0xFF000000)NColor(0xFFE0E0E0)
backgroundColorColorColor of the container backgroundColor(0xFF000000)NColor(0xFFE0E0E0)
textColorColorColor of the textColor(0xFFE0E0E0)NColor(0xFF000000)
appendToLinkboolappend the preview to linkfalseNfalse
launchFromLinkboolLaunch from the link for container with appendToLink: truefalseNtrue

CHANGELOG #

0.1.4 #

  • Added launchFromLink option

0.1.3 #

  • Fixed memory leak & failure of displaying widget after setting state issue
  • Reset the link value for appendToLink is false only

0.1.2 #

  • Resolved wrong package deployed on Pub

0.1.1 #

  • Added textColor option
  • Revamped container structure

0.1.0 #

  • Initial version, created by wingkwong

example/lib/main.dart

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

void main() => runApp(RichLinkPreviewExample());

class RichLinkPreviewExample extends StatefulWidget {
  @override
  _RichLinkPreviewExampleState createState() =>
      new _RichLinkPreviewExampleState();
}

class _RichLinkPreviewExampleState extends State<RichLinkPreviewExample> {
  TextEditingController _textController = new TextEditingController();
  String _link;

  @override
  void initState() {
    super.initState();
    _textController.addListener(() {
      setState(() {
        _link = _textController.text;
      });
    });
  }

  void _onTextChange(String val) {
    setState(() {
      _link = _textController.text;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        theme: ThemeData(
          primaryColor: Colors.green,
          hintColor: Colors.green,
        ),
        home: Scaffold(
            body: Builder(
          builder: (context) => Padding(
              padding: const EdgeInsets.all(20.0),
              child: Column(
                children: <Widget>[
                  Expanded(
                      child: RichLinkPreview(
                          link:
                              'https://ourland.hk/detail/72e1aeaf-360b-4f45-a528-ef1c5e4d803c',
                          appendToLink: true,
                          launchFromLink: true)),
                  RichLinkPreview(
                      link: _link,
                      borderColor: Color(0xFFE0E0E0),
                      backgroundColor: Color(0xFFE0E0E0)),
                  TextField(
                    decoration: InputDecoration(
                      border: new OutlineInputBorder(
                          borderSide: new BorderSide(color: Colors.teal)),
                    ),
                    controller: _textController,
                    onChanged: (String val) => _onTextChange(val),
                  )
                ],
              )),
        )));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  rich_link_preview: ^0.1.4

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:rich_link_preview/rich_link_preview.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
66
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
87
Overall:
Weighted score of the above. [more]
80
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Maintenance suggestions

Package is getting outdated. (-13.42 points)

The package was last published 59 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
open_graph_parser ^0.0.4 0.0.6
url_launcher ^5.0.0 5.4.2
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
csslib 0.15.0 0.16.1
flutter_web_plugins 0.0.0
html 0.13.4+2 0.14.0+3
http 0.12.0 0.12.0+4
http_parser 3.1.4
meta 1.1.8
path 1.6.4
plugin_platform_interface 1.0.2
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
url_launcher_macos 0.0.1+4
url_launcher_platform_interface 1.0.6
url_launcher_web 0.1.1+1
utf 0.9.0+5
vector_math 2.0.8