Questions tagged [textspan]
24 questions
10
votes
1 answer
Flutter: Enable text selection with clickable TextSpan inside RichText
I have a requirement to enable text selection within RichText. Also i need to call some code when user click on specific TextSpan.
I tired to run below code. But i notice that onTap is working only with _nonSelectableRichText(), while it is not…

Osama Na
- 236
- 4
- 9
5
votes
3 answers
Flutter: How to display Tooltip for TextSpan inside RichText
I have big paragraph, and many words have to have tooltip message. When you click on any of these words, then tooltip message should be appeared.
I tried to use RichText widget where it contains many TextSpan children like below:
RichText(
text:…

Osama Na
- 236
- 4
- 9
2
votes
1 answer
How to backrgroundColor full in TextSpan on flutter?
Widget richText() {
return Positioned(
top: h / 1.9,
right: w / 4.9,
child: Material(
color: Colors.transparent,
child: Container(
padding: const EdgeInsets.only(left: 8, right: 0),
…

Rian Pratama
- 57
- 6
2
votes
0 answers
Getting shifted to newline when using TextSpan with WidgetSpan in flutter
I am using TextSpan but to use rounded corner in background of text I'm using WidgetSpan and decoration, but WidgetSpan with TextSpan are getting separated by newline.
It is doing ohk on first line, but it gets separated after newline.
On the first…

Sahaj Singh
- 21
- 1
1
vote
0 answers
Flutter Textfield delete widgetspan as a whole
I am trying to do mentions in my project. The server will accept a format like @id, for example @15, which means I mentioned user number 15. But in the app, the actual username will be displayed as @Sam,where Sam is the user with id number 15.
What…

Vincent w
- 31
- 1
- 6
1
vote
1 answer
Flutter -> RichText From a List of Words
I don't have much experience with flutter.
I am using the language_tool library (https://pub.dev/packages/language_tool) for Dart and Flutter.
I would like the words present in the Errors list, which are the words with grammatical errors found…

CastoldiG
- 178
- 3
- 17
1
vote
1 answer
Flutter : TextEditingController Textspan's recognizer raising error on initializing text
Please check this video.
Here I extend TextEditingController to highlight(also clickable) the keyword "ali". It is working perfectly whenever the user types "ali". But when initializing text to the controller, it is showing a lot of errors. Someone…

Ali Akbar
- 21
- 1
- 4
1
vote
1 answer
Recognizer issue in multi-line TextSpan
As you can see, A yellow container with a red Text and a green Text.
Here is my code:
class DraftPage extends StatelessWidget {
DraftPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
…

无夜之星辰
- 5,426
- 4
- 25
- 48
0
votes
2 answers
How to vertically centre align content of Text.rich()
I want to vertically centre align all contents of Text.rich() but I am not able to do that. Here you can see the red and green boxes are not centre aligned.
Below is my code.
@override
Widget build(BuildContext context) {
const textStyle =…

Shahbaz Hashmi
- 2,631
- 2
- 26
- 49
0
votes
1 answer
type 'Null' is not a subtype of type 'TextSpan' - Flutter
when i run this, i got this error:
type 'Null' is not a subtype of type 'TextSpan'
child: SingleChildScrollView(child: Arguments_text['1']),
italic(String text) {
TextSpan(
text: text,
style: TextStyle(
fontSize: 17.0,
…

CastoldiG
- 178
- 3
- 17
0
votes
1 answer
In flutter what is the use ".." instead of "."?
Gesture detection in Flutter TextSpan I found this code
import 'package:flutter/gestures.dart';
...
new RichText(
text: new TextSpan(text: 'Non touchable. ', children: [
new TextSpan(
text: 'Tap here.',
recognizer:…

Geek
- 1
- 1
0
votes
1 answer
How to use focus on RichText in flutter?
I have a list of text span like this
var spans = [
TextSpan(text: content, style: style),
TextSpan(text: content, style: style)
//and 100 more
]
I am loading this inside SingleChildScrollView like this.
SingleChildScrollView(
…

KonTash
- 158
- 1
- 2
- 15
0
votes
1 answer
Flutter - do not wrap with text and container
i have this code:
import 'package:flutter/material.dart';
void main() => runApp(mainApp());
class mainApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Chat(),
);
…

CastoldiG
- 178
- 3
- 17
0
votes
1 answer
How to access the text in the textspan under Flexible - flutter integration tests
I am trying to fetch the text(Calories) from the below widget.
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
…

user1873274
- 181
- 1
- 9
0
votes
1 answer
How to use a TextSpan as a Widget inside VisibilityDetector
I have text in my app that I want to color differently as time goes on. I did this by using RichText widget with a separate text span for each character and a timer that will then update the the state and repaint all of the text spans appropriately.…

yitzih
- 3,018
- 3
- 27
- 44