flutter_link_preview 1.2.10 copy "flutter_link_preview: ^1.2.10" to clipboard
flutter_link_preview: ^1.2.10 copied to clipboard

outdated

This is a URL preview plugin that previews the content of a URL.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(),
    );
  }
}

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

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TextEditingController _controller;
  @override
  void initState() {
    _controller = TextEditingController(text: "https://www.baidu.com");
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Padding(
          padding: const EdgeInsets.all(15),
          child: Column(
            children: <Widget>[
              Row(
                children: <Widget>[
                  Expanded(
                    child: TextField(
                      controller: _controller,
                    ),
                  ),
                  RaisedButton(
                    onPressed: () {
                      setState(() {});
                    },
                    child: const Text("get"),
                  ),
                ],
              ),
              const SizedBox(height: 15),
              ConstrainedBox(
                constraints: const BoxConstraints(maxHeight: 500),
                child: FlutterLinkPreview(
                  url: _controller.value.text,
                  key: ValueKey(_controller.value.text),
                  titleStyle: TextStyle(
                    color: Colors.blue,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
76
likes
0
pub points
67%
popularity

Publisher

verified publisherletmaker.com

This is a URL preview plugin that previews the content of a URL.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

cached_network_image, flutter, html, http

More

Packages that depend on flutter_link_preview