highlight_sevice 0.0.7 copy "highlight_sevice: ^0.0.7" to clipboard
highlight_sevice: ^0.0.7 copied to clipboard

Find and replace your link, tag or hashtag.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:highlight_sevice/link_sevvice.dart';
import 'dart:async';

import 'package:url_launcher/url_launcher.dart';

void main() => runApp(const LinkServiceExample());

class LinkServiceExample extends StatelessWidget {
  const LinkServiceExample({super.key});
  
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Highlight Link example',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Highlight Link example'),
        ),
        body: SingleChildScrollView(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: <Widget>[
              Center(
                child: Column(
                  children: [
                     LinkService(
                      onOpen: _onOpen,
                      options: const LinkOptions(showEmail: false, showHashTag: false, showPhoneNumber: false, showUserTag: false),
                      text: "Today is #Happy ^^ #U\nContac via @HưngNguyễn     - Mobile: +84963907817     facebook.com abc.ai ahhygyt.fgt\nMade by https://www.facebook.com/hungnguyen280492/\n\nMail: hungnguyen.it36@gmail.com facebook.com abc.ai hungnguyen.it36 http:/hungnguyen.it httpbin.org/anything?json https://httpbin.org/anything?json",
                      
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  Future<void> _onOpen(LinkableElement link) async {
    if(link.isTag) {
      debugPrint(link.url);
    } else {
      if (await canLaunchUrl(Uri.parse(link.url))) {
        if (!await launchUrl(Uri.parse(link.url))) {
          throw Exception('Could not launch ${link.url}');
        }
      }
      
    }
  }
}
3
likes
130
points
31
downloads

Publisher

verified publisherkhohatsi.com

Weekly Downloads

Find and replace your link, tag or hashtag.

Documentation

API reference

License

unknown (license)

Dependencies

collection, flutter, lints, plugin_platform_interface, url_launcher

More

Packages that depend on highlight_sevice