mirror of
https://github.com/jonasbark/swiftcontrol.git
synced 2026-11-28 16:58:41 +01:00
29 lines
672 B
Dart
29 lines
672 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:bike_control/widgets/ui/colors.dart';
|
|
|
|
class GradientText extends StatelessWidget {
|
|
const GradientText(
|
|
this.text, {
|
|
super.key,
|
|
this.gradient = const LinearGradient(
|
|
colors: [BKColor.main, BKColor.mainEnd],
|
|
),
|
|
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),
|
|
);
|
|
}
|
|
}
|