import 'package:flutter/material.dart'; /// Rendert Text mit einer farbigen Kontur (Stroke) via Stack. class OutlinedText extends StatelessWidget { final String text; final TextStyle style; final Color fillColor; final Color strokeColor; final double strokeWidth; const OutlinedText( this.text, { super.key, required this.style, required this.fillColor, this.strokeColor = Colors.black, this.strokeWidth = 2.0, }); @override Widget build(BuildContext context) { final strokeStyle = style.copyWith( foreground: Paint() ..style = PaintingStyle.stroke ..strokeWidth = strokeWidth ..strokeJoin = StrokeJoin.round ..color = strokeColor, ); final fillStyle = style.copyWith(color: fillColor); return Stack( children: [ Text(text, style: strokeStyle), Text(text, style: fillStyle), ], ); } }