showThreadStorageSaveSurface function

Future<void> showThreadStorageSaveSurface(
  1. BuildContext context, {
  2. required RoomClient room,
  3. required String title,
  4. required String suggestedFileName,
  5. required String fileNameLabel,
  6. required ThreadStorageSaveContentType contentType,
  7. required Future<FileContent> loadContent(),
  8. String initialFolderPath = '',
  9. ThreadStorageSaveSurfacePresenter? mobilePresenter,
})

Implementation

Future<void> showThreadStorageSaveSurface(
  BuildContext context, {
  required RoomClient room,
  required String title,
  required String suggestedFileName,
  required String fileNameLabel,
  required ThreadStorageSaveContentType contentType,
  required Future<FileContent> Function() loadContent,
  String initialFolderPath = '',
  ThreadStorageSaveSurfacePresenter? mobilePresenter,
}) async {
  if (mobilePresenter != null) {
    await mobilePresenter(
      context,
      ThreadStorageSaveSurfaceRequest(
        room: room,
        title: title,
        suggestedFileName: suggestedFileName,
        fileNameLabel: fileNameLabel,
        contentType: contentType,
        loadContent: loadContent,
        initialFolderPath: initialFolderPath,
      ),
    );
    return;
  }

  if (_usesNativeMobileReactionFlowDialog(context)) {
    await showModalBottomSheet<void>(
      context: context,
      backgroundColor: Colors.transparent,
      isScrollControlled: true,
      useSafeArea: false,
      builder: (dialogContext) => _ThreadStorageSaveFlowDialog(
        room: room,
        title: title,
        suggestedFileName: suggestedFileName,
        fileNameLabel: fileNameLabel,
        loadContent: loadContent,
      ),
    );
    return;
  }

  await showShadDialog<void>(
    context: context,
    builder: (dialogContext) => _ThreadStorageSaveDesktopDialog(
      room: room,
      title: title,
      suggestedFileName: suggestedFileName,
      fileNameLabel: fileNameLabel,
      loadContent: loadContent,
    ),
  );
}