Skip to content

Fix: Disable long-press menus and update poll provider#205

Merged
kumarpalsinh25 merged 2 commits intomainfrom
kumar/bugs-fixes
Dec 26, 2025
Merged

Fix: Disable long-press menus and update poll provider#205
kumarpalsinh25 merged 2 commits intomainfrom
kumar/bugs-fixes

Conversation

@kumarpalsinh25
Copy link
Collaborator

@kumarpalsinh25 kumarpalsinh25 commented Dec 26, 2025

This commit introduces several fixes and minor refactorings:

  • Disables the long-press context menu for event and poll items when they are displayed in lists outside of their main detail screens to prevent unintended actions.
  • Updates the "Today's Focus" widget to use activePollListProvider instead of the more specific activePollsWithPendingResponseProvider for displaying polls.
  • Reorders the tabs on the Polls List Screen from Draft, Active, Completed to Active, Draft, Completed for better user experience.
  • Bumps the cloud_firestore pod version to 6.1.1 in Podfile.lock.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed long-press menu behavior for events when sheet-name display is active.
    • Disabled long-press menu for polls except on their detail screens.
  • Improvements

    • Reordered polls tab sequence for clearer navigation.
    • Switched polls data source used in the Today focus view for more accurate display.
    • Made header icons in today's items render from the provided icon parameter.

✏️ Tip: You can customize this high-level summary in your review settings.

This commit introduces several fixes and minor refactorings:

- Disables the long-press context menu for event and poll items when they are displayed in lists outside of their main detail screens to prevent unintended actions.
- Updates the "Today's Focus" widget to use `activePollListProvider` instead of the more specific `activePollsWithPendingResponseProvider` for displaying polls.
- Reorders the tabs on the Polls List Screen from `Draft, Active, Completed` to `Active, Draft, Completed` for better user experience.
- Bumps the `cloud_firestore` pod version to `6.1.1` in `Podfile.lock`.
@coderabbitai
Copy link

coderabbitai bot commented Dec 26, 2025

📝 Walkthrough

Walkthrough

UI widgets were adjusted: event and poll title long-press handlers made conditional; home today-focus now consumes activePollListProvider; today's item uses the passed icon; polls tab order was changed and TabBarView children reordered.

Changes

Cohort / File(s) Summary
Event Long-Press
lib/features/events/widgets/event_widget.dart
Added public isTitleLongPressEnabled; long-press callback now null when showSheetName is true, otherwise invokes showEventMenu.
Poll Long-Press
lib/features/polls/widgets/poll_widget.dart
onTapLongPressText made conditional: returns showPollMenu only when isDetailScreen is true; otherwise null (long-press disabled off-detail).
Home — Today Focus Provider
lib/features/home/widgets/today_focus/todays_focus_widget.dart
Switched provider consumption from activePollsWithPendingResponseProvider to activePollListProvider; local variable renamed to activePollsList; rendering/empty checks updated.
Home — Today Item Icon
lib/features/home/widgets/today_focus/todays_item_widget.dart
Header icon rendering changed to use the passed icon parameter instead of hard-coded Icons.event_rounded.
Polls Tab Order
lib/features/polls/screens/polls_list_screen.dart
Reordered tabs: PollStatus.draft moved from first to between active and completed; TabBarView children reordered to match; minor formatting only.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Poll Module added in firebase. #179: Implements provider refactor switching to activePollListProvider and pollListProvider, and conditionally disables long-press handlers for polls and events—directly aligning with the provider consumption and handler conditioning changes in this PR.

Poem

🐰 I hopped through lines of code tonight,
Long-presses paused when context’s right,
Icons donned the hat they were given,
Tabs shuffled, providers driven,
I thumped my foot — the widgets bright.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the two main changes: disabling long-press menus for event/poll widgets and updating the poll provider in Today's Focus widget.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kumar/bugs-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@kumarpalsinh25 kumarpalsinh25 marked this pull request as ready for review December 26, 2025 11:31
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
lib/features/polls/screens/polls_list_screen.dart (1)

110-114: Improved code formatting for readability.

The multi-line formatting of EmptyStateListWidget constructor calls improves readability with no functional changes.

Also applies to: 126-130, 142-146

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a3685f0 and 00de8c2.

⛔ Files ignored due to path filters (1)
  • ios/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • lib/features/events/widgets/event_widget.dart
  • lib/features/home/widgets/today_focus/todays_focus_widget.dart
  • lib/features/home/widgets/today_focus/todays_item_widget.dart
  • lib/features/polls/screens/polls_list_screen.dart
  • lib/features/polls/widgets/poll_widget.dart
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: test
  • GitHub Check: linux
  • GitHub Check: ios
  • GitHub Check: windows
  • GitHub Check: android
  • GitHub Check: macos
  • GitHub Check: Test zoe_native plugin
🔇 Additional comments (3)
lib/features/home/widgets/today_focus/todays_item_widget.dart (1)

54-54: LGTM! Icon parameter now properly utilized.

The header icon now correctly uses the provided icon parameter instead of the hardcoded value, making the widget properly reusable.

lib/features/polls/widgets/poll_widget.dart (1)

124-132: LGTM! Long-press correctly disabled in list views.

The conditional logic properly restricts the long-press menu to detail screens only, preventing unintended actions when polls are displayed in lists outside their main detail screen.

lib/features/polls/screens/polls_list_screen.dart (1)

58-60: LGTM! Tab reordering implemented correctly.

The tabs now display in the order "Active, Draft, Completed" as intended, with the TabBarView children properly aligned to match the new tab sequence.

Also applies to: 92-94

final activePollsWithPendingResponse = ref.watch(
activePollsWithPendingResponseProvider,
);
final activePollsList = ref.watch(activePollListProvider);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

find . -name "*.dart" -type f | head -20

Repository: acterglobal/zoe

Length of output: 973


🏁 Script executed:

# Search for provider definitions
rg -n 'final.*activePollListProvider|final.*activePollsWithPendingResponseProvider' --type=dart

Repository: acterglobal/zoe

Length of output: 557


🏁 Script executed:

# Search more broadly for these providers
rg -B5 -A10 'activePollListProvider|activePollsWithPendingResponseProvider' --type=dart

Repository: acterglobal/zoe

Length of output: 50371


🏁 Script executed:

# Find the provider definitions in poll_providers.dart
rg -B5 -A15 'final activePollList|final activePollsWithPendingResponse' lib/features/polls/providers/poll_providers.dart

Repository: acterglobal/zoe

Length of output: 662


🏁 Script executed:

# Check the todays_focus_widget_test to see if it's still using the old provider
head -60 test/features/home/widgets/today_focus/todays_focus_widget_test.dart | grep -A5 -B5 'activePoll'

Repository: acterglobal/zoe

Length of output: 345


🏁 Script executed:

# Get the full provider definitions more clearly
sed -n '310,330p' lib/features/polls/providers/poll_providers.dart

Repository: acterglobal/zoe

Length of output: 663


🏁 Script executed:

# Search for activePollsWithPendingResponse definition
rg -B2 -A20 'activePollsWithPendingResponseProvider' lib/features/polls/providers/poll_providers.dart | head -50

Repository: acterglobal/zoe

Length of output: 41


🏁 Script executed:

# Check if tests in todays_focus_widget_test.dart need to be updated
grep -n 'activePollsWithPendingResponseProvider\|activePollListProvider' test/features/home/widgets/today_focus/todays_focus_widget_test.dart | head -20

Repository: acterglobal/zoe

Length of output: 1394


Update tests to match the provider change in the widget.

The widget now uses activePollListProvider, which returns all active polls (including those the user has already voted on), not just pending ones. However, the test file test/features/home/widgets/today_focus/todays_focus_widget_test.dart still overrides activePollsWithPendingResponseProvider in 18+ test cases. Update all test overrides to use activePollListProvider instead to match the actual widget implementation.

Additionally, confirm that displaying all active polls (not just pending) is the intended behavior for the Today's Focus section.

🤖 Prompt for AI Agents
In lib/features/home/widgets/today_focus/todays_focus_widget.dart around line 24
and in test/features/home/widgets/today_focus/todays_focus_widget_test.dart, the
widget now reads from activePollListProvider but the tests still override
activePollsWithPendingResponseProvider; update all test overrides (18+
instances) to override activePollListProvider instead, adjust any mocked return
values to reflect that it now returns all active polls (including
already-voted), and run/adjust assertions to confirm the widget displays all
active polls as intended for Today's Focus.

Introduce a new boolean property `isTitleLongPressEnabled` to the `EventWidget`. This property is derived from the inverse of `showSheetName` and is used to conditionally enable or disable the `onTapLongPressText` gesture, which shows the event menu.

This makes the condition for enabling the long press more explicit and self-contained within the widget's logic.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
lib/features/events/widgets/event_widget.dart (1)

20-20: Consider making isTitleLongPressEnabled an explicit constructor parameter.

The new field improves clarity at the usage site (line 110), but it remains semantically coupled to showSheetName through the derived relationship. Having a public field that's always computed from another parameter is unconventional and prevents callers from independently controlling long-press behavior.

Consider decoupling these concerns by making isTitleLongPressEnabled an explicit constructor parameter with a default value, similar to the isDetailScreen pattern mentioned in past reviews for poll_widget.dart.

🔎 Proposed refactor to decouple the parameters
 class EventWidget extends ConsumerWidget {
   final String eventId;
   final EdgeInsetsGeometry? margin;
   final bool showSheetName;
-  final bool isTitleLongPressEnabled;
+  final bool enableLongPress;

   const EventWidget({
     super.key,
     required this.eventId,
     this.margin,
     this.showSheetName = true,
-  }) : isTitleLongPressEnabled = !showSheetName;
+    this.enableLongPress = false,
+  });

Then update line 110 to use enableLongPress directly:

-      onTapLongPressText: isTitleLongPressEnabled
+      onTapLongPressText: enableLongPress
           ? () => showEventMenu(

This approach allows callers to independently control sheet name display and long-press behavior, improving flexibility and clarity.

Also applies to: 27-27

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 00de8c2 and 31879db.

📒 Files selected for processing (1)
  • lib/features/events/widgets/event_widget.dart
🔇 Additional comments (1)
lib/features/events/widgets/event_widget.dart (1)

110-117: LGTM: Conditional long-press logic is correctly implemented.

The ternary operator properly enables/disables the long-press gesture by passing either the showEventMenu closure or null to onTapLongPressText. This approach follows Flutter conventions where null callbacks disable gestures.

@kumarpalsinh25 kumarpalsinh25 merged commit af8406c into main Dec 26, 2025
7 of 9 checks passed
@kumarpalsinh25 kumarpalsinh25 deleted the kumar/bugs-fixes branch December 26, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant