GradientText constructor
const
GradientText({
- Key? key,
- Text? child,
- String text = '',
- Gradient gradient = const LinearGradient(colors: [Colors.red, Colors.blue], begin: Alignment.topLeft, end: Alignment.bottomRight),
- TextStyle textStyle = const TextStyle(fontSize: 24, fontWeight: FontWeight.bold, color: Colors.white),
- TextAlign textAlign = TextAlign.center,
Implementation
const GradientText({
super.key,
this.child,
this.text = '',
this.gradient = const LinearGradient(
colors: [Colors.red, Colors.blue],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
this.textStyle = const TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white, // 默认白色文本以便渐变显示
),
this.textAlign = TextAlign.center,
});