showFieldCreationModal function

Future<Field?> showFieldCreationModal(
  1. BuildContext context,
  2. FieldType fieldType
)

Implementation

Future<Field?> showFieldCreationModal(BuildContext context, FieldType fieldType) async {
  final Field? result = await showDialog(
    barrierDismissible: false,
    context: context,
    builder: (BuildContext context) => BlocProvider<BaseDocumentBloc>(
      create: (BuildContext context) => FieldEditionBloc(
        entity: FieldMapper.fieldTypeToEntity(fieldType),
        fieldType: fieldType,
        field: null,
        draftService: context.read(),
      ),
      child: FieldCreationModal(fieldType: fieldType),
    ),
  );
  return result;
}