109 lines
2.6 KiB
Dart
109 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class GradientStar extends StatelessWidget {
|
|
final double size;
|
|
final bool hasGlow;
|
|
|
|
const GradientStar({
|
|
super.key,
|
|
this.size = 24,
|
|
this.hasGlow = true,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget starIcon = ShaderMask(
|
|
shaderCallback: (Rect bounds) {
|
|
return const LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
Color(0xFFFFFFFF), // Pure white
|
|
Color(0xFFFFF9C4), // Light lemon
|
|
Color(0xFFFFEE58), // Bright yellow
|
|
Color(0xFFFFCA28), // Golden amber
|
|
],
|
|
stops: [0.0, 0.35, 0.7, 1.0],
|
|
).createShader(bounds);
|
|
},
|
|
child: Icon(
|
|
Icons.star_rounded,
|
|
size: size,
|
|
color: Colors.white,
|
|
),
|
|
);
|
|
|
|
if (!hasGlow) return starIcon;
|
|
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0xFFFFD54F).withValues(alpha: 0.35),
|
|
blurRadius: size * 0.4,
|
|
spreadRadius: size * 0.1,
|
|
),
|
|
],
|
|
),
|
|
child: starIcon,
|
|
);
|
|
}
|
|
}
|
|
|
|
class GradientStarBadge extends StatelessWidget {
|
|
final String text;
|
|
final double size;
|
|
|
|
const GradientStarBadge({
|
|
super.key,
|
|
required this.text,
|
|
this.size = 20,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
const Color(0xFF2A2D4A),
|
|
const Color(0xFF1B1D30),
|
|
],
|
|
),
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(
|
|
color: const Color(0xFFFFD54F).withValues(alpha: 0.5),
|
|
width: 1.2,
|
|
),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: const Color(0xFFFFD54F).withValues(alpha: 0.15),
|
|
blurRadius: 8,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
GradientStar(size: size),
|
|
const SizedBox(width: 6),
|
|
Text(
|
|
text,
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.w900,
|
|
fontSize: 14,
|
|
letterSpacing: 0.5,
|
|
color: Color(0xFFFFF9C4),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|