Created
October 18, 2021 01:20
-
-
Save iyusa/6ad4c71866902c3d5ff6b2af6fceb4c3 to your computer and use it in GitHub Desktop.
[Flutter Bottom Menu]#flutter #menu #sheet #bottom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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