Created
October 7, 2025 13:50
-
-
Save rena2019/a86796290239caef9d7ae9f17f821e0e to your computer and use it in GitHub Desktop.
different text styles in 1 Text
This file contains hidden or 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
| //different text styles in 1 Text | |
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| const MyApp({super.key}); | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| debugShowCheckedModeBanner: false, | |
| home: Scaffold(body: Center(child: | |
| RichText( | |
| text: TextSpan( | |
| style: TextStyle(fontSize: 20.0, color: Colors.black), // Standardstil | |
| children: <TextSpan>[ | |
| TextSpan(text: 'red ', style: TextStyle(color: Colors.red)), | |
| TextSpan(text: 'bold ', style: TextStyle(fontWeight: FontWeight.bold)), | |
| TextSpan(text: 'standard '), | |
| TextSpan(text: 'italic ', style: TextStyle(fontStyle: FontStyle.italic)), | |
| TextSpan(text: 'underline', style: TextStyle(decoration: TextDecoration.underline)) | |
| ], | |
| ), | |
| ) | |
| )), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment