mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
32 lines
797 B
Dart
32 lines
797 B
Dart
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,
|
|
);
|
|
}
|
|
}
|