mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-14 12:23:43 +00:00
feat: support browse files on web (#283)
This commit is contained in:
14 files changed
+145
-71
No files matched your search
@@ -0,0 +1,4 @@
|
||||
import 'browser_download_stub.dart'
|
||||
if (dart.library.html) 'entry/browser_download_browser.dart';
|
||||
|
||||
void download(String url, String name) => doDownload(url, name);
|
||||
@@ -0,0 +1 @@
|
||||
void doDownload(String url, String name) => throw UnimplementedError();
|
||||
@@ -0,0 +1,9 @@
|
||||
// ignore: avoid_web_libraries_in_flutter
|
||||
import 'dart:html' as html;
|
||||
|
||||
void doDownload(String url, String name) {
|
||||
final anchorElement = html.AnchorElement(href: url);
|
||||
anchorElement.download = name;
|
||||
anchorElement.target = '_blank';
|
||||
anchorElement.click();
|
||||
}
|
||||
Reference in new issue
Block a user