Skip to content

Instantly share code, notes, and snippets.

@rena2019
Created October 7, 2025 13:50
Show Gist options
  • Select an option

  • Save rena2019/a86796290239caef9d7ae9f17f821e0e to your computer and use it in GitHub Desktop.

Select an option

Save rena2019/a86796290239caef9d7ae9f17f821e0e to your computer and use it in GitHub Desktop.
different text styles in 1 Text
//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