flutter_linkify 4.1.0 copy "flutter_linkify: ^4.1.0" to clipboard
flutter_linkify: ^4.1.0 copied to clipboard

outdated

Turns text URLs and emails into clickable inline links in text for Flutter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
import 'dart:async';

import 'package:url_launcher/url_launcher.dart';

void main() => runApp(new LinkifyExample());

class LinkifyExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'flutter_linkify example',
      home: Scaffold(
        appBar: AppBar(
          title: Text('flutter_linkify example'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            Center(
              child: Linkify(
                onOpen: _onOpen,
                text: "Made by https://cretezy.com\n\nMail: example@gmail.com",
              ),
            ),
            Center(
              child: SelectableLinkify(
                onOpen: _onOpen,
                text: "Made by https://cretezy.com\n\nMail: example@gmail.com",
              ),
            ),
          ],
        ),
      ),
    );
  }

  Future<void> _onOpen(LinkableElement link) async {
    if (await canLaunch(link.url)) {
      await launch(link.url);
    } else {
      throw 'Could not launch $link';
    }
  }
}
762
likes
40
points
313k
downloads

Publisher

verified publishercretezy.com

Weekly Downloads

Turns text URLs and emails into clickable inline links in text for Flutter.

Repository (GitHub)

License

MIT (license)

Dependencies

flutter, linkify

More

Packages that depend on flutter_linkify