Files

49 lines
1.2 KiB
Dart
Raw Permalink Normal View History

import 'package:flutter/material.dart';
/// A single 60 px circular answer chip showing either an emoji or short text.
class AnswerChip extends StatelessWidget {
final String label;
final Color backgroundColor;
final VoidCallback? onTap;
const AnswerChip({
super.key,
required this.label,
required this.backgroundColor,
this.onTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: AnimatedContainer(
duration: const Duration(milliseconds: 250),
curve: Curves.easeOut,
width: 60,
height: 60,
decoration: BoxDecoration(
color: backgroundColor,
shape: BoxShape.circle,
boxShadow: onTap != null
? [
BoxShadow(
color: backgroundColor.withValues(alpha: 0.4),
blurRadius: 8,
offset: const Offset(0, 2),
)
]
: null,
),
child: Center(
child: Text(
label,
style: const TextStyle(fontSize: 22),
textAlign: TextAlign.center,
),
),
),
);
}
}