23 lines
668 B
Dart
23 lines
668 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
class QuickMenu {
|
|
static void quickMenu(BuildContext context, BuildContext widgetContext, List<PopupMenuItem<dynamic>> items) {
|
|
final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
|
|
|
|
final RenderBox widgetRenderBox = widgetContext.findRenderObject() as RenderBox;
|
|
final Offset position = widgetRenderBox.localToGlobal(Offset.zero);
|
|
|
|
showMenu(
|
|
context: context,
|
|
position: RelativeRect.fromRect(
|
|
Rect.fromPoints(
|
|
position,
|
|
position.translate(0, 0),
|
|
),
|
|
Offset.zero & overlay.size,
|
|
),
|
|
items: items,
|
|
);
|
|
}
|
|
|
|
} |