Skip to content

Conversation

@justinmc
Copy link
Contributor

This was reopened from #37778 (I had crazy test errors that for some reason only went away when I checked out a fresh branch).## Description

This PR implements the CupertinoContextMenu widget.

CupertinoContextMenu(
  child: FittedBox(
    fit: BoxFit.cover,
    child: Image.asset('images/my_image.jpg'),
  ),
  actions: <CupertinoContextMenuSheetAction>[
    CupertinoContextMenuSheetAction(
      child: const Text('My action'),
      onPressed: () { ... },
    ),
    // More CupertinoContextMenuSheetActions...
  ],
);
native Flutter
context_menu_small

Related Issues

Closes #34728

Tests

  • CupertinoContextMenuSheetAction
    • tapping
    • hold to change color
  • CupertinoContextMenu
    • default state without being interacted with
    • opening
    • all different ways to close

@justinmc justinmc added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository labels Oct 31, 2019
@justinmc justinmc self-assigned this Oct 31, 2019
This was referenced Nov 4, 2019
@justinmc
Copy link
Contributor Author

justinmc commented Nov 5, 2019

I'm going to merge this without an LGTM on here since the old PR I opened this from already had reviews: #37778

@justinmc justinmc merged commit 9734754 into flutter:master Nov 5, 2019
@justinmc justinmc deleted the ios13-context-menus-2 branch November 5, 2019 15:56
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
Adds the CupertinoContextMenu widget for iOS 13 support.
}
}

void _onTapDown(TapDownDetails details) {
Copy link
Member

Choose a reason for hiding this comment

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

Hi, @justinmc, Why not trigger by onLongPress here?
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I remember correctly, the animation needs to start immediately on tap down. I wait for kLongPressTimeout until I consider the context menu to be fully open. If the tap is canceled before then, then it animates back and doesn't open.

The context menu is effectively opened on long press, not on tap, even though that's not the gesture I'm listening to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS 13] Context Menus

3 participants