xxxxxxxxxx
Text(
'Hello world',
style: TextStyle(
decoration: TextDecoration.underline,
),
)
xxxxxxxxxx
Text(
'Hello world',
style: TextStyle(
decoration: TextDecoration.underline,
),
)
xxxxxxxxxx
Widget build(BuildContext context)
return Scaffold(
appBar: AppBar(
title: const Text("Text Underline"),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const [
Text("Hello World"),
Text(
"Hello World",
style: TextStyle(
decoration: TextDecoration.underline,
),
),
Text.rich(
TextSpan(
text: 'Hello ',
style: TextStyle(fontSize: 50),
children: <textspan>[
TextSpan(
text: 'world',
style: TextStyle(
decoration: TextDecoration.underline,
)),
],
),
),
Text(
'Hello world',
style: TextStyle(
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.dashed,
),
),
Text(
'Hello world',
style: TextStyle(
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.dotted,
),
),
Text(
'Hello world',
style: TextStyle(
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.double,
),
),
Text(
'Hello world',
style: TextStyle(
decoration: TextDecoration.underline,
decorationStyle: TextDecorationStyle.wavy,
),
),
],
),
),
);
}
xxxxxxxxxx
Text(
'Underlined Text',
style: TextStyle(decoration: TextDecoration.underline),
)
///////////Using TextDecoration enum with RichText widget://////////////////
RichText(
text: TextSpan(
text: 'Underlined Text',
style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(
text: 'Underlined Text',
style: TextStyle(decoration: TextDecoration.underline),
),
],
),
)
xxxxxxxxxx
/////////Using TextDecoration enum with Text widget://///////
Text(
'Underlined Text',
style: TextStyle(decoration: TextDecoration.underline),
)
/////////////Using TextDecoration enum with RichText widget://///
RichText(
text: TextSpan(
text: 'Underlined Text',
style: DefaultTextStyle.of(context).style,
children: <TextSpan>[
TextSpan(
text: 'Underlined Text',
style: TextStyle(decoration: TextDecoration.underline),
),
],
),
)
xxxxxxxxxx
import 'package:flutter/material.dart';
class UnderlinedText extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Underlined Text'),
),
body: Center(
child: Text(
'Text with underline',
style: TextStyle(
decoration: TextDecoration.underline,
),
),
),
);
}
}
void main() {
runApp(MaterialApp(
home: UnderlinedText(),
));
}