Created
July 25, 2019 05:31
-
-
Save ipondroid/b7a127917540cc94ded5bed32d5fb01a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
), | |
) | |
] | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!