Home > database >  Is it possible to show links preview from Flutter web links?
Is it possible to show links preview from Flutter web links?

Time:10-07

I am thinking of developing an e-commerce app on flutter web, using Navigator 2.0, maybe beamer.

I would like people to be able to share flutter web links and show previews on social networks. Is this possible?

CodePudding user response:

Yes, you can do that by using this library : Here's link to library

You can use Widget called as AnyLinkPreview inside MaterialApp or a scafflod.

CodePudding user response:

Yes, You could use the AnyLinkPreview package for this problem. In that case, need to add this package into your project and then use AnyLinkPreview widget as you need.

For Example,

    final String _url =
      "https://speakerdeck.com/themsaid/the-power-of-laravel-queues";

    Widget getLinkPreview ()
    {
      return Container(
        child : AnyLinkPreview(
                        link: _url,
                        displayDirection: UIDirection.UIDirectionHorizontal,
                        cache: Duration(hours: 1),
                        backgroundColor: Colors.grey[300],
                        errorWidget: Container(
                          color: Colors.grey[300],
                          child: Text('Oops!'),
                        ),
                        errorImage: _errorImage,
                    ),
         );
    }

Note - If you need to show a preview link list then you could use the AnyLinkPreview widget inside the ListView widget.

  • Related