showNewFunctionSheet function
void
showNewFunctionSheet(
- BuildContext context, {
- required List<
String> existingCustomFunctionNames, - required dynamic onSaved(
- String newName,
- DartBlockDataType? newReturnType
- required dynamic onReceiveDartBlockNotification(
- DartBlockNotification notification
Implementation
void showNewFunctionSheet(
BuildContext context, {
required List<String> existingCustomFunctionNames,
required Function(String newName, DartBlockDataType? newReturnType) onSaved,
/// If the context is the same as the main DartBlockEditor's context, indicate
/// this argument to handle incoming DartBlockNotifications.
/// Otherwise, the notifications will be automatically propagated upwards.
required Function(DartBlockNotification notification)?
onReceiveDartBlockNotification,
}) {
HapticFeedback.mediumImpact();
showAdaptiveBottomSheetOrDialog(
context,
sheetPadding: EdgeInsets.all(8),
dialogPadding: EdgeInsets.all(16),
onReceiveDartBlockNotification: onReceiveDartBlockNotification,
child: CustomFunctionBasicEditor(
existingCustomFunctionNames: existingCustomFunctionNames,
canDelete: false,
canChange: true,
onDelete: () {},
onSaved: (newName, newReturnType) {
Navigator.of(context).pop();
onSaved(newName, newReturnType);
},
),
);
}