Skip to content

Instantly share code, notes, and snippets.

@ipondroid
Created July 25, 2019 05:31
Show Gist options
  • Save ipondroid/b7a127917540cc94ded5bed32d5fb01a to your computer and use it in GitHub Desktop.
Save ipondroid/b7a127917540cc94ded5bed32d5fb01a to your computer and use it in GitHub Desktop.
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('RichText Widget Demo'),
),
body: Center(
child: ListView(
padding: const EdgeInsets.all(20.0),
children: <Widget>[
RichText(
text: TextSpan(
style: Theme.of(context).textTheme.body1.copyWith(fontSize: 30),
children: <TextSpan>[
TextSpan(
text: 'text black withOpacity 0.6\n',
style: TextStyle(
color: Colors.black.withOpacity(0.6)
),
),
TextSpan(
text: 'text yellow and green, size 20\n',
style: TextStyle(
color: Colors.yellow,
backgroundColor: Colors.green,
fontSize: 20
),
),
TextSpan(
text: 'text ',
style: TextStyle(color: Colors.black.withOpacity(1.0)),
),
TextSpan(
text: 'span ',
style: TextStyle(color: Colors.red),
),
TextSpan(
text: 'style ',
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold
)
),
TextSpan(
text: 'get to link',
style: TextStyle(
color: Colors.blueAccent, fontStyle: FontStyle.italic,
decoration: TextDecoration.underline
),
)
]
),
),
],
),
),
);
}
}
@qb20nh
Copy link

qb20nh commented Jan 21, 2022

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment