forked from Cretezy/flutter_linkify
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.dart
87 lines (82 loc) · 2.9 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:linkify_plus/linkify/linkify.dart';
import 'package:linkify_plus/linkify/src/hyperlink.dart';
import 'package:linkify_plus/linkify_plus.dart';
import 'package:url_launcher/url_launcher.dart';
void main() => runApp(const LinkifyExample());
class LinkifyExample extends StatelessWidget {
const LinkifyExample({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'linkify_plus example',
home: Scaffold(
appBar: AppBar(
title: const Text('linkify_plus example'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Center(
child: Linkify(
onOpen: _onOpen,
textScaleFactor: 2,
options: const LinkifyOptions(),
text:
"Hi Jane,Please be advised your team has added a new educational resource \n#https://preprod.caremonitor.com.au/links/?c=UI0b5V0#Falls prevention – eyesight# to your resource library. ",
),
),
Center(
child: Linkify(
onOpen: _onOpen,
textScaleFactor: 2,
options: const LinkifyOptions(),
text: "Made by #https://cretezy.com#falls#",
),
),
Center(
child: Linkify(
onOpen: _onOpen,
linkifiers: const [HyperLinkifier()],
textScaleFactor: 2,
options: const LinkifyOptions(),
text: "[Test](http://urltolinkto.com)",
),
),
Center(
child: Linkify(
onOpen: _onOpen,
linkifiers: const [HyperLinkifier()],
textScaleFactor: 2,
options: const LinkifyOptions(),
text: "[Mail](tel:123-456-7890)",
),
),
Center(
child: Linkify(
onOpen: _onOpen,
textScaleFactor: 2,
options: const LinkifyOptions(),
text:
"Made by #https://dev.ihealthlabs.com/account/sign-up-success#iHealth# and unMade by #https://dev.google.com/account/sign-up-success#iHealth3# and unMade by https://dev.google.com/account/sign-up-success",
),
),
Center(
child: SelectableLinkify(
onOpen: _onOpen,
linkifiers: const [UserTagLinkifier()],
textScaleFactor: 4,
text: 'Hello @JohnDoe, did you see what @JaneDoe posted?',
),
),
],
),
),
);
}
Future<void> _onOpen(LinkableElement link) async {
await launch(link.url);
}
}