simple_url_preview 0.1.2 copy "simple_url_preview: ^0.1.2" to clipboard
simple_url_preview: ^0.1.2 copied to clipboard

outdated

Flutter package to show url preview. Custamizable background and text colors. Closable action.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Simple Url Preview Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Simple Url Preview Demo'),
    );
  }
}

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

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  String _url = "";

  _onUrlChanged(String updatedUrl) {
    setState(() {
      _url = updatedUrl;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            SimpleUrlPreview(
              url: _url,
              textColor: Colors.white,
              bgColor: Colors.red,
              isClosable: true,
              previewHeight: 150,
            ),
            TextField(
              onChanged: (newValue) => _onUrlChanged(newValue),
            ),
          ],
        ),
      ),
    );
  }
}
75
likes
0
pub points
85%
popularity

Publisher

unverified uploader

Flutter package to show url preview. Custamizable background and text colors. Closable action.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, html, http, string_validator, url_launcher

More

Packages that depend on simple_url_preview