简体   繁体   English

如何在保存到下载文件夹之前将标题赋予pdf文件?

[英]how to give title in flutter to pdf file before save to download folder?

I want exactly this page in flutter我想要这个页面在颤动在此处输入图像描述

I'm not sure where that screen is coming from.我不确定那个屏幕是从哪里来的。 But you can try the file_picker_writable plugin.但是你可以试试file_picker_writable插件。 (shameless plug). (无耻的插头)。

  Future<void> _openFilePickerForCreate() async {
    final rand = Random().nextInt(10000000);
    final fileInfo = await FilePickerWritable().openFileForCreate(
      fileName: 'newfile.$rand.codeux',
      writer: (file) async {
        final content = 'File created at ${DateTime.now()}\n\n';
        await file.writeAsString(content);
      },
    );
    if (fileInfo == null) {
      _logger.info('User canceled.');
      return;
    }
    final data = await _appDataBloc.store.load();
    await _appDataBloc.store
        .save(data.copyWith(files: data.files + [fileInfo]));
  }
}

this will open a folder chooser dialog for the user and a default file name (given by fileName ).这将为用户打开一个文件夹选择器对话框和一个默认文件名(由fileName给出)。

This code example will open the following dialog:此代码示例将打开以下对话框:

保存对话框

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM