mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
opt.: popupmenu
This commit is contained in:
31
lib/view/widget/popup_menu.dart
Normal file
31
lib/view/widget/popup_menu.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/data/res/ui.dart';
|
||||
|
||||
class PopupMenu<T> extends StatelessWidget {
|
||||
final List<PopupMenuEntry<T>> items;
|
||||
final void Function(T) onSelected;
|
||||
final Widget child;
|
||||
final EdgeInsetsGeometry padding;
|
||||
final T? initialValue;
|
||||
|
||||
const PopupMenu({
|
||||
super.key,
|
||||
required this.items,
|
||||
required this.onSelected,
|
||||
this.child = popMenuChild,
|
||||
this.padding = const EdgeInsets.all(7),
|
||||
this.initialValue,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopupMenuButton<T>(
|
||||
itemBuilder: (_) => items,
|
||||
onSelected: onSelected,
|
||||
initialValue: initialValue,
|
||||
padding: padding,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user