fix: allow guests to view event details by passing pre-loaded data
LearnMoreScreen now accepts an optional initialEvent parameter so it can render immediately from already-loaded data instead of re-fetching from the event-details API. This fixes the guest-mode flow where the unauthenticated API call was failing. Also changed getEventDetails to requiresAuth: true so logged-in users send their token when the API path is used. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -15,7 +15,8 @@ import '../core/constants.dart';
|
||||
|
||||
class LearnMoreScreen extends StatefulWidget {
|
||||
final int eventId;
|
||||
const LearnMoreScreen({Key? key, required this.eventId}) : super(key: key);
|
||||
final EventModel? initialEvent;
|
||||
const LearnMoreScreen({Key? key, required this.eventId, this.initialEvent}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<LearnMoreScreen> createState() => _LearnMoreScreenState();
|
||||
@@ -48,7 +49,13 @@ class _LearnMoreScreenState extends State<LearnMoreScreen> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
_pageNotifier = ValueNotifier(0);
|
||||
_loadEvent();
|
||||
if (widget.initialEvent != null) {
|
||||
_event = widget.initialEvent;
|
||||
_loading = false;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _startAutoScroll());
|
||||
} else {
|
||||
_loadEvent();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user