Skip to content

Commit 9ab80f4

Browse files
author
deimos
committed
programmatically open menu
1 parent 25f714d commit 9ab80f4

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib/src/dinamyc_star_menu.dart

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import 'package:flutter/material.dart';
2+
3+
import 'star_menu.dart';
4+
5+
class StarMenuOverlay {
6+
// Build the StarMenu on an overlay
7+
static displayStarMenu(BuildContext context, StarMenu starMenu) {
8+
// Retrieve the parent Overlay
9+
OverlayState? _overlayState = Overlay.of(context);
10+
11+
// Generate the Stack containing all StarItems that will
12+
// be displayed onto the Overlay
13+
OverlayEntry _overlayEntry = OverlayEntry(
14+
builder: (BuildContext context) {
15+
return Stack(
16+
children: <Widget>[
17+
starMenu,
18+
],
19+
);
20+
},
21+
);
22+
23+
24+
// Add it to the Overlay
25+
_overlayState!.insert(_overlayEntry);
26+
27+
}
28+
}

0 commit comments

Comments
 (0)