windows版本初步完成

This commit is contained in:
DelLevin-Home
2026-07-13 19:39:01 +08:00
parent 121cbf8b0b
commit 6c30026e32
37 changed files with 5583 additions and 624 deletions

View File

@@ -45,7 +45,7 @@ class BookDao {
switch (sortMode) {
case 1: return 'created_at DESC';
case 2: return 'rating DESC NULLS LAST, updated_at DESC';
default: return 'updated_at DESC';
default: return 'created_at DESC';
}
}

View File

@@ -1,7 +1,9 @@
import 'dart:async';
import 'dart:io';
import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart';
import 'package:flutter/foundation.dart';
import '../utils/image_path_helper.dart';
import '../models/data_models.dart';
/// 数据库帮助类 - 管理数据库的创建和版本控制
@@ -13,9 +15,14 @@ class DatabaseHelper {
DatabaseHelper._init();
/// 获取数据库根目录(统一使用 ImagePathHelper.getAppDir
Future<String> _getDbRootPath() async {
return await ImagePathHelper.getAppDir();
}
/// 数据库文件路径
Future<String?> get databasePath async {
final path = await getDatabasesPath();
final path = await _getDbRootPath();
return join(path, 'mooknote.db');
}
@@ -67,8 +74,10 @@ class DatabaseHelper {
}
Future<Database> _initDB(String filePath) async {
final dbPath = await getDatabasesPath();
final dbPath = await _getDbRootPath();
final path = join(dbPath, filePath);
// 确保目录存在
await Directory(dbPath).create(recursive: true);
return await openDatabase(
path,

View File

@@ -45,7 +45,7 @@ class GameDao {
switch (sortMode) {
case 1: return 'created_at DESC';
case 2: return 'rating DESC NULLS LAST, updated_at DESC';
default: return 'updated_at DESC';
default: return 'created_at DESC';
}
}

View File

@@ -49,7 +49,7 @@ class MovieDao {
switch (sortMode) {
case 1: return 'created_at DESC';
case 2: return 'rating DESC NULLS LAST, updated_at DESC';
default: return 'updated_at DESC';
default: return 'created_at DESC';
}
}

View File

@@ -40,7 +40,7 @@ class NoteDao {
switch (sortMode) {
case 1: return 'is_pinned DESC, created_at DESC';
case 2: return 'is_pinned DESC, title COLLATE NOCASE ASC';
default: return 'is_pinned DESC, updated_at DESC';
default: return 'is_pinned DESC, created_at DESC';
}
}