feat: add Flutter mobile app

This commit is contained in:
2026-08-18 01:07:44 +08:00
parent 38deb8d593
commit 301959b6ad
83 changed files with 10384 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
import 'package:drift/drift.dart';
import 'package:drift/native.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:imagefind_mobile/src/offline_database.dart';
void main() {
late OfflineDatabase database;
setUp(() => database = OfflineDatabase(NativeDatabase.memory()));
tearDown(() => database.close());
test(
'offline progress survives an upsert and can become completed',
() async {
await database.saveDownload(
OfflineEntriesCompanion.insert(
videoId: 'v1',
title: '测试视频',
localPath: 'video.mp4',
partialPath: const Value('video.mp4.part'),
bytesDownloaded: const Value(512),
totalBytes: const Value(1024),
status: const Value('downloading'),
),
);
await database.saveDownload(
OfflineEntriesCompanion.insert(
videoId: 'v1',
title: '测试视频',
localPath: 'video.mp4',
partialPath: const Value(null),
bytesDownloaded: const Value(1024),
totalBytes: const Value(1024),
status: const Value('completed'),
),
);
final entry = await database.downloadFor('v1');
expect(entry?.status, 'completed');
expect(entry?.partialPath, null);
expect(entry?.bytesDownloaded, 1024);
},
);
}