mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-14 12:23:43 +00:00
feat: support flutter web
This commit is contained in:
1 parent
c4a30dc4c2
commit
4d4d3b446a
39 files changed
+450
-299
No files matched your search
@@ -3,11 +3,13 @@ import 'dart:io';
|
||||
import 'package:macos_secure_bookmarks/macos_secure_bookmarks.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import 'util.dart';
|
||||
|
||||
class MacSecureUtil {
|
||||
static const _bookmarkKey = "bookmark:";
|
||||
|
||||
static Future<void> saveBookmark(String dir) async {
|
||||
if (!Platform.isMacOS) {
|
||||
if (!Util.isMacos()) {
|
||||
return;
|
||||
}
|
||||
final secureBookmarks = SecureBookmarks();
|
||||
@@ -17,7 +19,7 @@ class MacSecureUtil {
|
||||
}
|
||||
|
||||
static Future<void> loadBookmark() async {
|
||||
if (!Platform.isMacOS) {
|
||||
if (!Util.isMacos()) {
|
||||
return;
|
||||
}
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
class Util {
|
||||
static String fmtByte(int byte) {
|
||||
if (byte < 1024) {
|
||||
@@ -21,11 +23,29 @@ class Util {
|
||||
return (dir == "" ? "" : "$dir/") + buildPath(path, name);
|
||||
}
|
||||
|
||||
static isWeb() {
|
||||
return kIsWeb;
|
||||
}
|
||||
|
||||
static isAndroid() {
|
||||
return !kIsWeb && Platform.isAndroid;
|
||||
}
|
||||
|
||||
static isMacos() {
|
||||
return !kIsWeb && Platform.isMacOS;
|
||||
}
|
||||
|
||||
static isDesktop() {
|
||||
if (kIsWeb) {
|
||||
return false;
|
||||
}
|
||||
return Platform.isWindows || Platform.isLinux || Platform.isMacOS;
|
||||
}
|
||||
|
||||
static isUnix() {
|
||||
if (kIsWeb) {
|
||||
return false;
|
||||
}
|
||||
return !Platform.isWindows;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user