You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
535 B
25 lines
535 B
import 'package:flutter/material.dart';
|
|
|
|
class GradientText extends StatelessWidget {
|
|
const GradientText(
|
|
this.text, {
|
|
required this.gradient,
|
|
this.style,
|
|
});
|
|
|
|
final String text;
|
|
final TextStyle? style;
|
|
final Gradient gradient;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ShaderMask(
|
|
blendMode: BlendMode.srcIn,
|
|
shaderCallback: (bounds) => gradient.createShader(
|
|
Rect.fromLTWH(0, 0, bounds.width, bounds.height),
|
|
),
|
|
child: Text(text, style: style),
|
|
);
|
|
}
|
|
}
|