forked from Nexus/nexus
parent
ed2d08ed40
commit
76d78596cd
12 changed files with 141 additions and 49 deletions
21
lib/widgets/adaptive_menu_button.dart
Normal file
21
lib/widgets/adaptive_menu_button.dart
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import "package:material_ui/material_ui.dart";
|
||||
import "package:nexus/helpers/extensions/show_adaptive_menu.dart";
|
||||
|
||||
/// Like [PopupMenuButton], but shows a bottom sheet on mobile.
|
||||
class const AdaptiveMenuButton({
|
||||
required final Widget icon,
|
||||
required final List<PopupMenuEntry> Function(BuildContext context)
|
||||
itemBuilder,
|
||||
final String? tooltip,
|
||||
final bool enabled = true,
|
||||
super.key,
|
||||
}) extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => IconButton(
|
||||
icon: icon,
|
||||
tooltip: tooltip,
|
||||
onPressed: enabled
|
||||
? () => context.showAdaptiveMenu(itemBuilder(context))
|
||||
: null,
|
||||
);
|
||||
}
|
||||
Loading…
Reference in a new issue