Skip to content

Instantly share code, notes, and snippets.

@iyusa
Created October 18, 2021 01:20
Show Gist options
  • Save iyusa/6ad4c71866902c3d5ff6b2af6fceb4c3 to your computer and use it in GitHub Desktop.
Save iyusa/6ad4c71866902c3d5ff6b2af6fceb4c3 to your computer and use it in GitHub Desktop.
[Flutter Bottom Menu]#flutter #menu #sheet #bottom
/// Bottom menu handler
/// Biar tidak acak-acakan aja
///
class BottomMenu {
final topRadius = 10;
final BuildContext context;
final DataGridController controller;
BottomMenu(this.context, {required this.controller}) {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(borderRadius: topRadius),
builder: (context) {
return Wrap(children: [
ListTile(leading: const Icon(Icons.playlist_add), title: const Text('Add Row'), onTap: onTap),
ListTile(leading: const Icon(Icons.delete), title: const Text('Delete Row'), onTap: onTap)
]);
});
}
Future<void> onTap() async {
await Get.defaultDialog(title: 'Action', middleText: 'menu has clicked', textCancel: 'Click me please');
Get.back();
}
}
/// Cara memanggil
///
...
onPressed: () => BottomMenu(context, controller: controller),
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment