AugustToko / project_lw

Android LiveWallpaper Manager,安卓动态壁纸管理器
https://github.com/AugustToko/project_lw
GNU General Public License v3.0
16 stars 2 forks source link

分享壁纸时造成卡顿 #1

Open AugustToko opened 3 years ago

AugustToko commented 3 years ago

当分享一个大型壁纸 > 3mb 就会出现明显的卡顿。

  Future<void> shareWallpaper(Wallpaper wallpaper) async {
    final dir = Directory(wallpaper.getDirPath());

    final pak = await WallpaperFileUtil.packWallpaper(dir);

    print('----------------------------------');
    print(pak.path);
    print(pak.existsSync());

    final newPath = (await getTemporaryDirectory()).path +
        Platform.pathSeparator +
        FileUtils.basename(pak.path);

    pak.renameSync(newPath);

    print('----------------------------------');
    print(newPath);
    print(File(newPath));

    if (pak != null && pak.existsSync()) {
      Share.shareFiles([newPath],
          text: '${wallpaper.name}\n${wallpaper.description}');
    }
  }