Does anyone have a suggestion on how to italicize the text, "Connecting", in Flutter?
'String title = 'Connecting';'
I have tried variations on TextStyle but cannot get to work.
This is how you can achieve a 'Connecting' String in Flutter.
In Example, there is a Text Widget which is print your String and it takes text style property to give italic font size.
UPDATE: Using RichText Widget
Example:
import 'package:flutter/material.dart';
class TextItalic extends StatefulWidget {
const TextItalic({Key key}) : super(key: key);
@override
_TextItalicState createState() => _TextItalicState();
}
class _TextItalicState extends State<TextItalic> {
String title = 'Connecting';
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RichText(
text: TextSpan(children: <TextSpan>[
TextSpan(
text: "Any Text",
style: TextStyle(color: Colors.black)),
TextSpan(
text: title,
style: TextStyle(fontStyle: FontStyle.italic),
TextSpan(
text: "any Text",
style: TextStyle(color: Colors.black)),
]),
),
),
);
}
}
I hope you will get the idea, if this will help you then give the right tick and flag up, Happy Fluttering.
Text('Connecting', style: TextStyle(fontStyle: FontStyle.italic),)
without assignment works