forked from ibhavikmakwana/FlutterPlayground
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextSpan.dart
More file actions
77 lines (69 loc) · 1.86 KB
/
TextSpan.dart
File metadata and controls
77 lines (69 loc) · 1.86 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
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
class TextSpanExample extends StatefulWidget {
final String title;
TextSpanExample({Key key, this.title}) : super(key: key);
@override
_TextSpanState createState() => _TextSpanState();
}
class _TextSpanState extends State<TextSpanExample> {
final recognizer = TapGestureRecognizer()
..onTap = () {
print("You have tapped Flutter");
};
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: textSpanPage());
}
Widget textSpanPage() {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
textSpan(),
],
);
}
textSpan() {
return RichText(
text: TextSpan(
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 24.0,
color: Colors.blue.shade500,
),
children: <TextSpan>[
TextSpan(
text: 'Hello, This is the ',
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 24.0,
color: Colors.blue.shade500,
),
),
TextSpan(
recognizer: recognizer,
text: 'Flutter ',
style: TextStyle(
fontWeight: FontWeight.w900,
fontSize: 24.0,
color: Colors.blue.shade900,
),
),
TextSpan(
text: 'Playground',
),
],
),
textAlign: TextAlign.center,
textDirection: TextDirection.ltr,
);
}
}