flutter_link_preview 0.0.1 copy "flutter_link_preview: ^0.0.1" to clipboard
flutter_link_preview: ^0.0.1 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 MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @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),
              FlutterLinkPreview(
                url: _controller.value.text,
                key: ValueKey(_controller.value.text),
                titleStyle: TextStyle(
                  color: Colors.blue,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
76
likes
30
pub points
72%
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

flutter, html, http

More

Packages that depend on flutter_link_preview