119 lines
3.6 KiB
Dart
119 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:trainhub_flutter/core/constants/ui_constants.dart';
|
|
import 'package:trainhub_flutter/core/theme/app_colors.dart';
|
|
|
|
class KnowledgeBaseSection extends StatelessWidget {
|
|
const KnowledgeBaseSection({super.key, required this.onTap});
|
|
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Knowledge Base',
|
|
style: GoogleFonts.inter(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w600,
|
|
color: AppColors.textMuted,
|
|
letterSpacing: 0.8,
|
|
),
|
|
),
|
|
const SizedBox(height: UIConstants.spacing12),
|
|
_KnowledgeBaseCard(onTap: onTap),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class _KnowledgeBaseCard extends StatefulWidget {
|
|
const _KnowledgeBaseCard({required this.onTap});
|
|
|
|
final VoidCallback onTap;
|
|
|
|
@override
|
|
State<_KnowledgeBaseCard> createState() => _KnowledgeBaseCardState();
|
|
}
|
|
|
|
class _KnowledgeBaseCardState extends State<_KnowledgeBaseCard> {
|
|
bool _hovered = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MouseRegion(
|
|
onEnter: (_) => setState(() => _hovered = true),
|
|
onExit: (_) => setState(() => _hovered = false),
|
|
child: GestureDetector(
|
|
onTap: widget.onTap,
|
|
child: AnimatedContainer(
|
|
duration: UIConstants.animationDuration,
|
|
decoration: BoxDecoration(
|
|
color: _hovered
|
|
? AppColors.surfaceContainerHigh
|
|
: AppColors.surfaceContainer,
|
|
borderRadius: BorderRadius.circular(UIConstants.borderRadius),
|
|
border: Border.all(
|
|
color: _hovered
|
|
? AppColors.accent.withValues(alpha: 0.3)
|
|
: AppColors.border,
|
|
),
|
|
),
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: UIConstants.spacing16,
|
|
vertical: UIConstants.spacing16,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
color: AppColors.accentMuted,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: const Icon(
|
|
Icons.hub_outlined,
|
|
color: AppColors.accent,
|
|
size: 20,
|
|
),
|
|
),
|
|
const SizedBox(width: UIConstants.spacing16),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
'Manage Knowledge Base',
|
|
style: GoogleFonts.inter(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
color: AppColors.textPrimary,
|
|
),
|
|
),
|
|
const SizedBox(height: 3),
|
|
Text(
|
|
'Add trainer notes to give the AI context-aware answers.',
|
|
style: GoogleFonts.inter(
|
|
fontSize: 12,
|
|
color: AppColors.textMuted,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Icon(
|
|
Icons.chevron_right_rounded,
|
|
color: _hovered ? AppColors.accent : AppColors.textMuted,
|
|
size: 20,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|