I want to dynamically call bottom sheet so need paramters to call
I have been trying but not very successful
not a very coder please help me
thanks
how can I show bottom sheet call from custom action
Custom Code
- What have you tried so far?
using custom action
Future toBottomSheet( BuildContext context, String bottomSheetComponent, Color? backgroundColor, Color? barrierColor, bool nonDismissible, bool enableDrag, bool useSafeArea, ) async { Widget? widget = getWidgetByName(bottomSheetComponent); if (widget == null) { throw ArgumentError('Unknown widget type: $bottomSheetComponent'); } await showModalBottomSheet( context: context, isScrollControlled: true, backgroundColor: backgroundColor ?? Colors.transparent, barrierColor: barrierColor, isDismissible: !nonDismissible, enableDrag: enableDrag, builder: (context) { Widget content = Padding( padding: MediaQuery.viewInsetsOf(context), child: widget, ); if (useSafeArea) { content = SafeArea(child: content); } return content; }, ); } Widget? getWidgetByName(String name) { switch (name) { case 'AiChatWidget': return AiChatWidget(); // Add more cases for other widgets as needed default: return null; } }
- Did you check FlutterFlow's Documentation for this topic?
- Yes
1
1 reply