simulacion de estados y flujo de notificacion, modificacion de estilos en todas las vistas

This commit is contained in:
shinra32
2026-05-23 07:08:49 -06:00
parent ca076607c7
commit 92f570294a
43 changed files with 4335 additions and 2035 deletions

View File

@@ -48,20 +48,14 @@ class _HelpFaqScreenState extends ConsumerState<HelpFaqScreen> {
return Scaffold(
backgroundColor: AppTheme.background,
appBar: AppBar(
title: const Text('Ayuda y preguntas frecuentes'),
actions: [
IconButton(
tooltip: 'Reiniciar conversación',
icon: const Icon(Icons.refresh),
onPressed: state.messages.isEmpty
body: Column(
children: [
_GradientHeader(
hasMessages: state.messages.isNotEmpty,
onReset: state.messages.isEmpty
? null
: () => ref.read(helpChatControllerProvider.notifier).reset(),
),
],
),
body: Column(
children: [
if (state.messages.isEmpty) _QuickQuestions(onSelect: _send),
Expanded(
child: state.messages.isEmpty
@@ -80,7 +74,7 @@ class _HelpFaqScreenState extends ConsumerState<HelpFaqScreen> {
Container(
width: double.infinity,
padding: const EdgeInsets.all(12),
color: AppTheme.danger.withOpacity(0.1),
color: AppTheme.danger.withValues(alpha: 0.1),
child: Text(
state.error!,
style: const TextStyle(color: AppTheme.danger, fontSize: 13),
@@ -97,20 +91,120 @@ class _HelpFaqScreenState extends ConsumerState<HelpFaqScreen> {
}
}
class _GradientHeader extends StatelessWidget {
final bool hasMessages;
final VoidCallback? onReset;
const _GradientHeader({required this.hasMessages, this.onReset});
@override
Widget build(BuildContext context) {
return Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [0.0, 0.6, 1.0],
colors: [Color(0xFF4A0E26), Color(0xFF6D1234), Color(0xFF9B1B4A)],
),
),
child: SafeArea(
bottom: false,
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 4, 8, 18),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
IconButton(
icon: const Icon(Icons.arrow_back_ios_new_rounded,
color: Colors.white, size: 20),
onPressed: () => Navigator.of(context).pop(),
),
const Spacer(),
if (hasMessages)
IconButton(
tooltip: 'Reiniciar conversación',
icon: const Icon(Icons.refresh_rounded,
color: Colors.white, size: 20),
onPressed: onReset,
),
],
),
Padding(
padding: const EdgeInsets.fromLTRB(16, 4, 16, 0),
child: Row(
children: [
Container(
width: 42,
height: 42,
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.15),
shape: BoxShape.circle,
),
child: const Icon(Icons.support_agent_rounded,
color: Colors.white, size: 22),
),
const SizedBox(width: 14),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Ayuda y soporte',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
Text(
'Pregunta lo que necesites',
style: TextStyle(
fontSize: 12,
color: Colors.white.withValues(alpha: 0.75),
),
),
],
),
],
),
),
],
),
),
),
);
}
}
class _QuickQuestions extends StatelessWidget {
final ValueChanged<String> onSelect;
const _QuickQuestions({required this.onSelect});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
return Container(
width: double.infinity,
padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
border: Border(
bottom: BorderSide(
color: Theme.of(context).colorScheme.outlineVariant, width: 0.5),
),
),
child: Wrap(
spacing: 8,
runSpacing: 8,
children: [
for (final q in _quickQuestions)
ActionChip(label: Text(q), onPressed: () => onSelect(q)),
ActionChip(
label: Text(q, style: const TextStyle(fontSize: 12)),
onPressed: () => onSelect(q),
backgroundColor: AppTheme.primaryLight,
side: const BorderSide(color: AppTheme.primary, width: 0.5),
labelStyle: const TextStyle(color: AppTheme.primaryDark),
),
],
),
);