fix: fetch full event details in background to show important information
When navigating from the home screen, LearnMoreScreen now shows the pre-loaded event data instantly, then silently fetches full details from the event-details API in the background. This fills in fields missing from the slim list endpoint (important_information, images, important_info) without showing a loading spinner. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,7 +52,11 @@ class _LearnMoreScreenState extends State<LearnMoreScreen> {
|
|||||||
if (widget.initialEvent != null) {
|
if (widget.initialEvent != null) {
|
||||||
_event = widget.initialEvent;
|
_event = widget.initialEvent;
|
||||||
_loading = false;
|
_loading = false;
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) => _startAutoScroll());
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
_startAutoScroll();
|
||||||
|
// Fetch full event details in background to get important_information, images, etc.
|
||||||
|
_loadFullDetails();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
_loadEvent();
|
_loadEvent();
|
||||||
}
|
}
|
||||||
@@ -71,6 +75,21 @@ class _LearnMoreScreenState extends State<LearnMoreScreen> {
|
|||||||
// Data loading
|
// Data loading
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// Silently fetch full event details to fill in fields missing from the list
|
||||||
|
/// endpoint (important_information, images, etc.) without showing a loader.
|
||||||
|
Future<void> _loadFullDetails() async {
|
||||||
|
try {
|
||||||
|
final ev = await _service.getEventDetails(widget.eventId);
|
||||||
|
if (!mounted) return;
|
||||||
|
setState(() {
|
||||||
|
_event = ev;
|
||||||
|
});
|
||||||
|
_startAutoScroll();
|
||||||
|
} catch (_) {
|
||||||
|
// Silently fail — the pre-loaded data is already displayed
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _loadEvent() async {
|
Future<void> _loadEvent() async {
|
||||||
setState(() {
|
setState(() {
|
||||||
_loading = true;
|
_loading = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user