flutter / flutter/flutter

Able to set full screen width for MenuAnchor

Open
#155,079 3 comments 0 reactions 0 assignees View on GitHub
c: new feature c: proposal p: material_ui P3 package team-design triaged-design
Dominant language
Dart
Stars
179k
Forks
31.1k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

MenuAnchor sets the full screen width, but it is not actually full screen.

### Expected results

MenuAnchor can set full screen width

### Actual results

MenuAnchor is not set to full screen width

### Code sample

Code sample

```dart
MenuAnchor(
childFocusNode: _buttonFocusNode,
menuChildren: [
MenuItemButton(
child: Text(MenuEntry.about.label),
onPressed: () => _activate(MenuEntry.about),
),
SizedBox(
width:MediaQuery.of(context).size.width,
child:Text("dsfdsf")
),


],
builder:
(BuildContext context, MenuController controller, Widget? child) {
return TextButton(
focusNode: _buttonFocusNode,
onPressed: () {
if (controller.isOpen) {
controller.close();
} else {
controller.open();
}
},
child: const Text('OPEN MENU'),
);
},
),
```

### Screenshots or Video

![1726137667680](https://github.com/user-attachments/assets/2dc1b4c5-66af-42f9-9129-1e3d80e61938)

### Logs

Logs

```console
[Paste your logs here]
```

### Flutter Doctor output

Doctor output

```console
[Paste your output here]
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.