feat: extension support (#78)

This commit is contained in:
Levi authored and GitHub committed 2023-10-16 09:47:31 +08:00
1 parent 82d316af83
commit c073fc0a67
118 files changed
+6971 -780

No files matched your search

+4 -2
View File
@@ -55,7 +55,9 @@ const List iconMaps = [
'rmvb',
'rm',
'vob',
'3gp'
'3gp',
'm4s',
'ts'
],
'type': 'Video',
'thumbnail': 'file_video'
@@ -148,7 +150,7 @@ const List iconMaps = [
{
'extensions': ['apk'],
'type': 'Android',
'thumbnail': 'windows'
'thumbnail': 'android'
},
//other
{
+1 -1
View File
@@ -5,7 +5,7 @@ import 'util.dart';
final logger = Logger(
filter: ProductionFilter(),
printer: LogfmtPrinter(),
printer: SimplePrinter(printTime: true, colors: false),
output: buildOutput(),
);
+9 -1
View File
@@ -15,6 +15,14 @@ void showErrorMessage(msg) {
Get.snackbar(title, msg.toString());
}
var _showMessageFlag = true;
void showMessage(title, msg) {
Get.snackbar(title, msg);
if (_showMessageFlag) {
_showMessageFlag = false;
Get.snackbar(title, msg);
Future.delayed(const Duration(seconds: 3), () {
_showMessageFlag = true;
});
}
}
+34 -1
View File
@@ -3,8 +3,23 @@ import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:path_provider/path_provider.dart';
import 'package:path/path.dart' as path;
class Util {
static String? _storageDir;
static String cleanPath(String path) {
path = path.replaceAll(RegExp(r'\\'), "/");
if (path.startsWith(".")) {
path = path.substring(1);
}
if (path.startsWith("/")) {
path = path.substring(1);
}
return path;
}
static String safeDir(String path) {
if (path == "." || path == "./" || path == ".\\") {
return "";
@@ -33,6 +48,24 @@ class Util {
}
}
static Future<void> initStorageDir() async {
var storageDir = "./";
if (Platform.isAndroid) {
storageDir = (await getExternalStorageDirectory())?.path ?? storageDir;
} else if (Platform.isIOS) {
storageDir = (await getLibraryDirectory()).path;
}
_storageDir = storageDir;
}
static String getStorageDir() {
return _storageDir!;
}
static String getStorageAsset(String asset) {
return path.join(getStorageDir(), asset);
}
static isAndroid() {
return !kIsWeb && Platform.isAndroid;
}
@@ -76,7 +109,7 @@ class Util {
return [];
}
const ls = LineSplitter();
return ls.convert(text);
return ls.convert(text).where((line) => line.isNotEmpty).toList();
}
// if one future complete, return the result, only all future error, return the last error