Misc No-Op Buttons — Wired to Live Actions (feat/misc-no-ops)
Branch: feat/misc-no-ops
Background
Several interactive elements in the app were no-ops — they displayed to users but performed no action when tapped. This document covers all fixes shipped in feat/misc-no-ops.
Fixes
1. SocialInviteCard — “INVITA ORA”
File: lib/shared/widgets/feed_interruption_widgets.dart
The “INVITA ORA” button now calls ShareService().shareAppInvitation(), which triggers the native share sheet with an app install link.
ElevatedButton(
onPressed: () => ShareService().shareAppInvitation(),
...
)2. VendorDashboardScreen — “Vedi tutto”
File: lib/features/dashboard/screens/vendor_dashboard_screen.dart
The “Vedi tutto” TextButton next to “Feedback Recente (7g)” now navigates to the vendor’s event list:
TextButton(
onPressed: () => context.push('/home/my-events'),
child: const Text('Vedi tutto'),
)3. CrewDetailSheet — “Apri Chat Crew”
Files: lib/shared/widgets/crew_detail_sheet.dart, lib/shared/models/crew_model.dart, lib/features/social/services/crew_service.dart
Problem: The “Apri Chat Crew” button only closed the bottom sheet. The Crew model had no chatId field, so there was no chat to navigate to.
Solution — three coordinated changes:
a) Crew model — chatId field
class Crew {
// ...
final String? chatId; // null for crews created before this feature
factory Crew.fromJson(Map<String, dynamic> json) => Crew(
// ...
chatId: json['chat_id'] as String?,
);
}b) CrewService — auto-create chat on crew creation
createCrew() now:
- Inserts the crew row as before.
- Inserts a
grouptype row into thechatstable withmetadata: { crew_id }. - Adds the creator as
ownerinchat_participants. - Updates
crews.chat_idwith the new chat ID. - Returns the crew with
chatIdpopulated.
Step 2–4 are wrapped in a try/catch — a chat creation failure does not fail crew creation.
c) Crew detail sheet — navigate or show fallback
void _openCrewChat(BuildContext context) {
final chatId = widget.crew.chatId;
if (chatId == null) {
// Show snackbar: "Chat non ancora disponibile"
return;
}
Navigator.pop(context);
context.push('/social/chat/$chatId');
}Database Migration
supabase/migrations/20260318000003_crew_chat.sql
ALTER TABLE public.crews
ADD COLUMN IF NOT EXISTS chat_id UUID REFERENCES public.chats(id) ON DELETE SET NULL;
CREATE POLICY "Crew members can access crew chat"
ON public.chats FOR SELECT TO authenticated
USING (
id IN (
SELECT s.chat_id FROM public.crews s
JOIN public.crew_members sm ON sm.crew_id = s.id
WHERE sm.user_id = auth.uid() AND s.chat_id IS NOT NULL
)
);Apply with: supabase db push or Supabase dashboard SQL editor.
Notes
- Old crews (before this migration) will have
chat_id = NULL. The “Apri Chat Crew” button shows a graceful snackbar in this case. - New crews created after this migration will always have a linked group chat, automatically created at crew creation time.