flutter_link_previewer 1.0.6 copy "flutter_link_previewer: ^1.0.6" to clipboard
flutter_link_previewer: ^1.0.6 copied to clipboard

Preview of the link extracted from the provided text with basic customization and ability to render from cached data.

example/lib/main.dart

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

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        brightness: Brightness.dark,
        title: const Text('Example'),
      ),
      body: SingleChildScrollView(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: <Widget>[
            Container(
              margin: const EdgeInsets.all(16),
              decoration: const BoxDecoration(
                borderRadius: BorderRadius.all(
                  Radius.circular(20),
                ),
                color: Color(0xfff7f7f8),
              ),
              child: ClipRRect(
                borderRadius: const BorderRadius.all(
                  Radius.circular(20),
                ),
                child: LinkPreview(
                  enableAnimation: true,
                  text: 'https://flyer.chat',
                  width: MediaQuery.of(context).size.width,
                ),
              ),
            ),
            Container(
              margin: const EdgeInsets.all(16),
              decoration: const BoxDecoration(
                color: Color(0xfff7f7f8),
                borderRadius: BorderRadius.all(
                  Radius.circular(20),
                ),
              ),
              child: ClipRRect(
                borderRadius: const BorderRadius.all(
                  Radius.circular(20),
                ),
                child: LinkPreview(
                  enableAnimation: true,
                  text: 'https://github.com/flyerhq',
                  width: MediaQuery.of(context).size.width,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
352
likes
140
points
61.5k
downloads

Publisher

verified publisherflyer.chat

Weekly Downloads

Preview of the link extracted from the provided text with basic customization and ability to render from cached data.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_chat_types, flutter_linkify, html, http, linkify, meta, url_launcher

More

Packages that depend on flutter_link_previewer