mirror of
https://github.com/we-promise/sure.git
synced 2026-05-25 13:34:58 +00:00
* feat(mobile): add suggested questions to empty chat screen - New constants file (lib/constants/suggested_questions.dart) for the 4 suggested question chips, kept separate from screen logic with a clear l10n upgrade path noted in comments - Empty chat screen now shows a personalised greeting and tappable OutlinedButton chips; tapping one pre-fills and sends the message - Optimistic message insertion in ChatProvider.sendMessage so the user message and typing indicator appear instantly on tap, with rollback on failure - Full AI response revealed only once polling detects stable content (2 consecutive polls with no growth), preventing partial responses from flashing on screen - fetchChat stops any in-progress polling before fetching so a manual refresh always shows the authoritative server response - Fixed updateChatTitle silently wiping messages when the title-update API response omits the messages array Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(mobile): address PR review comments - Extract _rollbackOptimisticMessage helper to eliminate duplicated rollback logic in sendMessage failure and catch branches - Replace raw 'Error: ${e.toString()}' user-facing strings with a generic message; retain technical details via debugPrint in each catch block - Replace inline ternary in updateChatTitle with explicit if/else for readability while preserving message-preservation behaviour - Fix non-reactive AuthProvider read inside Consumer<ChatProvider> builder (listen: false → listen: true) so greeting updates when user's firstName changes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
815 B
Dart
15 lines
815 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// Suggested questions shown on the empty chat screen.
|
|
///
|
|
/// l10n upgrade path: when Flutter localisation is added to the mobile app,
|
|
/// replace this const list with a function that accepts [BuildContext] and
|
|
/// returns localised strings via AppLocalizations. The call site in
|
|
/// _EmptyState requires only a one-line change.
|
|
const List<({IconData icon, String text})> suggestedQuestions = [
|
|
(icon: Icons.account_balance_wallet_outlined, text: 'What is my current net worth?'),
|
|
(icon: Icons.show_chart, text: 'How has my spending changed this month?'),
|
|
(icon: Icons.savings_outlined, text: 'How can I improve my savings rate?'),
|
|
(icon: Icons.receipt_long_outlined, text: 'What are my biggest expenses lately?'),
|
|
];
|