Files

91 lines
2.9 KiB
Dart
Raw Permalink Normal View History

2026-07-14 11:11:36 +08:00
import 'package:flutter/material.dart';
import '../../../../core/contracts/danmaku.dart';
import 'danmaku_tokens.dart';
class DanmakuMatchTile extends StatelessWidget {
const DanmakuMatchTile({
super.key,
required this.candidate,
required this.selected,
required this.onTap,
this.trailing,
});
final DanmakuMatchCandidate candidate;
final bool selected;
final VoidCallback onTap;
final Widget? trailing;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
behavior: HitTestBehavior.opaque,
child: Container(
margin: const EdgeInsets.only(bottom: 4),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 6),
decoration: BoxDecoration(
color: selected ? DanmakuTokens.selectedFill : Colors.transparent,
borderRadius: BorderRadius.circular(DanmakuTokens.radius),
border: selected
? Border.all(color: DanmakuTokens.accent.withValues(alpha: 0.5))
: null,
),
child: Row(
children: [
Icon(
selected ? Icons.radio_button_checked : Icons.radio_button_off,
size: 15,
color: selected ? DanmakuTokens.accent : DanmakuTokens.textHint,
),
const SizedBox(width: 8),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
candidate.animeTitle,
style: TextStyle(
color: selected
? DanmakuTokens.textPrimary
: DanmakuTokens.textSecondary,
fontSize: 12,
fontWeight: selected
? FontWeight.w600
: FontWeight.normal,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
if (candidate.episodeTitle.isNotEmpty)
Text(
candidate.episodeTitle,
style: const TextStyle(
color: DanmakuTokens.textHint,
fontSize: 11,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
Text(
candidate.source.displayName,
style: const TextStyle(
color: DanmakuTokens.textFaint,
fontSize: 11,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
),
if (trailing != null) ...[const SizedBox(width: 8), trailing!],
],
),
),
);
}
}