feat: video download

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-11-06 12:12:32 +08:00
parent 976622df89
commit ffd4f9ee73
92 changed files with 4853 additions and 946 deletions

View File

@@ -10,8 +10,6 @@ import 'package:file_picker/file_picker.dart';
import 'package:flutter/services.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
abstract class Utils {
@@ -26,6 +24,8 @@ abstract class Utils {
static final bool isDesktop =
Platform.isWindows || Platform.isMacOS || Platform.isLinux;
static const jsonEncoder = JsonEncoder.withIndent(' ');
static Future<void> saveBytes2File({
required String name,
required Uint8List bytes,
@@ -74,13 +74,11 @@ abstract class Utils {
Color(int.parse(color.replaceFirst('#', 'FF'), radix: 16));
static int? _sdkInt;
static Future<int> get sdkInt async {
return _sdkInt ??= (await DeviceInfoPlugin().androidInfo).version.sdkInt;
}
static bool? _isIpad;
static Future<bool> get isIpad async {
if (!Platform.isIOS) return false;
return _isIpad ??= (await DeviceInfoPlugin().iosInfo).model
@@ -88,12 +86,6 @@ abstract class Utils {
.contains('ipad');
}
static String? _tempDir;
static Future<String> get temporaryDirectory async {
return _tempDir ??= (await getTemporaryDirectory()).path;
}
static Future<Rect?> get sharePositionOrigin async {
if (await isIpad) {
final size = Get.size;
@@ -116,15 +108,6 @@ abstract class Utils {
}
}
static String buildShadersAbsolutePath(
String baseDirectory,
List<String> shaders,
) {
return shaders
.map((shader) => path.join(baseDirectory, shader))
.join(Platform.isWindows ? ';' : ':');
}
static final numericRegex = RegExp(r'^[\d\.]+$');
static bool isStringNumeric(String str) {
return numericRegex.hasMatch(str);
@@ -156,13 +139,6 @@ abstract class Utils {
return v.toString() + random.nextInt(9999).toString();
}
static int findClosestNumber(int target, List<int> numbers) {
List<int> filterNums = numbers.where((number) => number <= target).toList();
return filterNums.isNotEmpty
? filterNums.reduce((a, b) => a > b ? a : b)
: numbers.reduce((a, b) => a > b ? b : a);
}
static List<int> generateRandomBytes(int minLength, int maxLength) {
return List<int>.generate(
minLength + random.nextInt(maxLength - minLength + 1),