-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.dart
More file actions
121 lines (86 loc) · 2.67 KB
/
main.dart
File metadata and controls
121 lines (86 loc) · 2.67 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
// A minimal example to illustrate MarkdownTooltip
//
// Run it with:
//
// cd example
// flutter create .
// flutter run
import 'package:flutter/material.dart';
import 'package:markdown_tooltip/markdown_tooltip.dart';
/// Flutter code sample for [MarkdownTooltip].
void main() => runApp(const MarkdownTooltipExampleApp());
/// Demonstrator class
class MarkdownTooltipExampleApp extends StatelessWidget {
/// Initialise.
const MarkdownTooltipExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('MarkdownTooltip Sample')),
body: const Padding(
padding: EdgeInsets.all(20.0),
child: MarkdownTooltipSample(),
),
),
);
}
}
/// Define the MarkdownTooltip to use.
class MarkdownTooltipSample extends StatelessWidget {
/// Initialise.
const MarkdownTooltipSample({super.key});
@override
Widget build(BuildContext context) {
return Row(
spacing: 5,
children: [
MarkdownTooltip(
message: '''
# Markdown Tooltip
I am a **markdown** tooltip. Notice the **bold** and *italic* text.
Tooltips should normally be short and are just reminders. But we can
slightly extend the tooltips to guide the user in their navigation and
use of the app.
+ Bullets are okay.
+ But they need to be separated by empty lines.
> This line begins with a greater than (>)
Here's some code:
```
flutter run --release
```
An ***ordered list*** example.
1. First example
2. Second example
---
Experiment and enjoy. Give your users a slightly better experience.
---
''',
child: ElevatedButton(
onPressed: () {},
child: const Text('Hover here for a tooltip with a link.'),
),
),
MarkdownTooltip(
message: '''
# Markdown Tooltip with a Link
This tooltip inlcudes a **link**. Links are included in **markdown** like:
```
[link](https://example.com)
```
Normally a tooltip will *disappear if you tap inside the tooltip*.
With an embedded link this gets tricky. So when a tool tip includes an
embedded markdown link, *the tooltip no longer disappears on a tap*.
Instead, if you tap the link then a browser will display the target of the
link. This is an [example of a link](https://togaware.com).
---
''',
child: ElevatedButton(
onPressed: () {},
child: const Text('Hover here to show a tooltip.'),
),
),
],
);
}
}